*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --card: #ffffff;
  --card-2: #f8f9fb;
  --borde: #dfe3e8;
  --texto: #1c2430;
  --texto-2: #5b6675;
  --primario: #1f6feb;
  --primario-hover: #1a5fd0;
  --primario-suave: #e7f0fe;
  --peligro: #c62828;
  --peligro-suave: #fdecec;
  --ok: #1e7d3c;
  --ok-suave: #e6f4ea;
  --aviso: #8a5a00;
  --aviso-suave: #fff4dc;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radio: 12px;
  --alto-nav: 64px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1318;
  --card: #171c23;
  --card-2: #1d232b;
  --borde: #2b333d;
  --texto: #e6e9ee;
  --texto-2: #9aa5b3;
  --primario: #4c8dff;
  --primario-hover: #6aa0ff;
  --primario-suave: #19263b;
  --peligro: #ff6b6b;
  --peligro-suave: #3a1d1f;
  --ok: #4cc17a;
  --ok-suave: #16301f;
  --aviso: #f0b64a;
  --aviso-suave: #33290f;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4);
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primario); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
[hidden] { display: none !important; }
.muted { color: var(--texto-2); }
.chico { font-size: .85rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; word-break: break-all; }

/* ─── Barra superior ─── */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--borde);
}
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--texto); text-decoration: none; white-space: nowrap; }
.marca-icono { font-size: 1.4rem; }
.marca-icono.grande { font-size: 2.6rem; }
.nav-escritorio { display: flex; gap: .25rem; flex: 1; }
.nav-escritorio a { padding: .5rem .8rem; border-radius: 8px; color: var(--texto-2); text-decoration: none; font-weight: 500; }
.nav-escritorio a:hover { background: var(--card-2); color: var(--texto); }
.nav-escritorio a.activo { background: var(--primario-suave); color: var(--primario); }
/* Botón ☀️/🌙 del tema (ver tema.js) */
.btn-tema { flex: none; width: 40px; height: 40px; margin-right: .5rem; border-radius: 50%; border: 1px solid var(--borde); background: var(--card-2); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.btn-tema:hover { background: var(--card); border-color: var(--primario); }
.btn-tema:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }
.btn-tema-login { position: fixed; top: 1rem; right: 1rem; margin: 0; }
.menu-usuario { position: relative; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primario); color: #fff; font-weight: 700; font-size: 1rem;
}
.menu-desplegable {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  padding: .4rem; display: flex; flex-direction: column;
}
.menu-desplegable a, .menu-desplegable button {
  padding: .7rem .8rem; border-radius: 8px; text-decoration: none; color: var(--texto);
  background: none; border: 0; text-align: left; font: inherit; cursor: pointer;
}
.menu-desplegable a:hover, .menu-desplegable button:hover { background: var(--card-2); }
.menu-cabecera { padding: .6rem .8rem; border-bottom: 1px solid var(--borde); margin-bottom: .3rem; display: flex; flex-direction: column; }
.menu-cabecera span { color: var(--texto-2); font-size: .85rem; }
body:not(.es-admin) .solo-admin { display: none !important; }
body:not(.es-gestor) .solo-gestor { display: none !important; }

/* ─── Navegación inferior (celular) ─── */
.nav-movil { display: none; }
@media (max-width: 820px) {
  .nav-escritorio, .btn-nuevo-top, .marca span:last-child { display: none; }
  .topbar { justify-content: space-between; }
  .nav-movil {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    height: calc(var(--alto-nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--card); border-top: 1px solid var(--borde);
  }
  .nav-movil a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--texto-2); text-decoration: none; font-size: .72rem; font-weight: 500;
  }
  .nav-movil a span { font-size: 1.3rem; line-height: 1; }
  .nav-movil a.activo { color: var(--primario); }
  .nav-movil .nav-nuevo span {
    background: var(--primario); color: #fff; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.6rem; margin-top: -18px; box-shadow: 0 4px 12px rgba(31, 111, 235, .4);
  }
  .vista { padding-bottom: calc(var(--alto-nav) + 1.5rem + env(safe-area-inset-bottom)); }
}
@media (min-width: 821px) { .solo-movil { display: none !important; } }

/* ─── Contenido ─── */
.vista { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 2rem; outline: none; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cabecera h1 { margin: 0; }
.volver { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .5rem; text-decoration: none; color: var(--texto-2); font-weight: 500; }
.tarjeta { background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; box-shadow: var(--sombra); margin-bottom: 1rem; }
.tarjeta > h2 { display: flex; align-items: center; gap: .5rem; }
.grilla { display: grid; gap: 1rem; }
.grilla-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.vacio { text-align: center; padding: 2.5rem 1rem; color: var(--texto-2); }
.vacio .grande { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.cargando { text-align: center; padding: 3rem; color: var(--texto-2); }

/* Inicio */
.bienvenida { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.accion-grande {
  display: flex; align-items: center; gap: 1rem; padding: 1.25rem; border-radius: var(--radio);
  background: var(--primario); color: #fff; text-decoration: none; box-shadow: var(--sombra); margin-bottom: 1rem;
}
.accion-grande:hover { background: var(--primario-hover); }
.accion-grande .icono { font-size: 2rem; }
.accion-grande strong { display: block; font-size: 1.2rem; }
.numeros { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.numero { background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); padding: .9rem 1rem; text-decoration: none; color: var(--texto); }
.numero strong { display: block; font-size: 1.8rem; line-height: 1.1; }
.numero span { color: var(--texto-2); font-size: .9rem; }
.alerta { padding: .9rem 1rem; border-radius: var(--radio); margin-bottom: 1rem; border: 1px solid transparent; }
.alerta-aviso { background: var(--aviso-suave); color: var(--aviso); border-color: color-mix(in srgb, var(--aviso) 30%, transparent); }
.alerta-ok { background: var(--ok-suave); color: var(--ok); }
.alerta a { color: inherit; font-weight: 600; }

/* Lista de registros */
.lista { display: flex; flex-direction: column; gap: .6rem; }
.item {
  display: block; background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: .85rem 1rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra);
}
.item:hover { border-color: var(--primario); }
.item-fila { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.item-titulo { font-weight: 700; font-size: 1.05rem; }
.item-fecha { color: var(--texto-2); font-size: .85rem; white-space: nowrap; }
.item-datos { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: var(--texto-2); font-size: .9rem; margin-top: .25rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--borde); font-size: .8rem; color: var(--texto-2); white-space: nowrap;
}
.chip-banda { background: var(--primario-suave); color: var(--primario); border-color: transparent; }
.punto { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.chip-aviso { background: var(--aviso-suave); color: var(--aviso); border-color: transparent; font-weight: 600; }
a.chip { text-decoration: none; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; }

/* Pestañas Bandas / Logos / Diferencias */
.subnav { display: flex; gap: .4rem; margin-bottom: 1rem; overflow-x: auto; padding-bottom: 2px; }
.subnav a {
  display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .9rem; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--borde); background: var(--card); color: var(--texto-2); text-decoration: none; font-weight: 600; font-size: .92rem;
}
.subnav a.activo { background: var(--primario); border-color: var(--primario); color: #fff; }
.contador { background: var(--aviso); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .78rem; }
.subnav a.activo .contador { background: #fff; color: var(--primario); }

/* Logos */
.logo-mini, .logo-micro, .logo-grande { object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); background: var(--card-2); flex: none; }
.logo-mini { width: 48px; height: 48px; }
.logo-micro { width: 22px; height: 22px; border-radius: 4px; vertical-align: middle; }
.logo-grande { width: 96px; height: 96px; border-radius: 12px; }
.logo-sin-foto { display: inline-grid; place-items: center; font-size: 1.3rem; color: var(--texto-2); }
.logo-micro.logo-sin-foto { font-size: .75rem; }
.logo-grande.logo-sin-foto { font-size: 2.4rem; }
.logo-enlace { display: inline-flex; align-items: center; gap: .5rem; }
.selector-logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; max-height: 300px; overflow-y: auto; padding: 2px; }
.opcion-logo {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .6rem .4rem; text-align: center; cursor: pointer;
  border: 2px solid var(--borde); border-radius: 12px; background: var(--card); font-size: .85rem; font-weight: 500; overflow-wrap: anywhere;
}
.opcion-logo input { position: absolute; opacity: 0; pointer-events: none; }
.opcion-logo:has(input:checked) { border-color: var(--primario); background: var(--primario-suave); color: var(--primario); }
.opcion-logo:has(input:focus-visible) { outline: 2px solid var(--primario); outline-offset: 2px; }
.opciones-certeza { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.opcion-certeza {
  display: flex; align-items: center; gap: .45rem; padding: .55rem .8rem; border: 2px solid var(--borde); border-radius: 10px; cursor: pointer; font-size: .92rem;
}
.opcion-certeza input { width: 18px; height: 18px; min-height: 0; margin: 0; }
.opcion-certeza:has(input:checked) { border-color: var(--primario); background: var(--primario-suave); }
.grilla-logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.tarjeta-logo {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; padding: 1rem .75rem;
  background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); color: var(--texto); text-decoration: none; box-shadow: var(--sombra);
}
.tarjeta-logo:hover { border-color: var(--primario); }
.alerta.diferencia { line-height: 1.5; }

.filtros { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
@media (max-width: 820px) { .filtros { grid-template-columns: 1fr 1fr; } .filtros .buscador { grid-column: 1 / -1; } }

/* ─── Formularios ─── */
.form { display: flex; flex-direction: column; gap: .9rem; }
.campo { display: flex; flex-direction: column; gap: .3rem; }
.campo > span, .etiqueta { font-weight: 600; font-size: .92rem; }
.campo small, .ayuda { color: var(--texto-2); font-size: .82rem; font-weight: 400; }
.opcional { color: var(--texto-2); font-weight: 400; font-size: .82rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--texto); background: var(--card);
  border: 1px solid var(--borde); border-radius: 10px; padding: .7rem .8rem; min-height: 46px;
}
textarea { min-height: 90px; resize: vertical; }
input[type="file"] { padding: .55rem; cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: .75rem; padding: .45rem .9rem; cursor: pointer;
  border: 1px solid var(--borde); border-radius: 8px; background: var(--primario-suave); color: var(--primario);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primario); outline-offset: 0; border-color: var(--primario); }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.fila-cantidad { display: grid; grid-template-columns: 2fr 1fr; gap: .5rem; }
.paso { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.paso-num {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primario); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: none;
}
.paso h2 { margin: 0; }
.error-form { color: var(--peligro); min-height: 1.2em; margin: 0; font-weight: 500; }
.firma { background: var(--card-2); border: 1px dashed var(--borde); border-radius: var(--radio); padding: .9rem 1rem; }
.barra-guardar {
  position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; display: flex; gap: .6rem; justify-content: flex-end;
  border-top: 1px solid var(--borde); margin-top: .5rem;
}
@media (max-width: 820px) {
  .barra-guardar { bottom: calc(var(--alto-nav) + env(safe-area-inset-bottom)); }
  .barra-guardar .btn { flex: 1; }
}

/* ─── Botones ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--borde);
  background: var(--card); color: var(--texto); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--card-2); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primario { background: var(--primario); color: #fff; border-color: var(--primario); }
.btn-primario:hover { background: var(--primario-hover); }
.btn-peligro { color: var(--peligro); border-color: color-mix(in srgb, var(--peligro) 40%, transparent); }
.btn-peligro:hover { background: var(--peligro-suave); }
.btn-peligro-lleno { background: var(--peligro); color: #fff; border-color: var(--peligro); }
.btn-grande { min-height: 52px; font-size: 1.05rem; }
.btn-chico { min-height: 36px; padding: .3rem .7rem; font-size: .88rem; }
.botones { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ─── Mapa ─── */
.mapa { height: 320px; border-radius: var(--radio); border: 1px solid var(--borde); z-index: 0; }
/* El mapa general sale del ancho del contenido para aprovechar la pantalla (hasta 1500px). */
.mapa-grande { height: calc(100vh - 110px); min-height: 520px; width: min(1500px, calc(100vw - 32px)); margin-left: calc(50% - min(750px, 50vw - 16px)); }
@media (max-width: 820px) { .mapa-grande { height: calc(100vh - 160px - var(--alto-nav)); min-height: 420px; } }
.mapa-chico { height: 220px; }
.ubicacion-acciones { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.buscar-direccion { display: flex; gap: .5rem; }
.buscar-direccion input { flex: 1; }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .6rem; font-size: .88rem; }
.leyenda span { display: inline-flex; align-items: center; gap: .35rem; }
.leaflet-popup-content { font: 14px/1.4 system-ui, sans-serif; }
.leaflet-popup-content a { font-weight: 600; }

/* ─── Detalle ─── */
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1.25rem; margin: 0; }
.datos div { min-width: 0; }
.datos dt { color: var(--texto-2); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.datos dd { margin: .1rem 0 0; font-size: 1rem; overflow-wrap: anywhere; }
.notas { white-space: pre-wrap; }
.contacto-linea { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.foto { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--borde); background: var(--card-2); }
.foto img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: zoom-in; }
.foto .foto-acciones { position: absolute; top: 6px; right: 6px; }
.previas { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.previas img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--borde); }
.banda-foto { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 1px solid var(--borde); }
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { color: var(--texto-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.estado-inactivo { color: var(--peligro); font-weight: 600; }

/* Auditoría */
.tabla-auditoria td { line-height: 1.45; }
.tabla-cambios { width: auto; min-width: 260px; font-size: .86rem; margin: .1rem 0; }
.tabla-cambios th, .tabla-cambios td { padding: .25rem .6rem .25rem 0; border-bottom: 1px dashed var(--borde); }
.tabla-cambios th { font-size: .72rem; }
.tabla-cambios td:first-child { color: var(--texto-2); white-space: nowrap; }
.tabla-cambios .antes { color: var(--peligro); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--peligro) 50%, transparent); }
.tabla-cambios .despues { color: var(--ok); font-weight: 500; }
.tabla-cambios td { overflow-wrap: anywhere; max-width: 320px; }
.datos-tecnicos { margin-top: .35rem; }
.datos-tecnicos summary { font-size: .75rem; color: var(--texto-2); cursor: pointer; }
.datos-tecnicos[open] { background: var(--card-2); border: 1px solid var(--borde); border-radius: 10px; padding: .5rem .75rem; }
.datos-lista { margin: .4rem 0 0; display: grid; gap: .2rem; font-size: .86rem; max-width: 560px; }
.datos-lista > div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .6rem; padding: .15rem 0; border-bottom: 1px dashed var(--borde); }
.datos-lista > div:last-child { border-bottom: 0; }
.datos-lista dt { color: var(--texto-2); }
.datos-lista dd { margin: 0; overflow-wrap: anywhere; }
.datos-lista .datos-lista { margin: 0; padding-left: .5rem; border-left: 2px solid var(--borde); }
@media (max-width: 600px) { .datos-lista > div { grid-template-columns: 1fr; gap: 0; } }

/* ─── Diálogo y aviso ─── */
.dialogo {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  background: var(--card); color: var(--texto); box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.dialogo::backdrop { background: rgba(10, 15, 25, .55); }
.dialogo-cuerpo { padding: 1.25rem; }
.dialogo-cuerpo h2 { margin-bottom: 1rem; }
.dialogo-botones { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
.dialogo-foto { width: min(1000px, calc(100vw - 24px)); background: #000; }
.dialogo-foto img { display: block; max-width: 100%; max-height: calc(100vh - 120px); margin: 0 auto; }
.dialogo-foto .dialogo-cuerpo { padding: .5rem; color: #ddd; }
.aviso {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%) translateY(150%); z-index: 3000;
  background: #1c2430; color: #fff; padding: .8rem 1.2rem; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  transition: transform .25s, visibility .25s; max-width: calc(100vw - 32px); font-weight: 500; visibility: hidden;
}
.aviso.visible { transform: translateX(-50%) translateY(0); visibility: visible; }
.aviso.error { background: var(--peligro); }
@media (max-width: 820px) { .aviso { bottom: calc(var(--alto-nav) + 1rem); } }

/* ─── Login ─── */
.pagina-login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-caja { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--borde); border-radius: 16px; padding: 2rem 1.5rem; box-shadow: var(--sombra); }
.login-marca { text-align: center; margin-bottom: 1.5rem; }
.login-marca h1 { margin: .3rem 0; }
.login-marca p { color: var(--texto-2); margin: 0; }

/* ─── Impresión (fichas) ─── */
.solo-impresion { display: none; }
@media print {
  .topbar, .nav-movil, .no-imprimir, .barra-guardar, .leaflet-control-container { display: none !important; }
  .solo-impresion { display: block; }
  body { background: #fff; color: #000; }
  .vista { max-width: none; padding: 0; }
  .tarjeta { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
  .mapa { height: 260px; }
  a { color: #000; text-decoration: none; }
}

/* Fotos del hallazgo con tipo */
.previas-fotos { display: grid; gap: .6rem; margin-top: .75rem; }
.previa-foto { display: flex; gap: .75rem; align-items: center; padding: .5rem; border: 1px solid var(--borde); border-radius: 12px; background: var(--card-2); }
.previa-foto img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; flex: none; }
.previa-datos { flex: 1; display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; min-width: 0; }
.previa-datos .campo { flex: 1; min-width: 180px; }
.foto-tipo { display: block; padding: .3rem .5rem; font-size: .78rem; font-weight: 600; color: var(--texto-2); background: var(--card); border-top: 1px solid var(--borde); }

/* Foto de la persona */
.persona-ficha { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.persona-foto { display: flex; flex-direction: column; align-items: center; gap: .4rem; flex: none; }
.persona-foto img, .persona-sin-foto { width: 110px; height: 130px; border-radius: 12px; object-fit: cover; border: 1px solid var(--borde); background: var(--card-2); }
.persona-foto img { cursor: zoom-in; }
.persona-sin-foto { display: grid; place-items: center; font-size: 2.6rem; color: var(--texto-2); }

/* Mapa de calor */
.vista-mapa { display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: .6rem; border: 1px solid var(--borde); border-radius: 12px; background: var(--card); flex-wrap: wrap; }
.vista-mapa label { position: relative; display: flex; align-items: center; padding: .45rem .8rem; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--texto-2); }
.vista-mapa input { position: absolute; opacity: 0; pointer-events: none; }
.vista-mapa label:has(input:checked) { background: var(--primario); color: #fff; }
.vista-mapa label:has(input:focus-visible) { outline: 2px solid var(--primario); outline-offset: 2px; }
.leyenda-calor { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; font-size: .85rem; color: var(--texto-2); }
.barra-calor { flex: 0 1 220px; height: 10px; border-radius: 999px; background: linear-gradient(90deg, #2b83ba, #abdda4, #ffffbf, #fdae61, #d7191c); }

/* Selección de registros para dar de baja */
.seleccionando .item { position: relative; padding-left: 3rem; cursor: pointer; user-select: none; }
.check-item { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 2px solid var(--borde); border-radius: 6px; background: var(--card); }
.item.elegido { border-color: var(--peligro); background: var(--peligro-suave); }
.item.elegido .check-item { background: var(--peligro); border-color: var(--peligro); }
.item.elegido .check-item::after { content: '✓'; color: #fff; font-weight: 700; font-size: .9rem; display: grid; place-items: center; height: 100%; }
.barra-seleccion { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; padding: .75rem 1rem; background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.barra-seleccion .espaciador { flex: 1; }
@media (max-width: 820px) { .barra-seleccion { bottom: calc(var(--alto-nav) + env(safe-area-inset-bottom)); } }


/* Papelera */
.item-papelera { border-left: 4px solid var(--peligro); }
.baja-info { margin: .6rem 0; padding: .55rem .75rem; border-radius: 8px; background: var(--peligro-suave); font-size: .9rem; display: grid; gap: .15rem; }

/* Segundo factor */
.pasos-2fa { padding-left: 1.2rem; display: grid; gap: 1rem; }
.qr-2fa { margin: .6rem 0; padding: .6rem; background: #fff; border-radius: 12px; display: inline-block; border: 1px solid var(--borde); }
.qr-2fa img { display: block; }
.codigos-emergencia { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: 1rem 0; font-size: 1.05rem; }
.codigos-emergencia span { padding: .5rem; text-align: center; border: 1px dashed var(--borde); border-radius: 8px; background: var(--card-2); }
#form2fa[hidden], #loginForm[hidden] { display: none; }

.alerta-error { background: var(--peligro-suave); color: var(--peligro); border-color: color-mix(in srgb, var(--peligro) 35%, transparent); }
.alerta .mono { word-break: break-all; }

/* Cadena de custodia y pericias */
.linea-tiempo { list-style: none; margin: .5rem 0 0; padding: 0; border-left: 3px solid var(--primario); }
.linea-tiempo li { position: relative; display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .5rem 0 .75rem 1rem; }
.linea-tiempo li::before { content: ''; position: absolute; left: -8px; top: .8rem; width: 13px; height: 13px; border-radius: 50%; background: var(--primario); border: 2px solid var(--card); }
.linea-tiempo .lt-fecha { font-weight: 600; font-size: .9rem; color: var(--texto-2); }
.linea-tiempo .lt-cuerpo { display: grid; gap: .15rem; }
.linea-tiempo li.anulado .lt-cuerpo > :not(.estado-inactivo) { text-decoration: line-through; opacity: .6; }
.linea-tiempo li.anulado::before { background: var(--peligro); }
@media (max-width: 600px) { .linea-tiempo li { grid-template-columns: 1fr; gap: .2rem; } }
.pericia.anulado { opacity: .65; }
.pericia.anulado .item-titulo { text-decoration: line-through; }
.resultado-positivo { color: var(--peligro); }
.resultado-negativo { color: var(--ok); }
.resultado-no_concluyente, .resultado-pendiente { color: var(--aviso); }

/* Causas */
.chip-causa { background: #f3e8ff; color: #6b21a8; border-color: transparent; font-weight: 600; }
:root[data-theme="dark"] .chip-causa { background: #2e1a47; color: #d8b4fe; }
.lista-miembros { display: grid; gap: .35rem; max-height: 240px; overflow-y: auto; padding: .5rem; border: 1px solid var(--borde); border-radius: 10px; margin-top: .4rem; }
.filtros select[name="causa_id"] { grid-column: span 2; }
@media (max-width: 820px) { .filtros select[name="causa_id"] { grid-column: 1 / -1; } }

/* Personas */
.item-persona { display: flex; gap: .85rem; align-items: center; }
.persona-mini { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--borde); background: var(--card-2); }
.persona-mini.persona-sin-foto { display: grid; place-items: center; font-size: 1.5rem; color: var(--texto-2); }
.verificar-caja { max-width: 460px; }
.verificar-caja h2 { font-size: 1.05rem; margin-top: 1rem; }

/* Datos de la cámara (EXIF) */
.foto-exif { display: block; padding: 0 .5rem .35rem; font-size: .72rem; color: var(--texto-2); background: var(--card); }
.foto-exif-aviso { color: var(--aviso); font-weight: 600; }
.sugerencia-exif { margin-top: .6rem; }

/* Estadísticas — un solo color de serie (azul de la guía, con su paso para modo oscuro) */
:root { --serie-1: #2a78d6; --serie-otros: #9aa5b3; --grilla: #e3e6ea; }
:root[data-theme="dark"] { --serie-1: #3987e5; --serie-otros: #6b7480; --grilla: #2b333d; }
.filtros-est { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grafico h2 { margin-bottom: .75rem; }
.barras { display: grid; gap: .35rem; }
.barra-fila { display: grid; grid-template-columns: minmax(90px, 38%) 1fr 2.5rem; align-items: center; gap: .6rem; padding: .25rem .2rem; border-radius: 6px; cursor: default; outline: none; }
.barra-fila:hover, .barra-fila:focus-visible { background: var(--card-2); }
.barra-nombre { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-pista { height: 12px; }
.barra { display: block; height: 100%; background: var(--serie-1); border-radius: 0 4px 4px 0; }
.barra-otros { background: var(--serie-otros); }
.barra-valor { font-size: .85rem; font-weight: 600; text-align: right; color: var(--texto); font-variant-numeric: tabular-nums; }
.columnas { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 200px; align-items: end; border-bottom: 1px solid var(--grilla); padding-top: .5rem; }
.columna { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; outline: none; }
.columna-barra { display: block; background: var(--serie-1); border-radius: 4px 4px 0 0; min-height: 0; margin: 0 2px; }
.columna:hover .columna-barra, .columna:focus-visible .columna-barra { filter: brightness(1.15); }
.columna-mes { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: .3rem; font-size: .72rem; color: var(--texto-2); white-space: nowrap; }
.grafico .columnas + p { margin-top: 1.6rem; }
.ver-tabla { margin-top: .75rem; font-size: .88rem; }
.ver-tabla summary { cursor: pointer; color: var(--texto-2); }
.ver-tabla table { margin-top: .5rem; }
.tooltip-grafico { position: fixed; z-index: 3000; pointer-events: none; background: #1c2430; color: #fff; padding: .4rem .65rem; border-radius: 8px; font-size: .85rem; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
@media (max-width: 820px) { .filtros-est { grid-template-columns: 1fr 1fr; } }

/* Menú superior: con muchas secciones se desliza de costado en vez de romper la barra */
.nav-escritorio { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-escritorio::-webkit-scrollbar { display: none; }
.nav-escritorio a { white-space: nowrap; flex: none; }
@media (max-width: 1180px) { .nav-escritorio a { padding: .5rem .55rem; font-size: .92rem; } }
.filtros-est select[name="causa_id"] { grid-column: auto; }

/* ─── Huellas de los PDF ─── */
.huella { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: var(--fondo-2, rgba(127,127,127,.08)); padding: .45rem .6rem; border-radius: 8px; margin: .3rem 0 .6rem; }
.lista-emisiones { display: flex; flex-direction: column; gap: .6rem; }
.emision { border-top: 1px solid var(--borde); padding-top: .5rem; }
.emision:first-child { border-top: 0; padding-top: 0; }

/* ─── Normas de manejo de la información ─── */
.lista-normas { display: flex; flex-direction: column; gap: .6rem; padding-left: 1.3rem; margin: 1rem 0; }
.lista-normas li { line-height: 1.45; }

/* ─── Tablero de la causa ─── */
.cronologia { list-style: none; margin: .5rem 0 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--borde); }
.cronologia li { position: relative; padding: 0 0 .9rem .6rem; }
.cronologia li::before { content: ''; position: absolute; left: calc(-1.1rem - 6px); top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primario); border: 2px solid var(--card); }
.cronologia a { display: flex; flex-direction: column; gap: .1rem; text-decoration: none; color: var(--texto); }
.cronologia a:hover strong { text-decoration: underline; }
.cronologia-fecha { font-size: .82rem; color: var(--texto-2); }
.cronologia-datos { font-size: .86rem; color: var(--texto-2); white-space: pre-wrap; }

/* ─── Custodia: acta y pedidos de corrección ─── */
.lt-acciones { margin-top: .45rem; }
.pedido-correccion { margin-top: .35rem; padding: .4rem .6rem; border-radius: 8px; background: var(--aviso-suave, rgba(234, 179, 8, .12)); }
.alerta-enlace { display: block; text-decoration: none; color: inherit; }
.alerta-enlace:hover { filter: brightness(.97); }
.tarjeta.pedido { display: flex; flex-direction: column; gap: .3rem; }

/* ─── Ingreso: enlace "¿Olvidaste tu contraseña?" ─── */
.btn-enlace { background: none; border: 0; padding: .3rem 0; color: var(--primario); font: inherit; font-size: .92rem; cursor: pointer; text-decoration: underline; align-self: center; }
.btn-enlace:hover { filter: brightness(.85); }

/* Asistente con IA */
.chip-ok { background: var(--ok-suave); color: var(--ok); border-color: transparent; font-weight: 600; }
.respuesta-ia { margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--radio); background: var(--card-2); border: 1px solid var(--borde); line-height: 1.55; }
.respuesta-ia .chip { margin: 0 .1rem; }
.progreso-ia { margin-top: .8rem; display: grid; gap: .35rem; }
.progreso-ia progress { width: 100%; height: 12px; accent-color: var(--primario); }
.progreso-ok { color: var(--ok); }
.progreso-ok progress { accent-color: var(--ok); }
.progreso-error { color: var(--peligro); }
.btn.deshabilitado { opacity: .5; pointer-events: none; }

/* Patrones */
.alerta-patron { border-left: 4px solid var(--aviso); }
.grupo-patron { display: grid; gap: .45rem; padding: .9rem 1rem; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--card-2); }
.fila-grupo { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; align-items: start; }
@media (max-width: 600px) { .fila-grupo { grid-template-columns: 1fr; } }
.tendencia-barras { display: flex; align-items: flex-end; gap: 3px; height: 64px; margin: .5rem 0; }
.tendencia-barras .tb { flex: 1; background: var(--primario); border-radius: 3px 3px 0 0; min-height: 2px; }
.tendencia-barras .tb-proy { background: repeating-linear-gradient(45deg, #e8893c, #e8893c 4px, #f2b27a 4px, #f2b27a 8px); }

/* Fuentes abiertas */
.noticia-osint .item-titulo a { color: var(--texto); text-decoration: none; }
.noticia-osint .item-titulo a:hover { text-decoration: underline; }
/* Mapa: noticias de procedimientos (círculos huecos y mapa de calor violeta) */
.aro { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid #868e96; background: var(--card); display: inline-block; flex: none; }
.aro-aprox { border-style: dashed; }
.barra-calor-noticias { background: linear-gradient(90deg, #d9b8ea, #bb8bd4, #9c5cbe, #7b3294, #40004b) !important; }
.vista-mapa .chico.muted { margin-right: .3rem; }

/* Tablero del inicio */
.tablero-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .25rem 0 1rem; }
.tablero-filtros select { width: auto; min-width: 12rem; }
.segmentado { display: inline-flex; background: var(--card); border: 1px solid var(--borde); border-radius: 999px; padding: 3px; }
.segmentado button { border: 0; background: none; color: var(--texto-2); font: inherit; font-size: .9rem; padding: .35rem .85rem; border-radius: 999px; cursor: pointer; }
.segmentado button.activo { background: var(--primario); color: #fff; font-weight: 600; }
.segmentado button:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem 1.1rem; text-decoration: none; color: var(--texto); box-shadow: var(--sombra); transition: transform .12s ease, border-color .12s ease; }
.kpi:hover, .kpi:focus-visible { transform: translateY(-2px); border-color: var(--primario); }
.kpi strong { font-size: 2rem; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi span { font-weight: 600; font-size: .92rem; }
.kpi small { color: var(--texto-2); font-size: .78rem; line-height: 1.3; }
.tablero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tablero > .tarjeta { margin: 0; min-width: 0; }
.tablero-ancho { grid-column: 1 / -1; }
@media (max-width: 860px) { .tablero { grid-template-columns: minmax(0, 1fr); } }
.tablero-cabecera { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem .8rem; margin-bottom: .6rem; }
.tablero-cabecera h2 { margin: 0; }
.mapa-tablero { height: 300px; }
.dias-grafico { position: relative; padding-left: 2rem; }
.dias-max { position: absolute; left: 0; top: 0; }
.dias-columnas { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; height: 190px; align-items: end; border-bottom: 1px solid var(--grilla); background: linear-gradient(var(--grilla) 1px, transparent 1px) 0 0 / 100% 50%; }
.dia { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; outline: none; cursor: default; }
.dia-pila { display: flex; flex-direction: column; gap: 2px; min-height: 0; border-radius: 4px 4px 0 0; overflow: hidden; }
.dia-pila span { display: block; min-height: 2px; }
.dia:hover .dia-pila, .dia:focus-visible .dia-pila { filter: brightness(1.12); }
.dia:focus-visible { box-shadow: 0 0 0 2px var(--primario); border-radius: 4px; }
.dia-antes .dia-pila { opacity: .35; }
.dia-fecha { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: .3rem; font-size: .72rem; color: var(--texto-2); white-space: nowrap; }
.dias-grafico + p, .dias-grafico + details { margin-top: 1.7rem; }
.barra-clic { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.barra-clic:hover .barra, .barra-clic:focus-visible .barra { filter: brightness(1.12); }
.alertas-cortas { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.alertas-cortas li { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; padding: .45rem .5rem; border-radius: 8px; border-left: 3px solid var(--aviso); }
.alertas-cortas li:hover { background: var(--card-2); }
.alertas-cortas a { color: var(--texto); text-decoration: none; font-size: .93rem; }
.alertas-cortas a:hover { text-decoration: underline; }
.alertas-cortas small { color: var(--texto-2); white-space: nowrap; font-size: .78rem; }

/* Tablero con el estilo del diseño de referencia (fondo celeste, tarjetas de color) */
:root { --panel-fondo: #d7f1f9; --panel-borde: #bfe5f1; --cal-0: #eef2f6; --cal-1: #c6dbf7; --cal-2: #8fb8ef; --cal-3: #4f8fe3; --cal-4: #1f5fbf; }
:root[data-theme="dark"] { --panel-fondo: #0f222b; --panel-borde: #1b3a47; --cal-0: #222a33; --cal-1: #1d3556; --cal-2: #24508c; --cal-3: #3a73c4; --cal-4: #6aa0f0; }
.panel { background: var(--panel-fondo); border: 1px solid var(--panel-borde); border-radius: 18px; padding: 1.1rem; margin: 0 -.25rem; }
.panel-cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; }
.panel-cabecera h1 { margin: .1rem 0 0; }
.panel-ruta { font-size: .72rem; font-weight: 700; letter-spacing: .12em; color: var(--texto-2); }
.panel .tablero-filtros { margin: 0; }
.panel > .chico.muted { margin: .4rem 0 .9rem; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: .9rem; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .1rem; padding: 1rem .8rem; border-radius: 12px; color: #fff; text-decoration: none; box-shadow: 0 6px 14px rgba(16, 24, 40, .16); transition: transform .12s ease, box-shadow .12s ease; }
.tile:hover, .tile:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(16, 24, 40, .22); }
.tile:focus-visible { outline: 3px solid #fff; outline-offset: -5px; }
.tile-etiqueta { font-size: 1.02rem; font-weight: 500; opacity: .95; }
.tile strong { font-size: 2.2rem; line-height: 1.05; font-weight: 800; letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.tile small { font-size: .78rem; opacity: .92; }
/* Colores con contraste de 5:1 o más para la letra blanca */
.tile-1 { background: linear-gradient(135deg, #d4502a, #c2410c); }
.tile-2 { background: linear-gradient(135deg, #c86a12, #b45309); }
.tile-3 { background: linear-gradient(135deg, #138a7f, #0f766e); }
.tile-4 { background: linear-gradient(135deg, #1a6f88, #155e75); }
.panel-grilla { display: grid; gap: .9rem; margin-bottom: .9rem; }
.panel-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .panel-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .panel-2, .panel-4, .tiles { grid-template-columns: minmax(0, 1fr); } .panel { padding: .75rem; margin: 0; } }
.panel-tarjeta { margin: 0; min-width: 0; border: 0; border-radius: 12px; box-shadow: 0 2px 8px rgba(16, 24, 40, .07); }
.titulo-acento { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.subtitulo-acento { margin: .1rem 0 .6rem; font-size: .8rem; color: var(--texto-2); }
.cifra-grande { font-size: 2.2rem; font-weight: 800; margin: .2rem 0 .4rem; line-height: 1; }
/* Línea */
.linea-tablero { width: 100%; height: auto; display: block; overflow: visible; }
.linea-tablero .rejilla { stroke: var(--grilla); stroke-width: 1; }
.linea-tablero .eje { fill: var(--texto-2); font-size: 11px; }
.linea-tablero .antes { fill: var(--card-2); }
.linea-tablero .punto-linea { fill: var(--card); stroke: #d6409f; stroke-width: 2; }
.linea-tablero .globo rect { fill: #1c2430; }
.linea-tablero .globo text { fill: #fff; font-size: 11px; font-weight: 600; }
.linea-tablero .zona-hover { fill: transparent; cursor: default; outline: none; }
.linea-tablero .zona-hover:hover, .linea-tablero .zona-hover:focus-visible { fill: rgba(127, 127, 127, .08); }
/* Barras en espejo */
.espejo-tarjeta { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; align-items: center; }
@media (max-width: 760px) { .espejo-tarjeta { grid-template-columns: minmax(0, 1fr); } }
.espejo { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; height: 190px; margin-top: .5rem; }
.espejo-dia { position: relative; height: 100%; outline: none; }
.espejo-dia::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--grilla); }
.espejo-arriba, .espejo-abajo { position: absolute; left: 0; right: 0; min-height: 0; }
.espejo-arriba { bottom: calc(50% + 1px); border-radius: 4px 4px 0 0; }
.espejo-abajo { top: calc(50% + 1px); border-radius: 0 0 4px 4px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.espejo-abajo i { display: block; min-height: 2px; }
.espejo-dia:hover, .espejo-dia:focus-visible { background: rgba(127, 127, 127, .08); border-radius: 4px; }
/* Resultado de "Analizar con IA" del clima social */
.clima-ia-resultado { margin-top: .9rem; display: grid; gap: .8rem; }
.clima-ia-numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); gap: .5rem; }
@media (max-width: 760px) { .clima-ia-numeros { grid-template-columns: repeat(3, minmax(0, 1fr)); } .clima-ia-emos { grid-column: 1 / -1; } }
.clima-ia-dato { display: grid; gap: .1rem; align-content: start; padding: .6rem .7rem; border-radius: 10px; background: var(--clima-hundido); border: 1px solid var(--borde); border-left: 4px solid var(--c, var(--clima-violeta)); outline: none; }
.clima-ia-dato strong { font-size: 1.4rem; line-height: 1.1; }
.clima-ia-dato small { font-size: .72rem; color: var(--texto-2); }
.clima-ia-dato-nombre { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); }
.clima-ia-emos { display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center; }
.clima-ia-emos .clima-ia-dato-nombre { width: 100%; }
.clima-ia-emo { font-size: .85rem; white-space: nowrap; }
.clima-ia-partes { display: grid; gap: .6rem; }
.clima-ia-parte { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem; border-radius: 10px; background: var(--clima-hundido); border: 1px solid var(--borde); }
.clima-ia-parte-icono { font-size: 1.25rem; line-height: 1.3; }
.clima-ia-parte h4 { margin: 0 0 .15rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--clima-violeta); }
.clima-ia-parte p { margin: 0; line-height: 1.45; }
.clima-ia-temas { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.clima-ia-pie { margin: 0; }
/* Ruedas con porcentaje debajo de "Procedimientos por día" */
.ruedas-dia { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--borde); }
@media (max-width: 600px) { .ruedas-dia { grid-template-columns: minmax(0, 1fr); } }
.rueda { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; }
.rueda .anillo-texto { font-size: 24px; }
.rueda strong { font-size: .92rem; }
.rueda p { margin: .2rem 0 0; line-height: 1.35; }
.ruedas-nota { grid-column: 1 / -1; margin: 0; text-align: center; }
/* Cada tema por separado: gráficos chicos (small multiples) */
.mini-temas-tarjeta { margin-bottom: .9rem; }
.mini-temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem; margin-top: .5rem; }
.mini-tema { padding: .6rem .7rem .5rem; border-radius: 10px; border: 1px solid var(--borde); background: var(--card-2); }
.mini-tema-cabecera { display: flex; justify-content: space-between; align-items: baseline; gap: .4rem; font-size: .85rem; }
.mini-tema-nombre { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-tema-nombre .punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.mini-tema-cabecera strong { font-size: 1.1rem; }
.mini-barras { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1px; height: 54px; margin: .4rem 0 .25rem; border-bottom: 1px solid var(--grilla); }
.mini-dia { position: relative; height: 100%; outline: none; }
.mini-dia i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--c); border-radius: 2px 2px 0 0; }
.mini-dia:hover, .mini-dia:focus-visible { background: rgba(127, 127, 127, .12); }
.mini-tema-pie { display: flex; justify-content: space-between; gap: .4rem; font-size: .7rem; }
.espejo-texto p { margin: .25rem 0; }
.espejo-texto strong { font-size: 1.25rem; }
/* Provincias como barras de progreso */
.progreso { display: block; width: 100%; border: 0; background: none; padding: .3rem 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.progreso-fila { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .25rem; }
.progreso-pista { display: block; height: 8px; border-radius: 999px; background: var(--cal-0); overflow: hidden; }
.progreso-pista span { display: block; height: 100%; border-radius: 999px; }
.progreso:hover .progreso-pista span, .progreso:focus-visible .progreso-pista span { filter: brightness(1.12); }
/* Anillo */
.anillo-tarjeta { display: flex; flex-direction: column; align-items: center; text-align: center; }
.anillo-fondo { fill: none; stroke: var(--cal-0); stroke-width: 9; }
.anillo-valor { fill: none; stroke-width: 9; stroke-linecap: round; }
.anillo-puntos { fill: none; stroke: var(--grilla); stroke-width: 2; stroke-dasharray: 1 5; }
.anillo-texto { font-size: 26px; font-weight: 800; }
.anillo-leyenda { list-style: none; padding: 0; margin: .6rem 0 .2rem; font-size: .86rem; display: grid; gap: .2rem; }
/* Calendario */
.calendario-mes { text-align: center; font-size: 1.15rem; letter-spacing: .04em; margin-bottom: .5rem; text-transform: capitalize; }
.calendario-grilla { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.calendario-dsem { font-size: .72rem; color: var(--texto-2); font-weight: 600; padding-bottom: .15rem; }
.cal-dia { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; font-size: .8rem; font-variant-numeric: tabular-nums; outline: none; }
.cal-n0 { background: var(--cal-0); color: var(--texto-2); }
.cal-n1 { background: var(--cal-1); color: var(--texto); }
.cal-n2 { background: var(--cal-2); color: #0b1b33; }
.cal-n3 { background: var(--cal-3); color: #fff; }
.cal-n4 { background: var(--cal-4); color: #fff; }
.cal-hoy { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px #e8890c; font-weight: 800; }
.cal-futuro { opacity: .45; }
.cal-dia:focus-visible { box-shadow: 0 0 0 2px var(--primario); }
.calendario-escala { display: flex; align-items: center; justify-content: center; gap: .3rem; margin-top: .5rem; }
.calendario-escala .cal-dia { width: 14px; height: 14px; aspect-ratio: auto; }
/* Medios */
.medios-tarjeta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 560px) { .medios-tarjeta { grid-template-columns: minmax(0, 1fr); } }
.medio { display: flex; gap: .8rem; align-items: flex-start; }
.medio .titulo-acento { font-size: 1rem; text-transform: none; }
.medio-aro { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem;
  background: radial-gradient(closest-side, var(--card) 76%, transparent 78% 100%), conic-gradient(var(--color) calc(var(--pct) * 1%), var(--cal-0) 0); }
.curva-vacia { height: 150px; border-radius: 8px; background-image: linear-gradient(var(--grilla) 1px, transparent 1px), linear-gradient(90deg, var(--grilla) 1px, transparent 1px); background-size: 100% 25px, 25px 100%; opacity: .7; }

/* Mapas: fondo del color del agua del mapa local (así no se ven franjas grises fuera del archivo) */
:root { --agua-mapa: #80deea; }
:root[data-theme="dark"] { --agua-mapa: #31353f; }
.leaflet-container { background: var(--agua-mapa); }
/* Botón de pantalla completa (control de Leaflet) */
.boton-pantalla-completa { display: block; min-width: 34px; height: 34px; padding: 0 .55rem; border: 2px solid rgba(0, 0, 0, .2); border-radius: 4px; background: #fff; color: #1c2430; font: 600 1.1rem/1 system-ui, sans-serif; cursor: pointer; background-clip: padding-box; }
.boton-pantalla-completa:hover { background: #f4f4f4; }
.boton-pantalla-completa:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }
.boton-pantalla-completa.salir { font-size: .95rem; background: #c62828; color: #fff; border-color: #c62828; }
.boton-pantalla-completa.salir:hover { background: #a91f1f; }
/* En pantalla completa: el mapa ocupa todo lo que dejan los filtros y las leyendas */
.marco-mapa:fullscreen { background: var(--bg); padding: .75rem 1rem; display: flex; flex-direction: column; gap: .35rem; overflow: auto; }
.marco-mapa:fullscreen > * { flex: none; }
.marco-mapa:fullscreen .cabecera { margin-bottom: 0; }
.marco-mapa:fullscreen .cabecera h1 { font-size: 1.2rem; }
.marco-mapa:fullscreen .mapa-grande { flex: 1 1 auto; height: auto; min-height: 0; width: 100%; margin-left: 0; }
.mapa:fullscreen { height: 100vh; width: 100vw; border-radius: 0; border: 0; }

/* Pantalla completa: título y filtros en una sola línea, sin las ayudas largas */
.marco-mapa:fullscreen .cabecera { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.marco-mapa:fullscreen .cabecera .botones { display: flex; flex-wrap: wrap; gap: .5rem; flex-direction: row; }
.marco-mapa:fullscreen .cabecera select { width: auto; }
.marco-mapa:fullscreen .ayuda { display: none; }
.marco-mapa:fullscreen .leyenda, .marco-mapa:fullscreen .leyenda-calor, .marco-mapa:fullscreen #infoMapa { margin: 0; }

/* Buscador único */
.buscador-top { margin-left: auto; margin-right: .6rem; }
.buscador-top input { width: 15rem; padding: .45rem .8rem; border-radius: 999px; font-size: .9rem; background: var(--card-2); }
.buscador-top input:focus { width: 19rem; background: var(--card); }
@media (max-width: 1150px) { .buscador-top input { width: 10rem; } .buscador-top input:focus { width: 14rem; } }
@media (max-width: 820px) { .buscador-top { display: none; } }
.buscador-grande { display: flex; gap: .5rem; margin: .5rem 0; }
.buscador-grande input { flex: 1; font-size: 1.05rem; padding: .7rem 1rem; }
.resumen-busqueda { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 1rem; }
.resumen-busqueda .chip { text-decoration: none; color: var(--texto); }
.chip-boton { cursor: pointer; background: var(--card); font: inherit; font-size: .88rem; }
.chip-boton:hover { border-color: var(--primario); }
mark { background: #ffe58a; color: #1c2430; border-radius: 3px; padding: 0 .1em; }
:root[data-theme="dark"] mark { background: #8a6d00; color: #fff; }

/* Tablero a lo ancho de la pantalla (no en la columna de 1100 px del resto de las páginas) */
.panel-ancho { width: min(1760px, calc(100vw - 32px)); margin-left: calc(50% - min(880px, 50vw - 16px)); margin-right: 0; }
@media (max-width: 760px) { .panel-ancho { width: auto; margin-left: 0; } }
/* Pantalla completa del tablero: ocupa toda la pantalla y se desplaza adentro */
.panel:fullscreen { width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0; padding: 1.25rem 1.75rem; overflow-y: auto; }
.panel:fullscreen .mapa-tablero { height: 380px; }
.btn-pantalla { white-space: nowrap; }
.btn-pantalla.salir { background: #c62828; color: #fff; border-color: #c62828; }
.btn-pantalla.salir:hover { background: #a91f1f; }
.panel:fullscreen .panel-cabecera { position: sticky; top: -1.25rem; z-index: 1000; background: var(--panel-fondo); margin: -1.25rem -1.75rem 0; padding: 1rem 1.75rem .6rem; box-shadow: 0 6px 10px -8px rgba(16, 24, 40, .25); }

/* Tarjeta de tendencias */
.tendencias-tarjeta { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.5rem; margin-bottom: .9rem; }
@media (max-width: 860px) { .tendencias-tarjeta { grid-template-columns: minmax(0, 1fr); } }
.hashtags { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: baseline; }
.hashtag { display: inline-flex; align-items: baseline; gap: .25rem; padding: .2rem .6rem; border-radius: 999px; background: var(--card-2); border: 1px solid var(--borde); color: var(--texto); text-decoration: none; font-weight: 700; line-height: 1.3; }
.hashtag small { font-size: .72rem; font-weight: 600; color: var(--texto-2); }
.hashtag:hover, .hashtag:focus-visible { border-color: #c2410c; color: #c2410c; }
.hashtag-sube { border-color: #f2c4a8; background: #fff4ec; }
:root[data-theme="dark"] .hashtag-sube { background: #3a2417; border-color: #6b3a1c; }
.tendencias-google { margin: 0; padding-left: 1.4rem; display: grid; gap: .3rem; }
.tendencias-google li { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; font-size: .92rem; }
.tendencias-google li::marker { color: var(--texto-2); font-weight: 700; }
.tendencias-google a { color: var(--texto); text-decoration: none; }
.tendencias-google a:hover { text-decoration: underline; }
.tendencias-google .tg-trafico { color: var(--texto-2); font-size: .78rem; white-space: nowrap; }
.tendencias-google li.del-tema .tg-busqueda, .tendencias-google li.del-tema a { color: #c62828; font-weight: 700; }
.chip-tema { font-size: .7rem; border-color: #c62828; color: #c62828; }

/* Recursos OSINT y acciones de cada noticia */
.recursos { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.recursos .tarjeta { margin: 0; }
.recurso-lista { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .55rem; }
.recurso-lista li { display: grid; gap: .1rem; }
.recurso-lista a { font-weight: 600; text-decoration: none; }
.recurso-lista a:hover { text-decoration: underline; }
.acciones-noticia { display: inline-flex; gap: .7rem; margin-left: auto; }
.acciones-noticia a { color: var(--texto-2); text-decoration: none; white-space: nowrap; }
.acciones-noticia a:hover { color: var(--primario); text-decoration: underline; }

/* Botón y barra de "Actualizar" en la tarjeta de tendencias */
.tendencias-marco { margin-bottom: .9rem; }
.tendencias-marco .tendencias-tarjeta { margin-bottom: 0; box-shadow: none; }
.tendencias-barra-arriba { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-bottom: .4rem; }
#progresoTendencias { margin: 0 0 .8rem; }

/* Noticias guardadas en la PC */
.acciones-noticia .btn-enlace { padding: 0; font-size: inherit; color: var(--texto-2); text-decoration: none; }
.acciones-noticia .btn-enlace:hover { color: var(--primario); text-decoration: underline; }
.acciones-noticia .btn-enlace.guardada { color: var(--ok); font-weight: 600; }
.dialogo-ancho { width: min(900px, calc(100vw - 32px)); }
.datos-guardada { display: grid; gap: .35rem; margin: .6rem 0; }
.datos-guardada div { display: grid; grid-template-columns: 12rem 1fr; gap: .5rem; }
@media (max-width: 600px) { .datos-guardada div { grid-template-columns: 1fr; } }
.datos-guardada dt { color: var(--texto-2); }
.datos-guardada dd { margin: 0; word-break: break-all; }
.texto-guardado { white-space: pre-wrap; max-height: 45vh; overflow-y: auto; padding: .8rem 1rem; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--card-2); line-height: 1.55; font-size: .93rem; }
.hashtags-chicos .hashtag { font-size: .8rem; font-weight: 600; }

/* Clima social: sigue el tema elegido (☀️/🌙). Los colores van en variables: claros por defecto y oscuros (el panel
   oscuro que pidió el usuario) con el tema oscuro. Redefine también los de lo que va adentro (texto de la IA, avisos). */
.clima-oscuro {
  --clima-fondo: radial-gradient(120% 140% at 100% 0%, #efeaff 0%, #f7f8fc 45%, #ffffff 100%); --clima-marco: #e2ddf5;
  --clima-violeta: #6d28d9; --clima-caja: #ffffff; --clima-hundido: #f4f6fa; --clima-pastilla: #eef1f6; --clima-pastilla-borde: #d5dbe5;
  --clima-pista: #e9edf3; --clima-chip-borde: #d5dbe5; --clima-insignia: #efeaff; --clima-insignia-borde: #c9bdf5;
  --clima-actual: #fdecee; --clima-anillo-fondo: rgba(16, 24, 40, .07);
  grid-column: 1 / -1; margin-top: .6rem; padding: 1.1rem 1.2rem 1rem; border-radius: 16px; color: var(--texto);
  background: var(--clima-fondo); border: 1px solid var(--clima-marco);
}
:root[data-theme="dark"] .clima-oscuro {
  --texto: #e6e9f2; --texto-2: #93a0b8; --borde: #243049; --card: #121a2c; --card-2: #16203a;
  --aviso: #f0b64a; --aviso-suave: #33290f; --peligro: #ff7b86; --peligro-suave: #3a1d24;
  --clima-fondo: radial-gradient(120% 140% at 100% 0%, #1b1540 0%, #0e1525 45%, #0b1120 100%); --clima-marco: #1d2740;
  --clima-violeta: #c4b5fd; --clima-caja: rgba(18, 26, 44, .85); --clima-hundido: #0d1424; --clima-pastilla: #243049; --clima-pastilla-borde: #34425f;
  --clima-pista: #1a2338; --clima-chip-borde: #2c3956; --clima-insignia: #2a2350; --clima-insignia-borde: #4c3f8f;
  --clima-actual: #24141f; --clima-anillo-fondo: rgba(255, 255, 255, .06);
}
.clima-encabezado { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; padding-bottom: .8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--borde); }
.clima-titulo { margin: 0; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; color: var(--clima-violeta); }
.clima-tenue { color: var(--texto-2); }
.clima-mini { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.clima-grilla { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1rem; }
@media (max-width: 860px) { .clima-grilla { grid-template-columns: minmax(0, 1fr); } }
.clima-columna { display: grid; gap: 1rem; align-content: start; }
.clima-caja { background: var(--clima-caja); border: 1px solid var(--borde); border-radius: 14px; padding: .9rem 1rem; }
.clima-caja-cabecera { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.clima-caja h3 { margin: 0; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--texto); }
.clima-pastilla { font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; background: var(--clima-pastilla); border: 1px solid var(--clima-pastilla-borde); white-space: nowrap; }
.clima-anillo { display: block; width: min(210px, 70%); margin: .2rem auto 1rem; }
.clima-anillo circle[tabindex] { outline: none; cursor: pointer; transition: stroke-width .15s; }
.clima-anillo circle[tabindex]:hover, .clima-anillo circle[tabindex]:focus-visible { stroke-width: 26; }
.clima-anillo-valor { fill: var(--texto); font-size: 30px; font-weight: 700; }
.clima-anillo-etiqueta { fill: var(--texto-2); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.clima-recuadros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.clima-recuadro { text-align: center; padding: .55rem .3rem; border-radius: 10px; background: var(--clima-hundido); border: 1px solid var(--borde); outline: none; }
.clima-recuadro strong { display: block; font-size: 1.05rem; }
.clima-recuadro-nombre { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-2); }
.clima-recuadro .punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.clima-actual { border-color: #e35d6a; background: var(--clima-actual); }
.clima-emociones { display: grid; gap: .65rem; }
.clima-emocion { outline: none; }
.clima-emocion-fila { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; margin-bottom: .25rem; }
.clima-cuenta { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--texto-2); white-space: nowrap; }
.clima-pista { height: 8px; border-radius: 999px; background: var(--clima-pista); overflow: hidden; }
.clima-pista span { display: block; height: 100%; border-radius: 999px; }
.clima-emocion:hover .clima-pista span, .clima-emocion:focus-visible .clima-pista span { filter: brightness(1.15); }
.clima-temas { display: flex; flex-wrap: wrap; gap: .5rem; }
.clima-tema { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .6rem; border-radius: 10px; background: var(--clima-hundido); border: 1px solid var(--clima-chip-borde); font-weight: 600; font-size: .85rem; outline: none; }
.clima-insignia { font-size: .72rem; padding: .05rem .4rem; border-radius: 6px; background: var(--clima-insignia); border: 1px solid var(--clima-insignia-borde); }
.clima-ia-fila { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: .7rem; font-size: .85rem; }
.clima-ia-fila label { white-space: nowrap; }
.clima-boton-ia { border: 0; border-radius: 10px; padding: .5rem 1rem; font: inherit; font-weight: 600; font-size: .9rem; color: #fff; cursor: pointer;
  background: linear-gradient(90deg, #7c3aed, #db2777); box-shadow: 0 4px 14px rgba(219, 39, 119, .25); }
.clima-boton-ia:hover { filter: brightness(1.1); }
.clima-boton-ia:disabled { opacity: .6; cursor: wait; }
#climaIA:not(:empty) { margin-top: .8rem; }
#climaIA .cargando { color: var(--texto-2); }
.clima-ia-fila label { display: inline-flex; align-items: center; gap: .35rem; }
.clima-ia-fila input[type="radio"] { width: auto; height: auto; min-height: 0; margin: 0; padding: 0; accent-color: #8b5cf6; flex: none; }

/* ─── Tablero de Inicio oscuro, igual que el clima social (pedido del usuario: "todo uniforme") ───
   Es oscuro en los dos temas: redefine los colores para todo lo que va adentro. */
:root[data-theme="dark"] .tablero-oscuro {
  --bg: #0b1120; --card: #121a2c; --card-2: #16203a; --borde: #243049; --texto: #e6e9f2; --texto-2: #93a0b8;
  --primario: #7aa2ff; --primario-hover: #93b4ff; --primario-suave: #1a2547;
  --peligro: #ff7b86; --peligro-suave: #3a1d24; --ok: #4cc17a; --ok-suave: #16301f; --aviso: #f0b64a; --aviso-suave: #33290f;
  --grilla: #222c42; --panel-fondo: #0b1120; --panel-borde: #1d2740; --agua-mapa: #31353f;
  --cal-0: #1a2338; --cal-1: #1d3556; --cal-2: #24508c; --cal-3: #3a73c4; --cal-4: #6aa0f0;
  color: var(--texto); border-color: var(--panel-borde);
  background: radial-gradient(120% 60% at 100% 0%, #1b1540 0%, #0e1525 40%, #0b1120 100%);
}
:root[data-theme="dark"] .tablero-oscuro .panel-tarjeta { background: rgba(18, 26, 44, .85); border: 1px solid var(--borde); border-radius: 14px; box-shadow: none; color: var(--texto); }
:root[data-theme="dark"] .tablero-oscuro .panel-ruta { color: #c4b5fd; }
:root[data-theme="dark"] .tablero-oscuro select, :root[data-theme="dark"] .tablero-oscuro .btn { background: var(--card); color: var(--texto); border-color: var(--borde); }
:root[data-theme="dark"] .tablero-oscuro .btn:hover { background: var(--card-2); }
:root[data-theme="dark"] .tablero-oscuro .segmentado button.activo { background: linear-gradient(90deg, #7c3aed, #db2777); }
/* Títulos: en mayúscula chica y con el color del texto (los colores quedan para los datos) */
:root[data-theme="dark"] .tablero-oscuro .titulo-acento, :root[data-theme="dark"] .tablero-oscuro .tablero-cabecera h2 { color: var(--texto) !important; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
:root[data-theme="dark"] .tablero-oscuro .medio .titulo-acento { font-size: .9rem; text-transform: none; letter-spacing: 0; }
:root[data-theme="dark"] .tablero-oscuro .cifra-grande, :root[data-theme="dark"] .tablero-oscuro .espejo-texto strong { color: var(--texto) !important; }
/* Tiles: recuadro oscuro con una franja de color arriba */
:root[data-theme="dark"] .tablero-oscuro .tile { background: #0d1424; border: 1px solid var(--borde); border-top: 3px solid var(--acento); color: var(--texto); box-shadow: none; }
:root[data-theme="dark"] .tablero-oscuro .tile:hover, :root[data-theme="dark"] .tablero-oscuro .tile:focus-visible { box-shadow: 0 8px 22px -10px var(--acento); }
:root[data-theme="dark"] .tablero-oscuro .tile:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
:root[data-theme="dark"] .tablero-oscuro .tile-etiqueta { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-2); }
:root[data-theme="dark"] .tablero-oscuro .tile small { color: var(--texto-2); }
:root[data-theme="dark"] .tablero-oscuro .tile-1 { --acento: #e35d6a; }
:root[data-theme="dark"] .tablero-oscuro .tile-2 { --acento: #e0a23a; }
:root[data-theme="dark"] .tablero-oscuro .tile-3 { --acento: #159f97; }
:root[data-theme="dark"] .tablero-oscuro .tile-4 { --acento: #1a9fc0; }
/* Gráficos */
:root[data-theme="dark"] .tablero-oscuro .linea-tablero .globo rect { fill: #2a2350; stroke: #4c3f8f; }
:root[data-theme="dark"] .tablero-oscuro .anillo .anillo-valor { stroke: #1a9fc0; }
:root[data-theme="dark"] .tablero-oscuro .anillo-texto { fill: var(--texto); }
:root[data-theme="dark"] .tablero-oscuro .cal-hoy { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px #e0a23a; }
:root[data-theme="dark"] .tablero-oscuro .cal-n2 { color: #e6e9f2; }
/* Tendencias */
:root[data-theme="dark"] .tablero-oscuro .hashtag { background: #0d1424; border-color: #2c3956; }
:root[data-theme="dark"] .tablero-oscuro .hashtag small { color: #c4b5fd; }
:root[data-theme="dark"] .tablero-oscuro .hashtag:hover, :root[data-theme="dark"] .tablero-oscuro .hashtag:focus-visible { border-color: #8b5cf6; color: var(--texto); }
:root[data-theme="dark"] .tablero-oscuro .hashtag-sube { background: #3a2417; border-color: #6b3a1c; }
:root[data-theme="dark"] .tablero-oscuro .tendencias-google li.del-tema .tg-busqueda, :root[data-theme="dark"] .tablero-oscuro .tendencias-google li.del-tema a { color: #ff7b86; }
/* El clima ya está dentro de una tarjeta oscura: sin su propio fondo */
:root[data-theme="dark"] .tablero-oscuro .clima-oscuro { background: none; border: 0; border-top: 1px solid var(--borde); border-radius: 0; padding: 1rem 0 0; }
:root[data-theme="dark"] .tablero-oscuro .leaflet-control-attribution { background: rgba(11, 17, 32, .75); color: var(--texto-2); }
:root[data-theme="dark"] .tablero-oscuro .leaflet-control-attribution a { color: var(--texto-2); }

/* ✈️ Aeronaves en vuelo (Mapa) */
.fila-aeronaves { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin-bottom: .6rem; }
.icono-avion { background: none; border: 0; }
.avion { display: block; width: 22px; height: 22px; color: #3b5bdb; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); transform-origin: 50% 50%; }
.avion svg { display: block; }
.avion-pista { color: #e8590c; }
.avion-emergencia { color: var(--peligro); }
.avion-tierra { opacity: .45; }
.leyenda .avion-pista, .leyenda .avion-emergencia { color: inherit; }
.leyenda svg { width: 14px; height: 14px; color: #3b5bdb; }
.leyenda .avion-pista svg { color: #e8590c; }
.leyenda .avion-emergencia svg { color: var(--peligro); }
.aro-pista { border-color: #e8590c; }
.panel-aeronaves { margin-top: 1rem; }
.panel-aeronaves h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.panel-aeronaves .tabla-scroll { overflow-x: auto; }
:root[data-theme="dark"] .avion { color: #91a7ff; }
/* 🚢 Barcos de la hidrovía */
.icono-barco { background: none; border: 0; }
.barco { display: block; width: 18px; height: 18px; color: #0b7285; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); transform-origin: 50% 50%; }
.barco svg { display: block; }
.barco-pista { color: #e8590c; }
:root[data-theme="dark"] .barco { color: #66d9e8; }
:root[data-theme="dark"] .barco-pista { color: #ff922b; }
.fila-clave { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.fila-clave input { min-width: 16rem; }
.estela { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
/* En pantalla completa el mapa ocupa lo que sobra: el panel de pistas (largo) lo dejaba sin alto. Se ve al salir. */
.marco-mapa:fullscreen .panel-aeronaves { display: none; }
.marco-mapa:fullscreen .mapa-grande { min-height: 55vh; }
.clima-anillo-fondo { stroke: var(--clima-anillo-fondo); }
/* Mapas en modo oscuro: los controles y recuadros de Leaflet vienen blancos */
:root[data-theme="dark"] .leaflet-bar a, :root[data-theme="dark"] .boton-pantalla-completa:not(.salir) { background: var(--card); color: var(--texto); border-color: var(--borde); }
:root[data-theme="dark"] .leaflet-bar a:hover, :root[data-theme="dark"] .boton-pantalla-completa:not(.salir):hover { background: var(--card-2); }
:root[data-theme="dark"] .leaflet-bar a.leaflet-disabled { background: var(--card-2); color: var(--texto-2); }
:root[data-theme="dark"] .leaflet-bar { border-color: var(--borde); }
:root[data-theme="dark"] .leaflet-popup-content-wrapper, :root[data-theme="dark"] .leaflet-popup-tip { background: var(--card); color: var(--texto); box-shadow: 0 3px 14px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .leaflet-container a.leaflet-popup-close-button { color: var(--texto-2); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(15, 19, 24, .75); color: var(--texto-2); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--texto-2); }

/* ─── 📋 Reportes: briefing en formato de infografía (ver vistaReportes) ───
   Claro por defecto y azul marino con el tema oscuro. Los colores de nivel son los mismos en los dos. */
.rep-controles h1 { margin-bottom: .2rem; }
.rep-filtros, .rep-ia { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .6rem 0; }
.rep-filtros select { width: auto; min-width: 16rem; }
.rep-ia .vista-mapa { margin: 0; }
.reporte {
  --rep-fondo: #f3f6fb; --rep-panel: #ffffff; --rep-panel-2: #eef3fa; --rep-borde: #d6dfec; --rep-texto: #13203a; --rep-tenue: #5a6880;
  --rep-acento: #1d4ed8; --rep-cabecera: linear-gradient(120deg, #e8f0ff 0%, #f7faff 55%, #e9f3ff 100%);
  --rep-sube: #c62828; --rep-baja: #1e7d3c; --rep-igual: #6b7280;
  --rep-alto: #dc2626; --rep-medio: #ea7a12; --rep-bajo: #d4a106; --rep-sin: #dde3ec; --rep-normal: #1e7d3c;
  background: var(--rep-fondo); color: var(--rep-texto); border: 1px solid var(--rep-borde); border-radius: 16px; padding: 1rem; display: grid; gap: .9rem;
}
:root[data-theme="dark"] .reporte {
  --rep-fondo: #071226; --rep-panel: #0c1c38; --rep-panel-2: #10244a; --rep-borde: #1d3a66; --rep-texto: #e8f0ff; --rep-tenue: #9fb2d3;
  --rep-acento: #5aa9ff; --rep-cabecera: linear-gradient(120deg, #0a1a36 0%, #0d2552 55%, #0a1a36 100%);
  --rep-sube: #ff7b86; --rep-baja: #4cc17a; --rep-igual: #9fb2d3; --rep-sin: #1a2c4d; --rep-normal: #4cc17a;
}
.reporte a { color: var(--rep-acento); }
.rep-cabecera { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; padding: 1rem 1.2rem; border-radius: 12px; background: var(--rep-cabecera); border: 1px solid var(--rep-borde); }
.rep-marca { display: flex; align-items: center; gap: .6rem; padding-right: 1.5rem; border-right: 1px solid var(--rep-borde); }
.rep-marca-icono { font-size: 2rem; }
.rep-marca strong { display: block; letter-spacing: .12em; font-size: 1.05rem; }
.rep-marca small { color: var(--rep-tenue); font-size: .72rem; letter-spacing: .04em; }
.rep-titulo h1 { margin: 0; font-size: 2.1rem; font-weight: 900; letter-spacing: .04em; line-height: 1.05; }
.rep-titulo p { margin: .2rem 0 0; color: var(--rep-acento); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.rep-datos { display: flex; flex-wrap: wrap; gap: .35rem 1.4rem; font-size: .85rem; padding: .2rem .3rem; }
.rep-clasificacion { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; padding: 1rem 1.2rem; border-radius: 12px; background: var(--rep-panel); border: 2px solid var(--rep-nivel-color); box-shadow: 0 0 18px -8px var(--rep-nivel-color); }
@media (max-width: 760px) { .rep-clasificacion { grid-template-columns: minmax(0, 1fr); } }
.rep-nivel-normal { --rep-nivel-color: var(--rep-normal); }
.rep-nivel-atencion { --rep-nivel-color: var(--rep-bajo); }
.rep-nivel-reforzada { --rep-nivel-color: var(--rep-medio); }
.rep-nivel-alta { --rep-nivel-color: var(--rep-alto); }
.rep-clasif-principal { display: flex; gap: .9rem; align-items: flex-start; }
.rep-icono-alerta { font-size: 2.4rem; line-height: 1; }
.rep-etiqueta { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rep-tenue); margin-bottom: .2rem; }
.rep-nivel { display: inline-block; margin: .1rem 0 .4rem; padding: .25rem .8rem; border-radius: 8px; background: var(--rep-nivel-color); color: #fff; font-size: 1.5rem; font-weight: 900; letter-spacing: .03em; text-transform: uppercase; }
.rep-chico { font-size: .85rem; }
.rep-tenue { color: var(--rep-tenue); }
.rep-reglas { margin-top: .4rem; font-size: .8rem; color: var(--rep-tenue); }
.rep-reglas summary { cursor: pointer; }
.rep-reglas ul { margin: .3rem 0; padding-left: 1.1rem; }
.rep-tendencias ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.rep-flecha { display: inline-block; min-width: 1.6em; font-weight: 900; text-align: center; }
.rep-flecha-sube { color: var(--rep-sube); }
.rep-flecha-baja { color: var(--rep-baja); }
.rep-flecha-igual { color: var(--rep-igual); }
.rep-nota { font-size: .78rem; color: var(--rep-tenue); margin: .4rem 0 0; }
.rep-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
@media (max-width: 760px) { .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rep-kpi { display: flex; flex-direction: column; gap: .1rem; padding: .8rem .9rem; border-radius: 12px; background: var(--rep-panel); border: 1px solid var(--rep-borde); border-top: 3px solid var(--rep-acento); }
.rep-kpi span { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rep-tenue); }
.rep-kpi strong { font-size: 1.9rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rep-kpi small { color: var(--rep-tenue); font-size: .75rem; }
.rep-seccion { padding: .9rem 1rem; border-radius: 12px; background: var(--rep-panel); border: 1px solid var(--rep-borde); min-width: 0; }
.rep-seccion h2 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .7rem; font-size: 1rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.rep-num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 6px; background: var(--rep-acento); color: #fff; font-size: .9rem; }
:root[data-theme="dark"] .rep-num { color: #071226; }
.rep-panorama { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
@media (max-width: 960px) { .rep-panorama { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .rep-panorama, .rep-modulos { grid-template-columns: minmax(0, 1fr) !important; } }
.rep-hecho { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: .8rem; border-radius: 10px; background: var(--rep-panel-2); border: 1px solid var(--rep-borde); color: var(--rep-texto) !important; text-decoration: none; font-size: .85rem; }
.rep-hecho:hover, .rep-hecho:focus-visible { border-color: var(--rep-acento); }
.rep-hecho strong { font-size: .92rem; line-height: 1.3; }
.rep-hecho-num { position: absolute; top: .5rem; right: .6rem; font-size: .72rem; font-weight: 800; color: var(--rep-acento); }
.rep-hecho-icono { font-size: 1.5rem; }
.rep-pastilla { align-self: flex-start; padding: .1rem .5rem; border-radius: 999px; background: var(--rep-panel); border: 1px solid var(--rep-borde); font-size: .75rem; font-weight: 600; }
/* 10 módulos (5 temas y 5 más): de a 5 por fila */
.rep-modulos { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .7rem; }
@media (max-width: 960px) { .rep-modulos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rep-modulo { padding: .7rem .8rem; border-radius: 10px; background: var(--rep-panel-2); border: 1px solid var(--rep-borde); font-size: .82rem; }
.rep-modulo p { margin: .2rem 0 0; color: var(--rep-tenue); }
.rep-modulo-cabecera { display: flex; align-items: center; gap: .35rem; }
.rep-modulo-cabecera strong::first-letter { text-transform: uppercase; }
.rep-modulo-num { padding: 0 .35rem; border-radius: 5px; background: var(--rep-acento); color: #fff; font-weight: 800; font-size: .75rem; }
:root[data-theme="dark"] .rep-modulo-num { color: #071226; }
.rep-modulo-cifra { font-size: 1.6rem; font-weight: 900; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.rep-modulo-cifra small { font-size: .8rem; font-weight: 600; color: var(--rep-tenue); }
.rep-dos { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .9rem; }
@media (max-width: 860px) { .rep-dos { grid-template-columns: minmax(0, 1fr); } }
.rep-tabla { width: 100%; border-collapse: collapse; font-size: .82rem; }
.rep-tabla th { text-align: left; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--rep-tenue); border-bottom: 1px solid var(--rep-borde); padding: .3rem .35rem; }
.rep-tabla td { padding: .32rem .35rem; border-bottom: 1px solid var(--rep-borde); vertical-align: top; }
.rep-semaforo { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: -1px; background: var(--rep-sin); }
.rep-semaforo-alto { background: var(--rep-alto); }
.rep-semaforo-medio { background: var(--rep-medio); }
.rep-semaforo-bajo { background: var(--rep-bajo); }
.rep-seccion-mapa { display: flex; flex-direction: column; }
.rep-mapa { width: 100%; max-height: 520px; margin: 0 auto; display: block; }
.rep-prov { stroke: var(--rep-fondo); fill: var(--rep-sin); }
.rep-prov-alto { fill: var(--rep-alto); }
.rep-prov-medio { fill: var(--rep-medio); }
.rep-prov-bajo { fill: var(--rep-bajo); }
.rep-prov-esta { fill: var(--rep-panel-2); stroke: var(--rep-acento); }
.rep-prov-otra { fill: var(--rep-sin); opacity: .5; }
.rep-punto { stroke: var(--rep-panel); stroke-width: .3; }
.rep-punto-alto { fill: var(--rep-alto); }
.rep-punto-medio { fill: var(--rep-medio); }
.rep-punto-bajo { fill: var(--rep-bajo); }
.rep-punto-nombre { fill: var(--rep-texto); stroke: var(--rep-panel-2); paint-order: stroke; stroke-linejoin: round; font-weight: 600; pointer-events: none; }
.rep-leyenda { display: flex; flex-wrap: wrap; gap: .3rem .9rem; justify-content: center; font-size: .78rem; margin-top: .5rem; }
.rep-leyenda > span { display: inline-flex; align-items: center; gap: .3rem; }
.rep-indicadores { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .84rem; }
.rep-indicadores li { display: flex; gap: .5rem; padding: .45rem .6rem; border-radius: 8px; background: var(--rep-panel-2); border-left: 3px solid var(--rep-medio); }
.rep-indicadores small { color: var(--rep-tenue); }
.rep-hashtags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .7rem; }
.rep-hashtags span { padding: .1rem .5rem; border-radius: 999px; background: var(--rep-panel-2); border: 1px solid var(--rep-borde); font-weight: 700; font-size: .8rem; }
.rep-valoracion { border: 2px solid var(--rep-nivel-color); }
.rep-valoracion-cuerpo { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 760px) { .rep-valoracion-cuerpo { grid-template-columns: minmax(0, 1fr); } }
.rep-valoracion-nivel { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-radius: 10px; background: var(--rep-nivel-color); color: #fff; font-weight: 900; font-size: 1.1rem; text-transform: uppercase; line-height: 1.2; }
.rep-valoracion-nivel span { font-size: 1.6rem; }
#repValoracion p { margin: 0 0 .4rem; line-height: 1.55; }
.rep-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; padding: .7rem .9rem; border-top: 2px solid var(--rep-acento); font-size: .75rem; color: var(--rep-tenue); }
.rep-pie strong { color: var(--rep-texto); letter-spacing: .1em; }
/* ─── Imprimir / PDF en UNA hoja A4 ───
   Al imprimir, la hoja es angosta y el reporte se armaba como en un celular (una columna, una sección por hoja).
   Antes de imprimir, la página le pone .modo-impresion al <body> (ver vistaReportes): diseño compacto del ancho de
   la hoja (190 mm ≈ 718 px), con las columnas de la pantalla grande. Después mide el alto y achica todo con
   --zoom-impresion lo justo para que entre en una hoja. */
.modo-impresion .reporte { width: 718px; max-width: none; margin: 0 auto; padding: 10px; gap: 7px; font-size: 11px; border-radius: 0; zoom: var(--zoom-impresion, 1); }
.modo-impresion .rep-cabecera { padding: 8px 12px; gap: 6px 14px; }
.modo-impresion .rep-marca-icono { font-size: 22px; }
.modo-impresion .rep-marca strong { font-size: 12px; }
.modo-impresion .rep-marca small, .modo-impresion .rep-titulo p { font-size: 9px; }
.modo-impresion .rep-titulo h1 { font-size: 26px; }
.modo-impresion .rep-datos { font-size: 9.5px; gap: 2px 12px; padding: 0; }
.modo-impresion .rep-clasificacion { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; padding: 8px 12px; }
.modo-impresion .rep-icono-alerta { font-size: 26px; }
.modo-impresion .rep-nivel { font-size: 17px; padding: 2px 10px; margin: 0 0 4px; }
.modo-impresion .rep-chico, .modo-impresion .rep-tendencias ul { font-size: 10px; gap: 1px; }
.modo-impresion .rep-etiqueta { font-size: 8.5px; }
.modo-impresion .rep-reglas { display: none; }
.modo-impresion .rep-nota { font-size: 8.5px; margin-top: 3px; }
.modo-impresion .rep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.modo-impresion .rep-kpi { padding: 6px 8px; }
.modo-impresion .rep-kpi span, .modo-impresion .rep-kpi small { font-size: 8.5px; }
.modo-impresion .rep-kpi strong { font-size: 20px; }
.modo-impresion .rep-seccion { padding: 7px 9px; }
.modo-impresion .rep-seccion h2 { font-size: 11px; margin-bottom: 5px; }
.modo-impresion .rep-num { width: 18px; height: 18px; font-size: 10px; }
.modo-impresion .rep-panorama { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px; }
.modo-impresion .rep-modulos { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 6px; }
.modo-impresion .rep-hecho { padding: 6px; gap: 2px; font-size: 9px; }
.modo-impresion .rep-hecho strong { font-size: 10px; }
.modo-impresion .rep-hecho-icono { font-size: 15px; }
.modo-impresion .rep-pastilla { font-size: 8.5px; }
.modo-impresion .rep-modulo { padding: 6px; font-size: 9px; }
.modo-impresion .rep-modulo-cifra { font-size: 16px; margin: 1px 0; }
.modo-impresion .rep-modulo p { margin-top: 1px; }
.modo-impresion .rep-dos { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 7px; }
.modo-impresion .rep-tabla { font-size: 9px; }
.modo-impresion .rep-tabla th { font-size: 8px; padding: 2px 4px; }
.modo-impresion .rep-tabla td { padding: 2px 4px; }
.modo-impresion .rep-mapa { max-height: 290px; }
.modo-impresion .rep-leyenda { font-size: 9px; margin-top: 3px; }
.modo-impresion .rep-indicadores { gap: 3px; font-size: 9.5px; }
.modo-impresion .rep-indicadores li { padding: 3px 6px; }
.modo-impresion .rep-indicadores small { font-size: 8.5px; }
.modo-impresion .rep-hashtags { margin-bottom: 4px; }
.modo-impresion .rep-hashtags span { font-size: 9px; }
.modo-impresion .rep-valoracion-cuerpo { grid-template-columns: 9rem minmax(0, 1fr); gap: 10px; }
.modo-impresion .rep-valoracion-nivel { font-size: 12px; padding: 6px 8px; }
.modo-impresion .rep-valoracion-nivel span { font-size: 18px; }
.modo-impresion #repValoracion p { line-height: 1.4; margin-bottom: 2px; font-size: 10.5px; }
.modo-impresion .rep-pie { font-size: 8.5px; padding: 5px 8px; }
@media print {
  /* Sin márgenes de página: el margen lo pone el <body>, así en el tema oscuro la hoja entera es oscura (sin bordes blancos). */
  @page { size: A4 portrait; margin: 0; }
  body.modo-impresion { padding: 6mm 10mm; background: #f3f6fb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  :root[data-theme="dark"] body.modo-impresion { background: #071226; }
  .reporte { border: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .reporte a { color: var(--rep-acento) !important; }
  #aviso, dialog { display: none !important; }
}
/* Mapa de calor semitransparente: deja ver provincias y nombres debajo (ver calorAjustable en app.js) */
.leaflet-heatmap-layer { opacity: .82; }
:root[data-theme="dark"] .barra-calor-noticias { background: linear-gradient(90deg, #5a2d7a, #8a3fae, #c055cf, #f07fd6, #ffd6f3) !important; }

/* ─── 🔔 Alertas por palabras clave ─── */
.btn-alertas { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin-right: .4rem; border-radius: 50%; border: 1px solid var(--borde); background: var(--card-2); font-size: 1.1rem; text-decoration: none; }
.btn-alertas:hover, .btn-alertas.activo { background: var(--card); border-color: var(--primario); }
.btn-alertas:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }
.contador-alertas { display: inline-block; min-width: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: var(--peligro); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.15rem; text-align: center; }
.btn-alertas .contador-alertas { position: absolute; top: -4px; right: -6px; box-shadow: 0 0 0 2px var(--bg); }
.alerta-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.alerta-form input { flex: 1 1 18rem; }
.alertas-terminos { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.alerta-termino { display: inline-flex; align-items: center; gap: .15rem; }
.alerta-termino.activo .chip { border-color: var(--primario); background: var(--primario-suave); }
.alerta-termino small { color: var(--texto-2); margin-left: .2rem; }
.alerta-nuevas { color: var(--peligro); font-size: .78rem; }
.alerta-borrar { border: 0; background: none; color: var(--texto-2); cursor: pointer; font-size: .9rem; padding: .2rem .35rem; border-radius: 6px; }
.alerta-borrar:hover { color: var(--peligro); background: var(--peligro-suave); }
.alerta-item-nueva { border-left: 3px solid var(--peligro); }
/* 𝕏 Tendencias en X: las de los temas, en rojo (como en "Lo más buscado") */
.hashtag-del-tema { border-color: #c62828; color: #c62828; }
.hashtag-del-tema small { color: #c62828; }
:root[data-theme="dark"] .hashtag-del-tema, :root[data-theme="dark"] .hashtag-del-tema small { border-color: #ff7b86; color: #ff7b86; }

/* ─── 📡 Pulso del momento (tarjeta de tendencias del Inicio) ───
   Colores de la paleta de dataviz, validados con su script: claro contra #ffffff, oscuro contra #121a2c. */
:root { --pulso-medios: #2a78d6; --pulso-google: #eb6834; --pulso-x: #1baf7a; }
:root[data-theme="dark"] { --pulso-medios: #3987e5; --pulso-google: #d95926; --pulso-x: #199e70; }
.pulso-medios { background: var(--pulso-medios); }
.pulso-google { background: var(--pulso-google); }
.pulso-x { background: var(--pulso-x); }
.pulso-titulo { color: var(--texto) !important; }
.pulso-leyenda { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .2rem 0 .7rem; font-size: .82rem; color: var(--texto-2); }
.pulso-leyenda > span { display: inline-flex; align-items: center; gap: .35rem; }
.pulso-cuadro { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; }
.pulso-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.pulso-fila { display: grid; grid-template-columns: minmax(7rem, 32%) minmax(0, 1fr) 7.5rem; align-items: center; gap: .6rem; padding: .3rem .35rem; border-radius: 8px; outline: none; }
.pulso-fila:hover, .pulso-fila:focus-visible { background: var(--card-2); }
.pulso-fila:focus-visible { box-shadow: 0 0 0 2px var(--primario); }
.pulso-nombre { color: var(--texto); font-weight: 700; font-size: .92rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulso-nombre:hover { text-decoration: underline; }
.pulso-nombre .chip-tema { font-weight: 600; vertical-align: 1px; }
/* Barra apilada: un segmento por fuente, 2 px de separación, el extremo final redondeado */
.pulso-barra { display: flex; gap: 2px; height: 12px; }
.pulso-seg { display: block; height: 100%; min-width: 3px; }
.pulso-seg:last-child { border-radius: 0 4px 4px 0; }
.pulso-donde { font-size: .74rem; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .pulso-fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } .pulso-donde { display: none; } }
.pulso-lado .barras { margin-top: .3rem; }
.pulso-lado .barra-fila { text-decoration: none; color: var(--texto); }
/* Tendencias del momento y de X, lado a lado; el clima social debajo, a todo el ancho */
.pulso-ancho { grid-column: 1 / -1; border-top: 1px solid var(--borde); padding-top: .9rem; }
/* Tendencias del momento unificadas: 📰 medios, 𝕏 X; con borde, en los dos */
.tend-donde { font-size: .72rem; letter-spacing: .05em; color: var(--texto-2); }
.tend-puesto { display: inline-block; min-width: 1.6rem; color: var(--texto-2); font-variant-numeric: tabular-nums; }
.tend-fila { text-decoration: none; color: var(--texto); border-radius: 8px; }
.tend-fila.tend-ambos { outline: 2px solid var(--primario); outline-offset: 1px; }
.clima-ancho { grid-column: 1 / -1; }
.clima .tend-fila:hover, .clima .tend-fila:focus-visible { background: var(--clima-hundido); }
/* Tono: cuántas de cuántas y qué quiere decir cada uno */
.clima-recuadro-cuenta { display: block; font-size: .7rem; color: var(--texto-2); }
.clima-explica { margin-top: .9rem; padding: .7rem .8rem; border-radius: 10px; background: var(--clima-hundido); border: 1px solid var(--borde); }
.clima-explica p { margin: 0 0 .4rem; }
.clima-explica ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .35rem; }
.clima-explica .punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .4rem; transform: translateY(-1px); }
/* Emociones: tarjetas con el % grande y "1 de cada N publicaciones" */
.clima-emo-titular { margin: 0 0 .8rem; font-size: .95rem; }
.clima-emo-grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: .5rem; }
.clima-emo { display: grid; gap: .15rem; padding: .7rem .75rem .65rem; border-radius: 12px; background: var(--clima-hundido); border: 1px solid var(--borde); border-top: 3px solid var(--emo); outline: none; }
.clima-emo:hover, .clima-emo:focus-visible { border-color: var(--emo); }
.clima-emo-primera { box-shadow: 0 0 0 1px var(--emo); }
.clima-emo-icono { font-size: 1.3rem; line-height: 1; }
.clima-emo-pct { font-size: 1.55rem; font-weight: 800; line-height: 1.1; color: var(--texto); font-variant-numeric: tabular-nums; }
.clima-emo-nombre { font-weight: 700; font-size: .85rem; }
.clima-emo-cada { font-size: .74rem; color: var(--texto-2); margin-bottom: .35rem; }
.pulso-detalle { grid-column: 1 / -1; border-top: 1px solid var(--borde); padding-top: .6rem; }
.pulso-detalle > summary { cursor: pointer; color: var(--texto-2); font-size: .9rem; font-weight: 600; }
.pulso-detalle-cuerpo { margin-top: .8rem; }
/* "Ver N más" del Pulso y de los procedimientos */
.pulso-mas { margin-top: .2rem; }
.pulso-mas > summary { cursor: pointer; color: var(--primario); font-size: .85rem; font-weight: 600; padding: .25rem .35rem; }
.pulso-mas[open] > summary { margin-bottom: .2rem; }
/* De qué se habla: los temas que también son tendencia en X */
.clima-insignia-x { font-weight: 800; }
.clima-tema-ambos { border-color: var(--clima-violeta); }

/* Inicio: "Últimos procedimientos" con títulos de 2 líneas como máximo (el título entero está en la noticia y al pasar
   el mouse), así queda parejo con "Para revisar" (03/11/2026). */
#recientesTablero .item-titulo a { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#alertasTablero .alertas-cortas li { padding-top: .35rem; padding-bottom: .35rem; }
/* En el Inicio, sin los botones Archivar / Copias / Guardar (están en 📰 Noticias): la lista queda más corta. */
#recientesTablero .acciones-noticia { display: none; }
