/* Tipografía servida por la misma app (sin Google Fonts). Licencia: fonts/OFL-plus-jakarta-sans.txt */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/plus-jakarta-sans.woff2') format('woff2');
}

/* ==========================================================================
   Paleta de marca: AZUL 60% (fondos, estructura) · MAGENTA 30% (acciones, acentos) · BLANCO 10% (texto, detalles)
   ========================================================================== */
:root {
  --azul-950: #050d3a;
  --azul-900: #0a1a6b;
  --azul-850: #0c1c6e;
  --azul-800: #10268f;
  --azul-700: #1537d6;
  --azul-600: #2a4df0;
  --azul-400: #6f8bff;
  --azul-200: #c3cfff;
  --magenta-700: #a50f6b;
  --magenta-600: #c8157e;
  --magenta-500: #e0218a;
  --magenta-400: #e8479b;
  --magenta-200: #f8b8da;
  --violeta: #7b2ff7;
  --blanco: #ffffff;
  --texto: #ffffff;
  --texto-2: rgba(255, 255, 255, 0.78);
  --texto-3: rgba(255, 255, 255, 0.58);
  --superficie: rgba(255, 255, 255, 0.06);
  --superficie-2: rgba(255, 255, 255, 0.1);
  --borde: rgba(255, 255, 255, 0.14);
  --ok: #34d399;
  --alerta: #fbbf24;
  --error: #ff6b8a;
  --degradado: linear-gradient(120deg, var(--magenta-500) 0%, var(--violeta) 48%, var(--azul-700) 100%);
  --degradado-btn: linear-gradient(120deg, var(--magenta-500), #b61fd0);
  --radio: 18px;
  --radio-sm: 12px;
  --sombra: 0 10px 30px rgba(3, 8, 40, 0.45);
  --fuente: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: only dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--azul-950);
  background-image:
    radial-gradient(1200px 600px at 110% -10%, rgba(224, 33, 138, 0.28), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(21, 55, 214, 0.55), transparent 60%),
    linear-gradient(180deg, var(--azul-900), var(--azul-950));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: var(--magenta-200); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--texto-3); }
.sub { color: var(--texto-2); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: 64px 1fr; min-height: 100vh; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: rgba(5, 13, 58, 0.72); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 20;
}
.marca { display: flex; gap: 10px; align-items: center; color: var(--texto); text-decoration: none; min-width: 0; }
.marca span { display: flex; flex-direction: column; min-width: 0; }
.marca strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca small { color: var(--texto-3); font-size: .72rem; }
.topbar-der { display: flex; align-items: center; gap: 10px; }
.chip-demo {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 5px 10px; border-radius: 99px; background: rgba(224, 33, 138, .2); color: var(--magenta-200);
  border: 1px solid rgba(224, 33, 138, .45);
}
.perfil select { max-width: 260px; }
.btn-icono {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--superficie); border: 1px solid var(--borde); color: var(--texto); cursor: pointer;
}
.btn-icono:hover { background: var(--superficie-2); }
.punto-estado { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--texto-3); }
.punto-estado.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); }
.punto-estado.error { background: var(--error); }

.menu { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 18px 12px; border-right: 1px solid var(--borde); background: rgba(5, 13, 58, 0.35); }
.menu a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 4px; border-radius: 12px;
  color: var(--texto-2); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.menu a svg { width: 20px; height: 20px; flex: none; }
.menu a:hover { background: var(--superficie); color: var(--texto); }
.menu a.activo { background: var(--degradado-btn); color: var(--blanco); box-shadow: 0 6px 18px rgba(224, 33, 138, .35); }
.menu .titulo-menu { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--texto-3); padding: 8px 14px; }
.vista { padding: 28px clamp(16px, 3vw, 40px) 110px; max-width: 1200px; width: 100%; outline: none; overflow-wrap: break-word; }
/* Textos largos sin espacios (correos, números) no deben ensanchar la pantalla. */
.vista b, .vista .sub, .vista h2, .vista h3, .vista .dir, .vista .folio { overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 60px 1fr; }
  .topbar { padding: 0 12px; }
  .marca small, .chip-demo { display: none; }
  .menu {
    height: auto; top: auto;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--borde);
    background: rgba(5, 13, 58, 0.95); backdrop-filter: blur(14px);
  }
  .menu .titulo-menu, .menu a.solo-escritorio { display: none; }
  .solo-movil { display: revert !important; }
  .perfil-chip.solo-movil { display: inline-flex !important; }
  .solo-escritorio-top { display: none !important; }
  .menu button.solo-movil { display: flex !important; }
  .menu button { flex-direction: column; gap: 3px; font: inherit; font-size: .66rem; font-weight: 600; padding: 7px 6px; margin: 0;
    background: none; border: 0; color: var(--texto-2); border-radius: 12px; align-items: center; cursor: pointer; }
  .menu button svg { width: 20px; height: 20px; }
  /* Modales como hoja inferior, al estilo de una app */
  .modal-fondo { align-items: end; padding: 0; }
  .modal { width: 100%; border-radius: 24px 24px 0 0; max-height: 92vh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); animation: subir .2s ease; }
  /* Botones del asistente siempre a mano, sobre la barra inferior */
  .acciones-fijas { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 5; margin: 18px -20px -20px; padding: 12px 20px;
    background: rgba(10, 26, 107, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--borde); border-radius: 0 0 var(--radio) var(--radio); }
  .acciones-fijas .btn.grande { min-height: 52px; }
  .encabezado { margin-bottom: 16px; }
  .hero { padding: 22px; border-radius: 20px; }
  .card { padding: 16px; }
  #toasts { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: none; }
  .paso { font-size: .68rem; }
  .menu a { flex-direction: column; gap: 3px; font-size: .66rem; padding: 7px 6px; margin: 0; text-align: center; }
  .vista { padding: 20px 16px 110px; }
}

/* Los hijos de grillas no deben ensanchar la página (tablas y gráficos en celular). */
.grid > *, .vista > *, .fila > * { min-width: 0; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--magenta-500); }

/* ---------- Solo celular / solo escritorio ---------- */
.solo-movil { display: none !important; }
.perfil-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 4px; border-radius: 99px;
  background: var(--superficie-2); border: 1px solid var(--borde); color: var(--texto); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
}
.perfil-chip .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--degradado-btn); font-size: .8rem; }
.hoja-lista { display: grid; gap: 8px; }
.hoja-lista a, .hoja-lista button.item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--superficie);
  border: 1px solid var(--borde); color: var(--texto); text-decoration: none; font: inherit; font-weight: 600; text-align: left; width: 100%; cursor: pointer;
}
.hoja-lista a svg, .hoja-lista button.item svg { width: 22px; height: 22px; flex: none; }
.hoja-lista .activo { border-color: var(--magenta-400); background: rgba(224, 33, 138, .18); }
.hoja-titulo { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--texto-3); margin: 16px 0 8px; font-weight: 700; }
.banner-instalar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; margin-bottom: 16px;
  background: var(--blanco); color: var(--azul-900); box-shadow: var(--sombra); }
.banner-instalar img { width: 40px; height: 40px; border-radius: 10px; }
.banner-instalar div { flex: 1; font-size: .88rem; line-height: 1.3; }
.banner-instalar .btn { min-height: 38px; padding: 0 14px; font-size: .85rem; }
.banner-instalar .cerrar-banner { background: none; border: 0; color: var(--azul-900); font-size: 1.2rem; cursor: pointer; padding: 4px 6px; }

/* ---------- Componentes ---------- */
.card {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 20px; box-shadow: var(--sombra);
}
.card + .card { margin-top: 16px; }
.card-titulo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-titulo h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: 1fr; } }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.pila > * + * { margin-top: 12px; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.encabezado p { margin: 0; color: var(--texto-2); }

.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px; margin-bottom: 20px;
  background: var(--degradado); box-shadow: 0 18px 40px rgba(123, 47, 247, .35);
}
.hero::after {
  content: ''; position: absolute; inset: auto -60px -80px auto; width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); overflow-wrap: anywhere; }
.hero h1.folio-grande { font-size: clamp(1.5rem, 7.5vw, 2.4rem); }
.hero p { color: rgba(255, 255, 255, .9); max-width: 560px; }
.hero .fila { position: relative; z-index: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 14px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .95rem;
  cursor: pointer; text-decoration: none; transition: transform .08s ease, filter .15s ease, background .15s;
  color: var(--blanco); background: var(--degradado-btn); box-shadow: 0 8px 20px rgba(224, 33, 138, .35);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn { white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); box-shadow: none; }
.btn.sec { background: var(--superficie-2); border-color: var(--borde); box-shadow: none; }
.btn.blanco { background: var(--blanco); color: var(--azul-900); box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
.btn.azul { background: var(--azul-700); box-shadow: 0 8px 20px rgba(21, 55, 214, .4); }
.btn.peligro { background: rgba(255, 107, 138, .16); border-color: rgba(255, 107, 138, .5); color: #ffd1dc; box-shadow: none; }
.btn.grande { min-height: 58px; font-size: 1.05rem; border-radius: 16px; padding: 0 26px; }
.btn.chico { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn.ancho { width: 100%; }

label.campo { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .86rem; color: var(--texto-2); }
label.campo small { font-weight: 500; color: var(--texto-3); }
input, select, textarea {
  font: inherit; color: var(--texto); background: rgba(255, 255, 255, .08); border: 1px solid var(--borde);
  border-radius: var(--radio-sm); padding: 11px 13px; min-height: 46px; width: 100%;
}
select option { color: #0a1a6b; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--texto-3); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, .btn-icono:focus-visible {
  outline: 3px solid rgba(232, 71, 155, .55); outline-offset: 1px; border-color: var(--magenta-400);
}
.campo.invalido input, .campo.invalido select, .campo.invalido textarea { border-color: var(--error); background: rgba(255, 107, 138, .08); }
.error-campo { color: var(--error); font-size: .8rem; font-weight: 600; }
.interruptor { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.interruptor input { appearance: none; width: 48px; height: 28px; min-height: 0; padding: 0; border-radius: 99px; position: relative; cursor: pointer; flex: none; }
.interruptor input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--blanco); transition: left .15s; }
.interruptor input:checked { background: var(--magenta-500); border-color: var(--magenta-500); }
.interruptor input:checked::after { left: 23px; }

.segmentos { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid var(--borde); }
.segmentos button { font: inherit; font-weight: 700; color: var(--texto-2); background: transparent; border: 0; border-radius: 12px; padding: 12px 10px; cursor: pointer; }
.segmentos button.activo { background: var(--blanco); color: var(--azul-900); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.e-borrador { background: rgba(255, 255, 255, .1); color: var(--texto-2); }
.e-creado { background: rgba(111, 139, 255, .18); color: var(--azul-200); border-color: rgba(111, 139, 255, .4); }
.e-asignado { background: rgba(123, 47, 247, .22); color: #d9c6ff; border-color: rgba(123, 47, 247, .5); }
.e-en_ruta { background: rgba(224, 33, 138, .2); color: var(--magenta-200); border-color: rgba(224, 33, 138, .5); }
.e-entregado { background: rgba(52, 211, 153, .16); color: #a7f3d0; border-color: rgba(52, 211, 153, .45); }
.e-fallido, .e-rechazado { background: rgba(255, 107, 138, .16); color: #ffc2cf; border-color: rgba(255, 107, 138, .45); }
.e-reagendado, .e-en_revision, .e-solicitado { background: rgba(251, 191, 36, .14); color: #fde68a; border-color: rgba(251, 191, 36, .45); }
.e-devuelto, .e-anulado { background: rgba(255, 255, 255, .08); color: var(--texto-3); border-color: var(--borde); }
.e-aprobado { background: rgba(111, 139, 255, .18); color: var(--azul-200); border-color: rgba(111, 139, 255, .4); }
.e-pagado { background: rgba(52, 211, 153, .16); color: #a7f3d0; border-color: rgba(52, 211, 153, .45); }
.e-pendiente { background: rgba(251, 191, 36, .14); color: #fde68a; border-color: rgba(251, 191, 36, .45); }
.e-en_revision { background: rgba(56, 189, 248, .15); color: #bae6fd; border-color: rgba(56, 189, 248, .45); }
.e-reembolsado { background: rgba(255, 255, 255, .08); color: var(--texto-3); border-color: var(--borde); }

.kpi { padding: 18px; border-radius: var(--radio); background: var(--superficie); border: 1px solid var(--borde); }
.kpi .etiqueta { color: var(--texto-3); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .valor { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .nota { color: var(--texto-2); font-size: .82rem; }
.kpi.destacado { background: var(--degradado); border: 0; }
.kpi.destacado .etiqueta, .kpi.destacado .nota { color: rgba(255, 255, 255, .88); }

.lista-envios { display: grid; gap: 10px; }
.item-envio {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 16px 18px;
  border-radius: 16px; background: var(--superficie); border: 1px solid var(--borde); color: var(--texto); text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s;
}
.item-envio:hover { background: var(--superficie-2); border-color: rgba(232, 71, 155, .5); }
.item-envio .folio { font-weight: 800; font-variant-numeric: tabular-nums; }
/* El folio se lee de una vez: no se corta en "ENV-2026-" / "000983" cuando la tarjeta tiene etiquetas a la derecha. */
.vista .item-envio .folio { white-space: nowrap; overflow-wrap: normal; }
/* Textos que pueden ser largos dentro de una tabla (folios en los que se repitió un comprobante) sí pueden cortarse. */
td .ajustable { white-space: normal; display: inline-block; max-width: 260px; line-height: 1.35; }
.item-envio .dir { color: var(--texto-2); font-size: .9rem; }
.item-envio .der { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.item-envio .monto { font-weight: 800; font-variant-numeric: tabular-nums; }

.tabla-wrap { overflow-x: auto; border-radius: var(--radio-sm); border: 1px solid var(--borde); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { white-space: nowrap; text-align: left; padding: 11px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 700; background: rgba(255, 255, 255, .04); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.pasos { display: flex; gap: 8px; margin-bottom: 20px; }
.paso { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: .78rem; font-weight: 700; color: var(--texto-3); }
.paso::before { content: ''; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .14); }
.paso.hecho, .paso.actual { color: var(--texto); }
.paso.hecho::before { background: var(--azul-400); }
.paso.actual::before { background: var(--degradado-btn); }

.linea-tiempo { list-style: none; margin: 0; padding: 0; }
.linea-tiempo li { position: relative; padding: 0 0 18px 30px; }
.linea-tiempo li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: rgba(255, 255, 255, .14); }
.linea-tiempo li:last-child::before { display: none; }
.linea-tiempo li::after { content: ''; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--azul-600); border: 3px solid var(--azul-900); box-shadow: 0 0 0 2px var(--azul-400); }
.linea-tiempo li:last-child::after { background: var(--magenta-500); box-shadow: 0 0 0 2px var(--magenta-400); }
.linea-tiempo .cuando { color: var(--texto-3); font-size: .8rem; }
/* Pasos del pago dentro del historial: punto verde para distinguirlos de los cambios de estado. */
.linea-tiempo li.pago::after { background: #10b981; box-shadow: 0 0 0 2px #6ee7b7; }
.linea-tiempo li.pago.rechazo::after { background: #f43f5e; box-shadow: 0 0 0 2px #fda4af; }

.progreso-envio { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 16px 0 6px; }
.progreso-envio div { text-align: center; font-size: .72rem; font-weight: 700; color: var(--texto-3); }
.progreso-envio div::before { content: ''; display: block; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .14); margin-bottom: 8px; }
.progreso-envio div.on { color: var(--texto); }
.progreso-envio div.on::before { background: var(--degradado-btn); }

.qr-caja { background: var(--blanco); border-radius: 16px; padding: 12px; display: inline-block; }
.qr-caja img { display: block; width: 180px; height: 180px; }
.foto-mini { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; border: 1px solid var(--borde); background: rgba(0, 0, 0, .2); }
.intentos { display: inline-flex; gap: 5px; vertical-align: middle; }
.intentos i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--texto-3); }
.intentos i.usado { background: var(--error); border-color: var(--error); }

.aviso { padding: 12px 14px; border-radius: 12px; background: rgba(111, 139, 255, .14); border: 1px solid rgba(111, 139, 255, .35); color: var(--azul-200); font-size: .9rem; }
.aviso.magenta { background: rgba(224, 33, 138, .14); border-color: rgba(224, 33, 138, .4); color: var(--magenta-200); }
.aviso.alerta { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .4); color: #fde68a; }
.aviso.ok { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .4); color: #a7f3d0; }

.desglose { display: grid; gap: 8px; }
.desglose div { display: flex; justify-content: space-between; color: var(--texto-2); }
.desglose .total { border-top: 1px dashed var(--borde); padding-top: 10px; margin-top: 4px; color: var(--texto); font-weight: 800; font-size: 1.25rem; }

.cuenta-regresiva { width: 150px; height: 150px; margin: 6px auto; position: relative; }
.cuenta-regresiva svg { transform: rotate(-90deg); }
.cuenta-regresiva .tiempo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.vacio { text-align: center; padding: 40px 20px; color: var(--texto-2); }
.vacio svg { width: 56px; height: 56px; opacity: .6; margin-bottom: 8px; }

/* Gráfico de barras */
.grafico { position: relative; }
.grafico svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafico .barra { fill: var(--magenta-400); }
.grafico .barra-hit { fill: transparent; cursor: pointer; }
.grafico .barra-hit:hover + .barra, .grafico .barra.hover { fill: #f06fb0; }
.grafico .eje { fill: var(--texto-3); font-size: 11px; font-family: var(--fuente); }
.grafico .grilla { stroke: rgba(255, 255, 255, .08); stroke-width: 1; }
.tooltip { position: absolute; pointer-events: none; background: var(--blanco); color: var(--azul-900); padding: 8px 10px; border-radius: 10px; font-size: .8rem; font-weight: 600; box-shadow: var(--sombra); transform: translate(-50%, -110%); white-space: nowrap; }
.ranking { display: grid; gap: 10px; }
.ranking .r { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.ranking .r .b { height: 10px; border-radius: 0 4px 4px 0; background: var(--magenta-400); }
.ranking .r .v { font-variant-numeric: tabular-nums; color: var(--texto-2); font-weight: 600; }

/* Modal y avisos */
.modal-fondo { position: fixed; inset: 0; z-index: 50; background: rgba(3, 8, 40, .72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: aparecer .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: linear-gradient(180deg, var(--azul-800), var(--azul-900)); border: 1px solid var(--borde); border-radius: 22px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.modal { position: relative; }
.modal .cerrar { position: absolute; top: 14px; right: 14px; z-index: 1; }
.modal-cuerpo > h2:first-child, .modal-cuerpo > .hoja-titulo:first-child { padding-right: 48px; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
#toasts { position: fixed; z-index: 60; right: 16px; bottom: 90px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 13px 16px; border-radius: 14px; font-weight: 600; background: var(--blanco); color: var(--azul-900); box-shadow: var(--sombra); border-left: 5px solid var(--magenta-500); animation: aparecer .2s ease; }
.toast.error { border-left-color: var(--error); }
.toast.ok { border-left-color: var(--ok); }

.pasarela { background: var(--blanco); color: #1b1f3b; border-radius: 18px; padding: 20px; }
.pasarela input { background: #f3f5ff; color: #1b1f3b; border-color: #d6dcf5; }
.pasarela .monto { font-size: 2rem; font-weight: 800; color: var(--azul-900); }
.monto-grande { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cargando { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: var(--blanco); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.esqueleto { height: 72px; border-radius: 16px; background: linear-gradient(90deg, var(--superficie), var(--superficie-2), var(--superficie)); background-size: 200% 100%; animation: brillo 1.2s infinite; }
@keyframes brillo { to { background-position: -200% 0; } }

/* Tablas que en el celular se muestran como tarjetas */
@media (max-width: 640px) {
  .tabla-wrap:has(.tabla-cards) { border: 0; overflow: visible; }
  .tabla-cards thead { display: none; }
  .tabla-cards, .tabla-cards tbody { display: block; }
  .tabla-cards tr { display: block; padding: 14px 16px; margin-bottom: 10px; border-radius: 16px; background: var(--superficie); border: 1px solid var(--borde); }
  .tabla-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; white-space: normal; text-align: right; }
  .tabla-cards td::before { content: attr(data-label); color: var(--texto-3); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-align: left; }
  .tabla-cards td:last-child { padding-top: 10px; }
  .tabla-cards td[data-label="Acción"]:not(:has(button)) { display: none; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print {
  body { background: #fff; color: #000; }
  .topbar, .menu, #toasts { display: none; }
}
#f-clave input::placeholder { color: #5a67a6; font-weight: 600; }

/* ---------- Inicio de sesión (AUTH_MODE=jwt) ---------- */
.modo-sesion .chip-demo, .modo-sesion .perfil { display: none !important; }
.modo-sesion #chip-perfil { display: inline-flex !important; }
.sin-sesion .shell { grid-template-columns: minmax(0, 1fr); }
.sin-sesion .menu { display: none; }
.sin-sesion #chip-perfil { display: none !important; }
.login-caja { min-height: calc(100vh - 170px); display: grid; place-items: center; }
.login { width: min(430px, 100%); margin: 0; padding: 30px 26px; }
.login .logo { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 14px; }
.login h1 { margin: 0 0 4px; }
.login form { display: grid; gap: 14px; margin-top: 20px; }
.login .clave { position: relative; display: block; }
.login .clave input { padding-right: 96px; width: 100%; }
.login .ver-clave { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 12px; }
.login details { margin-top: 16px; color: var(--texto-2); font-size: .9rem; }
.login summary { cursor: pointer; font-weight: 600; }
.login .pie { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--borde); text-align: center; }
.cuenta-resumen { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--superficie); border: 1px solid var(--borde); }
.cuenta-resumen .avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--degradado-btn); font-weight: 800; flex: none; }
.cuenta-resumen div { min-width: 0; } .cuenta-resumen .sub { overflow-wrap: anywhere; }
/* Orden de la ruta del repartidor: flechas a la izquierda de cada parada */
.parada { display: flex; gap: 8px; align-items: stretch; }
.parada > .item-envio { flex: 1; min-width: 0; }
/* Celular: en la tarjeta de la ruta, el estado va debajo y el folio y la dirección usan todo el ancho. */
@media (max-width: 640px) {
  .parada > .item-envio { grid-template-columns: minmax(0, 1fr); }
  .parada > .item-envio .der { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; }
}
.flechas-ruta { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.flechas-ruta .btn-icono { width: 36px; height: 36px; font-size: .8rem; }
/* Flecha de orden de ruta sin efecto (primera o última parada de su sección). */
.flechas-ruta .btn-icono:disabled { opacity: .3; cursor: default; }
