:root {
  color-scheme: light;
  --bg: #f2f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #e2e7ee;
  --border-strong: #cdd6e1;
  --text: #0f1b2d;
  --text-2: #334155;
  --muted: #5b6b80;
  --faint: #8a98aa;
  --brand: #6c896c;
  --brand-strong: #566e56;
  --brand-soft: #ebf0eb;
  --brand-line: #d3dcd3;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgb(15 27 45 / 0.06);
  --shadow: 0 1px 2px rgb(15 27 45 / 0.05), 0 10px 28px -14px rgb(15 27 45 / 0.22);
  --shadow-float: 0 2px 4px rgb(15 27 45 / 0.06), 0 14px 36px -12px rgb(15 27 45 / 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 64px;
  --nav-h: calc(64px + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================================================================== */
/* Cabecera                                                            */
/* ================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-symbol { display: block; width: auto; height: 30px; color: var(--text); flex: none; }
.brand-wordmark { font-size: 20px; font-weight: 800; letter-spacing: 0.16em; color: var(--text); }
.brand-sep { width: 1px; height: 26px; background: var(--border-strong); }
.brand-app { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.user-chip:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.user-chip-text { display: grid; line-height: 1.15; }
.user-chip-text strong { font-size: 14px; }
.user-chip-text small { color: var(--muted); font-size: 12px; }
.user-chip .chevron { width: 16px; height: 16px; color: var(--muted); }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 2000;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}
.menu-info {
  display: grid;
  gap: 2px;
  margin-bottom: 4px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.menu-info strong { color: var(--text); font-size: 14px; }
.menu-badge { justify-self: start; margin-top: 4px; padding: 2px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); font-size: 11.5px; font-weight: 700; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }

/* ================================================================== */
/* Botones                                                             */
/* ================================================================== */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 6px; }
.btn:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, .seg button:focus-visible, .nav-item:focus-visible {
  outline: 3px solid var(--brand-line);
  outline-offset: 1px;
}
.btn[disabled] { opacity: 0.6; cursor: progress; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ================================================================== */
/* Distribución en escritorio: mapa a la izquierda, viajes a la derecha */
/* ================================================================== */

.layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
  gap: 20px;
}
.trips-panel { min-height: 0; }

@media (min-width: 901px) {
  body { height: 100vh; height: 100dvh; overflow: hidden; }
  .trips-panel { overflow-y: auto; padding-right: 4px; scrollbar-gutter: stable; }
  .filters { position: sticky; top: 0; z-index: 2; }
}

/* ================================================================== */
/* Mapa (tema nocturno)                                                */
/* ================================================================== */

.map-panel {
  --glass: rgb(11 19 36 / 0.78);
  --glass-line: rgb(148 178 222 / 0.18);
  --glass-text: #e6edf7;
  --glass-muted: #93a7c4;
  position: relative;
  z-index: 1;
  min-height: 420px;
  border: 1px solid #1c2a44;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0b1324;
  box-shadow: var(--shadow);
}
#map { position: absolute; inset: 0; }
.maplibregl-map { font: inherit; }

/* Controles */
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 12px 12px 0 0; }
.maplibregl-ctrl-group {
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--glass) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px -10px rgb(0 0 0 / 0.6) !important;
}
.maplibregl-ctrl-group button { width: 34px; height: 34px; color: var(--glass-text); }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--glass-line); }
.maplibregl-ctrl-group button:not(:disabled):hover { background: rgb(255 255 255 / 0.08); }
.maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }
.reset-view { display: grid !important; place-items: center; }
.reset-view .i { width: 18px; height: 18px; }
/* Tu ubicación */
.maplibregl-ctrl-geolocate:disabled { pointer-events: none; opacity: 0.45; }
.maplibregl-user-location-dot, .maplibregl-user-location-dot::before { background-color: #38bdf8; }
.maplibregl-user-location-dot::after { border-color: #fff; }
.maplibregl-user-location-accuracy-circle { background-color: rgb(56 189 248 / 0.18); }
.expand-view { display: none !important; place-items: center; }
.expand-view .i { width: 17px; height: 17px; }

.maplibregl-ctrl-attrib { background: rgb(11 19 36 / 0.72) !important; color: #8ea2bf; }
.maplibregl-ctrl-attrib a { color: #b6c6dd; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }

/* Sedes */
.site-marker {
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}
.site-pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid rgb(255 255 255 / 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c) 60%);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 0 24px 4px color-mix(in srgb, var(--c) 55%, transparent);
  transition: transform 0.15s;
}
/* Pulso tipo radar */
.site-pin::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--c);
  animation: ping 2.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.8; } 80%, 100% { transform: scale(2.3); opacity: 0; } }
.site-pin .i { position: relative; width: 20px; height: 20px; }
.site-marker:hover .site-pin { transform: scale(1.08); }
.site-marker:focus-visible { outline: none; }
.site-marker:focus-visible .site-pin { outline: 3px solid var(--brand-line); outline-offset: 3px; }
.site-tag {
  display: grid;
  justify-items: center;
  padding: 5px 11px 6px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px -10px rgb(0 0 0 / 0.7);
  line-height: 1.15;
  white-space: nowrap;
}
.site-tag strong { color: var(--text); font-size: 13.5px; }
.site-tag small { color: var(--muted); font-size: 11px; font-weight: 500; }
.site-mine {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translate(-50%, -100%);
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
/* MapLibre fija la opacidad de los marcadores en línea. */
.site-marker.dim { opacity: 0.35 !important; }
.site-marker.tag-left { flex-direction: row-reverse; }
.site-marker.tag-right { flex-direction: row; }
.site-marker.tag-right .site-tag { justify-items: start; }
.site-marker.tag-left .site-tag { justify-items: end; }

/* Etiquetas de las rutas */
.route-label {
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px -10px rgb(0 0 0 / 0.7);
  color: var(--glass-muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.2s;
}
.route-label.active { padding: 4px 11px 4px 4px; color: var(--glass-text); }
.rl-count {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 14px rgb(255 255 255 / 0.18);
}
.rl-body { display: grid; line-height: 1.1; text-align: left; }
.rl-body strong { font-size: 12.5px; }
.rl-body small { color: var(--glass-muted); font-size: 11px; font-weight: 500; }
.route-label.dim { opacity: 0.3 !important; }
#map.zoomed-out .route-label:not(.active) { display: none; }
#map.zoomed-out .rl-body small { display: none; }
.route-label.collide { visibility: hidden; }

/* Coche del viaje seleccionado */
.car-marker {
  z-index: 4;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--c);
  border-radius: 50%;
  background: #0b1324;
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, transparent), 0 0 22px 6px color-mix(in srgb, var(--c) 60%, transparent);
  pointer-events: none;
}
.car-marker .i { width: 18px; height: 18px; }

/* Leyenda */
/* Arriba a la izquierda: abajo están los créditos del mapa y la tarjeta del viaje. */
.legend {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  max-width: calc(100% - 70px);
  padding: 8px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--glass-text);
  font-size: 12.5px;
  font-weight: 600;
}
.key { display: inline-flex; align-items: center; gap: 7px; }
.key-dot { width: 12px; height: 12px; border: 3px solid #0e9f6e; border-radius: 50%; background: #fff; }
.key-arc { width: 26px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #ffffff, #0e9f6e); box-shadow: 0 0 8px rgb(14 159 110 / 0.7); }
.legend-hint { color: var(--glass-muted); font-weight: 500; }

/* Tarjeta del viaje seleccionado, sobre el mapa */
.map-card {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: grid;
  gap: 8px;
  width: min(430px, calc(100% - 24px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: rise 0.2s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.mc-head { display: flex; align-items: center; gap: 12px; }
.mc-when { display: grid; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mc-when strong { font-size: 20px; }
.mc-when small { color: var(--muted); font-size: 12px; }
.mc-route { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-weight: 650; }
.mc-close { align-self: flex-start; margin: -6px -8px 0 0; }
.mc-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 13px; }
.mc-meta strong { color: var(--text); }
.mc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mc-foot .btn { margin-left: auto; }

/* Ventanas emergentes del mapa */
.maplibregl-popup-content { padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-float); font: inherit; }
.maplibregl-popup-close-button { top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 8px; font-size: 18px; color: var(--muted); }
.popup { display: grid; gap: 8px; min-width: 200px; padding-right: 14px; }
.popup-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; font-weight: 700; }
.popup-title .i { width: 16px; height: 16px; color: var(--brand); }
.po-main { display: inline-flex; align-items: center; gap: 7px; color: var(--text); }
.popup-title small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.popup-sub { margin-top: -4px; color: var(--muted); font-size: 13px; }
.popup-actions { display: grid; gap: 6px; }
.popup-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.popup-actions button:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.popup-actions button span { color: var(--muted); font-weight: 500; }

/* ================================================================== */
/* Filtros                                                             */
/* ================================================================== */

.filters {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.filters-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(15 27 45 / 0.12); }
.count {
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 10px 8px;
}
.filter-row .zone { grid-column: 1 / -1; }

/* Campo con icono a la izquierda (búsqueda, dirección) */
.search-field { position: relative; display: block; }
.search-field > .i { position: absolute; top: 50%; left: 11px; width: 17px; height: 17px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-field > input[type] { padding-left: 36px; }
input[type="search"] {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ================================================================== */
/* Campos                                                              */
/* ================================================================== */

.field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.label { padding: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.label em { color: var(--faint); font-style: normal; font-weight: 500; }
.hint { margin: 0; color: var(--faint); font-size: 12.5px; }

select, input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="date"], input[type="time"], input[type="number"], textarea {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
}
textarea { height: auto; min-height: 64px; padding: 9px 10px; resize: vertical; line-height: 1.4; }
/* Desplegables con flecha propia, separada del borde. */
select {
  -webkit-appearance: none;
  appearance: none;
  padding: 0 38px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b80' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  cursor: pointer;
}
select:hover { border-color: var(--faint); }

/* La hora se ve igual en todos los móviles (iPhone la centra y cambia la altura). */
input[type="time"] { -webkit-appearance: none; appearance: none; text-align: left; line-height: 40px; }
input[type="time"]::-webkit-date-and-time-value { text-align: left; }

/* Contraseña con botón para verla */
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 48px; }
/* Edge añade su propio ojo a las contraseñas: se oculta para que solo quede el de la app. */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.pw-toggle:focus-visible { outline: 3px solid var(--brand-line); }
.pw-toggle .i { width: 19px; height: 19px; }

/* ---------- Selector de fecha propio ---------- */

.datepicker { position: relative; min-width: 0; }
.date-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.date-btn:hover { border-color: var(--faint); }
.date-btn:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.date-btn .i { width: 17px; height: 17px; color: var(--brand); }
.date-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.datepicker.is-empty .date-text { color: var(--faint); }
.datepicker:not(.is-empty):has(.date-clear) .date-btn { padding-right: 40px; }
.date-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--faint);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.date-clear:hover { background: var(--surface-2); color: var(--text); }

.date-dialog { width: min(370px, calc(100vw - 24px)); padding: 16px 16px 14px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dp-title { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -0.01em; }
.dp-nav { border: 1px solid var(--border); }
.dp-nav:disabled { opacity: 0.35; cursor: default; }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dp-week span { padding: 4px 0 6px; color: var(--faint); font-size: 12px; font-weight: 700; text-align: center; }
.dp-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 12px;
  background: none;
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.dp-day:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-strong); }
.dp-day:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand); }
.dp-day.selected {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgb(108 137 108 / 0.7);
}
.dp-day:disabled { color: #c5cdd8; cursor: default; }
.dp-day.has-trips::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0e9f6e;
}
.dp-day.selected.has-trips::after { background: #fff; }
.dp-legend { display: flex; align-items: center; gap: 7px; margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; }
.dp-legend i { width: 6px; height: 6px; border-radius: 50%; background: #0e9f6e; }
.dp-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.chip:hover, .chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.chip.sm { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12.5px; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }

.pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pill { position: relative; display: grid; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.pill > span:hover { border-color: var(--c); }
.pill input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); box-shadow: inset 0 0 0 1px var(--c); }
.pill input:disabled + span { opacity: 0.35; cursor: not-allowed; border-color: var(--border); }
.pill input:focus-visible + span { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.pill-text { display: grid; line-height: 1.15; }
.pill-text small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }

/* Ofrezco viaje */
.origin-field { position: relative; }
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
}
.suggest li[data-i] {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest li[data-i] .i { width: 16px; height: 16px; flex: none; color: var(--faint); }
.suggest li[data-i] span { display: grid; line-height: 1.25; }
.suggest li[data-i] small { color: var(--muted); font-size: 12px; }
.suggest li.active, .suggest li[data-i]:hover { background: var(--brand-soft); }
.suggest li.typed { border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; margin-bottom: 4px; }
.suggest li.typed .i { color: var(--brand); }
.suggest-credit { padding: 6px 10px 2px; color: var(--faint); font-size: 11px; text-align: right; }
.origin-sites { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.origin-sites [data-origin-sites] { display: contents; }

.seg-wide { display: flex; }
.seg-wide label { position: relative; flex: 1; }
.day-pick, .shift-pick { position: relative; }
.seg-wide input { position: absolute; opacity: 0; pointer-events: none; }
.seg-wide span {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}
.seg-wide input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(15 27 45 / 0.12); }
.seg-wide input:focus-visible + span { outline: 3px solid var(--brand-line); }
.when-block { display: grid; gap: 16px; }
.when-block.grid2 { grid-template-columns: 1fr 1fr; gap: 12px; }

.day-picks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span {
  display: grid;
  place-items: center;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}
.day-pick input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; }
.day-pick input:focus-visible + span { outline: 3px solid var(--brand-line); outline-offset: 1px; }

.shift-rows { display: grid; gap: 8px; }
.shift-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 10px; }
.shift-pick { display: grid; }
.shift-pick input { position: absolute; opacity: 0; pointer-events: none; }
.shift-pick span {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.shift-pick span .i { width: 18px; height: 18px; color: var(--muted); }
.shift-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.shift-pick input:checked + span .i { color: var(--brand-strong); }
.shift-pick input:focus-visible + span { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.shift-time { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.shift-time small { white-space: nowrap; }
.shift-time input:disabled { opacity: 0.45; background: var(--surface-2); }
.shift-row:not(.on) .shift-time { opacity: 0.6; }
.time-field { display: grid; gap: 4px; }
.time-field small { color: var(--muted); font-size: 12px; }

/* Calendario */
.trip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.trip-actions .btn .i { width: 16px; height: 16px; }
.cal-trip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.cal-route { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-weight: 650; }
.cal-route small { flex-basis: 100%; color: var(--muted); font-weight: 500; font-size: 13px; }
.cal-actions { display: grid; gap: 8px; }
.cal-btn { justify-content: flex-start; gap: 12px; padding: 12px 14px; text-align: left; text-decoration: none; color: var(--text); white-space: normal; }
.cal-btn .i { width: 22px; height: 22px; color: var(--brand); }
.cal-btn span { display: grid; line-height: 1.25; }
.cal-btn small { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.route-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 13.5px;
  font-weight: 600;
}

.stepper {
  display: inline-grid;
  grid-template-columns: 44px 64px 44px;
  width: max-content;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
}
.stepper button { border: 0; background: var(--surface-2); font-size: 20px; line-height: 1; cursor: pointer; }
.stepper button:hover { background: var(--brand-soft); color: var(--brand-strong); }
.stepper input {
  height: 42px;
  border: 0;
  border-inline: 1px solid var(--border);
  border-radius: 0;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; background: var(--brand-soft); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ================================================================== */
/* Lista de viajes                                                     */
/* ================================================================== */

.trip-list { padding-bottom: 8px; }
.loading { color: var(--muted); text-align: center; padding: 40px 16px; }

.day-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 20px 4px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}
.day-title span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.day { display: grid; gap: 10px; }

.trip {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
@media (hover: hover) {
  .trip:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
}
.trip:focus-visible { outline: 3px solid var(--brand-line); outline-offset: 1px; }
.trip.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }

.trip { container-type: inline-size; }
.trip-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; }
.trip-time { display: grid; line-height: 1.1; font-variant-numeric: tabular-nums; }
.trip-time strong { font-size: 21px; letter-spacing: -0.01em; }
.trip-time small { color: var(--faint); font-size: 12px; }
.trip-route { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-weight: 650; font-size: 15.5px; }
.stop { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.stop.origin { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.stop.origin .i { width: 16px; height: 16px; flex: none; color: var(--brand); }
.arrow {
  position: relative;
  flex: 1 1 24px;
  min-width: 18px;
  max-width: 64px;
  height: 2px;
  background: var(--border-strong);
}
.arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border: 5px solid transparent;
  border-left: 7px solid var(--border-strong);
  border-right: 0;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, white);
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.badge.full { background: #eef2f6; color: var(--muted); }

.trip-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: 13.5px; }
.driver { display: flex; align-items: center; gap: 9px; color: var(--text); }
.driver span:last-child { display: grid; line-height: 1.2; }
.driver small { color: var(--faint); font-size: 12px; }
.contact { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); font-weight: 600; text-decoration: none; }
.contact:hover { text-decoration: underline; }
.contact .i { width: 15px; height: 15px; }
.contact.icon-only { margin-left: -8px; padding: 2px; }
.contact-lock { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.contact-lock .i { width: 14px; height: 14px; }
.eta { display: inline-flex; align-items: center; gap: 5px; }
.eta .i { width: 15px; height: 15px; }
.tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--h) 60% 92%);
  color: hsl(var(--h) 55% 30%);
  font-weight: 700;
  font-size: 12px;
}
.avatar.xs { width: 20px; height: 20px; font-size: 9.5px; }

.notes {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--border-strong);
  border-radius: 4px 10px 10px 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.trip-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; }

@container (max-width: 460px) {
  .trip-route { font-size: 15px; }
}

/* Cuándo: turno, días de la semana y horas */
.offer-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 13.5px; color: var(--text-2); }
.shift-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 700; }
.shift-badge .i { width: 14px; height: 14px; }
.shift-manana { background: #fef3c7; color: #92400e; }
.shift-tarde { background: #ffedd5; color: #9a3412; }
.shift-noche { background: #e0e7ff; color: #3730a3; }
.week { display: inline-flex; gap: 3px; }
.week i {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 6px;
  background: #f1f4f8;
  color: #b3bdca;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.week i.on { background: var(--brand); color: #fff; }
.when-text, .when-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.when-text .i, .when-chip .i { width: 15px; height: 15px; color: var(--brand); }

/* Contacto */
.btn .i { width: 16px; height: 16px; }
.btn.whatsapp { background: #e8f8ee; border-color: #b7e7c8; color: #157a3c; }
.btn.whatsapp:hover { background: #d6f3e1; }
.trip-foot .trip-actions { margin-left: 0; }
.seats { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.seat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  max-width: 100%;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.seat.taken { border: 1px solid var(--border); background: var(--surface-2); }
.seat.me { border-color: var(--brand-line); background: var(--brand-soft); }
.seat.free { padding: 0 10px; border: 1px dashed var(--border-strong); color: var(--faint); font-weight: 500; }
.seat-x {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: -5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.seat-x:hover { background: var(--danger-soft); color: var(--danger); }

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 36px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.empty-icon .i { width: 26px; height: 26px; }
.empty h3 { margin: 4px 0 0; font-size: 16px; }
.empty p { margin: 0 0 6px; max-width: 34ch; color: var(--muted); }

/* ================================================================== */
/* Diálogos                                                            */
/* ================================================================== */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px -16px rgb(15 27 45 / 0.45);
  overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(15 27 45 / 0.45); }
dialog[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 4px; }
.dialog-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.dialog-body { display: grid; gap: 16px; padding: 14px 20px 18px; }
.dialog-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.foot-hint { margin-right: auto; color: var(--muted); font-size: 13.5px; }
.auth-tabs { padding: 10px 20px 0; }
.auth-tabs .seg { display: flex; }
.auth-tabs .seg button { flex: 1; justify-content: center; }
.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}
.form-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 13.5px;
  font-weight: 600;
}

/* ================================================================== */
/* Aviso flotante y navegación inferior                                */
/* ================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 3000;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: #0f1b2d;
  color: #fff;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 32px -12px rgb(15 27 45 / 0.6);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.bottom-nav { display: none; }

/* ================================================================== */
/* Pantallas medianas                                                  */
/* ================================================================== */

@media (max-width: 1100px) and (min-width: 901px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 400px); gap: 16px; padding: 16px; }
  .topbar { padding: 0 16px; }
  .legend-hint { display: none; }
}

/* ================================================================== */
/* Tablet y móvil: lista o mapa a pantalla completa + barra inferior   */
/* ================================================================== */

@media (max-width: 900px) {
  :root { --header-h: 60px; }

  .topbar { position: sticky; top: 0; z-index: 900; padding: 0 16px; }
  .publish-top { display: none; }

  .layout { display: block; padding: 0; }
  body[data-view="list"] { padding-bottom: var(--nav-h); }

  /* Vista principal: mapa fijo arriba y la lista de viajes debajo. */
  body[data-view="list"] .map-panel {
    position: sticky;
    top: var(--header-h);
    z-index: 5;
    height: clamp(220px, 36vh, 380px);
    min-height: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 8px 20px -14px rgb(0 0 0 / 0.6);
  }
  /* En el mapa pequeño sobran la leyenda y la tarjeta: el viaje elegido ya
     se ve marcado en la lista. Los botones pasan a la izquierda. */
  body[data-view="list"] .legend,
  body[data-view="list"] .map-card { display: none; }
  body[data-view="list"] .maplibregl-ctrl-top-right { left: 0; right: auto; }
  body[data-view="list"] .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 10px 0 0 10px; }
  body[data-view="list"] .expand-view { display: grid !important; }
  /* Pines compactos para que quepan las tres sedes en el mapa pequeño. */
  body[data-view="list"] .site-marker { gap: 4px; }
  body[data-view="list"] .site-pin { width: 28px; height: 28px; border-width: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent), 0 0 16px 2px color-mix(in srgb, var(--c) 55%, transparent); }
  body[data-view="list"] .site-pin .i { width: 14px; height: 14px; }
  body[data-view="list"] .site-tag { padding: 3px 8px; border-radius: 8px; }
  body[data-view="list"] .site-tag strong { font-size: 12px; }
  body[data-view="list"] .site-tag small,
  body[data-view="list"] .site-mine { display: none; }
  body[data-view="map"] { overflow: hidden; }
  body[data-view="map"] .trips-panel { display: none; }
  body[data-view="map"] .map-panel {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: var(--nav-h);
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .trips-panel { width: 100%; max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }

  .legend { top: 10px; left: 10px; max-width: calc(100% - 70px); padding: 7px 10px; }
  .legend-hint { display: none; }
  .map-card { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 10px 10px 0 0; }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    height: var(--nav-h);
    padding: 0 12px env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: rgb(255 255 255 / 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .nav-item {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 8px 0 10px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }
  .nav-item .i { width: 23px; height: 23px; }
  .nav-item.active { color: var(--brand); }
  .nav-publish { padding: 0 22px 10px; color: var(--text); }
  .nav-plus {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-top: -22px;
    border: 4px solid var(--surface);
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 20px -6px rgb(108 137 108 / 0.7);
  }
  .nav-plus .i { width: 24px; height: 24px; }

  .toast { bottom: calc(var(--nav-h) + 12px); }

  /* Evita que iPhone haga zoom al escribir. */
  select, input, textarea { font-size: 16px !important; }
}

/* ================================================================== */
/* Móvil                                                               */
/* ================================================================== */

@media (max-width: 640px) {
  /* Los formularios suben desde abajo, ocupando todo el ancho. */
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 32px);
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }
  dialog[open] { animation: sheet 0.25s ease-out; }
  .date-dialog { width: 100%; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .dp-day { font-size: 16px; }
  @keyframes sheet { from { transform: translateY(48px); opacity: 0.6; } }
  .dialog-head { padding: 18px 16px 4px; }
  .dialog-body { padding: 14px 16px 18px; }
  .auth-tabs { padding: 10px 16px 0; }
  .dialog-foot { flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .dialog-foot .btn { flex: 1; }
  .foot-hint { flex-basis: 100%; text-align: center; order: 2; margin: 0; }
}

@media (max-width: 560px) {
  .user-chip-text, .user-chip .chevron { display: none; }
  .brand-symbol { height: 26px; }
  .brand-wordmark { font-size: 17px; }
  .brand-sep, .brand-app { display: none; }

  .when-block.grid2 { grid-template-columns: 1fr; }
  .user-chip { padding: 3px; }
  .grid2 { grid-template-columns: 1fr; }
  .trip { padding: 12px 14px; }
  .pill > span { font-size: 14px; }
  .site-tag small { display: none; }

  /* "¿En qué centro trabajas?": una tarjeta por fila, con indicador de selección. */
  .pills[data-pills="sede"] { grid-template-columns: 1fr; }
  .pills[data-pills="sede"] .pill > span { justify-content: flex-start; gap: 12px; min-height: 52px; padding: 10px 14px; text-align: left; font-size: 15px; }
  .pills[data-pills="sede"] .pill-text { display: flex; align-items: baseline; gap: 6px; }
  .pills[data-pills="sede"] .pill-text small { font-size: 13px; font-weight: 500; letter-spacing: 0; }
  .pills[data-pills="sede"] .pill > span::after {
    content: "";
    width: 20px;
    height: 20px;
    margin-left: auto;
    flex: none;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: var(--surface);
    transition: border-color 0.15s, background-color 0.15s;
  }
  .pills[data-pills="sede"] .pill input:checked + span::after {
    border-color: var(--c);
    background: var(--c);
    box-shadow: inset 0 0 0 3px var(--surface);
  }
}

/* ================================================================== */
/* Pantallas táctiles: objetivos más grandes                           */
/* ================================================================== */

@media (pointer: coarse) {
  .btn.sm { min-height: 40px; padding: 8px 14px; }
  .icon-btn { width: 40px; height: 40px; }
  .seg button { padding: 8px 12px; }
  .seat { height: 32px; }
  .seat-x { width: 26px; height: 26px; }
  .maplibregl-ctrl-group button { width: 40px; height: 40px; }
  .popup-actions button { padding: 11px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
