/* ═══════════════════════════════════════════════════════════════════════
   TRUSTWAY — sistema visual común (logistics + carrier + app del operador)
   Tema oscuro por defecto (torre de control), tema claro opcional.
   ═══════════════════════════════════════════════════════════════════════ */
/* Open Sans (misma tipografía que la plataforma de rastreo), servida desde el propio servidor. */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(/assets/fonts/open-sans-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(/assets/fonts/open-sans-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root, [data-theme="light"] {
  --bg: #f5f6f8;
  --bg-grad: #f5f6f8;
  --side: #ffffff;
  --side-text: #3f4652;
  --side-text-h: #191c22;
  --side-hover: #f2f4f7;
  --side-sep: #8a919c;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --panel-3: #eef0f3;
  --border: #e6e8ec;
  --border-2: #d5d9e0;
  --text: #191c22;
  --text-2: #3f4652;
  --muted: #6b7280;
  --green: #15803d;  --green-soft: #e8f5ec;
  --amber: #b45309;  --amber-soft: #fdf3e1;
  --orange: #c2410c; --orange-soft: #fdeee4;
  --red: #c0262d;    --red-soft: #fcebeb;
  --violet: #6d28d9; --violet-soft: #f1ecfc;
  --teal: #0f766e;   --teal-soft: #e3f4f2;
  --blue: #1d4ed8;   --blue-soft: #e8eefb;
  --grey: #4b5563;   --grey-soft: #f1f2f4;
  --shadow: 0 1px 2px rgba(16,24,40,.04);
  --radius: 10px;
  --radius-sm: 7px;
  --row-hover: #f8f9fb;
  --input: #ffffff;
  --map-filter: none;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f141c;
  --bg-grad: #0f141c;
  --side: #121821;
  --side-text: #aeb6c2;
  --side-text-h: #f1f3f6;
  --side-hover: #1a212c;
  --side-sep: #6b7480;
  --panel: #151b24;
  --panel-2: #1a212c;
  --panel-3: #222a36;
  --border: #252d39;
  --border-2: #313a48;
  --text: #e8ebef;
  --text-2: #b9c0cb;
  --muted: #858e9b;
  --green: #3fb96c;  --green-soft: rgba(63,185,108,.14);
  --amber: #e2a336;  --amber-soft: rgba(226,163,54,.14);
  --orange: #e8823f; --orange-soft: rgba(232,130,63,.14);
  --red: #e5534b;    --red-soft: rgba(229,83,75,.14);
  --violet: #a78bfa; --violet-soft: rgba(167,139,250,.14);
  --teal: #2fb3a6;   --teal-soft: rgba(47,179,166,.14);
  --blue: #5b8def;   --blue-soft: rgba(91,141,239,.14);
  --grey: #8f98a6;   --grey-soft: rgba(143,152,166,.14);
  --shadow: none;
  --row-hover: #1a212c;
  --input: #10151d;
  color-scheme: dark;
}
/* Color de marca por portal (logos): Logistics #0865CE · Carrier #008F91 */
[data-portal="logistics"], :root { --primary: #0865CE; --primary-2: #0652a6; --primary-soft: rgba(8,101,206,.09); }
[data-portal="carrier"] { --primary: #008F91; --primary-2: #007274; --primary-soft: rgba(0,143,145,.10); }
[data-theme="dark"][data-portal="logistics"] { --primary: #3b8ae6; --primary-2: #2f78cf; --primary-soft: rgba(59,138,230,.16); }
[data-theme="dark"][data-portal="carrier"] { --primary: #1fb0b2; --primary-2: #179597; --primary-soft: rgba(31,176,178,.16); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13.5px; line-height: 1.45; color: var(--text); background: var(--bg-grad);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum";
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.svg-i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.svg-i.sm { width: 15px; height: 15px; }
.svg-i.lg { width: 22px; height: 22px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.hide { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Estructura ──────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px 14px; color: var(--side-text); z-index: 40;
}
.brand { display: flex; align-items: center; padding: 2px 10px 22px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; max-width: 180px; display: block; }
.brand .logo-dark, [data-theme="dark"] .brand .logo-light { display: none; }
[data-theme="dark"] .brand .logo-dark { display: block; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-text);
  font-weight: 500; font-size: 13.5px; text-decoration: none; position: relative;
}
.nav a .svg-i { width: 18px; height: 18px; stroke-width: 1.7; color: var(--side-sep); }
.nav a:hover { background: var(--side-hover); color: var(--side-text-h); text-decoration: none; }
.nav a:hover .svg-i { color: var(--side-text-h); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.active .svg-i { color: var(--primary); }
.nav .sep { margin: 16px 10px 6px; font-size: 11.5px; color: var(--side-sep); font-weight: 500; }
.nav .count { margin-left: auto; background: var(--red-soft); color: var(--red); border-radius: 9px; font-size: 11px; padding: 0 7px; font-weight: 600; line-height: 18px; }
.nav .count.blue { background: var(--primary-soft); color: var(--primary); }
.side-help { margin-top: 10px; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--border); color: var(--side-text); text-decoration: none; font-size: 12.5px; }
.side-help:hover { text-decoration: none; color: var(--side-text-h); }
.side-help .svg-i { width: 20px; height: 20px; stroke-width: 1.6; color: var(--primary); }
.side-help b { display: block; font-weight: 600; color: var(--side-text-h); }
.side-help small { color: var(--muted); font-size: 11.5px; }
.side-manual { margin-top: 6px; border-radius: 8px; }
.side-manual + .side-help { margin-top: 0; border-top: 0; }
.side-manual.on { background: var(--primary-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.grey { background: var(--grey); }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border);
  background: var(--panel); position: sticky; top: 0; z-index: 30;
}
.top .burger { display: none; }
.top .spacer { flex: 1; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text-2);
  background: transparent; border: 1px solid transparent; cursor: pointer; position: relative;
}
.iconbtn:hover { background: var(--panel-2); color: var(--text); }
.iconbtn .svg-i { stroke-width: 1.7; }
.iconbtn .badge-n { position: absolute; top: 3px; right: 3px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.userbox { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid var(--border); }
.userbox .n { font-weight: 600; font-size: 12.5px; line-height: 1.15; }
.userbox .r { color: var(--muted); font-size: 11.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; font-weight: 600; color: var(--primary); font-size: 12px; }
.content { padding: 22px 24px 32px; flex: 1; }
.page-h { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h1 { font-size: 20px; font-weight: 650; text-transform: none; letter-spacing: -.015em; }
.page-h .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.page-h .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 24px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ── Tarjetas ────────────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 48px; }
.card-h h3 { font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.card-h h3 .svg-i { color: var(--muted); stroke-width: 1.7; }
.card-h .link { margin-left: auto; font-size: 12.5px; white-space: nowrap; }
.card-h .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; }

.grid { display: grid; gap: 14px; }
.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)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.g-dash { grid-template-columns: minmax(0, 1.3fr) minmax(0, .95fr) minmax(0, 1.15fr); }
.g-detail { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* KPIs (fila superior del resumen ejecutivo) */
.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 11px; display: flex; gap: 10px; min-width: 0; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--border-2); text-decoration: none; background: var(--panel-2); }
.kpi { padding: 14px; }
.kpi .ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--panel-2) !important; border: 1px solid var(--border); }
.kpi .ic .svg-i { width: 19px; height: 19px; stroke-width: 1.7; }
.kpi .t { font-size: 12px; color: var(--text-2); font-weight: 500; line-height: 1.25; min-height: 15px; }
.kpi .v { font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 11.5px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
/* El texto del cuadro se ajusta al ancho (antes se salía por la derecha) y el valor no se parte en dos renglones.
   En cuadros angostos se oculta el icono y el valor baja de tamaño para que quepa «32 h 30 min». */
.kpi { container-type: inline-size; }
.kpi > div:last-child { min-width: 0; flex: 1; }
.kpi .v { white-space: nowrap; }
@container (max-width: 200px) { .kpi .ic { display: none; } .kpi .v { font-size: 20px; } }
.kpi .d b { font-weight: 600; }
.ic.blue { background: var(--blue-soft); color: var(--blue); }
.ic.green { background: var(--green-soft); color: var(--green); }
.ic.amber { background: var(--amber-soft); color: var(--amber); }
.ic.red { background: var(--red-soft); color: var(--red); }
.ic.violet { background: var(--violet-soft); color: var(--violet); }
.ic.teal { background: var(--teal-soft); color: var(--teal); }
.ic.orange { background: var(--orange-soft); color: var(--orange); }
.ic.grey { background: var(--grey-soft); color: var(--grey); }
.c-green { color: var(--green); } .c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-blue { color: var(--blue); }
.c-violet { color: var(--violet); } .c-teal { color: var(--teal); } .c-orange { color: var(--orange); } .c-muted { color: var(--muted); }

/* Contadores por fase (torre) */
.phasebar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.phasebar a { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.phasebar a:hover { border-color: var(--border-2); }
.phasebar a.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; background: var(--primary-soft); }
.phasebar .t { font-size: 11.5px; color: var(--muted); }
.phasebar .v { font-size: 22px; font-weight: 650; }

/* ── Tablas ──────────────────────────────────────────────────────────── */
.tbl-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.tbl th.right { text-align: right; }
.tbl th.center { text-align: center; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tr.click { cursor: pointer; }
.tbl .sub { color: var(--muted); font-size: 11.5px; }
.tbl.compact td { padding: 6px 8px; }
.tbl.compact th { padding: 8px 8px; }
.tbl.dense td, .tbl.dense th { white-space: nowrap; font-size: 12px; }
.tbl .clip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .ico-status { width: 18px; }
.tbl-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.tbl-legend span { display: inline-flex; gap: 6px; align-items: center; }

/* ── Etiquetas ───────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 6px; white-space: nowrap; line-height: 1.6; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.muted { background: var(--grey-soft); color: var(--grey); }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--border-2); border-radius: 5px; padding: 0 6px; color: var(--text-2); background: var(--panel-2); white-space: nowrap; }
.status-up { font-weight: 500; font-size: 11.5px; padding: 1px 8px; border-radius: 6px; white-space: nowrap; line-height: 1.6; display: inline-block; }
.status-up.red { background: var(--red-soft); color: var(--red); }
.status-up.orange { background: var(--orange-soft); color: var(--orange); }
.status-up.amber { background: var(--amber-soft); color: var(--amber); }
.status-up.green { background: var(--green-soft); color: var(--green); }
.status-up.blue { background: var(--blue-soft); color: var(--blue); }
.status-up.violet { background: var(--violet-soft); color: var(--violet); }
.status-up.teal { background: var(--teal-soft); color: var(--teal); }
.status-up.muted { background: var(--grey-soft); color: var(--grey); }

/* Barras de progreso */
.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; min-width: 44px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--green); }
.bar.amber > i { background: var(--amber); } .bar.red > i { background: var(--red); } .bar.blue > i { background: var(--blue); } .bar.orange > i { background: var(--orange); }
.riskbar { display: flex; align-items: center; gap: 8px; }
.riskbar .bar { flex: 1; }

/* ── Botones y formularios ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; font-size: 13px;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn .svg-i { width: 16px; height: 16px; stroke-width: 1.8; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--red) 55%, transparent); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.lg { height: 46px; padding: 0 18px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); font-weight: 500; min-width: 0; }
label.f > span.l { display: flex; gap: 6px; align-items: center; }
.input, select.input, textarea.input {
  height: 36px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--input); color: var(--text); padding: 0 11px; font: inherit; font-size: 13px; width: 100%; min-width: 0;
}
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.err { border-color: var(--red); }
.ferr { color: var(--red); font-size: 11.5px; min-height: 0; }
.ferr:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.select-sm { height: 32px; font-size: 12.5px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel); color: var(--text); font: inherit; }
.search { position: relative; }
.search .svg-i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.search .input { padding-left: 32px; }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; color: var(--text-2); padding: 5px 11px; border-radius: 6px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.seg a.on, .seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.seg .n { color: var(--muted); font-size: 11px; margin-left: 3px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }

/* ── Donas / gráficas ────────────────────────────────────────────────── */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { position: relative; width: 140px; height: 140px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center b { font-size: 24px; font-weight: 650; display: block; line-height: 1; letter-spacing: -.02em; }
.donut .center span { font-size: 11.5px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 13px; flex: 1; min-width: 160px; }
.legend .li { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.legend .sw { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.legend .v { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend .sym { width: 16px; text-align: center; font-weight: 800; font-size: 16px; line-height: 1; }
.spark { width: 100%; height: 160px; }

/* ── Mapa ────────────────────────────────────────────────────────────── */
.map { width: 100%; height: 100%; min-height: 300px; border-radius: 0 0 var(--radius) var(--radius); background: #e9ecef; z-index: 1; }
[data-theme="dark"] .map { background: #0f141c; }
.map-card { display: flex; flex-direction: column; }
.map-card .map { flex: 1; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 9px 14px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.leaflet-popup-content a { color: var(--primary); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-zoom a, .leaflet-control-layers { background: var(--panel) !important; color: var(--text) !important; border-color: var(--border-2) !important; }
.leaflet-control-zoom a.map-fs-btn { display: flex; align-items: center; justify-content: center; border-top: 1px solid var(--border-2); }
.leaflet-container:fullscreen { width: 100% !important; height: 100% !important; border-radius: 0; }
.leaflet-container.map-max { position: fixed !important; inset: 0; width: auto !important; height: auto !important; z-index: 9000; border-radius: 0; margin: 0; }
html.map-max-on, html.map-max-on body { overflow: hidden; }
.leaflet-control-layers-expanded { padding: 8px 10px; }
.leaflet-control-attribution { background: rgba(255,255,255,.75) !important; color: #4b5563 !important; font-size: 9.5px; }
.leaflet-control-attribution a { color: #374151 !important; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(15,20,28,.7) !important; color: #8f98a6 !important; }
[data-theme="dark"] .leaflet-control-attribution a { color: #b9c0cb !important; }
.truck-pin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.truck-pin svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.truck-pin.green { background: #16a34a; } .truck-pin.amber { background: #e09113; } .truck-pin.red { background: #dc2626; }
.truck-pin.violet { background: #9333ea; } .truck-pin.grey { background: #64748b; } .truck-pin.blue { background: #2563eb; } .truck-pin.teal { background: #0d9488; }
.site-pin { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: #fff; border: 2px solid var(--primary); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.site-pin svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.map-tip { font-weight: 600; }
.leaflet-tooltip.unit-tip { font: 12.5px/1.45 'Open Sans', sans-serif; padding: 6px 9px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.leaflet-tooltip.unit-tip b { font-weight: 700; }
.pop-unit .pop-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; padding-right: 16px; }
.pop-unit table { border-collapse: collapse; width: 100%; margin-bottom: 8px; }
.pop-unit th { text-align: left; font-weight: 500; color: var(--muted); padding: 1px 10px 1px 0; white-space: nowrap; vertical-align: top; }
.pop-unit td { padding: 1px 0; }
.pop-unit .btn { color: #fff; } .pop-unit .btn:not(.primary) { color: var(--text); }

/* ── Línea de tiempo de fases ────────────────────────────────────────── */
.phases { display: flex; flex-direction: column; }
.ph { display: grid; grid-template-columns: 30px minmax(0, 1fr) 150px 84px; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.ph:last-child { border-bottom: 0; }
.ph .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--panel-3); color: var(--muted); border: 1px solid var(--border-2); }
.ph.done .n { background: #16a34a; border-color: #16a34a; color: #fff; }
.ph.current .n { background: var(--primary); border-color: var(--primary); color: #fff; }
.ph .t { font-weight: 600; }
.ph .s { color: var(--muted); font-size: 12px; }
.ph .when { font-size: 12px; color: var(--text-2); }
.ph .when b { display: block; font-weight: 600; }
.ph .when .real { color: var(--green); font-weight: 600; }
.ph .when .eta { color: var(--blue); font-weight: 600; }
.ph .when .late { color: var(--red); font-weight: 600; }
.ph .src { justify-self: end; }
.eta-box { margin-top: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; gap: 22px; flex-wrap: wrap; font-size: 12.5px; }
.eta-box b { font-weight: 650; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-weight: 550; }
.checklist { margin-top: 12px; border-top: 1px solid var(--border); }
.checklist .it { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.checklist .it:last-child { border-bottom: 0; }
.checklist .it-view { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: -4px 0 -4px 6px; vertical-align: middle; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); background: var(--panel); }
.checklist .it-view:hover { color: var(--primary); border-color: currentColor; }
.checklist .ok { color: var(--green); font-weight: 600; } .checklist .warn { color: var(--amber); font-weight: 600; } .checklist .fail { color: var(--red); font-weight: 600; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.thumb { aspect-ratio: 1/1; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; position: relative; color: var(--muted); font-size: 11.5px; text-align: center; text-decoration: none; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; padding: 14px 6px 5px; font-size: 11px; }
.thumb:hover { border-color: var(--primary); text-decoration: none; }

.log { display: flex; flex-direction: column; }
.log .it { display: grid; grid-template-columns: 110px 190px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.log .it:last-child { border-bottom: 0; }

/* Lista de atención */
.attn { display: flex; flex-direction: column; }
.attn .it { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.attn .it:last-child { border-bottom: 0; }
.attn .it .t { font-weight: 600; font-size: 12.8px; }
.attn .it .s { color: var(--muted); font-size: 12px; }
.attn .it .acts { margin-left: auto; display: flex; gap: 4px; flex: none; }
.sev { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.sev.s4 { background: var(--red); } .sev.s3 { background: var(--orange); } .sev.s2 { background: var(--amber); } .sev.s1 { background: var(--blue); }

/* Calendario de andenes */
.cal { overflow-x: auto; }
.cal-grid { display: grid; min-width: 820px; }
.cal-h { font-size: 11px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--border); text-align: left; }
.cal-row { position: relative; height: 54px; border-bottom: 1px solid var(--border); }
.cal-row .lbl { position: absolute; left: 0; top: 0; bottom: 0; width: var(--cal-lbl, 90px); padding-right: 8px; display: flex; flex-direction: column; justify-content: center; font-weight: 600; font-size: 12.5px; line-height: 1.25; min-width: 0; }
.cal-row .lbl.two .lbl-n { -webkit-line-clamp: 1; }
.cal-row .lbl-n { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-row .lbl-s { font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-lane { position: absolute; left: var(--cal-lbl, 90px); right: 0; top: 0; bottom: 0; background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px); }
.cal-ev { position: absolute; top: 8px; bottom: 8px; border-radius: 6px; padding: 3px 6px; font-size: 10.5px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #fff; background: #1d4ed8; border: 1px solid rgba(255,255,255,.15); cursor: pointer; text-decoration: none; }
.cal-ev.pending { background: transparent; border: 1.5px dashed var(--amber); color: var(--amber); }
.cal-ev.done { background: #15803d; }
.cal-ev.late { background: #b91c1c; }
.cal-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 2; }

/* ── Diálogos y avisos ───────────────────────────────────────────────── */
dialog.modal { border: 1px solid var(--border-2); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 50px rgba(16,24,40,.18); }
dialog.modal.wide { width: min(980px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(16,24,40,.45); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-h h3 { font-size: 15px; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 16px; overflow: auto; max-height: calc(100vh - 170px); }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast { background: var(--panel); border: 1px solid var(--border-2); border-left: 4px solid var(--green); color: var(--text); padding: 10px 14px; border-radius: 9px; box-shadow: 0 8px 24px rgba(16,24,40,.14); font-size: 13px; max-width: 380px; animation: tin .2s ease-out; }
.toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--amber); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty .svg-i { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--panel-2); font-size: 12.8px; }
.notice.amber { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft); }
.notice.red { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.notice.blue { border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: var(--blue-soft); }
.notice.green { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
.notice.violet { border-color: color-mix(in srgb, var(--violet) 45%, transparent); background: color-mix(in srgb, var(--violet) 10%, var(--panel)); }
.notice.imp-bar { align-items: center; position: sticky; top: 58px; z-index: 20; }   /* debajo de la barra superior (z 30), para que su menú quede encima */
.drop { position: relative; }
.drop-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.14); min-width: 220px; padding: 6px; display: none; z-index: 60; }
.drop.open .drop-menu { display: block; }
.drop-menu a, .drop-menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; text-align: left; }
.drop-menu a:hover, .drop-menu button:hover { background: var(--panel-2); text-decoration: none; }
.drop-menu .hd { padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.notif-list { max-height: 360px; overflow: auto; width: 340px; }

/* ── Acceso (login, recuperar, restablecer) ─────────────────────────── */
/* Colores de los logos: Logistics #0865CE · Carrier #008F91 · texto #191C22 */
.auth-body { margin: 0; background: #fff; color: #191c22; --brand: #0865CE; --brand-tint: #f3f6fb; --brand-tint-2: #e7eef8; --brand-line: #e1e8f2; }
.auth-body.auth-carrier { --brand: #008F91; --brand-tint: #f2f8f8; --brand-tint-2: #e2f0f0; --brand-line: #dcebeb; }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 540px); }

/* Lado informativo */
.auth-aside { position: relative; overflow: hidden; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: linear-gradient(160deg, var(--brand-tint) 0%, #fff 55%, var(--brand-tint-2) 100%); border-right: 1px solid var(--brand-line); }
.auth-art { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--brand); pointer-events: none; }
.auth-intro, .auth-foot { position: relative; }
.auth-intro { max-width: 460px; margin: auto 0; }
.auth-intro h2 { font-size: 28px; line-height: 1.22; font-weight: 650; color: #191c22; margin: 0 0 12px; letter-spacing: -.02em; }
.auth-intro p { color: #4f5866; font-size: 15px; line-height: 1.55; margin: 0 0 28px; }
.auth-intro ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-intro li { display: flex; align-items: center; gap: 12px; color: #343a46; font-size: 14.5px; }
.auth-intro li .svg-i { width: 34px; height: 34px; padding: 7px; border-radius: 9px; background: #fff; border: 1px solid var(--brand-line); stroke: var(--brand); stroke-width: 1.6; flex: none; }
.auth-foot { color: #8a93a2; font-size: 12px; }

/* Lado del formulario */
.auth { position: relative; display: flex; align-items: center; justify-content: center; padding: 56px 32px 40px; }
.auth-top { position: absolute; top: 20px; right: 24px; }
.lang-sw { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; color: #6b7280; }
.lang-sw .svg-i { width: 16px; height: 16px; stroke-width: 1.6; margin-right: 6px; }
.lang-sw a { color: #6b7280; padding: 4px 8px; border-radius: 6px; font-weight: 600; text-decoration: none; letter-spacing: .02em; }
.lang-sw a:hover { background: #f2f4f7; color: #191c22; text-decoration: none; }
.lang-sw a.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { display: block; height: 46px; width: auto; margin: 0 auto 32px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #e6e8ec; margin-bottom: 24px; }
.auth-tabs.one { grid-template-columns: 1fr; }
.auth-tabs button, .auth-tabs span { background: none; border: 0; font: inherit; font-size: 14px; font-weight: 500; color: #7a828e; padding: 0 4px 12px; cursor: pointer; position: relative; text-align: center; }
.auth-tabs button:hover { color: #191c22; }
.auth-tabs .on { color: var(--brand); font-weight: 600; }
.auth-tabs .on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px; }
.auth form { display: flex; flex-direction: column; gap: 18px; }
.auth form[hidden] { display: none; }
.auth .hint { color: #5b6472; font-size: 13.5px; line-height: 1.5; margin: 0; }
.auth label.f { color: #6b7280; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; gap: 7px; }
.auth .ifield { position: relative; display: block; }
.auth .ifield > .svg-i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #9aa1ac; stroke-width: 1.6; pointer-events: none; }
.auth .input { height: 46px; font-size: 14.5px; background: #f6f7f9; color: #191c22; border: 1px solid #e6e8ec; border-radius: 10px; padding-left: 44px; text-transform: none; letter-spacing: 0; }
.auth .input::placeholder { color: #a7adb7; }
.auth .input:hover { border-color: #d5d9e0; }
.auth .input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.auth .ifield:focus-within > .svg-i { color: var(--brand); }
.auth .ifield.pw .input { padding-right: 46px; }
.auth .ifield.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; background: none; border: 0; color: #8a919c; cursor: pointer; border-radius: 7px; }
.auth .ifield.pw button:hover { color: var(--brand); background: #eef0f3; }
.auth .ifield.pw button .svg-i { width: 18px; height: 18px; stroke-width: 1.6; }
.auth .btn-brand { height: 48px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 2px; }
.auth .btn-brand:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.auth .btn-brand:disabled { opacity: .65; cursor: default; }
.auth a { color: var(--brand); font-weight: 500; text-decoration: none; }
.auth a:hover { text-decoration: underline; }
.auth .opts { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.auth .opts a { display: inline-flex; align-items: center; gap: 6px; }
.auth .opts .svg-i { width: 16px; height: 16px; stroke-width: 1.6; }
.auth .chk { display: inline-flex; align-items: center; gap: 8px; color: #5b6472; cursor: pointer; user-select: none; }
.auth .chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.auth .op-link { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; padding-top: 18px; border-top: 1px solid #eef0f3; font-size: 13px; }
.auth .op-link .svg-i { width: 17px; height: 17px; stroke-width: 1.6; }
.auth .msg { font-size: 13px; border-radius: 8px; padding: 10px 12px; display: none; }
.auth .msg.err { display: block; background: #fdf2f2; color: #b42318; border: 1px solid #f5d5d2; }
.auth .msg.ok { display: block; background: #f0f9f4; color: #157f3b; border: 1px solid #d2ecdc; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth { min-height: 100vh; align-items: flex-start; padding: 72px 20px 32px; }
  .auth-top { top: 14px; right: 14px; }
}

/* ── App del operador (móvil) ────────────────────────────────────────── */
.op { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.op-h { background: #071b35; color: #fff; padding: calc(12px + env(safe-area-inset-top)) 16px 14px; }
.op-h .brand-s { font-weight: 800; letter-spacing: .14em; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.op-h .net { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgba(34,197,94,.2); color: #86efac; letter-spacing: 0; }
.op-h .net.off { background: rgba(245,165,36,.22); color: #fcd34d; }
.op-h .folio { font-size: 21px; font-weight: 750; margin-top: 8px; }
.op-h .route { color: #b6c6e0; font-size: 13.5px; }
.op-b { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 86px; }
.op-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.op-card .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.op-card h3 { font-size: 18px; margin: 4px 0 2px; }
.op-big { width: 100%; height: 58px; border-radius: 12px; border: 0; background: var(--primary); color: #fff; font: inherit; font-size: 17px; font-weight: 700; margin-top: 12px; cursor: pointer; }
.op-big:active { transform: scale(.99); }
.op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.op-tile { border: 1px solid var(--border-2); background: var(--panel-2); border-radius: 12px; min-height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--text); font: inherit; font-size: 13.5px; cursor: pointer; position: relative; }
.op-tile.done { border-color: var(--green); }
.op-tile .ok { position: absolute; top: 6px; right: 8px; color: var(--green); }
.op-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.op-steps li.done { color: var(--green); }
.op-steps li.cur { color: var(--blue); font-weight: 650; }
.op-steps li.todo { color: var(--muted); }
.op-tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 50; }
.op-tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.op-tabs button.on { color: var(--primary); }
.sig-pad { width: 100%; height: 220px; background: #fff; border-radius: 10px; touch-action: none; border: 1px solid var(--border-2); }

/* ── Responsivo ──────────────────────────────────────────────────────── */
@media (max-width: 1500px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .g-main, .g-detail, .g-dash { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phasebar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .top .burger { display: inline-grid; }
  .kpis, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3, .g-dash, .form-grid, .form-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .phasebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .userbox .n, .userbox .r { display: none; }
  .content { padding: 14px 12px 24px; }
  .ph { grid-template-columns: 28px minmax(0, 1fr); }
  .ph .when, .ph .src { grid-column: 2; justify-self: start; }
  .log .it { grid-template-columns: 1fr; gap: 2px; }
  .top .hide-sm { display: none; }
}
@media print {
  .side, .top, .footer, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ── Dashboard ejecutivo ─────────────────────────────────────────────── */
.dash-meta { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.dash-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.dash-meta b { font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dash { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: "map map crit crit" "map map ia ia" "eta st plants rank" "ops ops gps gps"; }
.dash > .a-ops { grid-area: ops; }
.ops-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); flex: none; }
.ops-kpis > div { padding: 9px 14px; border-right: 1px solid var(--border); min-width: 0; }
.ops-kpis > div:last-child { border-right: 0; }
.ops-kpis .t { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ops-kpis .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.35; }
.ops-kpis .d { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash .a-ops .tbl-wrap { max-height: 230px; }
.dash > .a-map { grid-area: map; } .dash > .a-crit { grid-area: crit; } .dash > .a-ia { grid-area: ia; }
.dash > .a-eta { grid-area: eta; } .dash > .a-st { grid-area: st; } .dash > .a-plants { grid-area: plants; }
.dash > .a-rank { grid-area: rank; } .dash > .a-gps { grid-area: gps; }
.dash .a-map .map { min-height: 440px; }
.dash .a-crit .tbl-wrap { max-height: 330px; }
.dash .donut-wrap { gap: 14px; padding: 14px; }
.dash .donut { width: 118px; height: 118px; }
.dash .legend { min-width: 140px; gap: 7px; font-size: 12.5px; }
.dash .dash-foot { padding: 0 14px 12px; }
.fs-more:empty { display: none; }
.fs-hide { display: none; }
#fs-btn .fs-off { display: none; }
#fs-btn > span { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 1500px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "map map" "crit crit" "ia ia" "eta st" "plants rank" "ops ops" "gps gps"; }
}
@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "crit" "ia" "eta" "st" "plants" "rank" "ops" "gps"; }
  .ops-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-kpis > div:nth-child(2) { border-right: 0; }
  .ops-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .dash .a-map .map { min-height: 320px; }
}

/* Pantalla completa: sin menú ni barra superior, todo cabe en la pantalla. */
body.dash-fs { overflow: hidden; }
body.dash-fs .side, body.dash-fs .top, body.dash-fs .footer, body.dash-fs .content > .notice { display: none; }
body.dash-fs .app { grid-template-columns: minmax(0, 1fr); height: 100vh; min-height: 0; }
body.dash-fs .main { height: 100vh; min-height: 0; overflow: hidden; }
body.dash-fs .content { height: 100vh; padding: 10px 14px 12px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body.dash-fs #fs-btn .fs-on { display: none; }
body.dash-fs #fs-btn .fs-off { display: inline-flex; }
body.dash-fs .page-h { margin-bottom: 8px; align-items: center; }
body.dash-fs .page-h h1 { font-size: 18px; }
body.dash-fs .kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; flex: none; }
body.dash-fs .kpi { padding: 8px 10px; gap: 8px; }
body.dash-fs .kpi .ic { width: 30px; height: 30px; }
body.dash-fs .kpi .v { font-size: 21px; }
body.dash-fs .kpi .d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.dash-fs .dash { flex: 1; min-height: 0; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1.15fr) minmax(0, .85fr) minmax(0, .95fr) minmax(0, .85fr);
  grid-template-areas: "map map crit crit" "map map ia ia" "eta st plants rank" "ops ops gps gps"; }
body.dash-fs .ops-kpis > div { padding: 5px 12px; }
body.dash-fs .ops-kpis .v { font-size: 17px; }
body.dash-fs .dash > .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body.dash-fs .dash .card-h { flex: none; padding-top: 7px; padding-bottom: 7px; min-height: 38px; }
body.dash-fs .dash .tbl-wrap { flex: 1; min-height: 0; max-height: none; overflow: hidden; }
body.dash-fs .dash .a-map .map { flex: 1; min-height: 0; }
body.dash-fs .dash .tbl-legend, body.dash-fs .dash .map-legend { flex: none; padding-top: 6px; padding-bottom: 6px; }
body.dash-fs .dash .donut-wrap { flex: 1; min-height: 0; flex-wrap: nowrap; padding: 6px 14px; gap: 14px; }
body.dash-fs .dash .donut { width: auto; height: 100%; max-height: 150px; aspect-ratio: 1; }
body.dash-fs .dash .dash-foot { flex: none; padding-bottom: 8px; }
@media (max-width: 1500px) { body.dash-fs .kpi .ic { display: none; } }
.fs-col { display: none; }
body.dash-fs .page-h > div:first-child { display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
body.dash-fs .page-h .sub { margin-top: 0; }
body.dash-fs .dash .legend { gap: 5px; font-size: 12.5px; min-width: 0; }
body.dash-fs .dash .donut { max-height: 140px; min-height: 60px; }
body.dash-fs .dash .donut .center b { font-size: 20px; }
@media (max-height: 860px) {
  body.dash-fs .dash .a-crit .tbl-legend { display: none; }
  body.dash-fs .dash .legend { gap: 2px; font-size: 12px; }
  body.dash-fs .dash .dash-foot { display: none; }
}
body.dash-fs .dash .donut .center span { font-size: 10.5px; }
.dash .donut .center span { font-size: 10px; }
/* Pantalla completa en celular o tablet: la vista de TV (todo en una pantalla) no cabe;
   se ocultan menú y barra superior pero el tablero sigue en columna y con scroll. */
@media (max-width: 900px) {
  body.dash-fs { overflow: auto; }
  body.dash-fs .app, body.dash-fs .main, body.dash-fs .content { height: auto; min-height: 100vh; overflow: visible; }
  body.dash-fs .content { display: block; padding: 12px 16px 16px; }
  body.dash-fs .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.dash-fs .kpi .ic { display: flex; }
  body.dash-fs .dash { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "map" "crit" "ia" "eta" "st" "plants" "rank" "ops" "gps"; }
  body.dash-fs .dash > .card { display: block; overflow: visible; }
  body.dash-fs .dash .tbl-wrap { overflow: auto; }
  body.dash-fs .dash .a-map .map { height: 320px; }
  body.dash-fs .dash .donut { height: 140px; }
  body.dash-fs .dash .dash-foot { display: block; }
}

/* Listados: orden por columna y paginación (cambio 26) */
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.th-sort:hover { color: var(--text); }
.th-sort.on { color: var(--text); }
.th-sort .ar { font-size: 11px; min-width: 8px; color: var(--blue); }
.pager { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pager .pp { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.pager .pp a, .pager .pages a, .pager .pages span { min-width: 28px; height: 26px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-2); text-decoration: none; font-variant-numeric: tabular-nums; }
.pager .pp a:hover, .pager .pages a:hover { background: var(--panel-2); }
.pager .pp a.on, .pager .pages a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.pager .pages { margin-left: auto; display: inline-flex; gap: 2px; }
.pager .pages .gap, .pager .pages .off { color: var(--muted); }
.filters .lbl { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.list-count { font-size: 12.5px; color: var(--muted); }

/* Permisos por rol (cambio 27) */
.perm-tbl td.center, .perm-tbl th.center { text-align: center; }
.perm-tbl tr.grp td { background: var(--panel-2); font-weight: 600; font-size: 12px; color: var(--text-2); text-transform: none; }
.perm-tbl input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; }

/* Módulos por cliente (cambio 28) */
.seg label { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-2); white-space: nowrap; }
.seg label.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.plan-note { margin-bottom: 12px; }

/* Buzón de documentos (cambio 30) */
.dropzone { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--border-2); border-radius: 10px; background: var(--panel-2); }
.dropzone > .svg-i { width: 26px; height: 26px; color: var(--muted); flex: none; }
.dropzone > div { flex: 1; }
.dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone { cursor: pointer; }
.dropzone .dz-mob { display: none; }
@media (hover: none), (max-width: 760px) { .dropzone .dz-desk { display: none; } .dropzone .dz-mob { display: inline; color: var(--blue); } .dropzone > .svg-i { width: 30px; height: 30px; color: var(--blue); } }
.cand { padding: 4px 0; display: block; }
.cand + .cand { border-top: 1px dashed var(--border); }
.cand .btn { margin-right: 6px; }

/* Escalamiento N0–N5 (cambio 31) */
.esc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .esc-grid { grid-template-columns: minmax(0, 1fr); } }
.esc-n { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 24px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; margin-right: 8px; }
.esc-grp { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: start; padding: 4px 0; }
.esc-grp > span { color: var(--muted); padding-top: 3px; }
.esc-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 5px; background: var(--red-soft); color: var(--red); margin-left: 4px; line-height: 1.7; }
details.alog { margin-top: 4px; font-size: 12px; }
details.alog summary { cursor: pointer; color: var(--muted); }
details.alog ul { margin: 4px 0 0; padding-left: 16px; color: var(--text-2); }

/* Rutas (cambio 34) */
dialog.modal.xl { width: min(1180px, calc(100vw - 24px)); }
.route-ed { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 14px; }
.route-ed .map { min-height: 460px; border-radius: 9px; }
@media (max-width: 900px) { .route-ed { grid-template-columns: minmax(0, 1fr); } .route-ed .map { min-height: 300px; } }
.ralt { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 5px; cursor: pointer; font-size: 12.5px; }
.ralt.on { border-color: var(--blue); background: var(--blue-soft); }
.ralt .sw { width: 18px; height: 4px; border-radius: 2px; flex: none; }

/* ── Pantalla completa de Torre de Control y Mapa (TW.fullscreen) ── */
.fs-btn > span { display: inline-flex; align-items: center; gap: 6px; }
.fs-btn .fs-off { display: none; }
body.page-fs .fs-btn .fs-on { display: none; }
body.page-fs .fs-btn .fs-off { display: inline-flex; }
@media (max-width: 900px) { .fs-btn { display: none; } }
body.page-fs { overflow: hidden; }
body.page-fs .side, body.page-fs .top, body.page-fs .footer, body.page-fs .content > .notice { display: none; }
body.page-fs .app { grid-template-columns: minmax(0, 1fr); height: 100vh; min-height: 0; }
body.page-fs .main { height: 100vh; min-height: 0; overflow: hidden; }
body.page-fs .content { height: 100vh; padding: 10px 14px 12px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body.page-fs .page-h { flex: none; margin-bottom: 8px; align-items: center; }
body.page-fs .page-h h1 { font-size: 18px; }
body.page-fs .page-h > div:first-child { display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
body.page-fs .page-h .sub { margin-top: 0; }
/* Torre de Control */
.tower-list { max-height: 640px; }
.tower-map { min-height: 330px; }
.tower-attn { max-height: 360px; overflow: auto; }
body.page-fs .page-h .tower-new { display: none; }
body.page-fs .phasebar { flex: none; gap: 8px; margin-bottom: 8px; }
body.page-fs .phasebar a { padding: 6px 10px; }
body.page-fs .phasebar .v { font-size: 19px; }
body.page-fs .tower-grid { flex: 1; min-height: 0; gap: 10px; }
body.page-fs .tower-grid > .card, body.page-fs .tower-grid .stack > .card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
body.page-fs .tower-grid .stack { min-height: 0; gap: 10px; }
body.page-fs .tower-grid .card-h, body.page-fs .tower-grid .map-legend { flex: none; }
body.page-fs .tower-list { flex: 1; min-height: 0; max-height: none; overflow: auto; }
body.page-fs .tower-grid .map-card { flex: 3; }
body.page-fs .tower-map { flex: 1; min-height: 0; }
body.page-fs .tower-grid .tower-attn-card { flex: 2; }
body.page-fs .tower-attn { flex: 1; min-height: 0; max-height: none; }
/* Mapa */
.map-box { position: relative; display: flex; min-height: 0; }
.map-box > .map { flex: 1; }
.map-box > .map-fs { position: absolute; top: 10px; right: 10px; z-index: 1000; box-shadow: var(--shadow); }
body.page-fs .mapwrap { flex: 1; height: auto; min-height: 0; }

/* Módulos por cliente: la opción elegida se ve sólida (contratado / prueba / apagado) */
.seg.st label.on[data-k="active"] { background: var(--primary); color: #fff; box-shadow: none; }
.seg.st label.on[data-k="trial"] { background: #c2410c; color: #fff; box-shadow: none; }
.seg.st label.on[data-k="off"] { background: #475569; color: #fff; box-shadow: none; }

/* Indicadores con 4 o 5 tarjetas; en celular pasan a 2 columnas */
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis.k4, .kpis.k5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Detalle del viaje en celular: unidad y operador primero, ETA arriba, fases plegables */
.card-b > .eta-box:first-child { margin-top: 0; margin-bottom: 12px; }
.ph-more { display: none; }
@media (max-width: 760px) {
  .g-detail { display: flex; flex-direction: column; gap: 14px; }
  .g-detail > .stack { display: contents; }
  .g-detail .m-first { order: -1; }
  .phases.m-fold .ph:not(.current) { display: none; }
  .ph-more { display: inline-flex; margin-top: 8px; }
  .eta-box { gap: 6px 18px; }
}

/* Paradas y recorrido detallado (TW.trackDetail) */
.stop-pin { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font: 600 11px/1 'Open Sans', sans-serif; color: #fff; background: #64748b; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.stop-pin.out { background: var(--red); }
.stop-pin.rest { background: var(--blue); }
.stop-pin.sm { width: 20px; height: 20px; font-size: 10px; border-width: 1.5px; box-shadow: none; }
.trk-f { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin-bottom: 12px; }
.trk-f .f { margin: 0; min-width: 0; }
.trk-f input, .trk-f select { min-width: 0; }
.trk-sum { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.trk-sum > div { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.trk-sum > div b { font-size: 15px; font-variant-numeric: tabular-nums; }
.trk-sum > div > span { font-size: 11.5px; color: var(--muted); }
.trk-sum > .trk-range { grid-column: 1 / -1; border: 0; padding: 0; }
.trk-gl { margin: 4px 0 0; padding-left: 18px; }
@media (max-width: 600px) { .trk-f .f { flex: 1 1 140px; } }

/* Dashboard: línea de POD (últimos 30 días) debajo de los indicadores */
.pod-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 14px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; }
.pod-strip:empty { display: none; }
.pod-strip a { color: inherit; text-decoration: none; white-space: nowrap; }
.pod-strip a:hover b { text-decoration: underline; }
.pod-strip .ps-i { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.pod-strip .ps-bar { flex: 1 1 120px; min-width: 80px; height: 6px; border-radius: 3px; overflow: hidden; display: flex; background: var(--panel-2); }
.pod-strip .ps-bar i { display: block; height: 100%; }
.pod-strip .ps-bar i.green { background: var(--green); } .pod-strip .ps-bar i.amber { background: var(--amber); }
.pod-strip .ps-bar i.orange { background: var(--orange); } .pod-strip .ps-bar i.red { background: var(--red); }
body.dash-fs .pod-strip { flex: none; margin: 0 0 8px; padding: 5px 12px; }
@media (max-width: 900px) { .pod-strip .ps-bar { flex-basis: 100%; order: 2; } .pod-strip .ps-i { order: 3; } }

/* BI · Analítica */
.bi-f { margin-bottom: 14px; }
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1200; background: var(--panel); border: 1px solid var(--border-2); border-radius: 9px; box-shadow: 0 10px 30px rgba(16,24,40,.16); max-height: 300px; overflow-y: auto; }
.ac-it { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.ac-it b { font-size: 13px; font-weight: 600; } .ac-it span { font-size: 12px; color: var(--muted); }
.ac-it:hover, .ac-it.on { background: var(--primary-soft); }
.ac-src { font-size: 10.5px; color: var(--muted); padding: 4px 12px; text-align: right; }
.dsel { position: relative; }
.dsel-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.dsel-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.dsel-btn .dsel-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsel-btn.err { border-color: var(--red); }
.dsel-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1300; background: var(--panel); border: 1px solid var(--border-2); border-radius: 9px; box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 6px; }
.dsel-pop .dsel-q { height: 32px; margin-bottom: 6px; }
.dsel-list { max-height: 280px; overflow-y: auto; }
.dsel-it { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.dsel-it:hover, .dsel-it.on { background: var(--primary-soft); }
.dsel-it.sel { font-weight: 600; } .dsel-it.dis { opacity: .45; cursor: default; }
.dsel-empty { padding: 10px; font-size: 12.5px; color: var(--muted); }
.dsel-leg { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 6px; padding: 6px 4px 2px; font-size: 11px; color: var(--muted); }
.dsel-leg .gdot { margin-left: 6px; } .dsel-leg .gdot:first-child { margin-left: 0; }
.gdot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; box-sizing: border-box; }
.gdot.on { background: var(--green); }
.gdot.off { background: #9aa3ae; }
.gdot.none { border: 1.5px solid #9aa3ae; background: transparent; }
.gdot.blank { visibility: hidden; }
form.filters.loading { opacity: .6; pointer-events: none; transition: opacity .15s; }
.bi-q { margin-right: 4px; }
.bi-k small.bi-d { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.bi-k small.bi-d.g { color: var(--green); } .bi-k small.bi-d.r { color: var(--red); }
@media print { .bi-q { display: none !important; } }
.bi-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.bi-k { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bi-k span { font-size: 12px; color: var(--muted); }
.bi-k b { font-size: 26px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bi-k b em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted); }
.bi-k small { font-size: 11.5px; color: var(--muted); }
.bi-ins { margin-bottom: 14px; }
.bi-ins ul { margin: 0; padding: 12px 18px 14px 34px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; }
.bi-ins li { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.bi-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.bi-grid > .card { margin: 0; min-width: 0; }
.bi-grid > .bi-full { grid-column: 1 / -1; }
.bi-grid > .card:nth-child(3), .bi-grid > .card:nth-child(4) { grid-column: span 1; }
.bi-grid > .card:nth-child(3) { grid-column: 1 / 2; }
.bi-chart { width: 100%; position: relative; }
.bi-chart svg { display: block; overflow: visible; }
.bi-leg { display: inline-flex; align-items: center; gap: 6px 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.bi-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 -2px 0 6px; vertical-align: -1px; }
.bi-leg i.ok { background: var(--green); } .bi-leg i.late { background: var(--red); } .bi-leg i.open { background: var(--border-2); }
.bi-bar { display: inline-block; vertical-align: middle; width: calc(100% - 52px); max-width: 160px; height: 8px; border-radius: 4px; background: var(--panel-3); margin-right: 8px; overflow: hidden; }
.bi-bar span { display: block; height: 100%; border-radius: 4px; }
.bi-bar .g { background: var(--green); } .bi-bar .a { background: var(--amber); } .bi-bar .r { background: var(--red); }
.bi-tip { position: fixed; z-index: 2000; display: none; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.14); max-width: 260px; }
@media (max-width: 1300px) { .bi-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .bi-grid { grid-template-columns: minmax(0, 1fr); } .bi-grid > .card { grid-column: 1 / -1 !important; } .bi-ins ul { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .bi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bi-k b { font-size: 22px; } }
@media print { .bi-f, .bi-tip { display: none !important; } .bi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .bi-grid > .card { break-inside: avoid; } }
.bi-k.click { cursor: pointer; } .bi-k.click:hover { border-color: var(--border-2); background: var(--panel-2); }

/* Marcas de documentos (✓/✗) en tractores, remolques y operadores */
.dmk { display: inline-flex; gap: 2px; white-space: nowrap; }
.dmk > span { display: inline-block; min-width: 24px; text-align: center; font-weight: 700; font-size: 13px; line-height: 18px; }
.dmk.dmk-h { display: flex; margin-top: 3px; }
.dmk-h > span { font-weight: 600; font-size: 10.5px; color: var(--muted); letter-spacing: .02em; cursor: help; }
.dmk .ok { color: var(--green); } .dmk .soon, .dmk .review { color: var(--amber); }
.dmk .expired { color: var(--red); } .dmk .missing { color: var(--muted); opacity: .55; }
.dmk-legend { margin: 0 0 10px; line-height: 1.9; }
.dmk-legend .dmk > span { min-width: 0; }
.dmk-legend .sep { display: inline-block; width: 14px; }

/* Flota: documentos de la empresa */
.codocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
.codoc { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; color: inherit; text-decoration: none; }
.codoc:hover { border-color: var(--muted); }
.codoc .mk { font-weight: 700; font-size: 16px; width: 18px; text-align: center; }
.codoc b { display: block; font-size: 13px; font-weight: 600; } .codoc small { display: block; font-size: 11.5px; color: var(--muted); }
.codoc.ok .mk { color: var(--green); } .codoc.soon .mk, .codoc.review .mk { color: var(--amber); } .codoc.soon small, .codoc.review small { color: var(--amber); }
.codoc.expired .mk, .codoc.expired small { color: var(--red); } .codoc.missing .mk { color: var(--muted); opacity: .6; }
.cofleet { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.cofleet a { color: inherit; }

/* Interruptor (MARIA IA por número) */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 20px; transition: background .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Conversación de WhatsApp */
.wa-thread { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; padding: 10px; background: var(--panel-2); border-radius: 8px; }
.wa-msg { max-width: 78%; padding: 7px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; background: var(--panel); border: 1px solid var(--border); align-self: flex-start; }
.wa-msg.out { align-self: flex-end; background: var(--green-soft); border-color: transparent; }
.wa-msg span { display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
@media (max-width: 760px) { #dlg-wa .modal-b { grid-template-columns: 1fr !important; } }

/* ── Tickets TI ─────────────────────────────────────────────────────── */
.tk-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .tk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.tk-dot.red { background: var(--red); } .tk-dot.orange { background: var(--orange); } .tk-dot.amber { background: var(--amber); } .tk-dot.green { background: var(--green); }
.tk-flow { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tk-flow-note { margin-left: auto; }
.tk-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-areas: 'info reply' 'log reply'; align-items: start; }
.tk-a-info { grid-area: info; } .tk-a-log { grid-area: log; } .tk-a-reply { grid-area: reply; position: sticky; top: 70px; }
@media (max-width: 980px) { .tk-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'info' 'reply' 'log'; } .tk-a-reply { position: static; } }
.tk-filters select { width: auto; max-width: 220px; height: 32px; font-size: 12.5px; padding: 0 28px 0 10px; }
.tk-h { font-size: 13px; margin: 18px 0 6px; }
.tk-text { line-height: 1.55; overflow-wrap: anywhere; }
.tk-note { margin-top: 6px; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; }
.tk-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tk-file { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit; font-size: 13px; }
.tk-file:hover { border-color: var(--blue); text-decoration: none; }
.tk-file span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-tl { position: relative; }
.tk-ev { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tk-ev:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.tk-node { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--blue); background: var(--panel); flex: none; margin-top: 3px; }
.tk-ev.status .tk-node { background: var(--blue); }
.tk-ev.edit .tk-node { border-color: var(--muted); }
.tk-ev > div { min-width: 0; flex: 1; }
.tk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tk-other { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.tk-other button.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; }
.tk-other button.link:hover { text-decoration: underline; }
input[name="cp_uuid"]::placeholder { text-transform: none; }

/* Equipos GPS del viaje (tractor y remolques) */
.dev { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0; font-size: 12.5px; line-height: 1.4; }
.dev-r { color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-s { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; white-space: nowrap; flex: none; }
.dev-s:before, .dev-c:before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dev-s.green, .dev-c.green { color: var(--green); } .dev-s.amber, .dev-c.amber { color: var(--amber); } .dev-s.red, .dev-c.red { color: var(--red); } .dev-s.muted, .dev-c.muted { color: var(--muted); }
.devs { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; line-height: 1.4; margin-top: 1px; }
.dev-c { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; cursor: default; }
.kv > .full { grid-column: 1 / -1; }
details.devd > summary { display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; user-select: none; }
details.devd > summary::-webkit-details-marker { display: none; }
details.devd > summary .k { font-size: 11.5px; color: var(--muted); }
details.devd > summary:after { content: ''; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -3px 0 0 2px; transition: transform .15s; }
details.devd[open] > summary:after { transform: rotate(-135deg); margin-top: 3px; }
.devd-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.devd-dot.green { background: var(--green); } .devd-dot.muted { background: #c3c8cf; }
.devd-n { font-size: 12px; color: var(--text-2); }
details.devd > .v { margin-top: 4px; padding-left: 15px; }
/* Botón con aspecto de enlace (números que abren un detalle) */
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--primary); }
span.sev { display: inline-block; margin: 0 2px 0 0; vertical-align: middle; }
/* Campana de alertas en celular: el menú ocupa el ancho de la pantalla (antes se salía por la izquierda) */
.notif-list a .grow { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .drop-menu.notif-list { position: fixed; left: 10px; right: 10px; top: 64px; width: auto; max-height: calc(100vh - 90px); }
}
.notif-list .hd b { white-space: nowrap; }
.notif-list .hd a { display: inline; width: auto; padding: 0; white-space: nowrap; color: var(--blue); }
/* Carga masiva: zona para arrastrar el archivo */
.cat-dz { padding: 9px 14px; gap: 12px; min-height: 42px; }
.cat-dz > .svg-i { width: 22px; height: 22px; }
.cat-dz #cat-dz-t { font-size: 13.5px; }
/* ── Chat flotante de MARIA IA (Soporte 24/7) ── */
.sup { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.sup > * { pointer-events: auto; }
.sup-box { width: 380px; height: min(600px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: 0 18px 48px rgba(16,24,40,.22); overflow: hidden; }
.sup-h { display: flex; align-items: center; gap: 10px; padding: 11px 10px 11px 14px; background: var(--primary); color: #fff; }
.sup-h small { display: block; opacity: .85; font-size: 11.5px; margin-top: 2px; }
.sup-h .iconbtn { color: #fff; background: transparent; border-color: transparent; }
.sup-h .iconbtn:hover { background: rgba(255,255,255,.15); }
.sup-av { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 700; flex: none; }
.sup-log { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.sup-m { display: flex; flex-direction: column; align-items: flex-start; max-width: 100%; }
.sup-m.me { align-items: flex-end; }
.sup-m small { font-size: 10.5px; color: var(--muted); margin: 3px 6px 0; }
.sup-b { max-width: 88%; padding: 9px 12px; border-radius: 14px; border-bottom-left-radius: 4px; background: var(--panel); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.sup-m.me .sup-b { background: var(--primary); color: #fff; border-color: var(--primary); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.sup-b p { margin: 0 0 6px; } .sup-b p:last-child { margin: 0; }
.sup-b ol, .sup-b ul { margin: 4px 0 6px; padding-left: 20px; }
.sup-refs { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.sup-refs span { font-size: 11.5px; color: var(--muted); }
.sup-refs a { font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); text-decoration: none; }
.sup-typing .sup-b span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin: 0 2px; animation: supb 1s infinite; }
.sup-typing .sup-b span:nth-child(2) { animation-delay: .15s; } .sup-typing .sup-b span:nth-child(3) { animation-delay: .3s; }
@keyframes supb { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.sup-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 8px; background: var(--bg); }
.sup-sug .chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); text-align: left; }
.sup-sug .chip:hover { border-color: var(--primary); color: var(--primary); }
.sup-f { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); background: var(--panel); }
.sup-f textarea { flex: 1; resize: none; border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13.5px; background: var(--panel); color: var(--text); max-height: 120px; }
.sup-f textarea:focus { outline: none; border-color: var(--primary); }
.sup-ft { font-size: 11.5px; color: var(--muted); padding: 0 12px 9px; background: var(--panel); }
@media (max-width: 600px) {
  .sup { right: 12px; bottom: 12px; }
  .sup.open { inset: 0; right: 0; bottom: 0; }
  .sup.open .sup-box { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}
@media print { .sup { display: none; } }
/* Celular: los indicadores del encabezado de una tarjeta pasan a otra línea (no ensanchan la página) */
@media (max-width: 600px) { .card-h { flex-wrap: wrap; row-gap: 6px; } .card-h .tools { flex-wrap: wrap; min-width: 0; max-width: 100%; } }
/* MARIA dentro de Ayuda y manual: la ventanita se acomoda en la columna derecha */
.sup.docked { position: static; z-index: auto; display: block; pointer-events: auto; }
.sup.docked .sup-box { width: 100%; height: calc(100vh - 180px); min-height: 420px; box-shadow: var(--shadow); border-radius: 12px; border-color: var(--border); }
.sup.docked [data-sup-min] { display: none; }
