/* Síguelo On Tow · lo propio sobre crm-base.css (que no se edita). Base: los mockups aprobados de la Etapa 0:
   colores de estado del servicio, mapa esquemático, propuesta de grúas, precio, línea de tiempo, modo oscuro,
   responsive del backoffice y las pantallas de las apps Android. Fase 1: se agregan al final las piezas del backoffice real (mapa Leaflet, formularios, modal). */

:root {
  /* Estados del servicio (paleta de On Mix). Además del color, cada estado lleva su forma en el chip. */
  --e-ofrecido: #0F766E; --e-ofrecido-s: #DDF3F0;
  --e-camino: #B45309;   --e-camino-s: #FEF3E2;
  --e-origen: #7E22CE;   --e-origen-s: #F3E8FF;
  --e-traslado: #1D4ED8; --e-traslado-s: #E8EEFC;
  --e-destino: #1E7B3A;  --e-destino-s: #E6F4EA;
  --e-cerrado: #6B7280;  --e-cerrado-s: #EEF0F3;
  --e-cancelado: #B42318; --e-cancelado-s: #FDECEA;
  --e-asignar: #3A414C;  --e-asignar-s: #EEF0F3;
  --borde: #D0D5DD;
  --pat-bg: #FFFFFF;
  --sombra: 0 1px 2px rgba(20,24,30,.06), 0 8px 24px rgba(20,24,30,.06);
  /* Mapa esquemático */
  --m-fondo: #EEEDE6; --m-manzana: #E4E2D8; --m-calle: #FFFFFF; --m-auto: #F6C76B; --m-auto-borde: #E3A93A;
  --m-agua: #B9D3E6; --m-parque: #CFE3C4; --m-cerro: #D9DFC9; --m-texto: #6B6A60; --m-texto-f: #3A414C;
  --m-anillo: #FFFFFF;
  /* Superficie oscura fija (botón oscuro, cabecera de las apps) */
  --osc: #15181D; --osc-txt: #FFFFFF;
}

/* ── Modo oscuro: tokens propios (#0F1216 fondo, #1A1F26 tarjetas, #E8EBEF texto, amarillo igual) ── */
:root[data-theme="oscuro"] {
  --ink: #E8EBEF; --ink-2: #C5CBD3; --muted: #9AA3AF; --line: #2B323C; --line-2: #222831; --bg: #0F1216; --card: #1A1F26;
  --soft: #151A20; --marca-suave: #3A3410; --marca-texto: #FFE680; --amber-ink: #FCD9A8; --amber-soft: #3A2A12;
  --red: #F87171; --red-soft: #3B1A1A; --green: #4ADE80; --green-soft: #15301F; --blue: #A5B8F5; --blue-soft: #1B2747;
  --purple: #D8B4FE; --purple-soft: #2E1C40; --teal: #5EEAD4; --teal-soft: #12302D;
  --e-ofrecido: #2DD4BF; --e-ofrecido-s: #12302D; --e-camino: #F59E0B; --e-camino-s: #3A2A12;
  --e-origen: #C084FC; --e-origen-s: #2E1C40; --e-traslado: #7BA0FF; --e-traslado-s: #1B2747;
  --e-destino: #4ADE80; --e-destino-s: #15301F; --e-cerrado: #A3AAB5; --e-cerrado-s: #252B33;
  --e-cancelado: #F87171; --e-cancelado-s: #3B1A1A; --e-asignar: #C5CBD3; --e-asignar-s: #252B33;
  --borde: #3A424D; --pat-bg: #0F1216; --sombra: 0 1px 2px rgba(0,0,0,.3);
  --m-fondo: #1A1F25; --m-manzana: #20262D; --m-calle: #2C333C; --m-auto: #6B5420; --m-auto-borde: #8A6B22;
  --m-agua: #1F3A52; --m-parque: #1E3326; --m-cerro: #222B22; --m-texto: #8D96A3; --m-texto-f: #C5CBD3; --m-anillo: #0F1216;
  --osc: #0B0D10;
  color-scheme: dark;
}
/* Arreglos sobre crm-base.css, que trae algunos colores fijos pensados solo para fondo claro */
:root[data-theme="oscuro"] .btn, :root[data-theme="oscuro"] .btn-icono, :root[data-theme="oscuro"] .campo,
:root[data-theme="oscuro"] .filtro, :root[data-theme="oscuro"] .buscar input, :root[data-theme="oscuro"] .btn-plegar { border-color: var(--borde); }
:root[data-theme="oscuro"] .btn.primario { color: #15181D; border-color: var(--marca); }
:root[data-theme="oscuro"] .btn.primario:hover { color: #15181D; }
:root[data-theme="oscuro"] .btn.oscuro { background: var(--marca-suave); border-color: #5C5218; color: var(--marca-texto); }
:root[data-theme="oscuro"] .menu a.item[aria-current="page"] { color: #15181D; }
:root[data-theme="oscuro"] .filtro[aria-pressed="true"] { background: var(--ink); color: #15181D; }
:root[data-theme="oscuro"] .filtro[aria-pressed="true"] .n { background: rgba(0,0,0,.12); }
:root[data-theme="oscuro"] .segmentado { background: #252B33; }
:root[data-theme="oscuro"] .menu-usuario .avatar { background: var(--marca); color: #15181D; }
:root[data-theme="oscuro"] .chip.ok { color: var(--green); } :root[data-theme="oscuro"] .chip.man,
:root[data-theme="oscuro"] .chip.aviso { color: var(--amber-ink); } :root[data-theme="oscuro"] .chip.error { color: var(--red); }
:root[data-theme="oscuro"] .aviso.error { color: #FECACA; } :root[data-theme="oscuro"] .aviso.ok { color: #BBF7D0; }
:root[data-theme="oscuro"] .menu-marca .logo, :root[data-theme="oscuro"] .logo-placa { background: #fff; border-radius: 8px; padding: 5px 8px; }
:root[data-theme="oscuro"] .switch span { background: #3A424D; }
:root[data-theme="oscuro"] .switch input:checked + span { background: var(--marca); }
:root[data-theme="oscuro"] .switch input:checked + span::after { background: #15181D; }

body { background: var(--bg); }
.pat { background: var(--pat-bg); border-color: var(--ink); color: var(--ink); }
.mono, .folio, .monto, .hora { font-family: var(--mono); }
.folio { font-weight: 600; }
.monto { font-variant-numeric: tabular-nums; white-space: nowrap; }
.der { text-align: right; }
.fila { display: flex; align-items: center; gap: 10px; }
.fila.entre { justify-content: space-between; }
.fila.envuelve { flex-wrap: wrap; }
.pila { display: flex; flex-direction: column; gap: 10px; }
.sep { height: 1px; background: var(--line); margin: 2px 0; }
.ot-producto { align-self: flex-start; margin: -4px 6px 8px; font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  background: var(--osc); color: var(--marca); border-radius: 6px; padding: 6px 8px; }
:root[data-theme="oscuro"] .ot-producto { background: var(--marca); color: #15181D; }
.ot-empresa { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.ot-empresa i { width: 28px; height: 28px; border-radius: 50%; background: var(--osc); color: var(--marca); display: grid; place-items: center; font: 700 11px/1 var(--sans); font-style: normal; }

/* ── Chips de estado del servicio: color + forma + texto ── */
.est { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px;
  background: var(--s); color: var(--c); white-space: nowrap; }
.est::before { content: ''; width: 9px; height: 9px; background: var(--c); flex-shrink: 0; }
.est.ofrecido { --c: var(--e-ofrecido); --s: var(--e-ofrecido-s); } .est.ofrecido::before { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.est.camino { --c: var(--e-camino); --s: var(--e-camino-s); } .est.camino::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.est.origen { --c: var(--e-origen); --s: var(--e-origen-s); } .est.origen::before { transform: rotate(45deg) scale(.85); }
.est.traslado { --c: var(--e-traslado); --s: var(--e-traslado-s); } .est.traslado::before { width: 12px; clip-path: polygon(0 0, 50% 50%, 50% 0, 100% 50%, 50% 100%, 50% 50%, 0 100%); }
.est.destino { --c: var(--e-destino); --s: var(--e-destino-s); } .est.destino::before { border-radius: 2px; }
.est.cierre { --c: var(--e-destino); --s: var(--e-destino-s); } .est.cierre::before { border-radius: 50%; }
.est.cerrado { --c: var(--e-cerrado); --s: var(--e-cerrado-s); } .est.cerrado::before { clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 20%, 86% 6%, 38% 72%); }
.est.cancelado, .est.fallido { --c: var(--e-cancelado); --s: var(--e-cancelado-s); } .est.cancelado::before, .est.fallido::before { clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); }
.est.asignar { --c: var(--e-asignar); --s: var(--e-asignar-s); } .est.asignar::before { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--c); border: 0; outline: 2px dashed transparent; }
.est.agendado { --c: var(--teal); --s: var(--teal-soft); } .est.agendado::before { border-radius: 2px; background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.est.libre { --c: var(--green); --s: var(--green-soft); } .est.libre::before { border-radius: 50%; }
.est.pausa { --c: var(--muted); --s: var(--line-2); } .est.pausa::before { width: 8px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }
.est.sinsenal { --c: var(--red); --s: var(--red-soft); } .est.sinsenal::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* ── Estructura del backoffice ── */
.ot-cab { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.ot-cab h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.ot-cab p { color: var(--muted); margin-top: 2px; }
.ot-cab .acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tema-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--ink-2); }
.barra .btn-menu-movil { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); align-items: center; justify-content: center; }
.titulo-tarjeta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.titulo-tarjeta h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.titulo-tarjeta .n { font: 600 12px/1 var(--mono); color: var(--muted); }
.cuerpo { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.nota { font-size: 12.5px; color: var(--muted); }
.nota-oculta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--purple); background: var(--purple-soft); border-radius: 6px; padding: 3px 8px; }

/* Despacho en vivo */
.despacho { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.mapa-grande { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--m-fondo); height: 640px; }
.mapa-grande svg.mapa, .mapa-chico svg.mapa { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mapa-chico { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--m-fondo); height: 260px; }
.m-leyenda { position: absolute; left: 12px; top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: auto auto; gap: 6px 16px; font-size: 12px; box-shadow: var(--sombra); }
.m-leyenda span { display: flex; align-items: center; gap: 7px; }
.m-leyenda i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid var(--m-anillo); box-shadow: 0 0 0 1px var(--c); }
.m-pie { position: absolute; right: 12px; bottom: 12px; background: var(--osc); color: #fff; border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.m-zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.m-zoom b { width: 34px; height: 34px; display: grid; place-items: center; font-weight: 500; font-size: 18px; color: var(--ink); }
.m-zoom b + b { border-top: 1px solid var(--line); }
.grupo-est { padding: 8px 18px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; }
.serv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.serv.sel { background: var(--marca-suave); box-shadow: inset 4px 0 0 var(--marca); }
.serv .l1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.serv .l2 { grid-column: 1 / -1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serv .t { font: 600 13px/1.2 var(--mono); color: var(--ink-2); text-align: right; }
.serv .t small { display: block; font: 500 11px/1.2 var(--sans); color: var(--muted); }
.serv .alerta { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--red); display: flex; gap: 6px; align-items: center; }
.serv .alerta.amb { color: var(--e-camino); }
.gruas-tabla td { font-size: 13px; }
.posvieja { color: var(--e-camino); font-weight: 600; }

/* Formulario de nuevo servicio */
.nuevo { display: grid; grid-template-columns: minmax(0, 1fr) 560px; gap: 18px; align-items: start; }
.form-sec { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.form-sec:last-child { border-bottom: 0; }
.form-sec h3 { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.form-sec h3 .num { font: 600 12px/1 var(--mono); background: var(--marca); color: #15181D; border-radius: 6px; padding: 4px 7px; }
.rej { display: grid; gap: 12px 14px; }
.rej.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rej.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rej.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rej .ancho { grid-column: 1 / -1; }
.cpo { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); min-width: 0; }
.cpo .v { min-height: 38px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--borde); background: var(--card); color: var(--ink); font-size: 14px;
  display: flex; align-items: center; gap: 8px; justify-content: space-between; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cpo .v.sel::after { content: '▾'; color: var(--muted); font-size: 12px; }
.cpo .v.vacio { color: var(--muted); }
.cpo .v.editable { border-color: var(--marca-ambar); box-shadow: 0 0 0 3px var(--marca-suave); }
.punto { display: flex; gap: 10px; align-items: flex-start; }
.punto .ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--mono); flex-shrink: 0; margin-top: 18px; }
.punto .ico.o { background: var(--osc); color: var(--marca); }
.punto .ico.d { background: var(--marca); color: #15181D; }
.chips-req { display: flex; flex-wrap: wrap; gap: 6px; }
.req { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--borde); font-size: 13px; font-weight: 500; background: var(--card); }
.req.si { border-color: var(--ink); background: var(--ink); color: var(--card); font-weight: 600; }

/* Propuesta de grúas */
.cand { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); align-items: start; }
.cand .rk { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 13px/1 var(--mono); background: var(--line-2); color: var(--ink-2); margin-top: 2px; }
.cand.prim .rk { background: var(--marca); color: #15181D; }
.cand.prim { background: color-mix(in srgb, var(--marca-suave) 55%, transparent); }
.cand .nom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.cand .dist { font: 600 18px/1.1 var(--mono); text-align: right; white-space: nowrap; }
.cand .dist small { display: block; font: 500 11px/1.3 var(--sans); color: var(--muted); }
.cand .info { font-size: 13px; color: var(--muted); }
.cand .marcas { grid-column: 2 / 3; display: flex; flex-wrap: wrap; gap: 6px; }
.cand .acc { grid-column: 3; grid-row: 2 / span 2; display: flex; align-items: flex-end; justify-content: flex-end; }
.cand.atenuada .nom, .cand.atenuada .dist { opacity: .75; }
.sub-cand { padding: 7px 16px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line-2); }

/* Precio */
.precio { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.precio td { padding: 7px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.precio td:last-child { text-align: right; font-family: var(--mono); white-space: nowrap; padding-left: 12px; }
.precio td small { display: block; color: var(--muted); font-size: 12px; }
.precio tr.sug td { color: var(--e-camino); }
.precio tr.tot td { border-bottom: 0; font-weight: 700; font-size: 16px; padding-top: 10px; }
.precio tr.sub td { font-weight: 600; border-bottom: 1px solid var(--line); }
.plan-uso { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.plan-uso .barra-plan { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; display: flex; }
.plan-uso .barra-plan i { display: block; height: 100%; background: var(--osc); }
:root[data-theme="oscuro"] .plan-uso .barra-plan i { background: var(--marca); }
.plan-uso .barra-plan i.este { background: var(--marca); }
:root[data-theme="oscuro"] .plan-uso .barra-plan i.este { background: #fff; }

/* Detalle: línea de tiempo y contadores */
.detalle-rej { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 18px; align-items: start; }
.fases { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
.fase { position: relative; padding: 0 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.fase .bar { height: 8px; border-radius: 4px; background: var(--c); margin-right: 4px; }
.fase b { font-size: 13px; }
.fase span { font: 500 12px/1.3 var(--mono); color: var(--muted); }
.contadores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.contador { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--card); position: relative; overflow: hidden; }
.contador::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.contador span { font-size: 12.5px; color: var(--muted); }
.contador b { font: 600 28px/1.1 var(--mono); }
.contador small { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 82px 18px minmax(0, 1fr) auto; gap: 0 12px; align-items: start; position: relative; padding-bottom: 14px; }
.tl li::after { content: ''; position: absolute; left: 102px; top: 14px; bottom: -2px; width: 2px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl .h { font: 600 13px/1.35 var(--mono); text-align: right; }
.tl .p { width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--c, var(--muted)); margin-top: 2px; z-index: 1; }
.tl .tx b { font-size: 14px; }
.tl .tx span { display: block; font-size: 12.5px; color: var(--muted); }
.tl .q { font-size: 11px; font-weight: 600; }
.fotos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.foto figcaption { font-size: 12px !important; }
.foto { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; position: relative; background: #39424E; }
.foto svg { width: 100%; height: 100%; display: block; }
.foto figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 10.5px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.foto .ok { position: absolute; right: 5px; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: #1E7B3A; color: #fff; display: grid; place-items: center; font-size: 10px; }
.firma { border: 1px dashed var(--borde); border-radius: 10px; background: var(--soft); padding: 8px 12px; }
.firma svg { width: 100%; height: 90px; display: block; color: var(--ink); }
.vel svg { width: 100%; height: auto; display: block; }

/* Tarifas */
.tabla td .sub { display: block; font-size: 12px; color: var(--muted); }
.calc { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); }
.convenio { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.convenio.sel { background: var(--marca-suave); box-shadow: inset 4px 0 0 var(--marca); }

/* Indicadores */
.mini-barra { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; min-width: 80px; }
.mini-barra i { display: block; height: 100%; background: #2F5BD3; border-radius: 4px; }

/* ── Responsive del backoffice ── */
@media (max-width: 1180px) {
  .despacho, .nuevo, .detalle-rej { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > .menu { display: none; }
  .barra { padding: 0 12px; height: 56px; }
  .barra .btn-menu-movil { display: inline-flex; }
  .barra .buscar { display: none; }
  .barra .ot-empresa span.nombre { display: none; }
  .contenido { padding: 14px 12px 32px; gap: 14px; }
  .ot-cab h1 { font-size: 20px; }
  .ot-cab .acciones { margin-left: 0; width: 100%; }
  .mapa-grande { height: 300px; }
  .m-leyenda { grid-template-columns: auto auto; font-size: 11px; padding: 7px 9px; gap: 4px 10px; }
  .rej.c2, .rej.c3, .rej.c4, .contadores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabla-env { overflow-x: auto; }
  .ocultar-movil { display: none !important; }
  .m-leyenda { display: none; }
  .gruas-tabla th:nth-child(2), .gruas-tabla td:nth-child(2), .gruas-tabla th:nth-child(3), .gruas-tabla td:nth-child(3) { display: none; }
  .fases { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; }
  .contador b { font-size: 24px; }
  .tl li { grid-template-columns: 66px 16px minmax(0, 1fr); }
  .tl li::after { left: 85px; }
  .tl li > .chip { grid-column: 3; justify-self: start; margin-top: 4px; }
  .titulo-tarjeta { flex-wrap: wrap; }
}

/* ══════════════ Apps Android (pantallas de 390 × 844) ══════════════ */
.tel { width: 390px; height: 844px; overflow: hidden; margin: 0; position: relative; display: flex; flex-direction: column;
  font: 17px/1.4 var(--sans); background: var(--bg); color: var(--ink); }
.and-estado { height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 22px;
  font: 600 13px/1 var(--sans); background: var(--osc); color: #fff; }
.and-estado.claro { background: var(--card); color: var(--ink); }
.and-estado .ic { display: flex; gap: 6px; align-items: center; }
.and-nav { height: 22px; flex-shrink: 0; display: grid; place-items: center; background: var(--card); }
.and-nav i { width: 108px; height: 4px; border-radius: 2px; background: var(--ink); opacity: .55; }
.app-cab { background: var(--osc); color: #fff; padding: 10px 18px 14px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.app-cab .f1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-cab h1 { font-size: 21px; font-weight: 600; }
.app-cab .sub { font-size: 14px; color: #B9C0CA; }
.conex { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(74,222,128,.16); color: #86EFAC; white-space: nowrap; }
.conex.sin { background: rgba(245,158,11,.18); color: #FCD34D; }
.fase-pasos { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; }
.fase-pasos i { height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); }
.fase-pasos i.h { background: var(--marca); }
.fase-pasos i.a { background: #fff; }
.fase-et { display: flex; justify-content: space-between; font-size: 12px; color: #9AA3AF; margin-top: 2px; }
.fase-et b { color: var(--marca); font-weight: 600; }
.cuerpo-app { flex: 1; overflow: hidden; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.t-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.t-et { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.t-dir { font-size: 22px; font-weight: 600; line-height: 1.2; }
.t-ref { font-size: 15px; color: var(--muted); }
.t-dato { font: 600 26px/1.1 var(--mono); }
.t-fila { display: flex; align-items: center; gap: 10px; }
.t-fila.entre { justify-content: space-between; }
.btn-fase { min-height: 68px; border-radius: 16px; border: 0; background: var(--marca); color: #15181D; font: 700 22px/1 var(--sans); display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  box-shadow: 0 2px 0 #C9A600; letter-spacing: .01em; }
.btn-fase.osc { background: var(--osc); color: #fff; box-shadow: none; }
:root[data-theme="oscuro"] .btn-fase.osc { background: #2B323C; }
.btn-fase.des { background: var(--line); color: var(--muted); box-shadow: none; }
.btn-sec { min-height: 54px; border-radius: 14px; border: 1.5px solid var(--borde); background: var(--card); color: var(--ink); font: 600 17px/1 var(--sans); display: flex; align-items: center; justify-content: center; gap: 10px; flex: 1; }
.btn-sec.peligro { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.nav-apps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nav-app { min-height: 58px; border-radius: 14px; border: 1.5px solid var(--borde); background: var(--card); display: flex; align-items: center; justify-content: center; gap: 10px; font: 600 17px/1 var(--sans); color: var(--ink); }
.nav-app .lg { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; font: 700 13px/1 var(--sans); }
.pie-app { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card); border-top: 1px solid var(--line); flex-shrink: 0; }
.mapa-app { position: relative; overflow: hidden; background: var(--m-fondo); flex-shrink: 0; }
.mapa-app svg.mapa { position: absolute; inset: 0; width: 100%; height: 100%; }
.foto-rej { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.f-slot { border-radius: 14px; border: 2px dashed var(--borde); background: var(--card); aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 15px; font-weight: 600; color: var(--ink-2); position: relative; overflow: hidden; }
.f-slot.hecha { border: 0; }
.f-slot.hecha svg.fo { position: absolute; inset: 0; width: 100%; height: 100%; }
.f-slot.hecha .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; color: #fff; font-size: 14px; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.f-slot.hecha .ok { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; background: #1E7B3A; color: #fff; display: grid; place-items: center; font-size: 14px; }
.f-slot.sig { border-color: var(--marca-ambar); background: var(--marca-suave); color: var(--marca-texto); }
.f-slot small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.lista-chk { display: flex; flex-direction: column; }
.lista-chk div { display: flex; align-items: center; gap: 12px; padding: var(--pad, 11px) 0; border-bottom: 1px solid var(--line-2); font-size: 16px; }
.lista-chk div:last-child { border-bottom: 0; }
.lista-chk .cb { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--osc); color: var(--marca); font-size: 15px; flex-shrink: 0; }
:root[data-theme="oscuro"] .lista-chk .cb { background: var(--marca); color: #15181D; }
.lista-chk .cb.no { background: transparent; border: 2px solid var(--borde); }
.lienzo-firma { border-radius: 16px; border: 2px dashed var(--borde); background: var(--card); height: 210px; position: relative; }
.lienzo-firma svg { position: absolute; inset: 10px 14px 34px; width: calc(100% - 28px); height: calc(100% - 44px); color: var(--ink); }
.lienzo-firma .linea { position: absolute; left: 18px; right: 18px; bottom: 34px; border-top: 1.5px solid var(--borde); }
.lienzo-firma .pie { position: absolute; left: 18px; right: 18px; bottom: 8px; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.t-campo { display: flex; flex-direction: column; gap: 4px; }
.t-campo span { font-size: 13px; color: var(--muted); }
.t-campo b { min-height: 50px; border: 1.5px solid var(--borde); border-radius: 12px; padding: 0 14px; display: flex; align-items: center; font-size: 17px; font-weight: 500; background: var(--card); }
/* Navegación inferior (app Empresa, Material 3) */
.nav-inf { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 8px 4px 6px; flex-shrink: 0; }
.nav-inf a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.nav-inf a i { width: 58px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-style: normal; }
.nav-inf a.act { color: var(--ink); font-weight: 700; }
.nav-inf a.act i { background: var(--marca); color: #15181D; }
.m3-cab { background: var(--card); padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.m3-cab .f1 { display: flex; align-items: center; gap: 12px; }
.m3-cab h1 { font-size: 22px; font-weight: 600; flex: 1; }
.m3-cab .logo-placa { height: 26px; }
.fab { position: absolute; right: 16px; bottom: 96px; height: 58px; padding: 0 22px 0 18px; border-radius: 18px; background: var(--marca); color: #15181D; display: flex; align-items: center; gap: 10px; font: 700 16px/1 var(--sans); box-shadow: 0 6px 16px rgba(0,0,0,.25); z-index: 5; }
.e-serv { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
.e-serv .l2 { grid-column: 1 / -1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips-fil { display: flex; gap: 8px; overflow: hidden; }
.chip-fil { flex-shrink: 0; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--borde); display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; background: var(--card); white-space: nowrap; }
.chip-fil.act { background: var(--marca-suave); border-color: var(--marca-ambar); font-weight: 700; color: var(--ink); }
.hoja { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.18); padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 10px; z-index: 4; }
.hoja .asa { width: 36px; height: 4px; border-radius: 2px; background: var(--line); align-self: center; }

.gruas-tabla td, .gruas-tabla th { white-space: nowrap; }

/* ══════════════ Fase 1 · backoffice real ══════════════ */
.app > .menu { z-index: 60; }
.ot-producto { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px 4px 4px; }
.ot-producto img { width: 20px; height: 20px; border-radius: 5px; display: block; }
.plegada .ot-producto { display: none; }
.menu-velo { display: none; }
body.solo-ver [data-escribe] { display: none !important; }
.enlace-fila { text-decoration: none; color: inherit; display: contents; }
a.serv { text-decoration: none; color: inherit; cursor: pointer; }
a.serv:hover { background: var(--soft); }
a.serv.sel:hover { background: var(--marca-suave); }
.filtro { text-decoration: none; }
.vacio-chico { padding: 14px 18px; color: var(--muted); font-size: 13px; }

/* Campos reales con el aspecto de los mockups (.cpo .v) */
.cpo input, .cpo select, .cpo textarea { min-height: 38px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--borde); background: var(--card); color: var(--ink); font-size: 14px; width: 100%; min-width: 0; }
.cpo select { padding-right: 26px; }
.cpo textarea { min-height: 64px; resize: vertical; }
.cpo input.mono { font-family: var(--mono); }
.cpo input.editable { border-color: var(--marca-ambar); box-shadow: 0 0 0 3px var(--marca-suave); }
.cpo input:disabled, .cpo select:disabled { background: var(--soft); color: var(--muted); }
.cpo .con-chip { position: relative; display: flex; align-items: center; }
.cpo .con-chip .chip { position: absolute; right: 8px; pointer-events: none; }
.campo { color: var(--ink); }
:root[data-theme="oscuro"] .campo { background: var(--card); }
:root[data-theme="oscuro"] .buscar input { background: var(--soft); }
button.req { cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); }
button.req.si { color: var(--card); }
.lugar-res { border: 1px solid var(--line); border-radius: 8px; background: var(--card); max-height: 220px; overflow: auto; }
.lugar-res button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--ink); }
.lugar-res button:hover { background: var(--soft); }
.marcar-mapa { font-size: 12px; }
.etiqueta .campo, .etiqueta select.campo { width: 100%; }
.rej-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.rej-campos .ancho { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink); }
.checks label { display: inline-flex; align-items: center; gap: 6px; }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.interruptor:last-child { border-bottom: 0; }
.interruptor b { font-weight: 600; display: block; }
.interruptor small { color: var(--muted); font-size: 12.5px; }

/* Mapa Leaflet con el aspecto del mapa de los mockups */
.mapa-grande .leaflet-container, .mapa-chico .leaflet-container, .mapa-ruta .leaflet-container { position: absolute; inset: 0; background: var(--m-fondo); font-family: var(--sans); }
.mapa-ruta { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--m-fondo); height: 300px; }
.mapa-grande .m-leyenda, .mapa-grande .m-pie { z-index: 500; }
.mapa-grande .leaflet-control-zoom { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: none; }
.leaflet-control-zoom a { background: var(--card) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--card) 80%, transparent) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
:root[data-theme="oscuro"] .leaflet-tile-pane { filter: brightness(.62) contrast(1.15) saturate(.6); }
.leaflet-div-icon.ot-marca { background: transparent; border: 0; }
.mg { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; border: 3px solid var(--m-anillo); box-shadow: 0 2px 6px rgba(0,0,0,.25);
  font: 700 13px/1 var(--mono); cursor: pointer; }
.mg.vieja { background: var(--m-anillo); color: var(--c); border: 3px dashed var(--c); }
.mg.sel { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 0 0 9px color-mix(in srgb, var(--c) 22%, transparent), 0 2px 6px rgba(0,0,0,.25); }
.mpin { width: 32px; height: 40px; }
.mdest { width: 26px; height: 26px; border-radius: 6px; background: #FFD500; border: 2.5px solid #15181D; display: grid; place-items: center; font: 700 14px/1 var(--mono); color: #15181D; }
.mbase { width: 24px; height: 24px; border-radius: 5px; background: #15181D; color: #FFD500; display: grid; place-items: center; font: 700 12px/1 var(--mono); }
.leaflet-tooltip.ot-etiqueta { background: #15181D; color: #fff; border: 0; font: 600 12.5px/1 var(--sans); padding: 6px 9px; border-radius: 6px; box-shadow: none; }
.leaflet-tooltip.ot-etiqueta::before { display: none; }
.leaflet-popup-content-wrapper { border-radius: 10px; background: var(--card); color: var(--ink); }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 10px 12px; font: 13px/1.45 var(--sans); }

/* Detalle */
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto.falta { background: var(--soft); border: 2px dashed var(--borde); display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; }
.foto.falta figcaption { color: var(--muted); background: none; }
.foto .ok.mal { background: var(--red); }
.firma img { width: 100%; height: 90px; object-fit: contain; display: block; }
:root[data-theme="oscuro"] .firma img { background: #fff; border-radius: 8px; }
.tl .tx span.rech { color: var(--red); font-weight: 600; }
.tl li.rechazado .tx b { text-decoration: line-through; color: var(--muted); }
.acciones-det { display: flex; flex-wrap: wrap; gap: 8px; }

/* Indicadores */
.barras-dia { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: 220px; padding-top: 18px; }
.barras-dia .b { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font: 600 11px/1 var(--mono); color: var(--ink-2); }
.barras-dia .b i { display: block; width: 100%; background: #2F5BD3; border-radius: 4px 4px 0 0; min-height: 2px; }
.barras-dia .b.hoy i { background: var(--marca); }
.barras-dia-pie { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; font: 500 11px/1 var(--mono); color: var(--muted); text-align: center; margin-top: 8px; }
.cliente-barra { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 14px; padding: 6px 0; }
.cliente-barra i { display: block; height: 16px; background: #2F5BD3; border-radius: 3px; min-width: 2px; }
.cliente-barra b { font: 500 13px/1 var(--mono); text-align: right; }
.kpis .kpi b.mono { font-family: var(--mono); }

/* Entrar y páginas públicas */
.entrar { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.entrar-caja { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.entrar-caja h1 { font-size: 22px; }
.publico { max-width: 920px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.publico-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.publico-cab img { height: 34px; }
:root[data-theme="oscuro"] .publico-cab img.logo { background: #fff; border-radius: 8px; padding: 5px 8px; }
:root[data-theme="oscuro"] .entrar-caja img.logo { background: #fff; border-radius: 8px; padding: 5px 8px; }

@media (max-width: 760px) {
  .app.menu-abierto > .menu { display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: 270px; height: 100vh; z-index: 1001; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
  .app.menu-abierto .menu-velo { display: block; position: fixed; inset: 0; background: rgba(21,24,29,.45); z-index: 1000; }
  .barra .acciones .chip { display: none; }
  .rej-campos { grid-template-columns: minmax(0, 1fr); }
  .cliente-barra { grid-template-columns: 110px minmax(0, 1fr) 34px; font-size: 13px; }
  .barras-dia { height: 160px; gap: 3px; }
  .barras-dia .b span { display: none; }
  .barras-dia-pie { gap: 3px; font-size: 9px; }
  .cand { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 24px; }
  .mapa-ruta { height: 240px; }
}

/* ── Conectar la plataforma GPS: elegir Síguelo Pro / Síguelo Lite e ingresar en su página (22-oct) ── */
.gps-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); border: 1px solid var(--borde); }
.gps-seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: inherit; font: 600 14px var(--sans, inherit); cursor: pointer; }
.gps-seg button[aria-checked="true"] { background: var(--osc); color: var(--osc-txt); }
.gps-seg button:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; }
.gps-ir { height: 48px; font-size: 15px; justify-content: center; width: 100%; }
.gps-manual summary { cursor: pointer; color: var(--suave, inherit); font-size: 13px; }
.gps-manual[open] { display: flex; flex-direction: column; gap: 10px; }
