/* TRANSMERSA · azul y ámbar del logo, tipografía Barlow (inspirada en rótulos de carretera). */
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url(fonts/barlow-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }

:root {
  --navy: #000548; --navy-2: #1b2172; --amber: #ffa600; --amber-soft: #fff3d6; --amber-ink: #7a4b00;
  --paper: #f2f3f8; --surface: #fff; --line: #d5d8e6; --muted: #525877;
  --green: #0a7442; --green-soft: #e3f4ea; --red: #b3261e; --red-soft: #fbe9e7;
  --r: 10px; --gap: 16px;
  --sans: Barlow, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "Barlow Condensed", Barlow, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--sans); color: var(--navy); background: var(--paper); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.125rem; font-weight: 700; }
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.guia { font-family: var(--cond); font-weight: 600; font-size: 1.15em; letter-spacing: .02em; white-space: nowrap; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 2px solid transparent;
  border-radius: var(--r); font: 600 1rem/1 var(--sans); text-decoration: none; cursor: pointer; background: var(--navy); color: #fff; }
.btn:hover { background: var(--navy-2); }
.btn-amber { background: var(--amber); color: var(--navy); }
.btn-amber:hover { background: #ffb629; }
.btn-line { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-line:hover { background: #e6e8f3; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #8f1e18; }
.btn-ok { background: var(--green); }
.btn-ok:hover { background: #075c34; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* Formularios */
.field { display: block; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
.field .err { color: var(--red); font-weight: 600; }
input[type=text], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid #9aa0bd; border-radius: 8px; background: #fff; color: var(--navy); font: 400 1rem/1.3 var(--sans); }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: 3px solid var(--amber); outline-offset: 0; }
input[aria-invalid=true] { border-color: var(--red); }
.grid2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--navy); flex: none; }

/* Avisos y etiquetas */
.flash { padding: 12px 16px; border-radius: var(--r); background: var(--green-soft); color: #064b2b; font-weight: 500; border-left: 5px solid var(--green); }
.flash.error { background: var(--red-soft); color: #7a1711; border-color: var(--red); }
.note { padding: 12px 16px; border-radius: var(--r); background: var(--amber-soft); color: var(--amber-ink); border-left: 5px solid var(--amber); }
.alerta { padding: 14px 16px; border-radius: var(--r); background: var(--red); color: #fff; }
.alerta a { color: #fff; font-weight: 700; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .82rem; font-weight: 600; background: #e4e6f2; color: var(--navy); white-space: nowrap; }
.tag.en_camino, .tag.en_curso { background: var(--amber-soft); color: var(--amber-ink); }
.tag.entregada, .tag.completado, .tag.aprobado { background: var(--green-soft); color: #064b2b; }
.tag.pendiente, .tag.reprogramada { background: var(--amber); color: var(--navy); }
.tag.cancelado, .tag.oculto { background: #e4e6f2; color: var(--muted); }
.tag.rojo { background: var(--red-soft); color: #7a1711; }

/* La ruta sin mapa: tramos de carretera que se van pintando de ámbar */
.ruta { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.ruta li { flex: 1; height: 14px; border-radius: 3px; background: var(--navy);
  background-image: linear-gradient(90deg, #fff 50%, transparent 50%); background-size: 16px 2px; background-position: 0 50%; background-repeat: repeat-x; }
.ruta li.hecho { background: var(--amber); }
.ruta.verde li { background: var(--green); }
.ruta.mini li { height: 8px; background-size: 8px 1px; }

/* Panel de oficina */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; text-decoration: none; letter-spacing: .02em; }
.marca img { height: 34px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; }
.nav { background: var(--navy); border-top: 1px solid #262c80; overflow-x: auto; }
.nav-in { max-width: 1120px; margin: 0 auto; padding: 0 8px; display: flex; gap: 2px; }
.nav a { color: #c9cdea; text-decoration: none; padding: 12px 12px 10px; font-weight: 500; white-space: nowrap; border-bottom: 4px solid transparent; }
.nav a:hover { color: #fff; }
.nav a[aria-current=page] { color: #fff; border-color: var(--amber); }
.nav .n { background: var(--amber); color: var(--navy); border-radius: 99px; padding: 0 7px; font-size: .8rem; font-weight: 700; margin-left: 4px; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.cifras div { padding: 14px 18px; border-left: 1px solid var(--line); margin-left: -1px; }
.cifras b { display: block; font: 600 2.25rem/1 var(--cond); }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: .85rem; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tabla td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla a { font-weight: 600; }
.scroll { overflow-x: auto; }
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.lista > li:last-child { border-bottom: 0; }
.bitacora { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--line); }
.bitacora li { position: relative; padding: 0 0 14px; }
.bitacora li::before { content: ""; position: absolute; left: -26px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--navy); border: 3px solid var(--surface); }
.bitacora li.warn::before { background: var(--amber); }
.bitacora li.rojo::before { background: var(--red); }
.bitacora li.ok::before { background: var(--green); }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.fotos a { display: block; text-decoration: none; font-size: .8rem; color: var(--muted); }
.fotos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; background: #dfe2ee; }
.dato { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 0; }
.dato dt { color: var(--muted); }
.dato dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.codigo { font: 600 2rem/1 var(--cond); letter-spacing: .25em; }
.enlace { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* Entrada */
.entrada { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--navy); }
.entrada-caja { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 28px 24px; }
.entrada-caja img { height: 64px; margin: 0 0 12px -6px; }

/* Página del cliente */
.cliente { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--surface); display: flex; flex-direction: column; }
.cliente header { background: var(--navy); color: #fff; padding: 14px 20px; display: flex; align-items: center; gap: 12px; }
.cliente header img { height: 38px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.cliente header b { font-size: 1.05rem; letter-spacing: .02em; }
.cliente header span { display: block; font-size: .82rem; color: #c9cdea; }
.cliente main { padding: 22px 20px 28px; flex: 1; }
.estado { font: 600 3rem/1 var(--cond); margin: 2px 0 6px; }
.estado.verde { color: var(--green); }
.ventana { background: var(--navy); color: #fff; border-radius: var(--r); padding: 14px 16px; }
.ventana span { display: block; font-size: .85rem; color: #c9cdea; }
.ventana b { font-size: 1.2rem; }
.novedades { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--line); }
.novedades li { position: relative; padding-bottom: 14px; }
.novedades li::before { content: ""; position: absolute; left: -26px; top: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--navy); border: 3px solid #fff; }
.novedades li.warn::before { background: var(--amber); }
.novedades time { display: block; font-size: .82rem; color: var(--muted); }
.fotocliente img { width: 100%; border-radius: var(--r); background: #dfe2ee; aspect-ratio: 4/3; object-fit: cover; }
.estrellas { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; border: 0; padding: 0; margin: 0; }
.estrellas input { position: absolute; opacity: 0; }
.estrellas label { font-size: 2.2rem; line-height: 1; color: #c5c9dd; cursor: pointer; padding: 2px; }
.estrellas input:checked ~ label, .estrellas label:hover, .estrellas label:hover ~ label { color: var(--amber); }
.estrellas input:focus-visible + label { outline: 3px solid var(--navy); border-radius: 6px; }
.pie { padding: 16px 20px 24px; border-top: 1px solid var(--line); }
.pin input { font: 600 2rem/1 var(--cond); letter-spacing: .5em; text-align: center; max-width: 220px; }

/* App del conductor: una mano, a pleno sol */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); }
.app-top { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 5; }
.app-top img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.app-top .grow b { display: block; line-height: 1.2; }
.app-top .grow span { font-size: .82rem; color: #c9cdea; }
.senal { font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--green); color: #fff; white-space: nowrap; }
.senal.off { background: var(--amber); color: var(--navy); }
.app-main { padding: 16px; flex: 1; }
.app-main h1 { font-size: 1.5rem; }
.volver { background: none; border: 0; color: #fff; font: 600 1rem var(--sans); padding: 8px 8px 8px 0; cursor: pointer; }
.viaje { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.grande { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 84px; padding: 14px 18px; border: 0; border-radius: 14px; text-align: left;
  font: 700 1.3rem/1.15 var(--sans); cursor: pointer; background: var(--navy); color: #fff; }
.grande small { display: block; font: 400 .9rem/1.3 var(--sans); opacity: .85; margin-top: 3px; }
.grande.ambar { background: var(--amber); color: var(--navy); }
.grande.verde { background: var(--green); }
.grande.blanco { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.grande:active { transform: translateY(1px); }
.grande[disabled] { opacity: .45; }
.grande .ico { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); font-size: 1.5rem; }
.grande.ambar .ico, .grande.blanco .ico { background: rgba(0,5,72,.1); }
.discreto { width: 100%; min-height: 48px; margin-top: 28px; border: 1.5px solid #b9bdd4; border-radius: 10px; background: transparent; color: var(--muted); font: 500 .95rem var(--sans); position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.discreto i { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(179,38,30,.25); }
.discreto.pulsando i { width: 100%; transition: width 3s linear; }
.discreto span { position: relative; }
.opcion { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); font: 600 1.1rem var(--sans); text-align: left; cursor: pointer; }
.opcion[aria-pressed=true] { border-color: var(--navy); background: var(--amber-soft); }
.entrega-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.entrega-item.lista-ok { background: var(--green-soft); border-color: #a9d8bd; }
.entrega-item b { display: block; font-size: 1.1rem; }
.camara { display: grid; place-items: center; gap: 6px; width: 100%; min-height: 120px; border: 2px dashed #8f95b5; border-radius: 12px; background: #fff; color: var(--navy); font: 600 1.05rem var(--sans); cursor: pointer; text-align: center; padding: 12px; }
.camara.lista { border: 2px solid var(--green); background: var(--green-soft); min-height: 64px; grid-auto-flow: column; justify-content: start; }
.camara img { max-height: 180px; border-radius: 8px; }
.codigo-in { font: 600 2.4rem/1 var(--cond) !important; letter-spacing: .5em; text-align: center; }
.cola { margin-top: 16px; font-size: .9rem; color: var(--muted); text-align: center; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 20px; max-width: 528px; margin: 0 auto; background: var(--navy); color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600; z-index: 20; box-shadow: 0 6px 24px rgba(0,5,72,.35); }
.toast.error { background: var(--red); }
.instalar { background: var(--amber-soft); border-radius: 12px; padding: 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .top, .nav, .btn, form { display: none !important; } body { background: #fff; } }
.stack > * + .ruta, .stack > * + .novedades, .stack > * + .bitacora, .stack > * + .lista { margin-top: var(--gap); }
.tabla .ruta { min-width: 96px; }
.entrega-item .guia { display: block; }
h1.guia { font-size: 2.25rem; letter-spacing: .01em; }

/* Novedades de un toque (conductor) */
.stack-s > * + * { margin-top: 8px; }
.mosaico { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tecla { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 104px; padding: 12px 8px; border: 2px solid var(--line);
  border-radius: 14px; background: #fff; color: var(--navy); font: 600 1.02rem/1.2 var(--sans); text-align: center; cursor: pointer; }
.tecla:active { border-color: var(--navy); background: var(--amber-soft); }
.emoji { font-size: 2rem; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.elegida { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--amber-soft); font-size: 1.2rem; }
.opcion .guia { display: block; font-size: 1rem; }
.mensajes li { gap: 8px; }

/* Ajustes de accesibilidad */
.app-top h1 { font-size: 1rem; line-height: 1.2; font-weight: 700; letter-spacing: 0; }
.saludo { font-size: 1.5rem; line-height: 1.15; }
.tabla a, .lista a, .dato a { display: inline-block; padding: 3px 0; min-height: 24px; }
.check input { width: 24px; height: 24px; }
