:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5f6368;
  --border: #e2e2dc;
  --brand: #ffc400;
  --brand-ink: #1a1a1a;
  --ok: #137333;
  --ok-bg: #e6f4ea;
  --danger: #c5221f;
  --danger-bg: #fce8e6;
  --info-bg: #fff8db;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --text: #f1f1f1;
    --muted: #a8a8a8;
    --border: #333;
    --ok: #81c995;
    --ok-bg: #1e3326;
    --danger: #f28b82;
    --danger-bg: #3c1f1e;
    --info-bg: #332b0a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 12px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: #111111; color: #ffffff; border-bottom: 3px solid var(--brand);
}
.brand { font-weight: 800; font-size: 1.1rem; text-decoration: none; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { display: block; height: 40px; width: auto; }
.brand-tag { color: var(--brand); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.topbar .who { font-size: 0.85rem; text-align: right; line-height: 1.2; }
.topbar form { display: inline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1100px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card.highlight { border: 2px solid var(--brand); }

.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.notice { background: var(--info-bg); padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=tel] {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
input:focus-visible, button:focus-visible, .btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex-shrink: 0; }
.hint { color: var(--muted); font-size: 0.875rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; border-radius: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 0; padding: 12px 10px; white-space: nowrap; }

.status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--border); white-space: nowrap; }
.pill.DISPONIBLE, .pill.ACTIVO, .pill.FINALIZADA { background: var(--ok-bg); color: var(--ok); }
.pill.EN_SERVICIO, .pill.ASIGNADA, .pill.PENDIENTE, .pill.PENDIENTE_APROBACION { background: var(--info-bg); }
.pill.DESCONECTADO, .pill.INACTIVO, .pill.CANCELADA, .pill.EXPIRADA { background: var(--danger-bg); color: var(--danger); }

.map { height: 220px; border-radius: 10px; margin: 12px 0; z-index: 0; }
.map.big { height: 300px; }

.req-meta { color: var(--muted); font-size: 0.875rem; margin-bottom: 6px; }
.req-place { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.eta-label { font-weight: 600; margin: 12px 0 8px; }
.eta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.eta-grid .btn { padding: 10px 4px; flex-direction: column; gap: 0; line-height: 1.1; }
.eta-grid .btn small { font-weight: 500; font-size: 0.75rem; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .big-emoji { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.live.off::before { background: var(--danger); }

dl.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 8px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 600; word-break: break-word; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
td form { display: inline; }
.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.auth { max-width: 420px; margin: 24px auto; }
.center { text-align: center; }

/* Historial del taxista */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-label { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-title { margin: 0; text-transform: capitalize; font-size: 1.1rem; }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history-item { padding: 12px 0; border-top: 1px solid var(--border); }
.history-place { font-weight: 700; margin: 2px 0; word-break: break-word; }

/* Historial de la central */
.filters-grid { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 760px) { .filters-grid { grid-template-columns: repeat(5, 1fr); } }
select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
input[type=date] {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.stats-5 { grid-template-columns: repeat(5, 1fr); margin-bottom: 16px; }
@media (max-width: 520px) { .stats-5 { grid-template-columns: repeat(3, 1fr); } }
td .btn-sm { margin: 2px 0; }

/* Suscripciones */
.pill.AL_DIA { background: var(--ok-bg); color: var(--ok); }
.pill.POR_VENCER { background: var(--info-bg); }
.pill.VENCIDA, .pill.SIN_SUSCRIPCION { background: var(--danger-bg); color: var(--danger); }
.pay-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pay-form select, .pay-form input { width: auto; padding: 6px 8px; font-size: 0.875rem; border-radius: 8px; }
.pay-form input[name=amount] { width: 110px; }
.pay-form input[name=note] { width: 130px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { flex: 1 1 200px; }
.topbar .who a { color: inherit; }

.free-form { margin-top: 6px; }
.btn-danger:hover { filter: brightness(0.95); }

/* Conteo regresivo de la suscripción (panel del taxista) */
.countdown { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; text-align: center; }
.countdown.warn { background: var(--info-bg); border-color: var(--brand); }
.countdown-title { font-weight: 700; font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.countdown.warn .countdown-title { color: var(--text); }
.countdown-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.countdown-boxes > div { background: var(--bg); border-radius: 10px; padding: 8px 4px; }
.countdown-boxes span { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown-boxes small { display: block; font-size: 0.72rem; color: var(--muted); }
.countdown-foot { font-size: 0.82rem; color: var(--muted); margin-top: 8px; }
.countdown.warn .countdown-foot strong { color: var(--text); }

/* Logo grande en las pantallas de ingreso (fondo oscuro para que se vea "VERY" en blanco) */
.hero-logo { background: #111111; border-radius: var(--radius); padding: 18px 16px; margin-bottom: 16px; text-align: center; border-bottom: 3px solid var(--brand); }
.hero-logo img { max-width: 100%; height: auto; width: 320px; }
