:root {
  --brand: #096db7;
  --brand-ink: #075a97;
  --brand-soft: #e6f1fa;
  --on-brand: #ffffff;
  --bg: #f3f6f9;
  --surface: #ffffff;
  --ink: #14212e;
  --muted: #5b6b7b;
  --line: #dde4eb;
  --ok: #0f8a5f;
  --warn-bg: #fff6e0;
  --warn-ink: #7a5300;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 46, .06), 0 4px 16px rgba(20, 33, 46, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #4fa3e3;
    --brand-ink: #7cbcec;
    --brand-soft: #14283a;
    --on-brand: #0d141b;
    --bg: #0d141b;
    --surface: #152029;
    --ink: #e6edf3;
    --muted: #93a4b4;
    --line: #26343f;
    --ok: #3ccf96;
    --warn-bg: #2e2510;
    --warn-ink: #f1c76b;
    --shadow: none;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo { filter: brightness(0) invert(1); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
[hidden] { display: none !important; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { width: min(230px, 58vw); height: auto; aspect-ratio: 522 / 35; display: block; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 4px 8px; border-radius: 999px; }

.hero { padding: 22px 0 14px; }
.hero h1 { font-size: 24px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
.hero p { margin: 0; font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.search { padding: 16px; display: grid; gap: 16px; }

.route { display: grid; grid-template-columns: 1fr; gap: 8px; position: relative; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
select, input[type="time"] {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  min-height: 48px; padding: 0 40px 0 14px; width: 100%;
  appearance: none; -webkit-appearance: none;
}
select {
  font-size: 17px; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6b7b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.swap {
  position: absolute; right: 52px; top: 50%; transform: translateY(-50%) translateY(10px);
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--brand); display: grid; place-items: center; cursor: pointer; z-index: 1;
  box-shadow: var(--shadow);
}
.swap:disabled { opacity: .4; cursor: default; }

.group { display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  min-height: 38px; padding: 0 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  position: relative;
}
.chip[aria-checked="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chips { position: relative; }
.date-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.custom-range { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.custom-range label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.custom-range input { width: 130px; padding: 0 12px; min-height: 42px; }

#resultados { margin: 20px 0; }
.res-head { margin: 0 2px 12px; }
.res-head h2 { font-size: 18px; margin: 0 0 2px; }
.res-head p { font-size: 13px; margin: 0; }
.more { font: inherit; font-size: 14px; font-weight: 600; color: var(--brand); background: none; border: 0; padding: 10px 2px 0; cursor: pointer; }
.notice { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }

.list { display: grid; gap: 8px; }
.trip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; }
.trip.next { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.trip.gone { opacity: .5; }
.time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.trip-body { min-width: 0; display: grid; gap: 4px; }
.line-pill { justify-self: start; white-space: nowrap; font-size: 12px; font-weight: 700; color: #fff; padding: 3px 9px; border-radius: 999px; background: var(--c, var(--brand)); }
.trip-route { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.trip-note { font-size: 13px; color: var(--ink); }
.trip-note::before { content: "↳ "; color: var(--muted); }
.eta { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.eta strong { display: block; color: var(--ok); font-size: 14px; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.zone { margin-bottom: 18px; }
.zone h3 { font-size: 15px; margin: 0 2px 8px; display: flex; align-items: center; gap: 8px; }
.zone h3 span { color: var(--muted); font-weight: 400; font-size: 13px; }

.empty { padding: 22px 18px; text-align: center; }
.empty h2 { font-size: 17px; margin: 0 0 6px; }
.empty p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.actions { display: flex; justify-content: center; margin-top: 14px; }
.btn { font: inherit; font-size: 14px; font-weight: 600; color: var(--brand); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }

.info { padding: 16px; margin-top: 8px; }
.info h2 { font-size: 15px; margin: 0 0 10px; }
.contact { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.contact:first-of-type { border-top: 0; padding-top: 0; }
.contact strong { display: block; font-size: 15px; }
.contact .muted { font-size: 13px; }
.contact-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.contact-links a { color: var(--brand); font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
#aviso { margin: 18px 0 32px; }

#debug:not(:empty) { font: 12px/1.5 ui-monospace, Menlo, monospace; background: var(--warn-bg); color: var(--warn-ink); padding: 12px; border-radius: 10px; margin-bottom: 32px; white-space: pre-wrap; }

@media (min-width: 560px) {
  .route { grid-template-columns: 1fr 1fr; gap: 16px; }
  .swap { position: static; transform: none; align-self: end; margin-bottom: 4px; }
  .route { grid-template-columns: 1fr auto 1fr; gap: 10px; }
  .hero h1 { font-size: 28px; }
}
