:root {
  --fondo: #f1f5f9;
  --panel: #ffffff;
  --texto: #0f172a;
  --sutil: #64748b;
  --borde: #e2e8f0;
  --barra: #0f172a;
  --acento: #0284c7;
  --acento-claro: #e0f2fe;
  --verde: #16a34a;
  --ambar: #f59e0b;
  --rojo: #dc2626;
  --radio: 10px;
  --sombra: 0 10px 30px rgba(15, 23, 42, .18);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: 14px;
  color: var(--texto);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); }
.oculto { display: none !important; }
.sutil { color: var(--sutil); font-weight: 400; }
.error { color: var(--rojo); min-height: 1.2em; font-size: 13px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

/* ---------- botones ---------- */
.btn { border: 1px solid var(--borde); background: #fff; color: var(--texto); border-radius: 8px;
  padding: 7px 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f8fafc; }
a.btn { text-decoration: none; }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn.primario:hover { background: #0369a1; }
.btn.peligro { color: var(--rojo); border-color: #fecaca; }
.btn.peligro:hover { background: #fef2f2; }
.btn.chico { padding: 4px 8px; font-size: 12px; }
.btn.ancho { width: 100%; justify-content: center; padding: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-icono { border: 0; background: transparent; color: inherit; font-size: 20px; width: 36px; height: 36px; border-radius: 8px; }
.btn-icono:hover { background: rgba(255,255,255,.1); }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #1e3a5f, #0f172a 60%); padding: 16px; }
.login-caja { background: #fff; padding: 28px; border-radius: 14px; width: min(360px, 100%); box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 12px; }
.login-caja p { margin: -6px 0 6px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--sutil); }
label input, label select, label textarea { padding: 8px 10px; border: 1px solid var(--borde); border-radius: 8px; color: var(--texto); background: #fff; }
label input:focus, label select:focus, label textarea:focus, .buscador input:focus { outline: 2px solid var(--acento-claro); border-color: var(--acento); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--texto); }

/* ---------- barra superior ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
.barra { background: var(--barra); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 12px; z-index: 1000; }
.marca { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.marca.grande { font-size: 20px; color: var(--texto); }
.logo { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #38bdf8; position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 4px; background: #38bdf8; border-radius: 50%; }
#sel-zona { background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 8px; padding: 7px 10px; max-width: 200px; }
.buscador { position: relative; flex: 1; max-width: 520px; }
.buscador input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid #334155; background: #1e293b; color: #fff; }
.buscador input::placeholder { color: #94a3b8; }
.buscar-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; color: var(--texto);
  border-radius: var(--radio); box-shadow: var(--sombra); max-height: 60vh; overflow: auto; }
.buscar-res button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-bottom: 1px solid var(--borde); }
.buscar-res button:hover, .buscar-res button.activo { background: var(--acento-claro); }
.buscar-res small { display: block; color: var(--sutil); }
.buscar-res .vacio { padding: 12px; color: var(--sutil); }
.acciones { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.barra .btn { background: #1e293b; color: #fff; border-color: #334155; }
.barra .btn:hover { background: #334155; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; background: #fff; color: var(--texto); border-radius: var(--radio);
  box-shadow: var(--sombra); min-width: 230px; padding: 6px; z-index: 1200; }
.menu.derecha { left: auto; right: 0; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover { background: var(--fondo); }
.menu hr { border: 0; border-top: 1px solid var(--borde); margin: 6px 0; }
.menu-usuario { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--borde); margin-bottom: 6px; }
body:not(.es-admin) .solo-admin { display: none !important; }
body:not(.es-super) .solo-super { display: none !important; }
body:not(.puede-editar) .solo-edicion { display: none !important; }
body:not(.gestiona-act) .solo-gestion { display: none !important; }

/* ---------- cuerpo ---------- */
.cuerpo { flex: 1; display: flex; position: relative; min-height: 0; }
#mapa { flex: 1; z-index: 1; }
.panel-zona { width: 290px; background: var(--panel); border-right: 1px solid var(--borde); overflow-y: auto; padding: 8px 8px 24px; z-index: 500; }
.panel-zona h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--sutil); margin: 18px 0 8px; }

/* ---------- árbol lateral ---------- */
.nodo { margin-bottom: 2px; }
.nodo-cab { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 8px; border-radius: 8px; color: var(--texto); }
.nodo-cab:hover { background: var(--fondo); }
.flecha { color: var(--sutil); font-size: 11px; width: 10px; flex: none; transition: transform .15s; }
.flecha.abierta { transform: rotate(90deg); }
.nodo-titulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--sutil); }
.nodo-cuenta { font-size: 11px; color: var(--sutil); background: var(--fondo); border-radius: 999px; padding: 1px 7px; flex: none; }
.nodo-cuerpo { padding: 2px 0 8px 18px; }
.nodo.zona > .nodo-cab .nodo-titulo { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--texto); }
.nodo.zona { border-bottom: 1px solid var(--borde); padding-bottom: 4px; margin-bottom: 6px; }
.nodo.zona.activa > .nodo-cab { background: var(--acento-claro); }
.nodo.zona > .nodo-cuerpo { padding-left: 10px; }
.nodo.zona .resumen { margin-bottom: 8px; }

.hoja-fila { display: flex; align-items: center; gap: 4px; }
.hoja { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; text-align: left; border: 0; background: none;
  padding: 6px 7px; border-radius: 7px; color: var(--texto); font-size: 13px; }
.hoja:hover { background: var(--acento-claro); }
.hoja.sangria { padding-left: 14px; }
.hoja-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hoja-txt small { display: block; color: var(--sutil); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.hoja-sub { color: var(--sutil); font-size: 11px; flex: none; }
.grupo { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--sutil);
  padding: 8px 7px 3px; text-transform: uppercase; letter-spacing: .4px; }
.filtro { width: 100%; padding: 6px 9px; border: 1px solid var(--borde); border-radius: 7px; margin-bottom: 4px; font-size: 13px; }
.pad { padding: 6px 8px; font-size: 13px; }
.nap.mini, .punto.mini { width: 11px; height: 11px; border-width: 2.5px; flex: none; }
.punto.mini { width: 9px; height: 9px; }
.acciones-zona { padding: 10px 7px 2px; }
.resumen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.resumen div { background: var(--fondo); border-radius: 8px; padding: 8px; text-align: center; }
.resumen b { display: block; font-size: 18px; }
.resumen small { color: var(--sutil); font-size: 11px; }
.titulo-zona { font-size: 17px; font-weight: 700; margin: 2px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; }
.item:hover { background: var(--fondo); }
.item .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.item small { color: var(--sutil); }
.color { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.estado-mk { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: none; }
.estado-mk.ok { background: var(--verde); }
.capas label { flex-direction: row; align-items: center; gap: 8px; color: var(--texto); padding: 3px 0; }
.leyenda div { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 13px; }
.leyenda svg { flex: none; }
.ley-caja { width: 22px; display: inline-flex; justify-content: center; flex: none; line-height: 0; }
.ley-linea { width: 22px; height: 0; border-top: 2px dashed #475569; flex: none; }
.ley-linea.gruesa { border-top: 4px solid #475569; }

/* ---------- marcadores ---------- */
.marca-icono { background: none; border: none; }
.glifo { filter: drop-shadow(0 1px 3px rgba(15, 23, 42, .55)); transition: transform .12s; transform-origin: 50% 50%; line-height: 0; }
.glifo.sel { transform: scale(1.35); filter: drop-shadow(0 0 5px rgba(56, 189, 248, .95)) drop-shadow(0 1px 3px rgba(15, 23, 42, .6)); }
.nap-etq { position: absolute; left: 31px; top: 4px; background: rgba(15,23,42,.82); color: #fff; font-size: 11px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px; white-space: nowrap; pointer-events: none; }
.nap-etq.alta { left: 37px; top: 8px; background: rgba(2, 132, 199, .92); }
.sin-etiquetas .nap-etq { display: none; }
.ico { display: inline-flex; flex: none; line-height: 0; }
.marca-temp { width: 22px; height: 22px; border-radius: 50%; background: var(--acento); border: 3px solid #fff; box-shadow: 0 0 0 3px var(--acento), 0 2px 8px rgba(0,0,0,.5); }
.leaflet-popup-content { font-size: 13px; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 14px; }

/* ---------- panel de caja ---------- */
.panel-caja { width: 420px; background: var(--panel); border-left: 1px solid var(--borde); overflow-y: auto; z-index: 600; display: flex; flex-direction: column; }
.pc-cab { padding: 14px 16px 10px; border-bottom: 1px solid var(--borde); position: sticky; top: 0; background: #fff; z-index: 2; }
.pc-cab h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.pc-cab .cerrar { margin-left: auto; font-size: 22px; color: var(--sutil); }
.pc-cab .cerrar:hover { background: var(--fondo); }
.pc-cab .ruta { color: var(--sutil); font-size: 13px; margin-top: 2px; }
.barra-ocup { height: 8px; background: var(--fondo); border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.barra-ocup span { display: block; height: 100%; background: var(--verde); }
.pc-botones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pc-tabs { display: flex; border-bottom: 1px solid var(--borde); padding: 0 12px; position: sticky; top: 0; }
.pc-tabs button { border: 0; background: none; padding: 10px 12px; color: var(--sutil); border-bottom: 2px solid transparent; }
.pc-tabs button.activo { color: var(--acento); border-color: var(--acento); font-weight: 600; }
.pc-cuerpo { padding: 12px 16px 24px; }
.dato { margin-bottom: 10px; }
.dato dt { font-size: 12px; color: var(--sutil); }
.dato dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.foto { width: 100%; border-radius: 8px; cursor: zoom-in; max-height: 240px; object-fit: cover; background: var(--fondo); }
.puerto { border: 1px solid var(--borde); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.puerto.ocupado { border-left: 4px solid var(--verde); }
.puerto.libre { border-left: 4px solid #cbd5e1; }
.puerto-fila { display: flex; align-items: center; gap: 8px; }
.puerto-num { font-weight: 800; font-size: 16px; width: 28px; text-align: center; color: var(--sutil); }
.puerto-fila input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--borde); border-radius: 8px; }
.puerto-info { margin: 8px 0 0 36px; font-size: 13px; }
.puerto-info .nom { font-weight: 600; }
.chip.tel { text-decoration: none; color: inherit; }
.chip.tel:hover { background: var(--acento-claro); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { background: var(--fondo); border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.chip.ok { background: #dcfce7; color: #166534; } .chip.off { background: #fee2e2; color: #991b1b; }
.puerto-meta { font-size: 11px; color: var(--sutil); margin: 4px 0 0 36px; }
.puerto-nota { margin: 6px 0 0 36px; }
.puerto-nota input { width: 100%; padding: 5px 8px; border: 1px dashed var(--borde); border-radius: 6px; font-size: 12px; }
.vista-previa { background: var(--acento-claro); border-radius: 8px; padding: 8px 10px; margin: 8px 0 0 36px; font-size: 13px; }
.hist { border-left: 2px solid var(--borde); padding: 0 0 12px 12px; position: relative; font-size: 13px; }
.hist::before { content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--acento); }
.hist small { color: var(--sutil); display: block; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 3000; padding: 16px; }
.modal-caja { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--sombra); }
.modal-caja.ancho { width: min(820px, 100%); }
.modal-cab { padding: 16px 20px 0; display: flex; align-items: center; }
.modal-cab h2 { margin: 0; font-size: 18px; flex: 1; }
.modal-cuerpo { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-pie { padding: 0 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fila3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.nota { background: var(--fondo); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--sutil); }
.nota.ok { background: #dcfce7; color: #166534; } .nota.mal { background: #fee2e2; color: #991b1b; }
.coord-ayuda { font-size: 12px; color: var(--sutil); }
table.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th, .tabla td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--borde); }
.tabla th { color: var(--sutil); font-weight: 600; font-size: 12px; }

/* modo "elegir en el mapa": el modal se reduce */
.modal.elegir { background: transparent; pointer-events: none; place-items: end center; }
.modal.elegir .modal-caja { display: none; }

/* ---------- ubicación y navegación ---------- */
.btn-mapa { position: absolute; right: 14px; bottom: 30px; z-index: 700; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--borde); background: #fff; color: #475569; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .3); }
.btn-mapa:hover { background: #f8fafc; }
.btn-mapa.activo { color: var(--acento); }
.btn-mapa.siguiendo { color: #fff; background: var(--acento); border-color: var(--acento); }
.marca-icono.yo { filter: drop-shadow(0 1px 4px rgba(2, 132, 199, .7)); }
.nav-barra { position: absolute; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 800;
  background: #0f172a; color: #fff; border-radius: 12px; box-shadow: var(--sombra); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; width: min(560px, calc(100% - 80px)); }
.nav-flecha { font-size: 26px; line-height: 1; color: #38bdf8; flex: none; width: 30px; text-align: center; }
.nav-txt { flex: 1; min-width: 0; font-size: 14px; }
.nav-txt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-txt small { color: #94a3b8; font-size: 12px; }
.nav-barra .btn-icono { color: #94a3b8; font-size: 16px; width: 30px; height: 30px; }
.nav-barra .btn-icono:hover { background: rgba(255,255,255,.12); color: #fff; }

.aviso-dibujo { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: #fff; padding: 8px 10px; border-radius: 10px;
  box-shadow: var(--sombra); z-index: 900; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 16px;
  border-radius: 10px; z-index: 4000; box-shadow: var(--sombra); max-width: calc(100% - 32px); }
.toast.mal { background: var(--rojo); }
body.navegando .toast { bottom: 96px; }
.visor { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 5000; display: grid; place-items: center; cursor: zoom-out; }
.visor img { max-width: 96vw; max-height: 96vh; }

.solo-movil { display: none; }

/* ---------- móvil (técnicos en campo) ---------- */
@media (max-width: 820px) {
  .solo-movil { display: inline-block; }
  .ocultar-movil { display: none; }
  .barra { gap: 6px; padding: 6px 8px; flex-wrap: wrap; }
  #sel-zona { max-width: 130px; }
  .buscador { order: 10; flex-basis: 100%; max-width: none; }
  .panel-zona { position: absolute; inset: 0 auto 0 0; width: 85%; max-width: 320px; box-shadow: var(--sombra); transform: translateX(-105%); transition: transform .2s; }
  .panel-zona.abierto { transform: none; }
  .panel-caja { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 72%; border-left: 0;
    border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.25); z-index: 850; }
  .fila, .fila3 { grid-template-columns: 1fr; }
  .nav-barra { width: calc(100% - 20px); bottom: 14px; align-items: flex-start; }
  .nav-txt small { white-space: normal; }
  .nav-flecha { margin-top: 2px; }
  body.navegando .toast { bottom: 110px; }
  .btn-mapa { bottom: 84px; right: 10px; }
  body.navegando .btn-mapa { bottom: 100px; }
}

/* ---------- splitter 1:2 dentro de la caja ---------- */
.puerto.splitter { border-left: 4px solid #7c3aed; background: #faf5ff; }
.puerto.splitter .hoja-txt b { font-size: 14px; }
.puerto.derivado { margin-left: 20px; }
.puerto.derivado.azul { border-left: 4px solid #2563eb; }
.puerto.derivado.naranja { border-left: 4px solid #ea580c; }
.derivado-cab { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sutil); margin-bottom: 6px; }
.hilo { width: 18px; height: 4px; border-radius: 2px; flex: none; }
.hilo.azul { background: #2563eb; }
.hilo.naranja { background: #ea580c; }
.btn-poner-spl { color: #7c3aed; border-color: #ddd6fe; }

/* ---------- actividades ---------- */
.hoja.act-alta .hoja-txt { font-weight: 600; }
.hoja.hecha, .hoja.cancelada { opacity: .55; }
.hoja.hecha .hoja-txt, .hoja.cancelada .hoja-txt { text-decoration: line-through; }
.pc-cab h2 svg { vertical-align: -6px; }
#act-cliente-fila { display: flex; flex-direction: column; gap: 6px; }
.avisos-caja { margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.aviso-act { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font-size: 13px;
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 8px; padding: 7px 9px; color: var(--texto); }
.aviso-act:hover { background: #fef3c7; }
.aviso-act small { display: block; color: var(--sutil); font-size: 11px; }

/* ---------- aviso de actividades pendientes ---------- */
.btn-icono.avisos { position: relative; display: inline-grid; place-items: center; }
.btn-icono.avisos #avisos-n { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--ambar); color: #3b2300; font-size: 10px;
  font-weight: 700; line-height: 16px; display: none; }
.btn-icono.avisos.con-pendientes #avisos-n { display: block; }
.btn-icono.avisos.urgente #avisos-n { background: var(--rojo); color: #fff; }
.btn-icono.avisos.con-pendientes { color: #fde68a; }

.aviso-zonas { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.aviso-zona { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--borde); border-left: 4px solid var(--ambar); background: #fff;
  border-radius: 10px; padding: 9px 11px; }
.aviso-zona:hover { background: #fffbeb; }
.aviso-zona.urgente { border-left-color: var(--rojo); }
.aviso-zona .az-n { flex: none; min-width: 30px; height: 30px; border-radius: 8px; background: #fef3c7;
  color: #92400e; font-weight: 700; display: grid; place-items: center; }
.aviso-zona.urgente .az-n { background: #fee2e2; color: #991b1b; }
.aviso-zona .az-txt { flex: 1; min-width: 0; }
.aviso-zona .az-txt small { display: block; color: var(--sutil); font-size: 11px; }
.aviso-zona .az-ir { color: var(--sutil); font-size: 20px; flex: none; }

/* ---------- zona con trabajo pendiente en el árbol lateral ---------- */
.nodo.zona.con-pendientes > .nodo-cab { background: #fffbeb; }
.nodo.zona.con-pendientes.activa > .nodo-cab { background: #fef3c7; }
.nodo.zona.con-pendientes > .nodo-cab .nodo-titulo { color: #92400e; font-weight: 700; }
.nodo.zona.con-pendientes.urgente > .nodo-cab .nodo-titulo { color: #991b1b; }
.nodo-alerta { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ambar); color: #3b2300; font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center; }
.nodo.zona.urgente .nodo-alerta { background: var(--rojo); color: #fff; }

/* ---------- historial de actividades ---------- */
/* lo terminado es el registro del trabajo: se lee entero, sin tachar ni atenuar */
.hoja.hist-act { opacity: 1; }
.hoja.hist-act .hoja-txt { text-decoration: none; white-space: normal; }
.hoja.hist-act .ico { width: 17px; text-align: center; color: var(--verde); font-weight: 700; }
.hoja.hist-act.cancelada .ico { color: var(--rojo); }

/* ---------- respaldo fotográfico de las actividades ---------- */
/* el detalle usa pre-wrap para respetar los saltos del texto; en la galería estorba */
.dato dd.fotos { white-space: normal; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin: 6px 0; }
.galeria figure { position: relative; margin: 0; display: flex; flex-direction: column; }
.galeria img { width: 100%; height: 86px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde);
  cursor: zoom-in; display: block; background: var(--fondo); }
.galeria figcaption { font-size: 10px; color: var(--sutil); text-align: center; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.galeria .quitar { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0;
  border-radius: 999px; background: rgba(15,23,42,.72); color: #fff; font-size: 14px; line-height: 1; }
.galeria .quitar:hover { background: var(--rojo); }
.campo-fotos { margin: 12px 0 4px; }
.campo-fotos .et { font-size: 12px; font-weight: 600; color: var(--sutil); margin-bottom: 4px; }

/* inventario de la zona */
.inv-lista { padding: 2px 8px; }
.inv-ver { display: flex; justify-content: space-between; gap: 8px; padding: 5px 4px; border-bottom: 1px solid var(--borde); font-size: 13px; }
.inv-ver small { display: block; color: var(--ambar); font-size: 12px; }
.inv-cant { font-weight: 600; white-space: nowrap; }
.inv-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.inv-fila { display: grid; grid-template-columns: minmax(120px, 1.3fr) 110px minmax(120px, 1.5fr) auto; gap: 6px; align-items: center; }
.inv-fila .inv-nom { font-size: 13px; }
.inv-fila input, .inv-fila select { padding: 7px 8px; border: 1px solid var(--borde); border-radius: 8px; min-width: 0; width: 100%; }
.inv-botones { display: flex; gap: 4px; justify-content: flex-end; }
.inv-cant-in { display: flex; align-items: center; gap: 4px; }
.inv-cant-in input { text-align: right; }
.inv-cant-in span, .inv-cant-in select { color: var(--sutil); font-size: 12px; }
.inv-cant-in select { width: auto; padding: 7px 4px; }
.inv-nuevo { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--borde); }
.inv-nuevo .et { font-size: 12px; font-weight: 600; color: var(--sutil); margin-bottom: 6px; }
@media (max-width: 640px) {
  .inv-fila { grid-template-columns: 1fr 110px; padding-bottom: 6px; border-bottom: 1px solid var(--borde); }
  .inv-fila .inv-coment { grid-column: 1 / -1; }
}

/* historial de ingresos y cambios */
.h-filtros { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: flex-end; }
.h-filtros select, .h-filtros input { padding: 7px 8px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; }
.h-fecha { flex-direction: row; align-items: center; gap: 4px; font-size: 12px; }
.tabla.historial .h-dia td { background: #f1f5f9; font-weight: 600; text-transform: capitalize; color: var(--texto); }
.tabla.historial .h-hora { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla.historial .h-acc { white-space: nowrap; }
.tabla.historial tr.h-sesion td { color: var(--sutil); }
.tabla.historial tr.h-ingreso td.h-acc { color: #15803d; font-weight: 600; }
.tabla.historial tr.h-fallido td { color: var(--rojo); }
.chip.vlan { background: #ede9fe; color: #5b21b6; font-weight: 600; white-space: nowrap; }
.chip.susp { background: #fef3c7; color: #92400e; font-weight: 600; }
.dato.susp { background: #fffbeb; border-left: 3px solid #f59e0b; padding: 6px 8px; border-radius: 6px; }
