/* ==========================================================================
   COTRIFRONSUR · Sistema de diseño
   Negro + amarillo de la marca, botones grandes para usar con el pulgar y
   buen contraste bajo el sol. Móvil primero.
   ========================================================================== */

:root {
  --bg: #0b0b0d;
  --surface: #161618;
  --surface-2: #1f1f22;
  --surface-3: #2a2a2e;
  --border: #34343a;
  --text: #f5f5f4;
  --text-2: #c2c2c7;
  --muted: #95959c;
  --yellow: #facc15;
  --yellow-press: #eab308;
  --yellow-soft: rgba(250, 204, 21, 0.14);
  --on-yellow: #111111;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #f87171;
  --red-strong: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.16);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --tap: 56px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--yellow); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px;
  border: 0; border-radius: var(--radius); cursor: pointer;
  font-weight: 700; font-size: 17px; text-decoration: none; text-align: center;
  background: var(--surface-3); color: var(--text);
  transition: transform 0.08s ease, background-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--yellow); color: var(--on-yellow); }
.btn-primary:active { background: var(--yellow-press); }
.btn-success { background: var(--green); color: #06130a; }
.btn-danger { background: var(--red-strong); color: #fff; }
.btn-info { background: var(--blue); color: #07121f; }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 2px var(--border); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-xl { min-height: 64px; font-size: 20px; border-radius: 18px; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.btn.is-loading { pointer-events: none; opacity: 0.75; }
.btn.is-loading::after {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite;
}

.link-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; background: none; border: 0; padding: 8px 4px; color: var(--yellow); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.fab {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.fab:active { transform: scale(0.95); }

/* ---------------------------------------------------------- Formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-weight: 600; font-size: 15px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 0 16px;
  background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px;
  font-size: 18px; color: var(--text);
}
.textarea { padding: 14px 16px; min-height: 110px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--yellow); }
.input[aria-invalid="true"] { border-color: var(--red); }
.field-hint { font-size: 14px; color: var(--muted); }
.field-error { font-size: 14px; color: var(--red); font-weight: 600; }
.input-group { position: relative; }
.input-group .input { padding-right: 56px; }
.input-group .input-action {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center;
}
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--text-2); cursor: pointer; }
.check input { width: 26px; height: 26px; flex: none; accent-color: var(--yellow); margin-top: 1px; }

.alert { padding: 14px 16px; border-radius: 14px; font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.alert-error { background: var(--red-soft); color: #fecaca; }
.alert-ok { background: var(--green-soft); color: #bbf7d0; }
.alert-info { background: var(--blue-soft); color: #dbeafe; }
.alert-warn { background: var(--yellow-soft); color: #fde68a; }

/* ------------------------------------------------------------- Tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: #86efac; }
.badge-red { background: var(--red-soft); color: #fca5a5; }
.badge-yellow { background: var(--yellow-soft); color: #fde047; }
.badge-blue { background: var(--blue-soft); color: #93c5fd; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; display: inline-block; }

.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }
.avatar-lg { width: 96px; height: 96px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 60px; padding: 10px 4px; border: 0; background: none; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--surface-3); color: var(--text);
}
.list-item:last-child { border-bottom: 0; }
.list-item .list-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.list-item strong { display: block; font-weight: 600; }
.list-item small { display: block; color: var(--muted); font-size: 14px; }
.list-item .grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------- Diálogos */
dialog.dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  overflow: auto;
}
dialog.dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.dialog-body { padding: 24px 22px 22px; }
.dialog-title { font-size: 22px; margin-bottom: 10px; }
.dialog-text { color: var(--text-2); margin-bottom: 18px; white-space: pre-line; }
.dialog-actions { display: grid; gap: 10px; margin-top: 8px; }
.dialog-close {
  position: sticky; float: right; top: 10px; margin: 10px 10px 0 0; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text); cursor: pointer; display: grid; place-items: center;
}
@media (min-width: 560px) { .dialog-actions.row { grid-template-columns: 1fr 1fr; } }

/* ----------------------------------------------------------------- Toast */
.toast-region { position: fixed; left: 50%; top: calc(12px + var(--safe-top)); transform: translateX(-50%); z-index: 3000; display: grid; gap: 8px; width: min(480px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  padding: 14px 18px; border-radius: 14px; background: #f5f5f4; color: #111; font-weight: 600; box-shadow: var(--shadow);
  animation: toast-in 0.25s ease; pointer-events: auto;
}
.toast-error { background: #fecaca; color: #450a0a; }
.toast-ok { background: #bbf7d0; color: #052e16; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* --------------------------------------------------------- Pantalla bloqueada */
.suspended {
  position: fixed; inset: 0; z-index: 4000; background: rgba(11, 11, 13, 0.97);
  display: grid; place-items: center; padding: 24px; text-align: center;
}
.suspended-card { max-width: 420px; display: grid; gap: 16px; justify-items: center; }
.suspended-icon { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.suspended h1 { font-size: 26px; }
.suspended p { color: var(--text-2); }

.maintenance-pill {
  position: fixed; bottom: calc(10px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 1150;
  padding: 6px 14px; border-radius: 999px; background: #78350f; color: #fef3c7; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow); max-width: calc(100% - 24px); text-align: center; pointer-events: none;
}

.offline-pill {
  position: fixed; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 1200;
  padding: 8px 16px; border-radius: 999px; background: #7c2d12; color: #ffedd5; font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--yellow); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* =========================================================================
   Página de bienvenida / acceso
   ========================================================================= */
.auth-page {
  min-height: 100dvh; display: flex; justify-content: center;
  background: radial-gradient(120% 60% at 50% 0%, rgba(250, 204, 21, 0.16), transparent 60%), var(--bg);
}
.auth-shell { width: min(460px, 100%); padding: calc(20px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); display: flex; flex-direction: column; }
.auth-welcome { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; text-align: center; }
.auth-logo { width: 180px; height: 180px; margin: 0 auto; border-radius: 50%; }
.auth-title { font-size: 30px; font-weight: 800; }
.auth-title span { color: var(--yellow); }
.auth-subtitle { color: var(--text-2); font-size: 18px; margin-top: 8px; }
.auth-actions { display: grid; gap: 14px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 18px; }
.auth-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-header h2 { font-size: 24px; }
.back-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; flex: none; }
.role-choice { display: grid; gap: 14px; }
.role-card {
  display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius-lg); cursor: pointer;
  border: 2px solid var(--border); background: var(--surface); text-align: left; color: var(--text);
}
.role-card:active { border-color: var(--yellow); }
.role-card .role-icon { width: 60px; height: 60px; border-radius: 18px; background: var(--yellow); color: var(--on-yellow); display: grid; place-items: center; flex: none; }
.role-card strong { font-size: 20px; display: block; }
.role-card small { color: var(--text-2); font-size: 15px; }
.photo-picker { display: flex; align-items: center; gap: 16px; }
.photo-picker .stack { gap: 2px; justify-items: start; }
.optional { color: var(--muted); font-weight: 500; }
.photo-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-editor .stack { gap: 4px; justify-items: start; }
.photo-editor .avatar { border: 3px solid var(--yellow); }
.photo-editor .btn, .photo-picker .btn { min-height: 48px; padding: 0 14px; font-size: 16px; white-space: nowrap; }
.install-logo { width: 84px; height: 84px; margin: 0 auto; border-radius: 22px; box-shadow: var(--shadow); }
.install-steps { margin: 0; padding: 14px 14px 14px 36px; display: grid; gap: 8px; text-align: left; color: var(--text-2); background: var(--surface-2); border-radius: 16px; }
.photo-picker .avatar { width: 84px; height: 84px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* =========================================================================
   Pantallas con mapa (pasajero y conductor), estilo inDrive
   ========================================================================= */
.page-map { overflow: hidden; height: 100dvh; }
.map { position: fixed; inset: 0; z-index: 0; background: #1b1c1f; }
.map-fallback { display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

.map-top { position: fixed; top: calc(14px + max(var(--safe-top), var(--panic-bar-h, 0px))); left: 14px; right: 14px; z-index: 1000; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 15px;
}
.status-chip.is-on { color: #86efac; }
.status-chip.is-off { color: var(--text-2); }

/* Pin central (punto de recogida o destino) */
.center-pin {
  position: fixed; left: 50%; top: var(--pin-y, 38%); z-index: 900; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
}
.pin-head {
  width: 50px; height: 50px; border-radius: 15px; background: var(--yellow); color: var(--on-yellow);
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); border: 3px solid #111;
  transition: transform 0.18s ease;
}
.pin-head.is-destination { background: #fff; }
.pin-stick { width: 3px; height: 18px; background: #f5f5f4; border-radius: 2px; }
.pin-shadow { width: 12px; height: 5px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); }
.center-pin.is-moving .pin-head { transform: translateY(-10px); }

.fab-locate { position: fixed; right: 14px; z-index: 1000; bottom: calc(var(--sheet-h, 260px) + 14px); transition: bottom 0.25s ease; }

/* Hoja inferior */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  padding: 8px 18px calc(18px + var(--safe-bottom));
  max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet:not(.is-full) { max-height: 64dvh; }
.sheet-grabber { width: 44px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 4px auto 14px; }
.sheet.is-full { top: 0; border-radius: 0; max-height: none; padding-top: calc(14px + var(--safe-top)); }
@media (min-width: 720px) {
  .sheet { left: 18px; right: auto; bottom: 18px; width: 420px; border-radius: 26px; max-height: calc(100dvh - 36px); }
  .sheet.is-full { top: 18px; border-radius: 26px; }
  .fab-locate { bottom: 28px; }
}
.sheet-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.sheet-sub { color: var(--text-2); margin-bottom: 16px; }
.stack { display: grid; gap: 12px; }

/* Buscando mototaxi */
.radar { position: relative; width: 96px; height: 96px; margin: 8px auto 14px; display: grid; place-items: center; }
.radar::before, .radar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--yellow); animation: radar 2s ease-out infinite; }
.radar::after { animation-delay: 1s; }
.radar-core { width: 60px; height: 60px; border-radius: 50%; background: var(--yellow); color: var(--on-yellow); display: grid; place-items: center; z-index: 1; }
@keyframes radar { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin: 14px 0 16px; }
.progress > span { display: block; height: 100%; background: var(--yellow); width: 100%; transform-origin: left; transition: transform 1s linear; }

/* Conductor asignado */
.trip-status { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.trip-status .dot { color: var(--green); animation: pulse 1.4s ease-in-out infinite; }
/* Moto de estado (no disponible / en carrera). Es también el botón oculto del pánico: no lleva texto ni forma de botón. */
.status-moto { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #052e12; -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.status-moto .icon { width: 20px; height: 20px; }
.status-moto.is-off { background: var(--surface-3); color: var(--text-2); width: 40px; height: 40px; }
.status-moto.is-off .icon { width: 24px; height: 24px; }
[data-panic-trigger] { -webkit-tap-highlight-color: transparent; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: background-color 0.25s, color 0.25s; }
@keyframes pulse { 50% { opacity: 0.35; } }
.person-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface-2); margin-bottom: 14px; }
.person-card .grow { flex: 1; min-width: 0; }
.person-card h3 { font-size: 20px; }
.person-card .meta { color: var(--text-2); font-size: 15px; }
.plate { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 8px; background: #f5f5f4; color: #111; font-weight: 800; letter-spacing: 0.06em; font-size: 15px; }
.fare { text-align: right; }
.fare strong { display: block; font-size: 28px; color: var(--yellow); line-height: 1; }
.fare small { color: var(--muted); font-size: 13px; }
.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-icon { width: 84px; height: 84px; border-radius: 50%; margin: 8px auto 14px; display: grid; place-items: center; }
.result-icon.ok { background: var(--green-soft); color: var(--green); }
.result-icon.bad { background: var(--red-soft); color: var(--red); }
.result-icon.wait { background: var(--yellow-soft); color: var(--yellow); }

/* Marcadores del mapa */
.mk-moto { width: 38px; height: 38px; border-radius: 50%; background: var(--yellow); color: #111; border: 3px solid #111; display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.mk-moto .icon { width: 20px; height: 20px; }
.mk-me { width: 22px; height: 22px; border-radius: 50%; background: var(--blue); border: 4px solid #fff; box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.3); }
.mk-pickup { width: 26px; height: 26px; border-radius: 50%; background: var(--yellow); border: 5px solid #111; box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35); }

/* Menú lateral */
.drawer-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, 0.6); }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 2001; width: min(320px, 86vw);
  background: var(--surface); padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 6px; transform: translateX(-102%); transition: transform 0.22s ease; overflow-y: auto;
}
.drawer.is-open { transform: none; }
.drawer-user { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; margin-bottom: 8px; border-bottom: 1px solid var(--surface-3); }
.drawer-user strong { font-size: 19px; display: block; }
.drawer-user small { color: var(--muted); }
.drawer-item { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 10px; border: 0; border-radius: 14px; background: none; color: var(--text); font-size: 18px; font-weight: 600; cursor: pointer; text-align: left; }
.drawer-item:active { background: var(--surface-2); }
.drawer-item.danger { color: var(--red); margin-top: auto; }
.drawer-brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 12px 10px 0; }
.drawer-brand img { width: 32px; height: 32px; border-radius: 50%; }

/* Conductor: cuenta regresiva y botones de precio (al finalizar el viaje) */
.countdown { position: relative; width: 84px; height: 84px; flex: none; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 9; }
.countdown .track { stroke: var(--surface-3); }
.countdown .bar { stroke: var(--yellow); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.countdown strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.fare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fare-btn { min-height: 76px; min-width: 0; padding: 0 6px; font-size: clamp(20px, 6vw, 26px); border-radius: 18px; }
.fare-other { margin-top: 18px; }
.driver-step { display: grid; gap: 10px; margin-top: 12px; }
.earnings-chip { background: var(--surface); box-shadow: var(--shadow); border-radius: 999px; min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.earnings-chip strong { color: var(--yellow); }
.go-online { min-height: 76px; font-size: 22px; letter-spacing: 0.02em; border-radius: 20px; }

/* =========================================================================
   Paneles: Administración y Super Admin
   ========================================================================= */
.panel-page { min-height: 100dvh; }
.panel-header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px; background: rgba(11, 11, 13, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface-3);
}
.panel-header img { width: 42px; height: 42px; border-radius: 50%; }
.panel-header h1 { font-size: 18px; }
.panel-header p { color: var(--muted); font-size: 13px; }
.panel-header .grow { flex: 1; min-width: 0; }
.panel-header .grow h1, .panel-header .grow p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { position: sticky; top: calc(65px + var(--safe-top)); z-index: 40; display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--surface-3); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tab[aria-selected="true"] { background: var(--yellow); color: var(--on-yellow); }
.tab .count { background: var(--red-strong); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.panel-main { width: min(1200px, 100%); margin: 0 auto; padding: 18px 16px 60px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; }
.section-head p { color: var(--muted); font-size: 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: grid; gap: 4px; }
.stat-label { color: var(--text-2); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.stat-value { font-size: clamp(22px, 7vw, 30px); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.stat-note { color: var(--muted); font-size: 13px; }
.stat-note.up { color: #86efac; }
.stat-note.down { color: #fca5a5; }
.stat.highlight { border-color: rgba(250, 204, 21, 0.5); background: linear-gradient(180deg, rgba(250, 204, 21, 0.1), transparent 70%), var(--surface); }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1.4fr 1fr; } }
.card h3 { font-size: 18px; margin-bottom: 4px; }
.card .card-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* Gráficos: una sola serie en amarillo (validado para fondo oscuro), barras finas,
   cuadrícula tenue, etiquetas selectivas y detalle al pasar el dedo o el cursor. */
.chart-wrap { position: relative; --series-1: #c98500; --series-1-hover: #e19a12; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--surface-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--series-1); }
.chart .value { fill: var(--text); font-weight: 700; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .col:hover .bar, .chart .col:focus-within .bar { fill: var(--series-1-hover); }
.chart .hit:focus-visible { fill: rgba(255, 255, 255, 0.06); }
.chart-empty { position: absolute; inset: 0 0 26px 34px; display: grid; place-items: center; color: var(--muted); font-size: 14px; pointer-events: none; }
.chart-tooltip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: #f5f5f4; color: #111; padding: 8px 12px; border-radius: 10px; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow);
}
.chart-tooltip strong { display: block; font-size: 16px; }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 14px; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
details.table-view .table-wrap { margin-top: 8px; max-height: 280px; overflow: auto; }
.is-refreshing { opacity: 0.55; transition: opacity 0.2s ease; }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; }
.rank li.empty { display: block; } /* sin carreras: el texto ocupa todo el ancho, no la columna del número */
.rank .pos { color: var(--muted); font-weight: 800; }
.rank .bar-bg { grid-column: 2 / 4; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.rank .bar-bg span { display: block; height: 100%; background: #c98500; border-radius: 3px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar .input, .toolbar .select { min-height: 48px; font-size: 16px; width: auto; flex: 1 1 170px; }
.toolbar .grow { flex: 2 1 240px; }
.toolbar .chips { flex: 1 1 100%; }
.filter-row { margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--border); background: none; color: var(--text-2); font-weight: 700; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-soft); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
.table td:first-child, .table td.num { white-space: nowrap; }
.table td.wide { min-width: 220px; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-person img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.cell-person small { display: block; color: var(--muted); }

/* Carreras en curso (administración): tarjetas grandes, usables desde el celular */
.active-rides { list-style: none; margin: 0 0 26px; padding: 0; display: grid; gap: 12px; }
@media (min-width: 900px) { .active-rides { grid-template-columns: repeat(2, 1fr); } .active-rides > .empty, .active-rides > .alert { grid-column: 1 / -1; } }
.active-rides > .empty { border: 1px dashed var(--border); border-radius: 18px; }
.active-ride { display: grid; gap: 6px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }
.active-ride.is-late { border: 2px solid var(--red-strong); background: linear-gradient(180deg, var(--red-soft), transparent 70%), var(--surface); }
.active-ride-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.active-ride-head strong { font-size: 18px; overflow-wrap: anywhere; }
.active-ride-time { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.active-ride.is-late .active-ride-time { color: #fca5a5; }
.active-ride .field-hint { overflow-wrap: anywhere; }
.active-ride-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.active-ride-actions .btn { flex: 1 1 200px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; color: var(--text-2); }

.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.kv div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.kv small { display: block; color: var(--muted); font-size: 12px; }
.kv strong { font-size: 16px; overflow-wrap: anywhere; }
.subhead { font-size: 16px; margin: 18px 0 8px; color: var(--text-2); }

.pw-requests { margin-bottom: 16px; border-color: rgba(250, 204, 21, 0.45); }
.pw-requests h3 { display: flex; align-items: center; gap: 8px; }
.pw-request { flex-wrap: wrap; }
.pw-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.temp-password { font-size: 28px; font-weight: 800; letter-spacing: 0.08em; text-align: center; padding: 16px; border-radius: 14px; background: var(--surface-2); color: var(--yellow); user-select: all; }

.place-map { height: 260px; border-radius: 16px; overflow: hidden; position: relative; margin-bottom: 14px; }
.place-map .map { position: absolute; inset: 0; }
.place-map .center-pin { position: absolute; top: 50%; }

.upload-preview { max-height: 220px; border-radius: 14px; margin: 10px 0; object-fit: contain; }
/* Comunicados: la imagen es lo principal; ocupa todo el ancho y se adapta a la pantalla. */
.ann-head { display: flex; gap: 12px; align-items: center; padding: 14px 64px 14px 18px; border-bottom: 1px solid var(--border); }
.ann-head img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.ann-head strong { display: block; font-size: 15px; letter-spacing: 0.02em; }
.ann-head small { display: block; color: var(--yellow); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.ann-head time { display: block; color: var(--muted); font-size: 13px; }
.ann-figure { display: block; width: 100%; margin: 0; padding: 0; border: 0; background: #000; cursor: zoom-in; }
.ann-figure img { display: block; width: 100%; height: auto; max-height: calc(100dvh - 320px); object-fit: contain; }
.ann-content { display: grid; gap: 8px; padding: 18px 20px 4px; }
.ann-title { font-size: 22px; line-height: 1.25; }
.ann-message { color: var(--text-2); font-size: 16px; white-space: pre-line; }
.ann-actions { padding: 16px 20px 20px; }
.ann-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.ann-card .ann-head { padding-right: 18px; }
.ann-card .ann-figure img { max-height: 60vh; }
.ann-card .ann-content { padding-bottom: 18px; }
.ann-list { display: grid; gap: 16px; }
dialog.dialog-announcement { width: min(560px, calc(100vw - 24px)); }
dialog.dialog-announcement.has-image { width: min(880px, calc(100vw - 24px)); }
dialog.dialog-announcement .dialog-body,
dialog.dialog-announcements .dialog-body { padding: 0; }
dialog.dialog-announcements { width: min(760px, calc(100vw - 24px)); }
dialog.dialog-announcements .dialog-title { padding: 20px 64px 0 20px; }
dialog.dialog-announcements .ann-list { padding: 4px 16px 16px; }
dialog.dialog-announcement .dialog-close { position: absolute; float: none; top: 10px; right: 10px; margin: 0; }
/* Tablet horizontal y computadora: imagen grande a la izquierda, texto a la derecha, todo a la vista. */
@media (min-width: 900px) and (orientation: landscape) {
  dialog.dialog-announcement.has-image { width: min(1120px, calc(100vw - 48px)); overflow: hidden; }
  dialog.dialog-announcement.has-image .dialog-body {
    display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); grid-template-rows: auto 1fr auto;
    max-height: calc(100dvh - 32px);
  }
  dialog.dialog-announcement.has-image .ann-figure { grid-column: 1; grid-row: 1 / 4; display: grid; place-items: center; }
  dialog.dialog-announcement.has-image .ann-figure img { max-height: calc(100dvh - 34px); }
  dialog.dialog-announcement.has-image .ann-head { grid-column: 2; grid-row: 1; }
  dialog.dialog-announcement.has-image .ann-content { grid-column: 2; grid-row: 2; align-content: start; overflow: auto; padding-top: 22px; }
  dialog.dialog-announcement.has-image .ann-actions { grid-column: 2; grid-row: 3; }
  dialog.dialog-announcement.has-image .ann-title { font-size: 26px; }
}
dialog.image-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, 0.95); }
dialog.image-viewer::backdrop { background: #000; }
dialog.image-viewer img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-out; }
dialog.image-viewer .dialog-close { position: fixed; float: none; top: calc(12px + var(--safe-top)); right: 12px; margin: 0; }

/* Super Admin */
.power-page { display: grid; gap: 22px; justify-items: center; text-align: center; padding-top: 12px; }
.power-state { font-size: 26px; font-weight: 800; }
.power-state.on { color: var(--green); }
.power-state.off { color: var(--red); }
.power-btn {
  width: min(240px, 64vw); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 8px;
  font-size: 22px; font-weight: 900; letter-spacing: 0.04em;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.power-btn .icon { width: 72px; height: 72px; stroke-width: 2.4; }
.power-btn:active { transform: scale(0.97); }
.power-btn.turn-off { background: radial-gradient(circle at 50% 35%, #2fd06b, #15803d); color: #03140a; box-shadow: 0 0 0 12px var(--green-soft), 0 0 60px rgba(34, 197, 94, 0.35); }
.power-btn.turn-on { background: radial-gradient(circle at 50% 35%, #f87171, #b91c1c); color: #fff; box-shadow: 0 0 0 12px var(--red-soft), 0 0 60px rgba(239, 68, 68, 0.35); }
.power-help { color: var(--text-2); max-width: 440px; }
.power-meta { color: var(--muted); font-size: 14px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(520px, 100%); }
.mini-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 6px; }
.mini-stats strong { display: block; font-size: 22px; }
.mini-stats small { color: var(--muted); font-size: 12px; }
details.card { width: min(640px, 100%); text-align: left; padding: 0; }
details.card summary { cursor: pointer; padding: 18px 20px; font-weight: 800; font-size: 17px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card summary::-webkit-details-marker { display: none; }
details.card[open] summary { border-bottom: 1px solid var(--surface-3); }
details.card .details-body { padding: 14px 20px 20px; }

/* =========================================================================
   V3 · "Recógeme aquí": un botón para el pasajero y alerta total para el conductor
   ========================================================================= */
.center { text-align: center; }
.btn-round { width: 56px; min-height: 56px; padding: 0; border-radius: 50%; flex: none; }

/* Cada paso de la hoja entra con un movimiento corto */
.sheet-view.is-entering { animation: view-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
/* Solo movimiento (sin transparencia): si el teléfono pausa la animación, el contenido igual se ve. */
@keyframes view-in { from { transform: translateY(14px); } }

/* Pin de recogida */
.pin-bubble {
  margin-bottom: 8px; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  background: #0e0e10; color: var(--text); font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}
.center-pin .pin-shadow { position: relative; }
.center-pin .pin-shadow::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 46px; height: 20px; margin: -10px 0 0 -23px;
  border-radius: 50%; border: 2px solid var(--yellow); animation: pin-ring 1.8s ease-out infinite;
}
.center-pin.is-moving .pin-shadow::after { animation: none; opacity: 0; }
@keyframes pin-ring { from { transform: scale(0.3); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }

/* Tarjeta "Te recogemos aquí" */
.pickup-card {
  display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 12px;
  border-radius: 18px; background: var(--surface-2); border: 1px solid transparent; transition: border-color 0.2s ease;
}
.pickup-card .grow { flex: 1; min-width: 0; }
.pickup-card strong { display: block; font-size: 19px; line-height: 1.25; overflow-wrap: anywhere; }
.pickup-card small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.pickup-card[data-tone="warn"] { border-color: #69552b; }
.pickup-card[data-tone="warn"] small { color: #fde68a; }
.pickup-card[data-tone="wait"] strong { color: var(--text-2); }
.pickup-card.is-compact strong { font-size: 17px; }
.pickup-card.is-compact small { margin: 0 0 2px; font-size: 13px; }
.pickup-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--yellow); color: var(--on-yellow); display: grid; place-items: center; flex: none; }
.pickup-note { color: #fde68a; font-size: 15px; margin-top: 4px; overflow-wrap: anywhere; }

.note-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; margin-bottom: 8px;
  border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 15px; cursor: pointer;
}
.note-field { margin-bottom: 12px; }

/* El botón: grande, con latido cuando ya se puede pedir */
.cta {
  position: relative; display: flex; width: 100%; min-height: 78px; gap: 14px; overflow: hidden;
  border-radius: 22px; font-size: clamp(20px, 6vw, 24px); font-weight: 900; letter-spacing: 0.02em;
}
.cta:disabled { background: var(--surface-3); color: var(--muted); opacity: 1; }
.cta.is-ready { animation: cta-glow 2.2s ease-out infinite; }
.cta.is-ready::before {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  animation: cta-shine 3.2s ease-in-out infinite;
}
.cta > * { position: relative; }
@keyframes cta-glow { 0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5); } 70%, 100% { box-shadow: 0 0 0 16px rgba(250, 204, 21, 0); } }
@keyframes cta-shine { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.cta-foot { margin-top: 12px; color: var(--muted); font-size: 14px; text-align: center; }

/* Buscando */
.search-head { display: flex; align-items: center; gap: 14px; }
.search-head .grow { flex: 1; min-width: 0; }
.search-head .radar { width: 64px; height: 64px; margin: 0; flex: none; }
.search-head .radar-core { width: 44px; height: 44px; }
.search-head .radar-core .icon { width: 24px; height: 24px; }
.search-head .sheet-title { margin-bottom: 2px; font-size: 20px; }
.search-head .sheet-sub { margin: 0; font-size: 15px; }
.search-seconds { flex: none; font-size: 20px; color: var(--yellow); font-variant-numeric: tabular-nums; }

/* Mototaxi asignado: minutos que faltan */
.eta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.eta-row .grow { flex: 1; min-width: 0; }
.eta-row .trip-status { margin-bottom: 2px; font-size: 19px; }
.eta-row .sheet-sub { margin: 0; font-size: 15px; }
.eta-badge {
  width: 74px; height: 74px; border-radius: 22px; flex: none; display: grid; place-items: center; align-content: center;
  background: var(--yellow); color: var(--on-yellow); transition: background-color 0.3s ease;
}
.eta-badge strong { font-size: 30px; font-weight: 900; line-height: 1; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.eta-badge span { font-size: 13px; font-weight: 800; }
.eta-badge[data-status="ARRIVED"] { background: var(--green); color: #06130a; }
.eta-badge[data-status="IN_PROGRESS"] { background: var(--blue); color: #07121f; }
.result-icon { animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop-in { from { transform: scale(0.5); } }

/* Permisos: se explica para qué son antes de que el navegador pregunte */
.gate {
  position: fixed; inset: 0; z-index: 2400; display: grid; place-items: end center; padding: 14px;
  background: rgba(11, 11, 13, 0.82); backdrop-filter: blur(6px);
}
.gate-card {
  width: min(440px, 100%); display: grid; gap: 14px; text-align: center;
  padding: 26px 22px calc(20px + var(--safe-bottom)); border-radius: 26px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: view-in 0.3s ease;
}
.gate-icon { width: 78px; height: 78px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: var(--on-yellow); animation: cta-glow 2s ease-out infinite; }
.gate h1 { font-size: 24px; }
.gate p { color: var(--text-2); }
@media (min-width: 720px) { .gate { place-items: center; } }
.permission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.permission-list li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); font-weight: 700; color: var(--text-2); }
.permission-list li.is-current { border: 2px solid var(--yellow); color: var(--text); }
.permission-list li.is-done { color: var(--text); opacity: 0.75; }
.permission-list li.is-done .icon { color: var(--green); }
.permission-hint { font-size: 14px; font-weight: 700; }
/* Conductor en línea sin sonido activado: tarjeta bloqueante, imposible de pasar por alto */
.sound-gate { place-items: center; background: rgba(11, 11, 13, 0.92); cursor: pointer; }
.sound-gate .gate-card { border: 3px solid var(--yellow); animation: view-in 0.3s ease, cta-glow 2s ease-out infinite; }
.sound-gate h1 { font-size: clamp(24px, 7vw, 30px); color: var(--yellow); }
.sound-gate p { font-size: 18px; }

/* Conductor: alerta de carrera nueva. Ocupa toda la pantalla, parpadea (2 destellos por
   segundo, por debajo del ritmo que puede provocar crisis fotosensibles) y deja ver el mapa. */
.ride-alert { position: fixed; inset: 0; z-index: 2500; display: grid; grid-template-rows: auto minmax(110px, 1fr) auto; }
.ride-alert-banner {
  display: flex; align-items: center; gap: 14px; padding: calc(14px + var(--safe-top)) 18px 14px;
  background: var(--yellow); color: #111; animation: alert-flash 0.5s steps(1, end) infinite;
}
.ride-alert-banner .grow { flex: 1; min-width: 0; }
.ride-alert-banner h2 { font-size: clamp(26px, 8.4vw, 36px); font-weight: 900; }
.ride-alert-banner p { font-weight: 700; font-size: 15px; }
.ride-alert .countdown { width: 68px; height: 68px; }
.ride-alert .countdown .track { stroke: currentColor; opacity: 0.25; }
.ride-alert .countdown .bar { stroke: currentColor; }
.ride-alert .countdown strong { font-size: 24px; }
.ride-alert-window { box-shadow: inset 0 0 0 7px var(--yellow); animation: alert-frame 0.5s steps(1, end) infinite; }
@keyframes alert-flash { 0%, 49.9% { background: var(--yellow); color: #111; } 50%, 100% { background: #0b0b0d; color: var(--yellow); } }
@keyframes alert-frame { 0%, 49.9% { box-shadow: inset 0 0 0 7px var(--yellow); } 50%, 100% { box-shadow: inset 0 0 0 7px #0b0b0d; } }
.ride-alert-panel {
  display: grid; gap: 12px; padding: 16px 18px calc(14px + var(--safe-bottom));
  max-height: 66dvh; overflow-y: auto; background: var(--bg); border-top: 4px solid var(--yellow);
}
.ride-alert-person { display: flex; align-items: center; gap: 12px; }
.ride-alert-person .avatar { width: 56px; height: 56px; }
.ride-alert-person .grow { flex: 1; min-width: 0; }
.ride-alert-person small { display: block; color: var(--muted); font-size: 13px; }
.ride-alert-person strong { display: block; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-alert-distance { text-align: right; flex: none; }
.ride-alert-distance strong { font-size: 30px; line-height: 1; color: var(--yellow); font-variant-numeric: tabular-nums; }
.ride-alert-distance small { color: var(--text-2); font-size: 14px; }
.ride-alert-place { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.ride-alert-place small { color: var(--muted); font-size: 13px; }
.ride-alert-place strong { display: block; font-size: clamp(20px, 6.2vw, 26px); line-height: 1.2; overflow-wrap: anywhere; }
.ride-alert-place p { margin-top: 4px; color: #fde68a; font-size: 16px; overflow-wrap: anywhere; }
.btn-accept {
  width: 100%; min-height: 86px; gap: 12px; border-radius: 24px;
  font-size: clamp(26px, 8vw, 32px); font-weight: 900; letter-spacing: 0.03em;
  background: var(--green); color: #04130a; animation: accept-pulse 1s ease-out infinite;
}
.btn-accept:active { background: #16a34a; }
@keyframes accept-pulse { from { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.65); } to { box-shadow: 0 0 0 18px rgba(34, 197, 94, 0); } }
.ride-alert-silent { display: flex; align-items: center; justify-content: center; gap: 8px; color: #fde68a; font-size: 14px; font-weight: 600; }
@media (min-width: 720px) {
  .ride-alert-panel { width: min(560px, 100%); margin: 0 auto; border: 4px solid var(--yellow); border-bottom: 0; border-radius: 26px 26px 0 0; }
}
body.is-alerting .sheet, body.is-alerting .map-top, body.is-alerting .fab-locate,
body.is-alerting .location-status, body.is-alerting .test-move, body.is-alerting .test-crosshair,
body.is-alerting .maplibregl-ctrl, body.is-alerting .gate { visibility: hidden; }
.sheet .actions-2 .btn { padding: 0 10px; font-size: 16px; }
/* Carrera en curso (conductor): panel compacto para dejar ver el mapa */
[data-state="trip"] .trip-status { margin-bottom: 10px; }
[data-state="trip"] .person-card { padding: 10px 12px; margin-bottom: 10px; }
[data-state="trip"] .person-card .avatar { width: 48px; height: 48px; }
[data-state="trip"] .person-card h3 { font-size: 18px; }
[data-state="trip"] .person-card .meta { font-size: 14px; }
[data-state="trip"] .pickup-card { padding: 10px 12px; margin-bottom: 0; }
[data-state="trip"] .btn-round { width: 48px; min-height: 48px; }
/* Guía de navegación: barra compacta (no tapa el mapa) con letra grande y clara bajo el sol.
   Distancia y maniobra en una sola franja; el «Luego…» en una línea corta. */
.nav-banner {
  position: fixed; z-index: 1050; top: calc(8px + max(var(--safe-top), var(--panic-bar-h, 0px))); left: 8px; right: 8px;
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 7px;
  border-radius: 18px; background: rgba(13, 20, 16, 0.94); border: 2px solid var(--green); box-shadow: var(--shadow);
}
.nav-banner .grow { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'dist then' 'text text'; column-gap: 10px; align-items: baseline; }
.nav-arrow { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; background: var(--green); color: #04130a; }
.nav-arrow .icon { width: 32px; height: 32px; stroke-width: 2.6; }
.nav-distance { grid-area: dist; display: block; font-size: 24px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-text {
  grid-area: text; margin: 1px 0 0; font-size: 17px; font-weight: 700; line-height: 1.2; min-width: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.nav-then { grid-area: then; margin: 0; color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-voice { width: 40px; height: 40px; border-radius: 50%; border: 0; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--text); cursor: pointer; }
.nav-voice .icon { width: 22px; height: 22px; }
.nav-voice[aria-pressed="false"] { color: var(--muted); }
.fab-overview { position: fixed; right: 14px; z-index: 1000; bottom: calc(var(--sheet-h, 260px) + 78px); transition: bottom 0.25s ease; }
/* Yendo a ayudar a un compañero, la barra roja del pánico queda arriba y la guía justo debajo. */
body.is-navigating .map-top { top: calc(var(--nav-h, 96px) + 22px + max(var(--safe-top), var(--panic-bar-h, 0px))); }
body.is-navigating .maplibregl-ctrl-top-right, body.is-navigating .location-status { display: none; }
body.is-navigating [data-state="trip"] .trip-status, body.is-navigating #statusChip,
body.is-navigating [data-state="trip"] .person-card .meta, body.is-navigating [data-state="trip"] .pickup-icon,
body.is-navigating #navigateBtn { display: none; }
/* Durante la guía el panel se encoge para dejar el mapa a la vista (se desliza si hace falta). */
body.is-navigating .sheet:not(.is-full) { max-height: 44dvh; padding-top: 4px; }
body.is-navigating .sheet-grabber { margin-bottom: 6px; }
body.is-navigating .route-status { margin-bottom: 8px; padding: 8px 12px; }
body.is-navigating [data-state="trip"] .person-card { padding: 8px 12px; margin-bottom: 8px; }
body.is-navigating [data-state="trip"] .person-card .avatar { width: 40px; height: 40px; }
body.is-navigating [data-state="trip"] .pickup-card { padding: 8px 12px; }
body.is-navigating .driver-step { margin-top: 8px; gap: 2px; }
body.is-navigating .driver-step .btn-xl { min-height: 56px; }
body.is-navigating .driver-step .btn-ghost { min-height: 44px; font-size: 15px; }
/* Yendo a ayudar a un compañero (sigue Disponible): solo quedan el interruptor y la moto, para ver la ruta. */
body.is-navigating [data-state="online"] .sheet-sub, body.is-navigating [data-state="online"] .section-head,
body.is-navigating [data-state="online"] #testPushBtn, body.is-navigating [data-state="online"] .avail-text small { display: none; }
body.is-navigating [data-state="online"] .avail-switch { min-height: 58px; padding-top: 8px; padding-bottom: 8px; margin-bottom: 8px; }
body.is-navigating [data-state="online"] .avail-text strong { font-size: 18px; }
body.is-navigating [data-state="online"] .waiting-row { margin-bottom: 0; }
body.is-navigating [data-state="online"] .waiting-row .sheet-title { font-size: 17px; margin: 0; }
@media (min-width: 720px) {
  .nav-banner { left: 474px; right: auto; width: min(520px, calc(100vw - 492px)); }
  .fab-overview { bottom: 92px; }
}
/* Modo de prueba (solo en la computadora de desarrollo) */
.demo-option { display: grid; gap: 2px; width: 100%; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.demo-option:not(:disabled):active { border-color: var(--yellow); }
.demo-option:disabled { opacity: 0.5; cursor: not-allowed; }
.demo-option strong { font-size: 18px; }
.demo-option small { color: var(--text-2); font-size: 14px; }
.demo-option.is-loading { opacity: 0.7; pointer-events: none; }
.demo-badge {
  position: fixed; z-index: 1000; left: 50%; top: calc(74px + var(--safe-top)); transform: translateX(-50%);
  padding: 6px 14px; border-radius: 999px; border: 1px dashed var(--yellow); white-space: nowrap;
  background: rgba(17, 19, 23, 0.94); color: var(--yellow); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; pointer-events: none;
}
/* Un botón solo (el otro está oculto) ocupa todo el ancho. */
.actions-2:has(> [hidden]) { grid-template-columns: 1fr; }
.tone-list { display: grid; gap: 10px; }
.tone-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 2px solid transparent; cursor: pointer; }
.tone-option:has(input:checked) { border-color: var(--yellow); }
.tone-option input { width: 24px; height: 24px; accent-color: var(--yellow); flex: none; }
.tone-option .grow { flex: 1; min-width: 0; }
.tone-option strong { display: block; font-size: 18px; }
.tone-option small { display: block; color: var(--muted); font-size: 14px; }

/* =========================================================================
   V4 · Uno por uno, Disponible manual, Conductor ↔ Cliente y retoque visual.
   Animaciones cortas (0,15–0,45 s) que solo mueven o escalan: si el teléfono las
   pausa, el contenido igual se ve. Con "reducir movimiento" se apagan (ver abajo).
   ========================================================================= */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-spring: cubic-bezier(0.2, 1.4, 0.4, 1); }

/* Botones: respuesta al toque */
.btn { transition: transform 0.12s var(--ease-out), background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease; }
.btn:not(:disabled):active { transform: scale(0.97); }
.drawer-item { transition: background-color 0.15s ease, transform 0.12s var(--ease-out); }
.drawer-item:active { transform: scale(0.98); }
.drawer.is-open .drawer-item { animation: drawer-item-in 0.32s var(--ease-out) backwards; }
.drawer.is-open .drawer-item:nth-of-type(2) { animation-delay: 0.03s; }
.drawer.is-open .drawer-item:nth-of-type(3) { animation-delay: 0.06s; }
.drawer.is-open .drawer-item:nth-of-type(4) { animation-delay: 0.09s; }
.drawer.is-open .drawer-item:nth-of-type(n+5) { animation-delay: 0.12s; }
@keyframes drawer-item-in { from { transform: translateX(-16px); } }
.drawer-backdrop:not([hidden]) { animation: fade-in 0.22s ease; }
@keyframes fade-in { from { opacity: 0; } }

/* Ventanas y avisos: aparecen con una escala suave */
dialog.dialog[open] { animation: dialog-in 0.26s var(--ease-out); }
dialog.dialog[open]::backdrop { animation: fade-in 0.22s ease; }
@keyframes dialog-in { from { transform: translateY(12px) scale(0.97); } }
.toast { animation: toast-in 0.3s var(--ease-spring); }
@keyframes toast-in { from { transform: translateY(-14px) scale(0.96); } }

/* Cambio de pantalla (modo cliente/conductor, entrar al panel): salida corta */
body.is-leaving > * { transition: opacity 0.24s ease, transform 0.24s var(--ease-out); opacity: 0; transform: scale(0.985); }

/* Portada: logo y botones entran en cascada; la tuerquita gira al tocarla */
.auth-welcome > * { animation: rise-in 0.55s var(--ease-out) backwards; }
.auth-welcome > :nth-child(2) { animation-delay: 0.08s; }
.auth-welcome > :nth-child(3) { animation-delay: 0.14s; }
.auth-welcome > :nth-child(4) { animation-delay: 0.2s; }
.auth-welcome > :nth-child(n+5) { animation-delay: 0.26s; }
.auth-welcome picture img { animation: logo-in 0.7s var(--ease-spring) backwards; }
@keyframes rise-in { from { transform: translateY(18px); } }
@keyframes logo-in { from { transform: scale(0.82) rotate(-6deg); } }
/* Tuerquita de la administración: arriba a la derecha (en la app Android no aparece) */
.auth-gear { position: absolute; top: calc(10px + var(--safe-top)); right: 10px; z-index: 5; color: var(--text-2); }
.auth-gear:hover, .auth-gear:focus-visible { color: var(--text); }
.gear-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #fff;
  display: inline-grid; place-items: center; cursor: pointer; transition: background-color 0.2s ease;
}
.gear-btn:hover, .gear-btn:focus-visible { background: rgba(255, 255, 255, 0.08); }
.gear-btn .icon { width: 26px; height: 26px; }
.gear-btn.is-spinning .icon { animation: gear-spin 0.7s var(--ease-out); }
@keyframes gear-spin { from { transform: rotate(0); } to { transform: rotate(180deg); } }
.dialog .gate-icon { margin-bottom: 4px; }

/* Arriba a la derecha del mapa: estado y el interruptor Conductor / Cliente */
.map-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.status-chip { transition: color 0.3s ease; }
.status-chip .dot { transition: transform 0.3s var(--ease-spring); }
.status-chip.is-on .dot { animation: pulse 1.6s ease-in-out infinite; }
.mode-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; padding: 4px; min-height: 44px;
  border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; isolation: isolate;
}
.mode-switch::before {
  content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--yellow); transition: transform 0.32s var(--ease-out);
}
.mode-switch.is-client::before { transform: translateX(100%); }
.mode-switch.is-switching::before { transform: translateX(100%); }
.mode-switch.is-client.is-switching::before { transform: translateX(0); }
.mode-opt { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; font-weight: 800; font-size: 14px; color: var(--text-2); transition: color 0.3s ease; white-space: nowrap; }
.mode-opt.is-active { color: var(--on-yellow); }
.mode-switch.is-switching .mode-opt.is-active { color: var(--text-2); }
.mode-switch.is-switching .mode-opt:not(.is-active) { color: var(--on-yellow); }
.mode-switch:disabled { cursor: progress; }

/* Interruptor DISPONIBLE / NO DISPONIBLE: grande, para el pulgar */
.avail-switch {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 86px; padding: 14px 18px; margin: 6px 0 12px;
  border: 2px solid var(--border); border-radius: 22px; background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.12s var(--ease-out);
}
.avail-switch:active { transform: scale(0.98); }
.avail-track { position: relative; width: 66px; height: 38px; flex: none; border-radius: 999px; background: var(--surface-3); transition: background-color 0.3s ease; }
.avail-knob {
  position: absolute; top: 4px; left: 4px; width: 30px; height: 30px; border-radius: 50%; background: #f5f5f4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); transition: transform 0.32s var(--ease-spring);
}
.avail-text strong { display: block; font-size: 22px; font-weight: 900; letter-spacing: 0.02em; }
.avail-text small { display: block; color: var(--text-2); font-size: 14px; }
.avail-switch.is-on { border-color: var(--green); background: linear-gradient(90deg, var(--green-soft), transparent 80%), var(--surface-2); }
.avail-switch.is-on .avail-track { background: var(--green); }
.avail-switch.is-on .avail-knob { transform: translateX(28px); }
.avail-switch.is-on strong { color: #86efac; }
.avail-switch.is-loading .avail-knob { transform: translateX(14px) scale(0.9); }
.avail-switch.is-on.is-loading .avail-knob { transform: translateX(14px) scale(0.9); }
.avail-switch.is-loading { opacity: 1; }
.avail-switch.is-loading::after { display: none; }

/* Esperando carreras */
.waiting-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.waiting-row .grow { flex: 1; min-width: 0; }
.waiting-row .sheet-title { font-size: 20px; margin-bottom: 2px; }
.waiting-row .sheet-sub { margin: 0; font-size: 15px; }
.radar-sm { width: 64px; height: 64px; margin: 0; flex: none; }
.radar-sm .radar-core { width: 44px; height: 44px; }
.radar-sm::before, .radar-sm::after { border-color: var(--green); }
.radar-sm .radar-core { background: var(--green); color: #04130a; }

/* Puntos suspensivos que "laten" (cargando / buscando) */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot-bounce 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }

/* Avisos dentro del panel del conductor */
.push-warning, .missed-warning {
  display: block; width: 100%; padding: 12px 14px; margin-bottom: 12px; border-radius: 14px;
  font-size: 15px; font-weight: 700; line-height: 1.35; text-align: left; animation: view-in 0.3s var(--ease-out);
}
.push-warning { border: 1px solid #a16207; background: #2c2105; color: #fde68a; cursor: pointer; }
.missed-warning { border: 1px solid #7f1d1d; background: var(--red-soft); color: #fecaca; }

/* Pasajero: a qué mototaxi se avisa y cuántos segundos le quedan */
.offer-ring { position: relative; width: 52px; height: 52px; flex: none; color: var(--yellow); }
.offer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.offer-ring circle { fill: none; stroke-width: 4; }
.offer-ring .track { stroke: var(--surface-3); }
.offer-ring .bar { stroke: var(--yellow); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.offer-ring strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.search-head.is-next { animation: next-in 0.45s var(--ease-out); }
@keyframes next-in { from { transform: translateX(26px); } }
.search-total { margin: -8px 0 12px; color: var(--muted); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.search-head .sheet-title .dots { color: var(--yellow); }

/* Mototaxi asignado: la tarjeta del conductor sube y el check se dibuja */
[data-state="assigned"].is-entering .person-card { animation: card-up 0.5s 0.06s var(--ease-out) backwards; }
[data-state="assigned"].is-entering .eta-badge { animation: pop-in 0.5s var(--ease-spring); }
@keyframes card-up { from { transform: translateY(26px); } }
.result-icon.ok .icon path { stroke-dasharray: 30; animation: draw-check 0.55s 0.15s ease-out backwards; }
@keyframes draw-check { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }

/* Moto en el mapa: una flecha pequeña indica hacia dónde va */
/* (MapLibre mueve los marcadores con `transform` y `position`: no se tocan aquí.) */
.mk-moto.has-heading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -31px 0 0 -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 9px solid var(--yellow);
  transform-origin: 6px 31px; transform: rotate(var(--heading, 0deg)); transition: transform 0.6s var(--ease-out);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
/* El punto de recogida "cae" en su lugar (en un hijo: el marcador lo posiciona MapLibre). */
.mk-pickup::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--yellow); animation: pickup-ring 0.7s var(--ease-out) backwards; pointer-events: none; }
@keyframes pickup-ring { from { transform: scale(2.4); opacity: 0; } }

/* Alerta del conductor: los últimos 10 segundos el número late */
.ride-alert-hint { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.ride-alert.is-urgent .countdown strong { animation: tick-urgent 1s ease-in-out infinite; }
@keyframes tick-urgent { 50% { transform: scale(1.18); } }
.ride-alert:not([hidden]) .ride-alert-panel { animation: panel-up 0.38s var(--ease-out); }
@keyframes panel-up { from { transform: translateY(40px); } }

/* Cargando: siluetas con brillo en vez de pantallas en blanco */
.skeleton-list { display: grid; gap: 10px; }
.skeleton { border-radius: 14px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skeleton-row { height: 58px; }
.skeleton-line { height: 14px; width: 60%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Panel de administración: tarjetas y filas aparecen en cascada corta */
.stats-grid > .stat { animation: rise-in 0.45s var(--ease-out) backwards; }
.stats-grid > .stat:nth-child(2) { animation-delay: 0.05s; }
.stats-grid > .stat:nth-child(3) { animation-delay: 0.1s; }
.stats-grid > .stat:nth-child(4) { animation-delay: 0.15s; }
.stat { transition: transform 0.2s var(--ease-out), border-color 0.2s ease; }
.stat:hover { transform: translateY(-2px); }
.chart .bar { transform-box: fill-box; transform-origin: bottom; animation: bar-grow 0.6s var(--ease-out) backwards; }
@keyframes bar-grow { from { transform: scaleY(0.05); } }
.table tbody tr { animation: row-in 0.35s var(--ease-out) backwards; }
.table tbody tr:nth-child(2) { animation-delay: 0.02s; }
.table tbody tr:nth-child(3) { animation-delay: 0.04s; }
.table tbody tr:nth-child(4) { animation-delay: 0.06s; }
.table tbody tr:nth-child(n+5) { animation-delay: 0.08s; }
@keyframes row-in { from { transform: translateY(8px); } }
.tab { transition: background-color 0.2s ease, color 0.2s ease, transform 0.12s var(--ease-out); }
.tab:active { transform: scale(0.96); }
.power-btn { transition: transform 0.15s var(--ease-out), box-shadow 0.3s ease, background-color 0.3s ease; }
.power-btn:not(:disabled):active { transform: scale(0.96); }

/* ------------------------------------------------ Eliminar cuenta (advertencia) */
dialog.dialog-warning { border: 2px solid var(--red-strong); text-align: center; animation: warning-in 0.35s var(--ease-out); }
dialog.dialog-warning::backdrop { background: rgba(40, 0, 0, 0.78); }
dialog.dialog-warning .dialog-body { background: linear-gradient(180deg, var(--red-soft), transparent 45%); }
dialog.dialog-warning.is-shaking { animation: warning-shake 0.4s ease; }
dialog.dialog-warning form { text-align: left; }
.warning-icon {
  width: 76px; height: 76px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red-strong); color: #fff; animation: warning-pulse 1.6s ease-out infinite;
}
.warning-icon svg { width: 38px; height: 38px; }
.warning-label { color: var(--red); font-weight: 800; letter-spacing: 0.18em; font-size: 13px; margin-bottom: 4px; }
.warning-title { color: #fecaca; }
.warning-text { color: var(--text); }
@keyframes warning-in { from { opacity: 0; transform: scale(0.92); } }
@keyframes warning-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes warning-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Zona de peligro en "Mi cuenta" */
.danger-zone { margin-top: 22px; padding: 16px; border: 1px dashed var(--red-strong); border-radius: var(--radius); background: var(--red-soft); }
.danger-zone h3 { color: var(--red); display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.danger-zone h3 svg { width: 18px; height: 18px; }
.danger-zone p { color: var(--text-2); font-size: 14px; margin-bottom: 12px; }
.btn-danger-outline { background: transparent; color: var(--red); border: 2px solid var(--red-strong); transition: background-color 0.2s ease, color 0.2s ease, transform 0.12s var(--ease-out); }
.btn-danger-outline:hover, .btn-danger-outline:focus-visible { background: var(--red-strong); color: #fff; }
.btn-danger-outline:active { transform: scale(0.97); }

/* Despedida al eliminar la cuenta */
.farewell { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 24px; text-align: center; background: rgba(11, 11, 13, 0.97); animation: warning-in 0.3s ease; }
.farewell-card { max-width: 380px; display: grid; gap: 12px; justify-items: center; }
.farewell-card .warning-icon { animation: none; background: var(--red-soft); color: var(--red); }
.farewell-card h1 { font-size: 24px; }
.farewell-card p { color: var(--text-2); }

/* Nombre de una cuenta eliminada (historial y métricas) */
.name-deleted { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
.deleted-tag {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--red-soft); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; vertical-align: middle;
}
.deleted-tag svg { width: 12px; height: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.is-app [data-web-only] { display: none !important; }
/* Lo que solo existe en la app Android (en la web del navegador no aparece). */
html:not(.is-app) [data-app-only] { display: none !important; }

.drawer-version { color: var(--muted); font-size: 12px; padding: 4px 10px 0; margin: 0; }
/* Hay una versión nueva: el botón del menú dice "Actualizar a 1.0.x" y lleva un punto amarillo. */
#menuUpdate.has-update { color: var(--yellow); font-weight: 700; }
#menuUpdate.has-update::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); margin-left: auto; }
.update-gate-mandatory { z-index: 3000; place-items: center; background: rgba(11, 11, 13, 0.96); }
.update-version { color: var(--yellow); font-weight: 800; font-size: 16px; margin: 0; }
.update-status { color: var(--text); font-weight: 700; font-size: 15px; margin: 0; font-variant-numeric: tabular-nums; }

/* =========================================================================
   Extras del viaje: mensajes rápidos, resumen del conductor, zonas con demanda,
   lugares guardados, "a 1 minuto" y estrellas
   ========================================================================= */

/* Conductor: mensajes rápidos al pasajero (fila que se desliza de lado, no ocupa alto) */
.quick-messages { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.quick-messages::-webkit-scrollbar { display: none; }
.quick-chip { flex: none; min-height: 42px; font-size: 14px; color: var(--text); border-color: var(--surface-3); background: var(--surface-2); transition: border-color 0.2s ease, background-color 0.2s ease; }
.quick-chip.is-sending { opacity: 0.6; }
.quick-chip.is-sent { border-color: var(--green); background: var(--green-soft); color: #86efac; }
.quick-chip.is-sent::before { content: "✓ "; }

/* Conductor (app): el chip "Hoy: $…" abre Mi resumen */
.is-app .earnings-chip { cursor: pointer; }
.summary-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.summary-card { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.summary-card small { color: var(--muted); font-size: 13px; font-weight: 600; }
.summary-card strong { font-size: 19px; }
.summary-card span { color: var(--yellow); font-weight: 700; font-size: 14px; }

/* Conductor: leyenda de las zonas con demanda */
.demand-legend { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 12px; background: rgba(11, 11, 13, 0.82); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; color: var(--text); }
.demand-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend-swatch.is-high { background: rgba(239, 68, 68, 0.55); border: 2px solid #ef4444; }
.legend-swatch.is-mid { background: rgba(249, 115, 22, 0.45); border: 2px solid #f97316; }

/* Pasajero: mensaje del conductor y aviso "a 1 minuto" */
.driver-message { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--blue-soft); border: 1px solid rgba(96, 165, 250, 0.45); }
.driver-message .icon { color: var(--blue); flex: none; }
.driver-message small { display: block; color: var(--text-2); font-size: 12px; font-weight: 600; }
.driver-message strong { display: block; font-size: 16px; }
.driver-message.is-new { animation: pop-in 0.45s var(--ease-spring); }
.near-notice { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--yellow-soft); border: 1px solid rgba(250, 204, 21, 0.55); color: #fde68a; font-weight: 800; text-align: center; }
.near-notice.is-new { animation: pop-in 0.45s var(--ease-spring); }
@keyframes pop-in { from { transform: scale(0.94); opacity: 0.4; } }

/* Pasajero: estrellas al terminar el viaje */
.rate-box { display: grid; gap: 10px; justify-items: center; margin: 4px 0 14px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.rate-title { margin: 0; font-weight: 800; font-size: 16px; }
.rate-stars { display: flex; gap: 4px; }
.rate-star { width: 48px; height: 48px; border: 0; background: none; padding: 0; font-size: 36px; line-height: 1; color: #52525b; cursor: pointer; transition: transform 0.15s var(--ease-spring), color 0.15s ease; }
.rate-star.is-on { color: var(--yellow); }
.rate-star:active { transform: scale(0.9); }
.rate-tags { justify-content: center; }
.rate-tags .chip { min-height: 38px; font-size: 13px; }
.rate-thanks { margin: 0; color: #86efac; font-weight: 700; }

/* App Android · pantalla del conductor: la moto se ve más grande en los tres estados y en el mapa.
   Es también el botón oculto del pánico (mantener 3 s): más grande = más fácil de sostener. */
.is-app .page-driver .status-moto.is-off { width: 56px; height: 56px; }
.is-app .page-driver .status-moto.is-off .icon { width: 38px; height: 38px; }
.is-app .page-driver .radar-sm { width: 80px; height: 80px; }
.is-app .page-driver .radar-sm .radar-core { width: 58px; height: 58px; }
.is-app .page-driver .radar-sm .radar-core .icon { width: 40px; height: 40px; }
.is-app .page-driver .trip-status .status-moto { width: 48px; height: 48px; }
.is-app .page-driver .trip-status .status-moto .icon { width: 32px; height: 32px; }
.is-app .page-driver .mk-moto { width: 52px; height: 52px; }
.is-app .page-driver .mk-moto .icon { width: 34px; height: 34px; }
.is-app .page-driver .mk-moto.has-heading::after { margin-top: -38px; transform-origin: 6px 38px; }
