/* =====================================================================
   VUELTA LLENA · extensiones sobre Balance Diseño
   ---------------------------------------------------------------------
   Qué hace: agrega los componentes propios de Vuelta Llena que no están
   en la base de Balance (marco de teléfono para las apps Flutter, fila de
   carga con "km hacia casa", panel de viaje activo, remolque que se llena,
   pasos de viaje, ofertas en el chat, páginas públicas).
   Reglas: usa SOLO tokens de _base.css (--accent, --s1, --s2, --ink,
   --surface, --shadow…). No define colores nuevos. Se carga DESPUÉS de
   _base.css y _ui.css.
   ===================================================================== */

/* ---------- Escenario para pantallas móviles (maqueta) ---------- */
.vl-stage { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 340px) auto; gap: 40px; align-items: start; justify-content: center; padding: 40px 24px; }
.vl-stage__info { position: sticky; top: 40px; }
.vl-stage__info h1 { margin: 6px 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.vl-stage__info p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.vl-stage__info ul { margin: 0 0 16px; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; }
.vl-stage__nav { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 860px) { .vl-stage { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 16px; } .vl-stage__info { position: static; max-width: 420px; } }

/* ---------- Marco de teléfono ---------- */
.vl-device { width: 390px; max-width: 100%; height: 844px; border-radius: 44px; padding: 10px; background: #0a0a0b; box-shadow: var(--shadow-lift); }
.vl-screen { position: relative; height: 100%; border-radius: 36px; overflow: hidden; background: var(--page); display: flex; flex-direction: column; }
.vl-status { height: 34px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); }
.vl-scroll { flex: 1; overflow: auto; }
@media (max-width: 440px) { .vl-device { height: auto; min-height: 780px; border-radius: 0; padding: 0; box-shadow: none; } .vl-screen { border-radius: 0; } }

/* Barra superior de la app */
.vl-appbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.vl-appbar h1 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; flex: 1; }
.vl-appbar .icon-btn { width: 48px; height: 48px; }  /* DD16: táctil >= 48 px */
.vl-truck { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.vl-truck b { display: block; font-size: 15px; font-weight: 650; }
.vl-truck small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Patente (identidad del camión) */
.vl-plate { flex: none; white-space: nowrap; display: inline-flex; align-items: stretch; border: 1.5px solid var(--ink); border-radius: 6px; overflow: hidden; font-size: 12px; font-weight: 650; letter-spacing: .04em; font-variant-numeric: tabular-nums; background: var(--surface); }
.vl-plate i { width: 7px; background: #1f4fa0; }
.vl-plate span { padding: 2px 6px; }

/* Barra de pestañas inferior */
.vl-tabbar { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: 8px; }
.vl-tabbar a { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; position: relative; }
.vl-tabbar a svg { width: 22px; height: 22px; }
.vl-tabbar a.is-active { color: var(--accent); }
.vl-tabbar a.is-active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); }
.vl-tabbar .nav__badge { position: absolute; top: 6px; right: 24%; }

/* Secciones dentro de la app */
.vl-section { padding: 14px 16px 6px; }
.vl-section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.vl-section__head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.025em; }
.vl-card { margin: 0 12px 12px; }
.vl-card .bg-card__body { padding: 14px; }

/* Botones de la app: táctiles (DD16: >= 48 px; estado de viaje 64 px) */
.vl-btn { min-height: 48px; font-size: 15px; border-radius: 12px; }
.vl-btn--xl { min-height: 64px; font-size: 18px; font-weight: 700; width: 100%; justify-content: center; }
.vl-btn--block { width: 100%; justify-content: center; }

/* ---------- Panel de viaje activo (oscuro: es el único bloque negro) ---------- */
.vl-trip { margin: 12px; border-radius: var(--radius); padding: 16px; color: #fafaf8;
  background: radial-gradient(420px 220px at 110% -20%, rgba(242,107,29,.28), transparent 60%), radial-gradient(360px 200px at -10% 120%, rgba(22,153,108,.22), transparent 60%), #0a0a0b;
  box-shadow: var(--shadow-lift); }
.vl-trip .bg-eyebrow { color: var(--accent-2); }
.vl-trip h3 { color: #fafaf8; margin: 6px 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.vl-trip p { margin: 0; font-size: 13.5px; color: #cfcfca; }
.vl-gps { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; color: #e8e8e4; }
.vl-gps i { width: 8px; height: 8px; border-radius: 50%; background: var(--s2-hi); box-shadow: 0 0 0 4px rgba(62,196,150,.18); }
.vl-gps.is-offline i { background: var(--warn); box-shadow: 0 0 0 4px rgba(242,169,0,.2); }

/* ---------- Fila de carga: "km hacia casa" es el titular ---------- */
.vl-load { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.vl-km { border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); position: relative; overflow: hidden; align-self: start; }
.vl-km::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2) 55%, var(--s2)); }
.vl-km b { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }
.vl-km small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.vl-route { font-size: 16px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
.vl-facts { margin: 3px 0 8px; color: var(--muted); font-size: 13px; }
.vl-facts b { color: var(--ink); font-weight: 600; }
.vl-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vl-price small { display: block; font-size: 11px; color: var(--muted); }
.vl-price b { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vl-load .vl-full { grid-column: 1 / -1; }

/* ---------- Remolque que se llena (ancla visual "vuelta llena") ---------- */
.vl-trailer { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.vl-trailer svg { width: 104px; height: 30px; flex: none; }
.vl-trailer b { color: var(--ink); }

/* ---------- Pasos (viaje y cobro) ---------- */
.vl-steps { list-style: none; margin: 0; padding: 0; }
.vl-steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.vl-steps li:last-child { border-bottom: 0; }
.vl-steps li i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; }
.vl-steps li.is-done i { background: var(--s2); border-color: var(--s2); }
.vl-steps li.is-done i::after { content: "✓"; }
.vl-steps li.is-now i { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
.vl-steps li time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Chat con ofertas formales ---------- */
.vl-chat { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; }
.vl-msg { max-width: 80%; padding: 9px 12px; border-radius: 14px; font-size: 14px; background: var(--surface); border: 1px solid var(--border); align-self: flex-start; }
.vl-msg--me { align-self: flex-end; background: var(--accent-wash); border-color: transparent; }
.vl-msg small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.vl-offer { align-self: stretch; }
.vl-offer .bg-card__body { padding: 12px 14px; }
.vl-offer__amount { font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.vl-compose { flex: none; display: flex; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); }
.vl-compose .input { min-height: 46px; }

/* ---------- Lista de datos clave (detalle) ---------- */
.vl-kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: 14px; }
.vl-kv dt { color: var(--muted); }
.vl-kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Medidor de verificación ---------- */
.vl-verify { margin: 0 12px 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border)); font-size: 13.5px; }
.vl-verify b { color: var(--warn-ink); }

/* ---------- Mapa esquemático (seguimiento) ---------- */
.vl-map { position: relative; height: 240px; background-color: var(--surface-2); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 36px 36px; border-bottom: 1px solid var(--border); }
.vl-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Páginas públicas ---------- */
.vl-public { max-width: 640px; margin: 0 auto; padding: 32px 16px 56px; }
.vl-public .bg-card__body { padding: 22px; }
.vl-public__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.vl-public__brand b { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Galería (index) ---------- */
.vl-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.vl-gallery a { display: block; text-decoration: none; color: var(--ink); }
.vl-gallery .bg-tile { padding: 14px 16px; height: 100%; }
.vl-gallery b { display: block; font-size: 14.5px; font-weight: 650; }
.vl-gallery small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* Botones que son enlaces: sin subrayado (en _ui.css solo los <button> lo resuelven) */
a.bg-btn, a.vl-btn { text-decoration: none; }
.bg-table .bg-badge { white-space: nowrap; }

/* ---------- Ingreso: tiles de números del panel de marca (venían solo en la plantilla compilada) ---------- */
.login__kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.login__kpis div { padding: 14px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(6px); }
.login__kpis b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.login__kpis small { color: rgba(255,255,255,.6); font-size: 11.5px; }
@media (max-width: 860px) { .login__brand { gap: 22px; } .login__kpis b { font-size: 18px; } }

/* ---------- Topbar en móvil: la búsqueda y el selector de sucursal no entran a 390 px ---------- */
@media (max-width: 640px) {
  .topbar { gap: 6px; }
  .topbar__search, .topbar > .select { display: none; }
}

/* El atributo hidden debe ganarle al display de los botones */
.bg-btn[hidden], .vl-btn[hidden] { display: none !important; }
