/* Ruta Compartida — una columna tipo teléfono, pestañas abajo, viajes como boletos con troquel */
:root {
  --bg: #f3f5f2; --surface: #ffffff; --surface-2: #eef2ef; --ink: #14231f; --muted: #5d6d68; --line: #dde3df;
  --accent: #1f6b52; --accent-ink: #ffffff; --accent-soft: #e2efe9;
  --sign: #f2b705; --sign-ink: #2a2100; --danger: #b3362b; --danger-soft: #f8e4e1; --warn-soft: #fbf0cf;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1715; --surface: #17221f; --surface-2: #1d2a26; --ink: #e7eeeb; --muted: #94a59f; --line: #2a3834;
    --accent: #4fb08c; --accent-ink: #06150f; --accent-soft: #1d3a30;
    --danger: #ef7a6f; --danger-soft: #3a1f1c; --warn-soft: #3a3115;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sign); outline-offset: 2px; border-radius: 6px; }

.app { max-width: 520px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
body.ancho .app { max-width: 980px; }

/* Encabezado */
header.top { position: sticky; top: 0; z-index: 9; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 0 10px; }
.brand { font: 800 21px/1 var(--display); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand i { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--sign); color: var(--sign-ink); font: 800 13px var(--mono); font-style: normal; transform: rotate(-4deg); }
.top-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); cursor: pointer; text-decoration: none; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font: 700 11px/18px var(--body); text-align: center; }
.me { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--line); text-decoration: none; }
.me .av { width: 100%; height: 100%; font-size: 13px; }
.link-entrar { font-weight: 700; text-decoration: none; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* Texto */
h1 { font: 800 29px/1.1 var(--display); letter-spacing: -.025em; margin: 6px 0 12px; text-wrap: balance; }
h2 { font: 700 19px/1.2 var(--display); margin: 24px 0 10px; text-wrap: balance; }
h3 { font: 700 16px/1.3 var(--body); margin: 0; }
.sub { color: var(--muted); margin: -6px 0 14px; }
.label { font: 600 11px var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-weight: 400; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
p { margin: 0 0 8px; }

/* Contenedores */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card.plano { background: var(--surface-2); border-color: transparent; }
.card.aviso { background: var(--warn-soft); border-color: transparent; }
.card.peligro { border-color: var(--danger); }
.stack { display: grid; gap: 10px; }
.list { display: grid; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 > * { min-width: 0; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acts.end { justify-content: flex-end; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.empty b, .empty a { color: var(--ink); }
.cargando { padding: 40px 0; text-align: center; color: var(--muted); }
.cargando::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: giro .8s linear infinite; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cargando::before { animation: none; } }

/* Formularios */
.field { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 2px; min-width: 0; }
.field > label { font: 600 11px var(--body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.field input, .field select, .field textarea { border: 0; background: transparent; font: 500 16px var(--body); color: var(--ink); padding: 2px 0; outline: none; width: 100%; min-width: 0; }
.field textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.field small { color: var(--muted); font-size: 12px; }
form.pub { display: grid; gap: 10px; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; cursor: pointer; }
.switch input, .checks input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.search { background: var(--accent); border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.search .field { border-color: transparent; }
.swap { justify-self: end; margin: -30px 48px -14px 0; z-index: 1; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--accent); background: var(--sign); color: var(--sign-ink); font-size: 16px; cursor: pointer; }

/* Botones */
.cta { border: 0; border-radius: 10px; padding: 13px 16px; font: 700 16px var(--body); background: var(--sign); color: var(--sign-ink); cursor: pointer; text-align: center; text-decoration: none; display: block; width: 100%; }
.cta.verde { background: var(--accent); color: var(--accent-ink); }
.cta:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 12px; font: 600 14px var(--body); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.danger.lleno { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.chico { padding: 5px 9px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 600 14px var(--body); cursor: pointer; text-decoration: underline; }
.back { border: 0; background: none; color: var(--accent); font: 600 14px var(--body); padding: 8px 0; cursor: pointer; }

/* Chips y pestañas internas */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 2px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; font: 500 13px var(--body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: none; color: var(--muted); font: 600 13px var(--body); padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; position: relative; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg .n { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; }

/* Estados */
.pill { display: inline-block; font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.pill.ok { color: var(--accent); background: var(--accent-soft); }
.pill.espera { color: var(--sign-ink); background: var(--sign); }
.pill.gris { color: var(--muted); background: var(--surface-2); }
.pill.mal { color: var(--danger); background: var(--danger-soft); }

/* Boleto de viaje */
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; color: inherit; text-decoration: none; position: relative; min-width: 0; }
a.ticket:hover { border-color: var(--accent); }
.route { display: grid; grid-template-columns: auto 14px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; }
.time { font: 500 15px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.time small { font-size: 11px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); justify-self: center; }
.dot.end { background: var(--accent); }
.rail { grid-column: 2; width: 2px; height: 14px; background: repeating-linear-gradient(var(--muted) 0 3px, transparent 3px 6px); justify-self: center; }
.city { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.dur { grid-column: 3; font-size: 12px; color: var(--muted); }
.price { font: 800 20px var(--display); text-align: right; grid-row: 1 / 4; grid-column: 4; align-self: start; white-space: nowrap; }
.price small { display: block; font: 500 11px var(--body); color: var(--muted); }
.perf { border-top: 2px dashed var(--line); margin: 0 -14px; position: relative; }
.perf::before, .perf::after { content: ""; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.perf::before { left: -9px; clip-path: inset(0 0 0 50%); }
.perf::after { right: -9px; clip-path: inset(0 50% 0 0); }
.driver { display: flex; align-items: center; gap: 10px; min-width: 0; }
.driver .meta { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.driver .meta b { color: var(--ink); font-weight: 600; display: block; font-size: 14px; }
.seats { display: flex; gap: 3px; flex: none; }
.seat { width: 10px; height: 14px; border-radius: 3px 3px 2px 2px; background: var(--accent); }
.seat.off { background: var(--line); }
.full { position: absolute; top: 12px; right: 12px; font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--danger); }
.intl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font: 600 12px var(--body); color: var(--muted); }
.cc { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink); }
.cc.py { background: #d52b1e; color: #fff; border-color: #d52b1e; }
.cc.bo { background: #007a3d; color: #fff; border-color: #007a3d; }
.cc.ar { background: #74acdf; color: #0b2a44; border-color: #74acdf; }
.mas1 { font-size: 11px; color: var(--muted); font-family: var(--body); }

/* Recorrido detallado */
.stops { list-style: none; margin: 0; padding: 0; display: grid; }
.stops li { display: grid; grid-template-columns: 78px 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 32px; position: relative; color: var(--muted); }
.stops li .time { font-size: 13px; }
.stops li .city { font-weight: 500; }
.stops li.on { color: var(--ink); }
.stops li.on .city { font-weight: 700; }
.stops li .dot { background: var(--surface); }
.stops li.on .dot { background: var(--accent); }
.stops li:not(:last-child)::after { content: ""; position: absolute; left: 94px; top: 23px; width: 2px; height: 18px; background: var(--line); }
.stops li.tramo:not(:last-child)::after { background: var(--accent); }
.stops li .etq { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.border-box { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.border-box .ico { width: 28px; height: 28px; border-radius: 6px; background: var(--sign); color: var(--sign-ink); display: grid; place-items: center; font: 800 12px var(--mono); }
.border-box b { display: block; font-size: 14px; }
.border-box span { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font: 500 12px var(--body); padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tag.ok { color: var(--accent); }
.docs { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }

/* Personas */
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 700 14px var(--display); color: #fff; flex: none; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.big { width: 88px; height: 88px; font-size: 30px; }
.av.med { width: 52px; height: 52px; font-size: 18px; }
.verif { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 800 10px var(--body); vertical-align: 1px; margin-left: 2px; }
.persona { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.persona .meta { min-width: 0; font-size: 13px; color: var(--muted); }
.persona .meta b { display: block; font-size: 15px; color: var(--ink); }
.stars { color: var(--sign); letter-spacing: 1px; }
.stars .off { color: var(--line); }
.review { display: grid; gap: 4px; padding-block: 10px; border-top: 1px solid var(--line); }
.review:first-child { border-top: 0; padding-top: 0; }
.review .t { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.review p { margin: 0; font-size: 14px; }
.rate { display: flex; gap: 4px; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate label { font-size: 32px; line-height: 1; color: var(--line); cursor: pointer; padding: 2px; }
.rate label.lit { color: var(--sign); }
.rate input:focus-visible + label { outline: 3px solid var(--accent); border-radius: 6px; }

/* Reserva */
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 20px var(--body); cursor: pointer; }
.stepper output { font: 800 24px var(--display); min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.fee { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 600; }
.total b { font: 800 24px var(--display); font-variant-numeric: tabular-nums; }
.code { font: 600 13px var(--mono); letter-spacing: .06em; background: var(--sign); color: var(--sign-ink); padding: 2px 8px; border-radius: 5px; }
.contacto { display: grid; gap: 10px; }
.contacto .tel { font: 600 20px var(--mono); user-select: all; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; padding: 4px 2px; }
.burbuja { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja.mia { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-bottom-right-radius: 4px; }
.burbuja:not(.mia) { align-self: flex-start; border-bottom-left-radius: 4px; }
.burbuja small { display: block; font-size: 11px; opacity: .75; margin-top: 2px; text-align: right; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form .field { flex: 1; }
.chat-form textarea { min-height: 42px; max-height: 120px; }

/* Notificaciones */
.notif { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.notif .pto { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.notif.nueva .pto { background: var(--danger); }
.notif small { color: var(--muted); font-size: 12px; }

/* Perfil */
.phead { display: flex; gap: 16px; align-items: center; }
.phead h1 { margin: 0 0 4px; font-size: 26px; overflow-wrap: anywhere; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats.cuatro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .stats.cuatro { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat b { display: block; font: 800 22px var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.alerta { border-color: var(--sign); background: var(--warn-soft); }
.photo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.vh:focus-visible + label { outline: 3px solid var(--sign); outline-offset: 2px; }
.doc-img { width: 100%; max-height: 320px; object-fit: contain; background: var(--surface-2); border-radius: 10px; }

/* Admin */
.arow { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; min-width: 0; }
.arow .t { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.arow .t b { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.mini { width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: 500 14px var(--body); background: var(--bg); color: var(--ink); }
.grid-admin { display: grid; gap: 10px; }
@media (min-width: 760px) { .grid-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Pestañas de abajo */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
nav.tabs .in { display: flex; width: 100%; max-width: 560px; }
nav.tabs a { flex: 1; color: var(--muted); font: 600 11px var(--body); padding: 6px 2px; display: grid; justify-items: center; gap: 2px; text-decoration: none; position: relative; }
nav.tabs a svg { width: 22px; height: 22px; }
nav.tabs a[aria-current="page"] { color: var(--accent); }
nav.tabs .badge { top: 0; right: calc(50% - 22px); }

/* Avisos */
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 30; max-width: min(92vw, 480px); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.toast.mal { background: var(--danger); color: #fff; }
dialog { border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); width: min(92vw, 440px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 20, 17, .5); }
.dlg { padding: 18px; display: grid; gap: 12px; }
.dlg textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.error-box { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.pasos-uso { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
footer.pie { margin-top: 32px; text-align: center; font-size: 12px; color: var(--muted); }
footer.pie a { color: var(--muted); }
