/* =============================================================================
 * Seguridad Ciudadana - tema de la consola
 *
 * Misma identidad visual que Resileo (docs/09 y docs/10 de Resileo): paleta
 * medida sobre la barra de navegación de referencia, tipografía Inter
 * auto-alojada y la escala de 13 / 12 / 11 / 10 px. Ver docs/03-identidad-visual.md
 * ========================================================================== */

@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/inter/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('../fonts/inter/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --rs-marino: #1B263B;
  --rs-teal: #197774;
  --rs-teal-osc: #14605E;
  --rs-teal-claro: #3CC5C0;
  --rs-texto-claro: #C4CAD1;
  --rs-texto-tenue: #B3B9C2;
  --rs-separador: #3E485A;
  --rs-blanco: #FFFFFF;
  --rs-rojo: #C70707;
  --rs-naranja: #F06000;
  --rs-ambar: #E0A100;
  --rs-verde: #4E9A2F;
  --rs-azul: #00549C;
  --rs-azul-claro: #0168B8;
  --rs-fondo: #F4F6F8;
  --rs-borde: #D8DEE5;
  --rs-borde-suave: #EEF1F4;
  --rs-texto: #22303C;
  --rs-tenue: #6B7683;
  --rs-gradiente: linear-gradient(90deg, #C70707 0%, #D96A00 22%, #78AE21 42%, #217628 56%, #02478F 76%, #0168B8 100%);
  --rs-fuente: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --rs-fs-campo: 0.8125rem;
  --rs-fs-ayuda: 0.75rem;
  --rs-fs-seccion: 0.6875rem;
  --ancho-lateral: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--rs-fuente); font-size: 0.875rem; color: var(--rs-texto); background: var(--rs-fondo);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; line-height: 1.45;
}
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.6rem; }
a { color: var(--rs-azul); text-decoration: none; }
a:hover { color: var(--rs-azul-claro); text-decoration: underline; }
svg.i { width: 1em; height: 1em; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* --- Estructura ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--ancho-lateral) 1fr; grid-template-rows: auto 1fr auto;
       grid-template-areas: "cab cab" "lat cont" "lat pie"; min-height: 100vh; }
.cabecera { grid-area: cab; background: var(--rs-marino); color: var(--rs-blanco); display: flex; align-items: center;
            justify-content: space-between; gap: 1rem; padding: 0.55rem 1rem 0.5rem;
            border-bottom: 3px solid transparent; border-image: var(--rs-gradiente) 1; position: sticky; top: 0; z-index: 1000; }
.marca { display: flex; align-items: center; gap: 0.7rem; min-width: 0; color: inherit; }
.marca:hover { text-decoration: none; color: inherit; }
.marca-emblema { width: 38px; height: 44px; flex: 0 0 auto; }
.marca-emblema.grande { width: 64px; height: 75px; }
.marca-texto { display: flex; flex-direction: column; min-width: 0; }
.marca-nombre { font-size: 1.2rem; font-weight: 700; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.055em; }
.marca-lema { color: var(--rs-texto-tenue); font-size: 0.68rem; margin-top: 0.12rem; }
.marca-entidad { color: var(--rs-teal-claro); font-size: 0.66rem; font-weight: 500; margin-top: 0.1rem; }
.cab-derecha { display: flex; align-items: center; gap: 0.9rem; color: var(--rs-texto-claro); font-size: 0.78rem; }
.cab-usuario { text-align: right; line-height: 1.25; }
.cab-usuario b { color: var(--rs-blanco); font-weight: 600; display: block; }
.cab-usuario span { color: var(--rs-teal-claro); font-size: 0.7rem; }
.cab-boton { background: transparent; border: 1px solid var(--rs-separador); color: var(--rs-texto-claro); border-radius: 6px;
             padding: 0.35rem 0.6rem; font: inherit; cursor: pointer; display: inline-flex; gap: 0.35rem; align-items: center; }
.cab-boton:hover { color: var(--rs-blanco); background: rgba(255,255,255,0.07); text-decoration: none; }
.cab-menu-movil { display: none; }
.alarma-sos { display: none; align-items: center; gap: 0.45rem; background: var(--rs-rojo); color: #fff; border-radius: 6px;
              padding: 0.35rem 0.7rem; font-weight: 700; font-size: 0.8rem; animation: latido 1.2s infinite; }
.alarma-sos.visible { display: inline-flex; }
.alarma-sos:hover { color: #fff; text-decoration: none; }
@keyframes latido { 0%,100% { box-shadow: 0 0 0 0 rgba(199,7,7,0.7); } 50% { box-shadow: 0 0 0 6px rgba(199,7,7,0); } }

.contenido { grid-area: cont; padding: 1.1rem 1.4rem 1.5rem; min-width: 0; }
.pie { grid-area: pie; border-top: 3px solid transparent; border-image: var(--rs-gradiente) 1; background: var(--rs-fondo);
       padding: 0.6rem 1.4rem; font-size: 0.7rem; color: #6B7885; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.pie .sep { color: #C3CAD2; margin: 0 0.45rem; }
.pie a { color: #8A939E; }

/* --- Navegación lateral (idéntica a Resileo docs/10) ----------------------- */
.nav-lateral { grid-area: lat; background: var(--rs-marino); padding: 0.4rem 0 0; position: sticky; top: 62px;
               height: calc(100vh - 62px); overflow-y: auto; display: flex; flex-direction: column; }
.nav-lateral ul { list-style: none; margin: 0; padding: 0; }
.nav-item > a, .nav-sublista a {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.34rem 0.7rem 0.34rem 1rem; margin: 0 0.45rem;
  font-size: 0.8125rem; line-height: 1.45; color: var(--rs-texto-claro); border-radius: 6px; }
.nav-sublista a { padding-left: 1.1rem; }
.nav-item > a svg.i, .nav-sublista a svg.i { color: #959DA7; font-size: 0.95rem; }
.nav-item > a:hover, .nav-sublista a:hover { background: rgba(255,255,255,0.07); color: var(--rs-blanco); text-decoration: none; }
.nav-item > a.activa, .nav-sublista a.activa { background: var(--rs-teal); color: var(--rs-blanco); font-weight: 600; }
.nav-item > a.activa svg.i, .nav-sublista a.activa svg.i { color: var(--rs-blanco); }
.nav-item.primero { margin: 0.2rem 0 0.3rem; }
.nav-cabecera { display: flex; align-items: stretch; }
.nav-cabecera button.titulo { flex: 1 1 auto; text-align: left; background: transparent; border: 0; cursor: pointer;
  padding: 0.78rem 0.35rem 0.78rem 1.15rem; font: 600 0.625rem/1.2 var(--rs-fuente); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--rs-texto-tenue); display: flex; justify-content: space-between; align-items: center; }
.nav-cabecera button.titulo:hover { color: var(--rs-blanco); }
.nav-seccion.contiene-activa > .nav-cabecera button.titulo { color: var(--rs-blanco); }
.nav-flecha { margin-right: 0.7rem; transition: transform 0.18s ease; font-size: 0.85rem; }
.nav-seccion.cerrada .nav-flecha { transform: rotate(-90deg); }
.nav-sublista { overflow: hidden; max-height: 40rem; transition: max-height 0.22s ease; }
.nav-seccion.cerrada .nav-sublista { max-height: 0; }
.nav-contraer { margin-top: auto; display: flex; align-items: center; gap: 0.45rem; width: 100%; padding: 0.7rem 1rem;
  background: transparent; border: 0; border-top: 1px solid var(--rs-separador); color: var(--rs-texto-tenue);
  font: 600 0.625rem var(--rs-fuente); letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; text-align: left; }
.nav-contraer:hover:not(:disabled) { background: rgba(255,255,255,0.06); color: var(--rs-blanco); }
.nav-contraer:disabled { opacity: 0.45; cursor: default; }
.nav-lateral a:focus-visible, .nav-lateral button:focus-visible { outline: 2px solid var(--rs-teal-claro); outline-offset: -2px; }

/* --- Encabezado de página ---------------------------------------------------- */
.pagina-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
              border-bottom: 1px solid var(--rs-borde); padding-bottom: 0.6rem; margin-bottom: 1rem; }
.pagina-cab h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.pagina-cab .sub { color: var(--rs-tenue); font-size: 0.8rem; margin-top: 0.15rem; }
.acciones { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.migas { font-size: 0.75rem; color: var(--rs-tenue); margin-bottom: 0.3rem; }

/* --- Botones ---------------------------------------------------------------------- */
.boton { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--rs-teal); color: var(--rs-blanco);
         border: 1px solid var(--rs-teal); border-radius: 6px; padding: 0.45rem 0.85rem; font: 500 var(--rs-fs-campo) var(--rs-fuente);
         cursor: pointer; text-decoration: none; white-space: nowrap; }
.boton:hover { background: var(--rs-teal-osc); color: var(--rs-blanco); text-decoration: none; }
.boton.secundario { background: var(--rs-blanco); color: var(--rs-texto); border-color: var(--rs-borde); }
.boton.secundario:hover { background: #EEF2F5; }
.boton.peligro { background: var(--rs-rojo); border-color: var(--rs-rojo); }
.boton.peligro:hover { background: #A30505; }
.boton.pequeno { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.boton:disabled { opacity: 0.5; cursor: not-allowed; }
.enlace-boton { background: none; border: 0; padding: 0; color: var(--rs-azul); font: inherit; cursor: pointer; }
.enlace-boton:hover { text-decoration: underline; }

/* --- Avisos -------------------------------------------------------------------------- */
.avisos { margin-bottom: 0.9rem; display: grid; gap: 0.4rem; }
.aviso { border-radius: 8px; padding: 0.6rem 0.85rem; font-size: 0.8125rem; border: 1px solid; }
.aviso.ok { background: #EAF6EC; border-color: #B9DFC0; color: #1D5A2A; }
.aviso.error { background: #FDECEC; border-color: #F3C1C1; color: #8A1414; }
.aviso.info { background: #EAF2FB; border-color: #BFD6EE; color: #0B4277; }
.aviso.alerta { background: #FFF6E0; border-color: #F2D48A; color: #6B4A00; }

/* --- Tarjetas e indicadores (Resileo: panel de inicio) ------------------------------ */
.rs-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.rs-kpi { display: block; background: var(--rs-blanco); border: 1px solid var(--rs-borde); border-top: 3px solid var(--rs-teal);
          border-radius: 10px; padding: 0.7rem 0.85rem 0.8rem; color: var(--rs-texto); transition: box-shadow .15s, transform .15s; }
a.rs-kpi:hover { color: var(--rs-texto); text-decoration: none; box-shadow: 0 2px 10px rgba(27,38,59,0.12); transform: translateY(-1px); }
.rs-kpi.critico { border-top-color: var(--rs-rojo); }
.rs-kpi.critico.activo { background: #FFF5F5; }
.rs-kpi.aviso-k { border-top-color: var(--rs-ambar); }
.rs-kpi.azul { border-top-color: var(--rs-azul); }
.rs-kpi-cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.4rem; min-height: 2.1rem; }
.rs-kpi-etiqueta { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.25; color: var(--rs-tenue); }
.rs-kpi-icono { font-size: 0.95rem; color: var(--rs-teal); }
.rs-kpi.critico .rs-kpi-icono { color: var(--rs-rojo); }
.rs-kpi.aviso-k .rs-kpi-icono { color: #A87900; }
.rs-kpi-valor { margin-top: 0.15rem; font-size: 2rem; font-weight: 800; line-height: 1.1; }
.rs-kpi-pie { font-size: 0.6875rem; color: var(--rs-tenue); margin-top: 0.15rem; }

.tarjeta { background: var(--rs-blanco); border: 1px solid var(--rs-borde); border-radius: 10px; padding: 1rem 1.1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.tarjeta > h2, .tarjeta > h3 { font-size: 1rem; font-weight: 700; margin: 0 0 0.15rem; }
.tarjeta .ayuda-t { margin: 0 0 0.85rem; font-size: 0.78rem; color: var(--rs-tenue); }
.rejilla-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.rejilla-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.sin-datos { margin: 0; color: var(--rs-tenue); font-size: 0.8125rem; }

/* --- Tablas ------------------------------------------------------------------------- */
.tabla-envoltura { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.tabla th { padding: 0 0.6rem 0.45rem 0; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--rs-tenue); text-align: left; border-bottom: 1px solid var(--rs-borde); white-space: nowrap; }
.tabla td { padding: 0.5rem 0.6rem 0.5rem 0; border-bottom: 1px solid var(--rs-borde-suave); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:hover { background: #FAFBFC; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .tenue { color: var(--rs-tenue); }

/* --- Pastillas de estado ----------------------------------------------------------- */
.pastilla { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.6875rem;
            font-weight: 600; background: #E7EBEF; color: var(--rs-texto); white-space: nowrap; }
.pastilla .punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.e-ASIGNADO { background: #E7EBEF; color: #3A4654; }
.e-EN_INICIO { background: #E3EEFA; color: #0B4F94; }
.e-EN_RUTA { background: #DDF2F1; color: #12605D; }
.e-FINALIZADO { background: #E6F3E1; color: #2F6B1A; }
.e-CANCELADO, .e-FALSA_ALARMA { background: #ECEDEF; color: #6B7683; }
.e-ABIERTO { background: var(--rs-rojo); color: #fff; }
.e-EN_ATENCION { background: #FFE9C7; color: #7A4B00; }
.e-CERRADO { background: #E6F3E1; color: #2F6B1A; }
.e-SOS { background: var(--rs-rojo); color: #fff; }
.e-ALARMA { background: #FFF0C2; color: #6B4A00; }
.e-ACTIVA { background: var(--rs-rojo); color: #fff; animation: latido 1.2s infinite; }
.e-SOLICITADA { background: #FFE9C7; color: #7A4B00; }
.e-PENDIENTE { background: #E7EBEF; color: #3A4654; }
.e-COMPLETADA { background: #E6F3E1; color: #2F6B1A; }
.e-ENVIANDO { background: #E3EEFA; color: #0B4F94; }
.e-ENVIADO { background: #DDF2F1; color: #12605D; }
.e-ENTREGADO, .e-LEIDO { background: #E6F3E1; color: #2F6B1A; }
.e-FALLIDO { background: #FDECEC; color: #8A1414; }
.texto-peligro { color: var(--rs-rojo); }
.nowrap { white-space: nowrap; }
.qr svg { width: 100%; max-width: 220px; height: auto; display: block; }
.pasos { margin: 0.4rem 0 0; padding-left: 1.2rem; line-height: 1.55; }
.pasos li { margin-bottom: 0.45rem; }
.e-bloqueado { background: #FDECEC; color: #8A1414; }
.e-inactivo { background: #ECEDEF; color: #6B7683; }

/* --- Formularios (13 / 12 / 11 px, como Resileo) ------------------------------------ */
.formulario { max-width: 860px; }
.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.1rem; }
.campo { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.campo.ancho { grid-column: 1 / -1; }
.campo label, .etiqueta { font-size: var(--rs-fs-campo); font-weight: 600; color: var(--rs-texto); }
.campo .ayuda, .ayuda { font-size: var(--rs-fs-ayuda); color: var(--rs-tenue); }
.seccion-form { grid-column: 1 / -1; font-size: var(--rs-fs-seccion); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
                color: var(--rs-tenue); border-bottom: 1px solid var(--rs-borde); padding-bottom: 0.3rem; margin-top: 0.4rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="datetime-local"],
input[type="search"], input[type="tel"], input[type="file"], select, textarea {
  font: var(--rs-fs-campo) var(--rs-fuente); color: var(--rs-texto); background: var(--rs-blanco); border: 1px solid #C9D1DA;
  border-radius: 6px; padding: 0.48rem 0.6rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(25,119,116,0.35); border-color: var(--rs-teal); }
textarea { min-height: 5rem; resize: vertical; }
input[type="color"] { width: 3.2rem; height: 2.2rem; border: 1px solid #C9D1DA; border-radius: 6px; padding: 2px; background: #fff; }
.casilla { display: flex; align-items: center; gap: 0.5rem; font-size: var(--rs-fs-campo); font-weight: 400; }
.casilla input { width: 1rem; height: 1rem; accent-color: var(--rs-teal); }
.form-pie { display: flex; gap: 0.6rem; margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--rs-borde); }
.barra-lote { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; padding-bottom: 0.8rem;
              margin-bottom: 0.4rem; border-bottom: 1px solid var(--rs-borde-suave); }
.barra-lote input[type=text] { flex: 1 1 16rem; width: auto; }
.lote-cuenta { font-weight: 600; min-width: 9.5rem; color: var(--rs-tenue); }
.col-sel { width: 2rem; text-align: center; }
.col-sel input { width: 1rem; height: 1rem; cursor: pointer; }
.tabla tr.seleccionada td { background: #EAF5F4; }
.filtros { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; }
.filtros input, .filtros select { width: auto; min-width: 11rem; }
.pestanas { display: flex; gap: 0.25rem; flex-wrap: wrap; border-bottom: 1px solid var(--rs-borde); margin-bottom: 1rem; }
.pestanas a { padding: 0.5rem 0.85rem; font-size: 0.8125rem; color: var(--rs-tenue); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pestanas a:hover { color: var(--rs-texto); text-decoration: none; }
.pestanas a.activa { color: var(--rs-teal); border-bottom-color: var(--rs-teal); font-weight: 600; }

/* --- Paginación ---------------------------------------------------------------------- */
.paginacion { display: flex; gap: 0.3rem; align-items: center; justify-content: flex-end; margin-top: 0.8rem; font-size: 0.78rem; color: var(--rs-tenue); }

/* --- Ingreso ------------------------------------------------------------------------- */
.ingreso { min-height: 100vh; display: grid; place-items: center; background: var(--rs-marino); padding: 1rem;
           background-image: radial-gradient(circle at 20% 10%, rgba(60,197,192,0.12), transparent 45%), radial-gradient(circle at 85% 90%, rgba(1,104,184,0.18), transparent 45%); }
.ingreso-caja { width: 100%; max-width: 380px; background: var(--rs-blanco); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.35); }
.ingreso-cab { background: var(--rs-marino); padding: 1.3rem 1.4rem 1.1rem; border-bottom: 3px solid transparent; border-image: var(--rs-gradiente) 1; color: #fff; }
.ingreso-cuerpo { padding: 1.3rem 1.4rem 1.4rem; display: grid; gap: 0.85rem; }
.ingreso-cuerpo .boton { justify-content: center; padding: 0.6rem; font-size: 0.875rem; }
.ingreso-pie { text-align: center; font-size: 0.75rem; color: var(--rs-tenue); }

/* --- Gráficas (panel) ---------------------------------------------------------------- */
.grafica-barras { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 160px;
                  border-bottom: 1px solid var(--rs-borde); padding-top: 0.5rem; }
.gb-col { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; position: relative; cursor: default; }
.gb-seg { border-radius: 4px 4px 0 0; min-height: 0; }
.gb-col .gb-seg + .gb-seg { border-radius: 4px 4px 0 0; }
.gb-col .gb-seg:first-child:not(:last-child) { border-radius: 0; }
.gb-seg.sos { background: var(--rs-rojo); }
.gb-seg.alarma { background: var(--rs-ambar); }
.gb-col:hover .gb-seg { filter: brightness(1.12); }
.gb-ejes { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: 0.625rem; color: var(--rs-tenue); text-align: center; margin-top: 0.3rem; }
.leyenda { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--rs-texto); margin-bottom: 0.4rem; flex-wrap: wrap; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.barra-h { display: grid; grid-template-columns: 9rem 1fr 2.5rem; gap: 0.5rem; align-items: center; font-size: 0.78rem; margin-bottom: 0.4rem; }
.barra-h .pista { height: 10px; background: #EEF1F4; border-radius: 4px; overflow: hidden; }
.barra-h .relleno { height: 100%; border-radius: 0 4px 4px 0; }
.barra-h .valor { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip { position: fixed; z-index: 3000; pointer-events: none; background: var(--rs-marino); color: #fff; font-size: 0.75rem;
           padding: 0.4rem 0.55rem; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,0.25); display: none; line-height: 1.4; }

/* --- Mapa (como Resileo: árbol de capas a la izquierda, convenciones plegables) ----- */
.mapa-pagina { display: grid; grid-template-columns: 250px 1fr; gap: 0; height: calc(100vh - 62px - 3rem - 2.4rem);
               min-height: 480px; border: 1px solid var(--rs-borde); border-radius: 10px; overflow: hidden; background: #fff; }
.mapa-capas { border-right: 1px solid var(--rs-borde); overflow-y: auto; padding: 0.6rem 0.7rem; font-size: 0.6875rem; }
.mapa-capas h3 { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rs-tenue); margin: 0.7rem 0 0.25rem; }
.mapa-capas h3:first-child { margin-top: 0.1rem; }
.mapa-capas details { margin-bottom: 0.15rem; }
.mapa-capas summary { cursor: pointer; font-weight: 600; font-size: 0.75rem; padding: 0.25rem 0; color: var(--rs-texto); list-style: none; display: flex; align-items: center; gap: 0.3rem; }
.mapa-capas summary::-webkit-details-marker { display: none; }
.mapa-capas summary::before { content: "▸"; color: var(--rs-tenue); transition: transform .15s; display: inline-block; }
.mapa-capas details[open] > summary::before { transform: rotate(90deg); }
.mapa-capas label { display: flex; align-items: center; gap: 0.4rem; line-height: 15px; padding: 2px 0 2px 0.9rem; font-size: 0.75rem; cursor: pointer; }
.mapa-capas label input { width: 13px; height: 13px; margin: 0; accent-color: var(--rs-teal); }
.mapa-capas .cuenta { margin-left: auto; color: var(--rs-tenue); font-variant-numeric: tabular-nums; }
.mapa-capas .simbolo { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); flex: 0 0 auto; }
.mapa-capas .estado-mapa { margin-top: 0.8rem; font-size: 0.6875rem; color: var(--rs-tenue); border-top: 1px solid var(--rs-borde); padding-top: 0.5rem; }
#mapa, .mapa-mini { width: 100%; height: 100%; min-height: 300px; }
.mapa-mini { height: 320px; border-radius: 8px; border: 1px solid var(--rs-borde); }
.convenciones { position: absolute; right: 10px; bottom: 28px; z-index: 900; display: flex; align-items: flex-end; gap: 0; }
.convenciones .pestana { writing-mode: vertical-rl; transform: rotate(180deg); background: var(--rs-marino); color: #fff; border: 0; cursor: pointer;
                         font: 600 0.625rem var(--rs-fuente); letter-spacing: 0.06em; text-transform: uppercase; padding: 0.6rem 0.3rem; border-radius: 0 6px 6px 0; }
.convenciones .panel-conv { background: rgba(255,255,255,0.96); border: 1px solid var(--rs-borde); border-radius: 6px 0 0 6px; box-shadow: 0 1px 4px rgba(27,38,59,0.18);
                            padding: 0.5rem 0.7rem; font-size: 0.6875rem; min-width: 11rem; white-space: nowrap; }
.convenciones.plegada .panel-conv { display: none; }
.panel-conv div { display: flex; align-items: center; gap: 0.45rem; margin: 0.15rem 0; }
.mapa-contenedor { position: relative; }
.marcador { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.45); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 9px; }
.marcador.sos { background: var(--rs-rojo); animation: latido 1.2s infinite; }
.marcador.camion { border-radius: 6px; }
.etiqueta-placa { background: rgba(27,38,59,0.85); color: #fff; border: 0; border-radius: 4px; font: 600 10px var(--rs-fuente); padding: 1px 4px; box-shadow: none; }
.etiqueta-placa::before { display: none; }
.leaflet-container { font-family: var(--rs-fuente); }
.leaflet-popup-content { font-size: 0.78rem; margin: 10px 12px; }
.leaflet-popup-content b { font-size: 0.85rem; }

/* --- Línea de tiempo y adjuntos --------------------------------------------------- */
.linea { list-style: none; padding: 0; margin: 0; }
.linea li { position: relative; padding: 0 0 0.9rem 1.3rem; border-left: 2px solid var(--rs-borde); margin-left: 0.4rem; }
.linea li:last-child { border-left-color: transparent; }
.linea li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--rs-borde); }
.linea li.hecho::before { background: var(--rs-teal); border-color: var(--rs-teal); }
.linea li.alerta::before { background: var(--rs-rojo); border-color: var(--rs-rojo); }
.linea .cuando { font-size: 0.7rem; color: var(--rs-tenue); }
.adjuntos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.adjunto { width: 112px; border: 1px solid var(--rs-borde); border-radius: 8px; overflow: hidden; background: #fff; font-size: 0.65rem; color: var(--rs-tenue); }
.adjunto .vista { height: 78px; background: #EEF1F4; display: grid; place-items: center; color: #8A949E; font-size: 1.6rem; overflow: hidden; }
.adjunto .vista img { width: 100%; height: 100%; object-fit: cover; }
.adjunto .meta { padding: 0.25rem 0.4rem; display: flex; justify-content: space-between; gap: 0.2rem; align-items: center; }
.adjunto .bloqueado { font-size: 0.6rem; text-align: center; padding: 0 0.3rem; line-height: 1.2; }
.visor { position: fixed; inset: 0; background: rgba(10,15,25,0.88); z-index: 4000; display: none; place-items: center; padding: 2rem; }
.visor.abierto { display: grid; }
.visor img, .visor video { max-width: 92vw; max-height: 82vh; border-radius: 6px; background: #000; }
.visor-pdf { max-height: 82vh; overflow-y: auto; color: #C4CAD1; display: grid; gap: 0.6rem; justify-items: center; }
.visor-pdf canvas { background: #fff; border-radius: 4px; max-width: 100%; height: auto; }
.visor .cerrar { position: absolute; top: 1rem; right: 1.2rem; color: #fff; background: none; border: 0; font-size: 2rem; cursor: pointer; }
.visor .pie-visor { color: #C4CAD1; font-size: 0.75rem; margin-top: 0.6rem; text-align: center; }

/* --- Video en vivo ---------------------------------------------------------------- */
.envivo { background: #0E1420; border-radius: 10px; overflow: hidden; position: relative; aspect-ratio: 16/9; display: grid; place-items: center; color: #C4CAD1; }
.envivo video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.envivo .rotulo { position: absolute; top: 0.6rem; left: 0.6rem; background: var(--rs-rojo); color: #fff; font-weight: 700; font-size: 0.7rem;
                  padding: 0.2rem 0.5rem; border-radius: 4px; letter-spacing: 0.05em; display: none; }
.envivo.reproduciendo .rotulo { display: block; animation: latido 1.2s infinite; }
.envivo .mensaje-vivo { position: absolute; text-align: center; padding: 1rem; font-size: 0.85rem; }
.envivo.reproduciendo .mensaje-vivo { display: none; }

.secreto { font: 700 1.6rem ui-monospace, Consolas, monospace; letter-spacing: 0.15em; background: #F4F6F8; border: 1px dashed var(--rs-teal);
           border-radius: 8px; padding: 0.8rem 1rem; text-align: center; margin: 0.6rem 0; user-select: all; }
.matriz th.rol { text-align: center; }
.matriz td.c { text-align: center; }
.matriz tr.grupo td { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rs-tenue); font-weight: 600; padding-top: 0.9rem; }

.oculto { display: none !important; }
.texto-derecha { text-align: right; }
.mt { margin-top: 1rem; }

/* --- Pantallas pequeñas ---------------------------------------------------------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "cab" "cont" "pie"; }
  .nav-lateral { position: fixed; top: 62px; left: 0; bottom: 0; width: var(--ancho-lateral); z-index: 1500; transform: translateX(-100%); transition: transform .2s; height: auto; }
  body.menu-abierto .nav-lateral { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,0.3); }
  .cab-menu-movil { display: inline-flex; }
  .marca-lema, .marca-entidad, .cab-usuario span { display: none; }
  .rejilla-2, .rejilla-3, .campos { grid-template-columns: 1fr; }
  .mapa-pagina { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; }
  .mapa-capas { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--rs-borde); }
  #mapa { height: 70vh; }
  .contenido { padding: 0.9rem; }
}

/* Swagger UI dentro de la consola: misma fuente y sin su barra superior */
.swagger-caja { padding: 0.4rem 0.6rem; }
.swagger-caja .swagger-ui, .swagger-caja .swagger-ui .info .title, .swagger-caja .swagger-ui .opblock-tag { font-family: var(--rs-fuente); }
.swagger-caja .swagger-ui .info { margin: 1rem 0; }
.swagger-caja .swagger-ui .scheme-container { box-shadow: none; padding: 0.6rem 0; }
