/* Estilos base tomados del CRM Síguelo Gestión (soporte-wialon/public/app.css) para mantener la misma apariencia. */
:root {
  --ink: #15181D;
  --ink-2: #3A414C;
  --muted: #5B6370;
  --line: #E2E5EA;
  --line-2: #EEF0F3;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --soft: #F7F8FA;
  --marca: #FFD500;
  --marca-ambar: #FFBF00;
  --marca-naranjo: #FFAA00;
  --marca-suave: #FFF7CC;
  --marca-texto: #6B4A00;
  --amber-ink: #8A3B06;
  --amber-soft: #FEF3E2;
  --red: #B42318;
  --red-soft: #FDECEA;
  --green: #1E7B3A;
  --green-soft: #E6F4EA;
  --blue: #1E3A8A;
  --blue-soft: #E8EEFC;
  --purple: #581C87;
  --purple-soft: #F3E8FF;
  --teal: #0F5F58;
  --teal-soft: #DDF3F0;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --c-v0: #B42318;
  --c-vlow: #D97706;
  --c-com: #1D4ED8;
  --c-gps: #7E22CE;
  --c-unk: #6B7280;
  --c-sim: #0F766E;
  --menu: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); min-height: 100vh; }
a { color: var(--ink); text-decoration-color: var(--marca-naranjo); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: #000; text-decoration-color: var(--ink); }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.peq { font-size: 12px; }
.b { font-weight: 600; }
[hidden] { display: none !important; }
.oculto { display: none !important; }

/* ── Estructura: menú lateral plegable + contenido ── */
.app { display: grid; grid-template-columns: var(--menu) minmax(0, 1fr); min-height: 100vh; }
.app.plegada { --menu: 64px; }
.menu { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.menu > * { flex-shrink: 0; } /* con muchos módulos el menú se desplaza: los títulos de grupo no se aplastan */
.menu-marca { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 14px; }
.menu-marca img { height: 32px; width: auto; display: block; }
.menu-marca .marca-pin { display: none; }
.plegada .menu-marca .logo { display: none; }
.plegada .menu-marca .marca-pin { display: block; height: 34px; }
.plegada .menu-marca { flex-direction: column; gap: 10px; padding-bottom: 10px; }
.menu-grupo { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; white-space: nowrap; overflow: hidden; }
.plegada .menu-grupo { height: 8px; padding: 0; margin: 6px 0; border-top: 1px solid var(--line-2); font-size: 0; }
.menu a.item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.menu a.item:hover { background: var(--soft); color: var(--ink); }
.menu a.item[aria-current="page"] { background: var(--marca); color: var(--ink); font-weight: 600; }
.menu a.item svg { flex-shrink: 0; }
.plegada .menu a.item span { display: none; }
.plegada .menu a.item { justify-content: center; padding: 0; }
.menu-pie { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.menu-usuario { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--soft); border: 0; width: 100%; text-align: left; cursor: pointer; }
.menu-usuario .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--marca); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex-shrink: 0; }
.menu-usuario div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.menu-usuario b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-usuario span { font-size: 12px; color: var(--muted); }
.plegada .menu-usuario div { display: none; }
.plegada .menu-usuario { justify-content: center; padding: 6px 0; }
.btn-plegar { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); flex-shrink: 0; }
.plegada .menu-marca { justify-content: center; }

.principal { display: flex; flex-direction: column; min-width: 0; }
.barra { height: 60px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 20px; position: sticky; top: 0; z-index: 50; }
.barra .titulo { font-size: 16px; font-weight: 600; white-space: nowrap; }
.buscar { flex: 1; max-width: 520px; position: relative; }
.buscar input { width: 100%; min-height: 38px; padding: 0 12px 0 36px; border-radius: 8px; border: 1px solid #D0D5DD; background: var(--soft); }
.buscar svg { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.buscar-res { position: absolute; top: 44px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,24,30,.14); max-height: 420px; overflow: auto; z-index: 60; }
.buscar-res a { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.buscar-res a:hover { background: var(--soft); }
.buscar-res a small { color: var(--muted); }
.buscar-res .tipo { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--marca-texto); }
.barra .acciones { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.barra .btn-menu-movil { display: none; } /* solo en celular (abre el menú); en escritorio el menú se pliega con su propio botón */
.contenido { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 18px; }

/* ── Botones y controles ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid #D0D5DD; background: var(--card); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--soft); color: var(--ink); }
.btn.primario { background: var(--marca); border-color: var(--marca-ambar); color: var(--ink); font-weight: 600; }
.btn.primario:hover { background: var(--marca-ambar); }
.btn.oscuro { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.oscuro:hover { background: #000; color: #fff; }
.btn.contorno { border: 1.5px solid var(--ink); font-weight: 600; }
.btn.peligro { color: var(--red); border-color: #F2C9C4; }
.btn.peligro:hover { background: var(--red-soft); }
.btn.peq { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.grande { min-height: 46px; padding: 0 18px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-icono { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #D0D5DD; background: var(--card); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.btn-icono:hover { background: var(--soft); }
.campo { min-height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid #D0D5DD; background: var(--card); font-size: 14px; max-width: 100%; }
textarea.campo { padding: 8px 10px; min-height: 76px; resize: vertical; width: 100%; }
select.campo { padding-right: 28px; }
.campo:disabled { background: var(--soft); color: var(--muted); }
.campos { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.campos label, .etiqueta { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.campos label > .campo, .etiqueta > .campo { color: var(--ink); }
.campos label.ancho, .etiqueta.ancho { flex: 1 1 100%; }
.segmentado { display: inline-flex; background: #E6E8EC; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmentado button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); font: 500 13px/1 var(--sans); cursor: pointer; }
.segmentado button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(20,24,30,.15); }
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: #C4C9D1; transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { left: 21px; background: var(--marca); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── Chips, estados, tarjetas ── */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok, .chip.ins { background: var(--green-soft); color: #14532D; }
.chip.rev, .chip.info, .chip.sim { background: var(--blue-soft); color: var(--blue); }
.chip.man, .chip.aviso { background: var(--amber-soft); color: #7C2D12; }
.chip.aviso, .chip.error { padding: 2px 8px; border-radius: 999px; font-size: 12px; } /* «aviso» y «error» también son clases de bloque */
.chip.des { background: var(--purple-soft); color: var(--purple); }
.chip.error, .chip.baja, .chip.norep { background: var(--red-soft); color: #8F1B12; }
.chip.marca { background: var(--marca-suave); color: var(--marca-texto); }
.chip.teal { background: var(--teal-soft); color: var(--teal); }
.chip.sin { background: transparent; color: var(--muted); padding-left: 0; }
.pat { font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: .03em; background: #fff; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.pat.grande { font-size: 24px; letter-spacing: .04em; padding: 2px 12px; border-width: 2px; border-radius: 6px; }
.dias { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 6px; font: 600 13px/1 var(--mono); white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.dias.d7 { background: var(--amber-soft); color: #B45309; }
.dias.d15 { background: var(--red-soft); color: var(--red); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.avatar-peq { width: 26px; height: 26px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.tarjeta { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.tarjeta.pad { padding: 18px 20px; }
.bloque { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.bloque h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bloque h2 .num { font: 600 13px/1 var(--mono); background: var(--marca); border-radius: 6px; padding: 4px 7px; margin-right: 6px; }
.bloque p.ayuda, .ayuda { font-size: 13px; color: var(--muted); }
.aviso { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.aviso.error { background: var(--red-soft); color: #7A1A12; }
.aviso.info { background: var(--amber-soft); color: var(--amber-ink); }
.aviso.ok { background: var(--green-soft); color: #14532D; }
.aviso.neutro { background: var(--soft); border: 1px solid var(--line); color: var(--ink-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 30px; font-weight: 600; line-height: 1.1; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi small.mal { color: var(--red); font-weight: 500; }
.pagina-cab { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.pagina-cab h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.pagina-cab p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.pagina-cab .acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.pagina-cab > div:first-child { min-width: 0; }
.columnas { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.columnas-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.columnas-3 { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr) minmax(0, 320px); gap: 18px; align-items: start; }
.filtros-fila { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filtro { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid #D0D5DD; background: var(--card); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.filtro[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filtro .n { font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 6px; background: rgba(0,0,0,.08); }
.filtro[aria-pressed="true"] .n { background: rgba(255,255,255,.2); }

/* ── Tablas y listas ── */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 13px; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: var(--soft); }
.tabla tr[aria-selected="true"] td { background: var(--marca-suave); }
.tabla-env { overflow: auto; border-radius: 12px; }
.lista-items { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--card); cursor: pointer; font: inherit; color: inherit; }
.item:hover { background: var(--soft); }
.item[aria-pressed="true"], .item.sel { background: var(--marca-suave); box-shadow: inset 4px 0 0 var(--marca); }
.item-txt { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.item-txt b { font-size: 14px; }
.item-txt span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.item-der { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.dato { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dato span:first-child { font-size: 12px; color: var(--muted); }
.dato .v { font-weight: 500; overflow-wrap: anywhere; }
.dato .v.mal { color: var(--red); }
.rejilla-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.rejilla-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.rejilla-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.historial { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.historial li { display: flex; gap: 10px; align-items: flex-start; }
.historial .marca-ev { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--marca-naranjo); }
.historial .marca-ev.persona { background: var(--ink); }
.historial .marca-ev.error { background: var(--red); }
.historial .marca-ev.regla { background: var(--c-com); }
.historial small { display: block; font-size: 12px; color: var(--muted); }
.historial p { font-size: 13px; line-height: 1.45; }
.sec { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.sec + .sec { border-top: 1px solid var(--line); }
.sec h3 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.sec h3.grande { font-size: 15px; color: var(--ink); }
.vacio { padding: 24px 16px; text-align: center; color: var(--muted); }

/* ── Kanban ── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #ECEEF1; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col.sobre { outline: 2px dashed var(--marca-ambar); }
.col-cab { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 6px; font-weight: 600; font-size: 14px; }
.col-cab span { color: var(--muted); font-weight: 500; font-size: 13px; }
.ficha { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; text-decoration: none; color: inherit; }
.ficha:hover { border-color: #B8BEC7; }
.ficha.arrastrando { opacity: .5; }
.ficha .fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ficha .pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line-2); padding-top: 8px; font-size: 12px; color: var(--muted); }
.ficha b { font-weight: 500; font-size: 14px; }

/* ── Modal ── */
.modal-fondo { position: fixed; inset: 0; background: rgba(21,24,29,.5); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { background: var(--card); border-radius: 14px; width: min(720px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal.ancho { width: min(980px, 100%); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-cab h2 { font-size: 17px; font-weight: 600; }
.modal-cuerpo { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.modal-pie { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.error { background: #7A1A12; }
.toast.ok { background: #14532D; }
.toast.toast-deshacer { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.toast-deshacer .toast-txt { flex: 1; min-width: 0; }
.toast-deshacer .toast-cuenta { font: 12px var(--mono); color: #AEB4BE; }
.toast-deshacer .toast-btn { background: transparent; border: 0; color: var(--marca); font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.toast-deshacer .toast-btn:hover { background: rgba(255,255,255,.08); }

/* ── Gráficos simples ── */
.barras-v { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; align-items: end; height: 180px; border-bottom: 1px solid #D0D5DD; }
.barras-v .barra { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 12px; color: var(--ink-2); }
.barras-v .barra i { display: block; width: 100%; background: #2F5BD3; border-radius: 4px 4px 0 0; }
.barras-pie { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; font-size: 11px; color: var(--muted); text-align: center; }
.barra-h { display: grid; grid-template-columns: 180px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.barra-h i { display: block; height: 14px; background: #2F5BD3; border-radius: 0 4px 4px 0; min-width: 2px; }
.barra-h .n { text-align: right; color: var(--ink-2); }
.barras { display: flex; align-items: flex-end; gap: 4px; height: 70px; border-bottom: 1px solid #D0D5DD; padding-bottom: 1px; }
.barras .barra { flex: 1; border-radius: 3px 3px 0 0; background: #9AA3AF; min-height: 3px; }
.barras .barra.vacia { height: 6px !important; background: #DADDE3; }
.barras .barra.cero { background: var(--red); }

/* ── Responsive (CRM) ── */
@media (max-width: 1180px) {
  .columnas, .columnas-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app.plegada { --menu: 236px; }
  .menu { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 950; transform: translateX(-100%); transition: transform .15s; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .app.menu-abierto .menu { transform: none; }
  .plegada .menu a.item span, .plegada .menu-usuario div, .plegada .menu-marca .logo { display: initial; }
  .plegada .menu-marca { flex-direction: row; }
  .plegada .menu a.item { justify-content: flex-start; padding: 0 10px; }
  .plegada .menu-grupo { height: auto; padding: 12px 10px 4px; font-size: 11px; border: 0; }
  .btn-plegar { display: none; }
  .barra .btn-menu-movil { display: inline-flex; }
  .menu-marca .marca-pin, .plegada .menu-marca .marca-pin { display: none; }
  .barra { padding: 0 12px; }
  .barra .titulo { display: none; }
  .contenido { padding: 14px 12px 40px; }
  .columnas-2, .rejilla-3, .rejilla-4 { grid-template-columns: minmax(0, 1fr); }
  .rejilla-2 { grid-template-columns: minmax(0, 1fr); }
  .kanban { grid-auto-columns: minmax(230px, 80vw); }
  .modal-fondo { padding: 12px; }
}

/* ════════════════ Síguelo On Mix: despacho ════════════════ */
.reloj { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 8px; background: var(--ink); color: #fff; font: 600 14px/1 var(--mono); white-space: nowrap; }
.reloj small { font: 500 11px/1 var(--sans); color: var(--marca); text-transform: uppercase; letter-spacing: .05em; }
.campana { position: relative; }
.campana .n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 600 11px/18px var(--mono); text-align: center; }
.menu a.item .n { margin-left: auto; font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 6px; background: var(--red); color: #fff; }
.plegada .menu a.item .n { display: none; }
.est { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 6px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.est i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.barra-progreso { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; min-width: 80px; }
.barra-progreso i { display: block; height: 100%; background: var(--green); border-radius: 4px; }

/* Flota por estado */
.flota { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.flota-col { background: #ECEEF1; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 96px; border-top: 4px solid var(--c); }
.flota-col h3 { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; font-weight: 600; padding: 2px 4px 4px; }
.flota-col h3 span { font: 600 12px/1 var(--mono); color: var(--muted); }
.cam { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; text-decoration: none; color: inherit; font-size: 12px; }
.cam:hover { border-color: #B8BEC7; }
.cam .fila { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.cam .t { font: 600 11px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.cam .t.mal { color: var(--red); }
.cam small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam.alerta { border-color: #F2C9C4; box-shadow: inset 3px 0 0 var(--red); }

/* Línea de tiempo por obra */
.gantt { --izq: 230px; display: flex; flex-direction: column; overflow-x: auto; }
.gantt-fila { display: grid; grid-template-columns: var(--izq) minmax(640px, 1fr); border-bottom: 1px solid var(--line-2); min-height: 52px; }
.gantt-fila:last-child { border-bottom: 0; }
.gantt-eti { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; justify-content: center; border-right: 1px solid var(--line); min-width: 0; position: sticky; left: 0; background: var(--card); z-index: 3; }
.gantt-eti b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-eti a { text-decoration: none; }
.gantt-eti span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-pista { position: relative; }
.gantt-cab .gantt-pista { height: 30px; }
.gantt-cab .gantt-eti { font-size: 12px; color: var(--muted); font-weight: 600; }
.gantt-hora { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); font: 500 11px/1 var(--mono); color: var(--muted); padding: 9px 0 0 4px; }
.gantt-cuerpo .gantt-pista { background-image: linear-gradient(to right, var(--line-2) 1px, transparent 1px); background-size: var(--paso-hora) 100%; }
.gantt-ahora { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.gantt-ahora[data-hora]::before { content: attr(data-hora); position: absolute; top: 2px; left: 4px; font: 600 10px/1 var(--mono); color: var(--red); background: var(--card); padding: 1px 3px; border-radius: 3px; }
.gantt-v { position: absolute; height: 14px; border-radius: 4px; display: flex; overflow: hidden; text-decoration: none; min-width: 4px; }
.gantt-v.plan { height: 10px; border: 1.5px dashed #9AA3AF; background: rgba(255,255,255,.6); border-radius: 4px; }
.gantt-v.real { gap: 2px; background: var(--card); box-shadow: 0 0 0 1px var(--card); }
.gantt-v.real i { display: block; height: 100%; background: var(--c); }
.gantt-v.real i:first-child { border-radius: 4px 0 0 4px; }
.gantt-v.real i:last-child { border-radius: 0 4px 4px 0; }
.gantt-v.real i:only-child { border-radius: 4px; }
.gantt-v:hover { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 4; }
.gantt-v.real b { position: absolute; left: 4px; top: 0; font: 600 10px/14px var(--mono); color: #fff; pointer-events: none; }
.leyenda-est { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); align-items: center; }
.leyenda-est span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda-est i { width: 14px; height: 10px; border-radius: 3px; background: var(--c); }
.leyenda-est i.plan { background: transparent; border: 1.5px dashed #9AA3AF; }
.tip { position: fixed; z-index: 3000; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.45; pointer-events: none; max-width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.tip b { color: var(--marca); }

.gantt.sin-eti .gantt-fila { grid-template-columns: minmax(480px, 1fr); }
.gantt.sin-eti .gantt-eti { display: none; }
.obra-pin { width: 14px; height: 14px; border-radius: 3px; background: #8E3FD0; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* Alertas */
.alerta-it { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.alerta-it:last-child { border-bottom: 0; }
.alerta-it .sev { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--marca-naranjo); }
.alerta-it.alta .sev { background: var(--red); }
.alerta-it.cerrada { opacity: .65; }
.alerta-it .txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.alerta-it .txt b { font-size: 14px; font-weight: 600; }
.alerta-it .txt span { font-size: 13px; color: var(--ink-2); }
.alerta-it .txt small { font-size: 12px; color: var(--muted); }
.alerta-it .der { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* Mapa */
.mapa-env { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; height: calc(100vh - 60px - 120px); min-height: 460px; overflow: hidden; }
.mapa-caja { position: relative; min-height: 0; }
#mapa { position: absolute; inset: 0; }
.mapa-lado { border-left: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.mapa-lado .item { padding: 10px 14px; }
.marcador { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; color: #fff; }
.marcador svg { width: 16px; height: 16px; }
.marcador-eti { position: absolute; left: 34px; top: 6px; white-space: nowrap; font: 600 11px/1 var(--mono); background: #fff; border: 1.5px solid var(--ink); border-radius: 4px; padding: 2px 4px; color: var(--ink); }
.leaflet-container { font: 13px/1.4 var(--sans); }
.mapa-leyenda { position: absolute; z-index: 500; left: 12px; bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }

/* Hitos del viaje */
.hitos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hitos li { display: grid; grid-template-columns: 18px minmax(0, 1fr) 64px 64px 70px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.hitos li:last-child { border-bottom: 0; }
.hitos li.cab { font-size: 12px; color: var(--muted); font-weight: 600; }
.hitos .p { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--c, #9AA3AF); background: var(--card); }
.hitos li.hecho .p { background: var(--c, var(--ink)); }
.hitos .mono { text-align: right; }
.dif.mal { color: var(--red); font-weight: 600; }
.dif.ok { color: var(--green); }
.mapa-viaje { height: 360px; border-radius: 0 0 12px 12px; }
.plan-tabla td, .plan-tabla th { font-family: var(--sans); }
.plan-tabla td.mono { font-family: var(--mono); }
.resumen-plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.resumen-plan .kpi { padding: 10px 12px; }
.resumen-plan .kpi b { font-size: 22px; }

@media (max-width: 1180px) {
  .flota { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mapa-env { grid-template-columns: minmax(0, 1fr); height: auto; }
  .mapa-caja { height: 460px; }
  .mapa-lado { border-left: 0; border-top: 1px solid var(--line); max-height: 360px; }
}
@media (max-width: 860px) {
  .flota { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gantt { --izq: 150px; }
  .reloj small { display: none; }
  .hitos li { grid-template-columns: 18px minmax(0, 1fr) 54px 54px; }
  .hitos li > :nth-child(5) { display: none; }
}

/* ── Aviso de modo demostración ── */
.aviso-modo { background: var(--amber-soft); color: var(--amber-ink); font-size: 13px; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.aviso-modo a { color: inherit; font-weight: 600; }
.aviso-modo.soporte { background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Configuración ── */
.pasos { display: flex; flex-direction: column; gap: 2px; }
.paso { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.paso:last-child { border-bottom: 0; }
.paso .marca { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--mono); background: var(--soft); border: 1px solid var(--line); flex-shrink: 0; }
.paso.hecho .marca { background: var(--green-soft); border-color: transparent; color: #14532D; }
.paso .txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.paso .txt span { font-size: 13px; color: var(--muted); }
.lista-chequeo { max-height: 420px; overflow: auto; }
.lista-chequeo td:first-child, .lista-chequeo th:first-child { width: 36px; }

/* ── Editor de geocercas ── */
.geo-env { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 60px - 120px); min-height: 520px; overflow: hidden; }
.geo-lado { border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.geo-lado .item { padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.geo-lado .item:hover { background: var(--soft); }
.geo-lado .item[aria-selected="true"] { background: var(--marca-suave); }
.geo-lado .item .txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.geo-lado .item .txt span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-lado .grupo { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 6px; display: flex; justify-content: space-between; align-items: center; }
.geo-form { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); background: var(--soft); }
.geo-mapa { position: relative; min-height: 0; }
.geo-mapa #mapa-geo { position: absolute; inset: 0; }
.geo-mapa.marcando #mapa-geo { cursor: crosshair; }
.geo-pista { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--ink); color: #fff; font-size: 13px; padding: 8px 14px; border-radius: 999px; pointer-events: none; }
.geo-buscar { position: absolute; top: 12px; right: 12px; z-index: 500; width: min(340px, calc(100% - 24px)); }
.geo-buscar .buscar-res { top: 42px; }
@media (max-width: 900px) {
  .geo-env { grid-template-columns: minmax(0, 1fr); height: auto; }
  .geo-mapa { height: 460px; order: -1; }
  .geo-lado { border-right: 0; border-top: 1px solid var(--line); max-height: none; }
  .aviso-modo { padding: 8px 16px; }
}

/* ── Bitácora y acciones manuales ── */
.bitacora { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.bitacora li { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.chip.manual { background: var(--blue-soft); color: var(--blue, #1D4ED8); font-size: 10px; padding: 1px 6px; }
.acciones-viaje { display: flex; gap: 8px; flex-wrap: wrap; }
.hitos.con-accion li { grid-template-columns: 18px minmax(0, 1fr) 64px 64px 70px 84px; }
.hitos.con-accion li > :last-child { text-align: right; }
@media (max-width: 900px) {
  .hitos.con-accion li { grid-template-columns: 18px minmax(0, 1fr) 54px 54px 80px; }
}

/* ── Ingreso ── */
.pantalla-entrar { display: flex; align-items: center; justify-content: center; padding: 16px; min-height: 100vh; }
.caja-entrar { width: min(400px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.menu-usuario { cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; font: inherit; color: inherit; }
.menu-usuario:hover { background: var(--soft); }
.modal-pie.separado { justify-content: space-between; }
.modal-pie .btn svg { flex-shrink: 0; }
.campo-clave { position: relative; display: flex; }
.campo-clave .campo { flex: 1; padding-right: 44px; color: var(--ink); }
.ver-clave { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.ver-clave:hover { background: var(--soft); }

html[data-solo-lectura] .solo-operar { display: none !important; }

/* ── Barras por día (reportes) ── */
.barras-dia { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; height: 220px; }
.barras-eje { display: flex; flex-direction: column; justify-content: space-between; font: 11px/1 var(--mono); color: var(--muted); text-align: right; padding-bottom: 20px; margin-top: -5px; }
.barras-area { display: flex; flex-direction: column; min-width: 0; }
.barras-plot { flex: 1; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--line-2) 1px, transparent 1px) 0 0 / 100% 50%; }
.barra-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: default; }
.barra-col i { display: block; background: #2A62D9; border-radius: 4px 4px 0 0; }
.barra-col:hover i { background: #1D4ED8; }
.barras-fechas { display: flex; gap: 2px; height: 20px; align-items: flex-end; }
.barras-fechas small { flex: 1 1 0; min-width: 0; font: 10px/1 var(--mono); color: var(--muted); white-space: nowrap; overflow: visible; }

/* ── Seguimiento público ── */
.pagina-seguimiento { background: var(--bg, #F3F4F6); min-height: 100vh; }
.seg-cab { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.seg-cab img { height: 28px; }
.seg-cab span { font-size: 13px; color: var(--muted); }
.seg-cuerpo { max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.seg-avance { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 6px; }
.seg-avance b { font-size: 26px; font-weight: 600; }
.seg-avance small { font-size: 14px; color: var(--muted); font-weight: 400; }
#mapa-seg { height: 300px; }
.pagina-seguimiento .tabla td, .pagina-seguimiento .tabla th { white-space: nowrap; padding: 10px 8px; }
.seg-cuerpo > * { min-width: 0; }

/* ── Documentos imprimibles (guía, estado de pago, factura) ── */
.pagina-documento { background: #E9EBEF; }
.doc-barra { display: flex; gap: 8px; justify-content: center; padding: 14px; }
.doc { background: #fff; color: #111; width: min(820px, calc(100% - 32px)); margin: 0 auto 32px; padding: 32px 36px; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08); font-size: 12.5px; display: flex; flex-direction: column; gap: 14px; }
.doc-cab { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.doc-emisor { display: flex; flex-direction: column; gap: 2px; }
.doc-emisor b { font-size: 15px; }
.doc-recuadro { border: 3px solid #C8102E; color: #C8102E; padding: 10px 16px; text-align: center; display: flex; flex-direction: column; gap: 4px; min-width: 240px; font-size: 13px; }
.doc-recuadro.interno { border-color: #555; color: #333; }
.doc-recuadro small { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.doc-fecha { font-size: 12.5px; }
.doc-anulado { font-size: 22px; font-weight: 700; color: #C8102E; letter-spacing: .3em; text-align: center; border: 2px solid #C8102E; padding: 4px; }
.doc table { width: 100%; border-collapse: collapse; }
.doc-datos th, .doc-datos td { border: 1px solid #ccc; padding: 5px 8px; text-align: left; vertical-align: top; }
.doc-datos th { width: 110px; background: #F4F5F7; font-weight: 600; white-space: nowrap; }
.doc-lineas th { background: #F4F5F7; text-align: left; padding: 6px 8px; border-bottom: 2px solid #999; }
.doc-lineas td { padding: 6px 8px; border-bottom: 1px solid #ddd; }
.doc .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.doc-pie-grilla { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.doc-recibo, .doc-referencias { border: 1px solid #ccc; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.doc-recibo span { border-bottom: 1px dotted #999; padding-bottom: 2px; }
.doc-recibo small { font-size: 9.5px; color: #555; }
.doc-referencias { gap: 4px; }
.doc-totales th, .doc-totales td { padding: 5px 8px; border-bottom: 1px solid #ddd; text-align: right; font-family: var(--mono); }
.doc-totales th { font-family: var(--sans); text-align: left; font-weight: 500; }
.doc-totales tr.total th, .doc-totales tr.total td { font-weight: 700; font-size: 14px; border-top: 2px solid #111; }
.doc-nota { font-size: 10.5px; color: #555; border-top: 1px solid #ddd; padding-top: 8px; }
@media (max-width: 640px) { .doc { padding: 18px; } .doc-cab, .doc-pie-grilla { display: flex; flex-direction: column; } .doc-recuadro { min-width: 0; align-self: stretch; } }
@media print {
  @page { size: letter; margin: 12mm; }
  .no-imprimir { display: none !important; }
  .pagina-documento { background: #fff; }
  .doc { box-shadow: none; width: 100%; margin: 0; padding: 0; }
}
