/* ===== 68 Monitor · sistema visual ===== */
:root {
  --azul: #003366; --celeste: #00829A; --verde: #4CAF50; --naranja: #FF9800; --rojo: #E53935;
  --bg: #F2F5F9; --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(0,130,154,.10), transparent 60%),
         radial-gradient(900px 500px at -10% 110%, rgba(0,51,102,.08), transparent 60%);
  --surface: rgba(255,255,255,.86); --surface-solid: #FFFFFF; --surface-2: #F7F9FC;
  --text: #13202E; --text-2: #5B6B7C; --text-3: #8695A5;
  --border: rgba(15, 40, 70, .09); --border-2: rgba(15, 40, 70, .16);
  --zebra: rgba(0, 51, 102, .025); --row-hover: rgba(0, 130, 154, .07);
  --shadow: 0 1px 2px rgba(15,40,70,.04), 0 6px 20px -8px rgba(15,40,70,.10);
  --shadow-h: 0 2px 4px rgba(15,40,70,.05), 0 18px 40px -14px rgba(15,40,70,.22);
  --ring: 0 0 0 3px rgba(0,130,154,.25);
  --r: 16px; --r-sm: 10px; --sp: 18px; --sidebar: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-celeste: rgba(0,130,154,.12); --t-verde: rgba(76,175,80,.14); --t-naranja: rgba(255,152,0,.14);
  --t-azul: rgba(0,51,102,.10); --t-rojo: rgba(229,57,53,.12); --c-azul-txt: #003366;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1422; --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(0,130,154,.18), transparent 60%),
           radial-gradient(900px 500px at -10% 110%, rgba(76,175,80,.07), transparent 60%);
    --surface: rgba(18,32,50,.78); --surface-solid: #122032; --surface-2: #0F1B2B;
    --text: #E6EDF5; --text-2: #9DB0C4; --text-3: #6E8296;
    --border: rgba(255,255,255,.07); --border-2: rgba(255,255,255,.14);
    --zebra: rgba(255,255,255,.02); --row-hover: rgba(0,130,154,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5);
    --shadow-h: 0 2px 4px rgba(0,0,0,.3), 0 20px 44px -14px rgba(0,0,0,.65);
    --t-azul: rgba(120,170,230,.14); --c-azul-txt: #9CC3EE; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1422; --bg-glow: radial-gradient(1200px 600px at 100% -10%, rgba(0,130,154,.18), transparent 60%),
         radial-gradient(900px 500px at -10% 110%, rgba(76,175,80,.07), transparent 60%);
  --surface: rgba(18,32,50,.78); --surface-solid: #122032; --surface-2: #0F1B2B;
  --text: #E6EDF5; --text-2: #9DB0C4; --text-3: #6E8296;
  --border: rgba(255,255,255,.07); --border-2: rgba(255,255,255,.14);
  --zebra: rgba(255,255,255,.02); --row-hover: rgba(0,130,154,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -10px rgba(0,0,0,.5);
  --shadow-h: 0 2px 4px rgba(0,0,0,.3), 0 20px 44px -14px rgba(0,0,0,.65);
  --t-azul: rgba(120,170,230,.14); --c-azul-txt: #9CC3EE; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-glow), var(--bg); background-attachment: fixed; color: var(--text);
  font-size: 14px; -webkit-font-smoothing: antialiased; transition: background-color .4s var(--ease), color .4s var(--ease); }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; font-weight: 700; }
h3 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
h3 small { color: var(--text-3); font-weight: 500; font-size: 12px; }
.muted { color: var(--text-2); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }
::selection { background: rgba(0,130,154,.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* ===== Animaciones ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,.45); } 50% { box-shadow: 0 0 0 7px rgba(76,175,80,0); } }
@keyframes pulseWarn { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,.5); } 50% { box-shadow: 0 0 0 7px rgba(255,152,0,0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shimmer { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes stripes { to { background-position: 28px 0, 0 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Transiciones entre secciones (View Transitions API) */
::view-transition-old(root) { animation: .18s var(--ease) both fadeOutUp; }
::view-transition-new(root) { animation: .32s var(--ease) both fadeInUp; }
@keyframes fadeOutUp { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); position: fixed; top: 12px; bottom: 12px; left: 12px; border-radius: 22px; z-index: 20;
  background: radial-gradient(400px 260px at 0% 0%, rgba(0,130,154,.35), transparent 70%), linear-gradient(180deg, #0B2545, #071A33);
  color: #fff; display: flex; flex-direction: column; box-shadow: 0 20px 50px -20px rgba(3,20,45,.6);
  transition: transform .35s var(--ease); overflow: hidden;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 18px 18px; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11px; opacity: .6; line-height: 1.35; margin-top: 2px; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; flex: none; display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 18px -6px rgba(0,0,0,.5); transition: transform .4s var(--spring); }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-logo.big { width: 92px; height: 92px; border-radius: 22px; margin: 0 auto 16px; animation: float 4s ease-in-out infinite; }
.sidebar nav { padding: 8px 12px; flex: 1; position: relative; }
.sidebar nav a {
  position: relative; z-index: 1; display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.66);
  text-decoration: none; padding: 12px 14px; border-radius: 12px; margin-bottom: 4px; font-weight: 500; height: 44px;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.sidebar nav a svg { transition: transform .35s var(--spring); }
.sidebar nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar nav a:hover svg { transform: scale(1.15); }
.sidebar nav a.active { color: #fff; background: transparent; }
.nav-indicator {
  position: absolute; left: 12px; right: 12px; height: 44px; top: 0; border-radius: 12px; z-index: 0;
  background: linear-gradient(135deg, rgba(0,130,154,.95), rgba(0,105,130,.95));
  box-shadow: 0 8px 20px -8px rgba(0,130,154,.8), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .45s var(--spring), opacity .3s; opacity: 0;
}
.sidebar-foot { padding: 14px; display: grid; gap: 10px; }
.sync-card { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.sync-card small { display: block; opacity: .6; font-size: 11px; }
.sync-card strong { font-size: 13px; font-weight: 600; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--verde); animation: pulse 2.4s infinite; flex: none; }
.status-dot.busy { background: var(--naranja); animation: pulseWarn 1.2s infinite; }
.status-dot.err { background: var(--rojo); animation: none; }

.content { margin-left: calc(var(--sidebar) + 24px); flex: 1; min-width: 0; padding: 0 28px 40px 12px; }
.topbar {
  position: sticky; top: 12px; z-index: 10; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center;
  padding: 14px 16px 14px 20px; margin: 12px 0 22px; border-radius: 18px; background: var(--surface);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.title-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; align-items: flex-end; flex: 1 1 520px; justify-content: flex-end; }
.filters select { min-width: 104px; }
#themeToggle { align-self: flex-end; }
.filters-icon { color: var(--text-3); margin-bottom: 9px; }
.filters label, .row label { display: flex; flex-direction: column; font-size: 11px; color: var(--text-3); gap: 4px; font-weight: 500; }
select, input[type=search], input[type=text] {
  font: inherit; font-size: 13px; padding: 8px 12px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background-color: var(--surface-solid); color: var(--text); min-width: 120px;
  transition: border-color .2s, box-shadow .2s;
}
select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238695A5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select:hover, input:hover { border-color: var(--celeste); }
select:focus, input:focus { outline: none; border-color: var(--celeste); box-shadow: var(--ring); }
.btn.menu-toggle { display: none; }

/* Píldora de carga en segundo plano */
.load-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2);
  padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--t-naranja); width: fit-content; animation: rise .4s var(--ease); }
.pill-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--naranja); border-right-color: transparent; animation: spin .8s linear infinite; }
.pill-bar { width: 70px; height: 4px; border-radius: 4px; background: rgba(255,152,0,.2); overflow: hidden; }
.pill-bar i { display: block; height: 100%; width: 0; background: var(--naranja); border-radius: 4px; transition: width .6s var(--ease); }

/* ===== Páginas ===== */
.page > * { animation: rise .55s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .06s; } .page > *:nth-child(3) { animation-delay: .12s; }
.page > *:nth-child(4) { animation-delay: .18s; } .page > *:nth-child(5) { animation-delay: .24s; }
.grid { display: grid; gap: var(--sp); margin-bottom: var(--sp); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

/* ===== Cards ===== */
.card {
  background: var(--surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); margin-bottom: var(--sp);
  border: 1px solid var(--border); transition: box-shadow .35s var(--ease), border-color .35s;
}
.card:hover { box-shadow: var(--shadow-h); border-color: var(--border-2); }
.grid .card { margin-bottom: 0; }
.card.toolbar { padding: 14px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
#entCompare > h3 { margin-bottom: 14px; }
.chip-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; transition: transform .4s var(--spring); }
.card:hover .chip-ico { transform: rotate(-6deg) scale(1.08); }
.chip-ico svg.i { width: 17px; height: 17px; }
.chip-ico.celeste { background: var(--t-celeste); color: var(--celeste); }
.chip-ico.verde { background: var(--t-verde); color: #3B8E3F; }
.chip-ico.naranja { background: var(--t-naranja); color: #D97F00; }
.chip-ico.azul { background: var(--t-azul); color: var(--c-azul-txt); }
.chip-ico.rojo { background: var(--t-rojo); color: var(--rojo); }

/* ===== KPIs ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp); margin-bottom: var(--sp); }
.kpi {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-height: 124px;
  transition: transform .4s var(--spring), box-shadow .35s var(--ease); animation: rise .5s var(--ease) both;
}
.kpi:nth-child(2) { animation-delay: .05s; } .kpi:nth-child(3) { animation-delay: .1s; }
.kpi:nth-child(4) { animation-delay: .15s; } .kpi:nth-child(5) { animation-delay: .2s; }
.kpi::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: var(--kpi-tint, var(--t-celeste)); transition: transform .6s var(--ease); }
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-h); }
.kpi:hover::after { transform: scale(1.4); }
.kpi-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .value { position: relative; z-index: 1; font-size: clamp(19px, 1.7vw, 25px); font-weight: 750; letter-spacing: -.02em;
  margin: 14px 0 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi .sub { position: relative; z-index: 1; font-size: 12px; color: var(--text-3); }
.meter { height: 6px; background: var(--border); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--celeste), var(--verde));
  transition: width 1.4s var(--ease); }

.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 450px; }

/* ===== Tablas ===== */
.table-wrap { overflow: auto; max-height: 540px; border: 1px solid var(--border); border-radius: 12px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); text-align: left;
  padding: 11px 12px; font-weight: 600; font-size: 12px; white-space: nowrap; border-bottom: 1px solid var(--border-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); transition: background .15s; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; display: block; text-align: right; }
.up { color: #2E8B3A; font-weight: 600; } .down { color: var(--rojo); font-weight: 600; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--t-celeste); color: var(--celeste); }
.badge.bajo { background: var(--t-rojo); color: var(--rojo); } .badge.medio { background: var(--t-naranja); color: #C77400; }
.badge.alto { background: var(--t-verde); color: #2E8B3A; }

/* ===== Botones ===== */
.btn {
  font: inherit; font-weight: 600; font-size: 13px; padding: 9px 15px; border-radius: 11px; border: 1px solid var(--border-2);
  background: var(--surface-solid); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .25s var(--spring), box-shadow .25s var(--ease), background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--celeste); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-primary { background: linear-gradient(135deg, #00829A, #006A80); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(0,130,154,.7); }
.btn-primary:hover { border-color: transparent; box-shadow: 0 10px 22px -8px rgba(0,130,154,.85); }
.btn-glass { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); justify-content: center; }
.btn-glass:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); }
.btn-glass:hover svg { animation: spin .8s var(--ease); }
.btn-icon { padding: 9px; border-radius: 12px; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn-lg { padding: 13px 20px; font-size: 14px; width: 100%; margin-top: 14px; justify-content: center; }
.seg { display: inline-flex; gap: 6px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.btn.loading { pointer-events: none; }
.btn.loading svg { display: none; }
.btn.loading::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; }

/* ===== Autocompletado / chips ===== */
.autocomplete, .search-box { position: relative; }
.ac-icon, .search-box svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.ac-icon { top: 24px; }
.autocomplete input { width: 100%; padding: 13px 16px 13px 44px; font-size: 15px; border-radius: 14px; }
.search-box input { padding-left: 38px; min-width: 240px; }
.search-box svg.i { left: 12px; width: 16px; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface-solid);
  border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow-h); max-height: 340px; overflow: auto; z-index: 15;
  animation: rise .2s var(--ease); transform-origin: top;
}
.ac-list li { padding: 9px 12px; border-radius: 10px; cursor: pointer; transition: background .15s, padding .2s var(--ease); }
.ac-list li:hover, .ac-list li.sel { background: var(--row-hover); padding-left: 16px; }
.ac-list li small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { background: linear-gradient(135deg, var(--azul), #0B4A86); color: #fff; padding: 6px 6px 6px 13px; border-radius: 999px; font-size: 12px;
  font-weight: 500; display: inline-flex; gap: 8px; align-items: center; animation: pop .35s var(--spring); }
.chip button { background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 50%; width: 20px; height: 20px; cursor: pointer;
  display: grid; place-items: center; transition: background .2s, transform .25s var(--spring); }
.chip button:hover { background: var(--rojo); transform: rotate(90deg); }

/* ===== Exportar ===== */
.formats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.formats label { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--border-2); border-radius: 14px;
  cursor: pointer; transition: border-color .25s, background .25s, transform .3s var(--spring); position: relative; }
.formats label input { position: absolute; opacity: 0; pointer-events: none; }
.formats label svg.i { width: 22px; height: 22px; color: var(--text-3); transition: color .2s, transform .35s var(--spring); }
.formats label b { display: block; font-size: 14px; }
.formats label small { color: var(--text-3); font-size: 12px; }
.formats label:hover { border-color: var(--celeste); transform: translateY(-2px); }
.formats label:has(input:checked) { border-color: var(--celeste); background: var(--t-celeste); box-shadow: inset 0 0 0 1px var(--celeste); }
.formats label:has(input:checked) svg.i { color: var(--celeste); transform: scale(1.15); }
.check { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px dashed var(--border-2); border-radius: 12px; cursor: pointer; font-size: 13px; }
input[type=checkbox], input[type=radio] { accent-color: var(--celeste); width: 16px; height: 16px; }
.columns-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; max-height: 360px; overflow: auto; }
.columns-list label { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 7px 9px; border-radius: 9px; cursor: pointer; transition: background .15s; }
.columns-list label:hover { background: var(--row-hover); }

/* ===== Skeleton / spinner ===== */
.kpi.skeleton { background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 1200px 100%; animation: shimmer 1.4s infinite linear; }
.kpi.skeleton::after { display: none; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border-2); border-top-color: var(--celeste); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 48px auto; }

/* ===== Overlay onboarding / modal ===== */
.overlay, .modal { position: fixed; inset: 0; background: rgba(4, 16, 32, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; z-index: 50; animation: fadeIn .3s; padding: 16px; }
.onboard-card, .modal-card { background: var(--surface-solid); border: 1px solid var(--border); border-radius: 24px; padding: 36px; max-width: 580px;
  width: 100%; text-align: center; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); animation: rise .45s var(--spring); }
.onboard-card h2 { margin: 0 0 8px; letter-spacing: -.02em; }
.onboard-card p { color: var(--text-2); line-height: 1.55; }
.modal-card { text-align: left; max-width: 440px; padding: 26px; }
.modal-card h3 { margin-bottom: 8px; }
.modal-card p { color: var(--text-2); line-height: 1.5; }
.progress { height: 10px; background: var(--border); border-radius: 10px; overflow: hidden; margin: 22px 0 10px; }
.progress .bar { height: 100%; width: 0; border-radius: 10px; transition: width .8s var(--ease);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.2) 0 7px, transparent 7px 14px), linear-gradient(90deg, var(--celeste), var(--verde));
  background-size: 28px 28px, 100% 100%; animation: stripes 1s linear infinite; }
.ob-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.ob-file { font-size: 12px; color: var(--text-3); margin-top: 6px; min-height: 16px; }
.ob-errors { text-align: left; color: #C77400; font-size: 12px; max-height: 120px; overflow: auto; padding-left: 18px; }

/* ===== Toasts ===== */
.toasts { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 10px; z-index: 60; }
.toast { position: relative; overflow: hidden; display: flex; gap: 10px; align-items: flex-start; background: var(--surface-solid); color: var(--text);
  padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow-h); min-width: 260px; max-width: 400px;
  animation: toastIn .35s var(--spring); font-weight: 500; }
.toast svg.i { color: var(--celeste); margin-top: 1px; }
.toast.ok svg.i { color: var(--verde); } .toast.err svg.i { color: var(--rojo); } .toast.warn svg.i { color: var(--naranja); }
.toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--celeste); opacity: .5;
  transform-origin: left; animation: drain var(--dur, 3.5s) linear forwards; }
.toast.out { opacity: 0; transform: translateX(30px) scale(.96); transition: .3s var(--ease); }

/* ===== Accesibilidad: menos movimiento ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ===== Responsive (tablet) ===== */
@media (max-width: 1180px) { .g-2 { grid-template-columns: 1fr; } }
/* Pantallas bajas o angostas: la barra superior deja de ser fija para no tapar contenido */
@media (max-width: 1250px), (max-height: 720px) { .topbar { position: relative; top: 0; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(calc(-100% - 24px)); }
  .sidebar.open { transform: none; }
  .content { margin-left: 0; padding: 0 16px 24px; }
  .btn.menu-toggle { display: inline-flex; }
  .filters { margin-left: 0; }
  .columns-list, .formats { grid-template-columns: 1fr; }
}

/* ===== Análisis: filtros Power BI ===== */
.pbi-panel { margin-bottom: var(--sp); }
.pbi-card { position: relative; margin-bottom: 0; }
.pbi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pbi-chips:empty { display: none; }
.pbi-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.pbi-field { font: inherit; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border-radius: 999px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-2); cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .25s var(--spring); }
.pbi-field svg.i { width: 13px; height: 13px; opacity: .6; }
.pbi-field:hover { border-color: var(--celeste); color: var(--celeste); transform: translateY(-1px); }
.pbi-field.on { border-style: solid; border-color: var(--celeste); background: var(--t-celeste); color: var(--celeste); }
.pbi-field b { background: var(--celeste); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.pbi-pop { position: absolute; left: 20px; right: 20px; top: 100%; margin-top: 6px; z-index: 18; background: var(--surface-solid);
  border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow-h); padding: 14px; animation: rise .25s var(--ease); max-width: 560px; }
.pbi-pop-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pbi-pop-head .btn { margin-left: auto; }
.pbi-pop .search-box input { width: 100%; }
.pbi-opts { max-height: 300px; overflow: auto; margin: 10px 0; display: grid; gap: 2px; }
.pbi-opts label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pbi-opts label:hover { background: var(--row-hover); }
.pbi-opts label span { flex: 1; }
.pbi-opts label small { color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ===== Mini KPIs ===== */
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 4px 0 14px; }
.mini-kpis > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.mini-kpis small { display: block; color: var(--text-3); font-size: 11px; }
.mini-kpis b { font-size: 16px; font-variant-numeric: tabular-nums; }
.sub-h { margin: 14px 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.pad { padding: 30px; text-align: center; }
.small { font-size: 12px; }

/* ===== Diagnóstico ===== */
.dg-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.dg-head h2 { margin: 4px 0 12px; font-size: 20px; letter-spacing: -.02em; }
.dg-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: center; }
.gauge { position: relative; text-align: center; }
.gauge-box { height: 120px; }
.gauge-val { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gauge-val b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.gauge-val small { color: var(--text-3); font-size: 11px; }
.pctl { text-align: center; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pctl b { display: block; font-size: 28px; font-weight: 800; color: var(--celeste); }
.pctl b small { font-size: 14px; }
.pctl span { font-size: 12px; color: var(--text-2); }
.dg-empty { display: flex; gap: 14px; align-items: center; }
.dg-empty svg.i { width: 32px; height: 32px; color: var(--naranja); }
.ind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ind { border-radius: 12px; padding: 11px 13px; border: 1px solid var(--border); border-left: 4px solid var(--border-2); background: var(--surface-2);
  transition: transform .3s var(--spring); }
.ind:hover { transform: translateY(-2px); }
.ind small { display: block; color: var(--text-2); font-size: 12px; font-weight: 500; }
.ind b { display: block; font-size: 19px; margin: 3px 0; font-variant-numeric: tabular-nums; }
.ind span { font-size: 11px; color: var(--text-3); }
.ind.ok { border-left-color: var(--verde); } .ind.warn { border-left-color: var(--naranja); } .ind.bad { border-left-color: var(--rojo); }
.table tr.grp td { background: var(--t-azul) !important; color: var(--c-azul-txt); font-weight: 600; font-size: 12px; }
.table tr.dim td { color: var(--text-3); }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--border-2); }
.dots i.on { background: linear-gradient(135deg, var(--celeste), var(--verde)); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.alerts li.alta svg.i { color: var(--rojo); } .alerts li.media svg.i { color: var(--naranja); } .alerts li.baja svg.i { color: var(--celeste); }
.recs { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.recs b { color: var(--text); }
.dist-bar { display: flex; gap: 3px; height: 30px; margin-bottom: 14px; border-radius: 10px; overflow: hidden; }
.dist-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; min-width: 0; transition: flex .8s var(--ease); }
.modal-card.wide { max-width: 760px; max-height: 86vh; overflow: auto; }
.modal-card.wide h3 svg.i { color: var(--celeste); }
@media (max-width: 1150px) { .dg-head { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .dg-gauges, .ind-grid { grid-template-columns: 1fr; } }

/* Desplegables (buscador de entidades, filtros Power BI) por encima de las tarjetas siguientes:
   las tarjetas con backdrop-filter crean su propio contexto de apilamiento */
.card:has(.ac-list:not([hidden])), .card:has(.pbi-pop:not([hidden])), .card:focus-within { position: relative; z-index: 30; }
.pbi-panel:has(.pbi-pop:not([hidden])) { position: relative; z-index: 30; }
.ac-list { z-index: 40; max-height: 420px; }

/* Filtro rápido: tipo de proyecto (DETALLE_PROYECTO) */
.pbi-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.pbi-quick > small { color: var(--text-2); font-weight: 600; margin-right: 4px; }
.pbi-quick button { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface-solid); color: var(--text-2); cursor: pointer; transition: all .2s var(--ease); }
.pbi-quick button:hover { border-color: var(--naranja); color: #C77400; }
.pbi-quick button.on { background: var(--naranja); border-color: var(--naranja); color: #fff; }
.pbi-quick button small { opacity: .7; margin-left: 4px; }
.card-head .seg select { min-width: 140px; }
.table tr.tot td { font-weight: 700; background: var(--t-celeste) !important; }
.table tr.otros td { color: var(--text-2); font-style: italic; }

.filtros-activos { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--t-celeste); color: var(--celeste); font-size: 12px; font-weight: 600; }
.filtros-activos svg.i { width: 13px; height: 13px; }

/* ===== Radar y monitoreo (CENEPRED · DIMSE) ===== */
@keyframes blip { 0% { transform: scale(1.9); opacity: 1; box-shadow: 0 0 14px 3px var(--c, #7FD6E6); } 55%, 100% { transform: scale(1); opacity: .45; } }
@keyframes ecg { from { stroke-dashoffset: 2200; } to { stroke-dashoffset: 0; } }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,.6); } 50% { box-shadow: 0 0 0 6px rgba(76,175,80,0); } }
.radar { position: relative; aspect-ratio: 1; border-radius: 50%; overflow: hidden; flex: none;
  background:
    linear-gradient(transparent calc(50% - .5px), rgba(127,214,230,.22) 0 calc(50% + .5px), transparent 0),
    linear-gradient(90deg, transparent calc(50% - .5px), rgba(127,214,230,.22) 0 calc(50% + .5px), transparent 0),
    repeating-radial-gradient(circle closest-side, transparent 0 calc(25% - 1px), rgba(127,214,230,.3) calc(25% - 1px) 25%),
    radial-gradient(circle, rgba(0,130,154,.28), rgba(3,22,44,.9) 75%);
  box-shadow: 0 0 0 1px rgba(127,214,230,.35), inset 0 0 24px rgba(0,130,154,.35), 0 0 34px -10px rgba(0,200,220,.55); }
.radar .sweep { position: absolute; inset: 0; border-radius: 50%; animation: spin 4s linear infinite;
  background: conic-gradient(from 0deg, transparent 0 280deg, rgba(0,200,220,.05) 280deg, rgba(0,200,220,.42) 358deg, rgba(170,245,255,.95) 360deg); }
.radar .blip { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; z-index: 1;
  background: var(--c, #7FD6E6); animation: blip 4s linear infinite; animation-delay: var(--d, 0s); }
.radar.big .blip { width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; cursor: pointer; }
.radar .core { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%;
  background: #AAF5FF; box-shadow: 0 0 12px #AAF5FF; z-index: 1; }
.radar .ring-label { position: absolute; left: 51.5%; font-size: 9px; color: rgba(170,235,245,.6); font-weight: 600; letter-spacing: .04em; }

.radar-card { margin: 0 14px; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.radar-card .radar { width: 58px; }
.radar-card small { display: block; font-size: 10px; letter-spacing: .08em; color: #7FD6E6; font-weight: 700; }
.radar-card strong { display: block; font-size: 13px; }
.radar-card div > span { font-size: 11px; opacity: .6; }

.monitor-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center;
  padding: 26px 30px 44px; border-radius: 20px; margin-bottom: var(--sp); color: #fff;
  background: radial-gradient(520px 320px at 88% 40%, rgba(0,130,154,.5), transparent 70%), linear-gradient(135deg, #0B2545, #061529);
  box-shadow: 0 20px 50px -24px rgba(3,20,45,.7); }
.monitor-hero::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(127,214,230,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(127,214,230,.06) 1px, transparent 1px);
  background-size: 26px 26px; -webkit-mask-image: linear-gradient(90deg, #000, transparent 75%); mask-image: linear-gradient(90deg, #000, transparent 75%); }
.mh-text { position: relative; }
.mh-org { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #7FD6E6; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); animation: livePulse 1.8s infinite; flex: none; }
.monitor-hero h2 { margin: 10px 0 8px; font-size: clamp(20px, 2.4vw, 28px); letter-spacing: -.02em; line-height: 1.15; }
.monitor-hero p { margin: 0; color: rgba(255,255,255,.72); line-height: 1.55; max-width: 640px; }
.monitor-hero p b { color: #fff; }
.mh-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mh-tags span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 11px; border-radius: 999px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.8); }
.mh-tags svg.i { width: 13px; height: 13px; }
.mh-tags em { font-style: normal; }
.mh-radar-wrap { margin: 0; display: grid; justify-items: center; gap: 10px; position: relative; }
.radar.big { width: 210px; }
.mh-radar-wrap figcaption { font-size: 11px; color: rgba(255,255,255,.6); text-align: center; line-height: 1.6; }
.lg { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 8px; vertical-align: middle; }
.lg.ok { background: var(--verde); } .lg.mid { background: var(--naranja); } .lg.low { background: var(--rojo); }
.mh-pulse { position: absolute; left: 0; right: 0; bottom: 4px; width: 100%; height: 34px; pointer-events: none; }
.mh-pulse path { fill: none; stroke: #4FD1C5; stroke-width: 1.6; opacity: .55; stroke-dasharray: 1100 1100; animation: ecg 6s linear infinite; }

/* ===== Menú: cajón con fondo, barra inferior, filtros plegables ===== */
.scrim { position: fixed; inset: 0; z-index: 19; background: rgba(4,16,32,.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.sidebar-close, .filters-toggle, .tabbar { display: none; }
.brand > div { min-width: 0; }

/* Tablet (horizontal): menú tipo riel solo con íconos */
@media (min-width: 901px) and (max-width: 1180px) {
  :root { --sidebar: 84px; }
  .brand { justify-content: center; padding: 18px 10px; }
  .brand > div, .radar-card > div, .sync-card > div, .sidebar nav a span { display: none; }
  .sidebar nav a { justify-content: center; padding: 12px 0; }
  .radar-card { margin: 0 12px; padding: 8px; justify-content: center; }
  .radar-card .radar { width: 44px; }
  .sync-card { justify-content: center; padding: 10px; }
  #btnUpdate { font-size: 0; gap: 0; padding: 10px; }
}

@media (max-width: 900px) {
  .sidebar { width: min(300px, 86vw); top: 0; bottom: 0; left: 0; border-radius: 0 22px 22px 0;
    transform: translateX(-105%); padding-top: env(safe-area-inset-top); }
  .sidebar.open { transform: none; }
  .sidebar.open + .scrim { opacity: 1; pointer-events: auto; }
  body:has(.sidebar.open) { overflow: hidden; }
  .sidebar-close { display: inline-flex; margin-left: auto; background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); }
  .filters-toggle { display: inline-flex; margin-left: auto; }
  .topbar { padding: 10px 12px; gap: 10px; top: 0; }
  .title-wrap { min-width: 0; flex: 1; }
  .filters { display: none; flex: 1 1 100%; order: 5; }
  .topbar.show-filters .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; animation: rise .25s var(--ease); }
  .topbar.show-filters .filters-toggle { background: var(--t-celeste); color: var(--celeste); border-color: var(--celeste); }
  .filters select { width: 100%; min-width: 0; }
  .filters-icon { display: none; }
  .monitor-hero { grid-template-columns: 1fr; padding: 22px 20px 42px; }
}

/* Celular */
@media (max-width: 700px) {
  .btn.menu-toggle { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 18; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom)); height: 62px; padding: 6px; border-radius: 20px;
    background: rgba(9,30,56,.92); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
    box-shadow: 0 14px 34px -12px rgba(3,20,45,.7); border: 1px solid rgba(255,255,255,.08); }
  .tabbar a, .tabbar button { font: inherit; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: rgba(255,255,255,.6); text-decoration: none; font-size: 10px; font-weight: 600; border-radius: 14px;
    transition: color .2s, background .25s var(--ease); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tabbar a.active { color: #fff; background: linear-gradient(135deg, rgba(0,130,154,.95), rgba(0,105,130,.95)); }
  .tabbar svg.i { width: 20px; height: 20px; }
  .content { padding: 0 12px calc(92px + env(safe-area-inset-bottom)); }
  .topbar { margin: calc(8px + env(safe-area-inset-top)) 0 14px; border-radius: 16px; }
  h1 { font-size: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 14px; min-height: 106px; }
  .kpi .value { font-size: clamp(13px, 4.1vw, 17px); margin: 10px 0 2px; }
  .kpi .label { font-size: 11px; }
  .kpi .chip-ico { width: 28px; height: 28px; }
  .card { padding: 14px; border-radius: 14px; margin-bottom: 12px; }
  .card-head { margin-bottom: 12px; }
  h3 { font-size: 14px; flex-wrap: wrap; }
  h3 small { flex-basis: 100%; padding-left: 42px; margin-top: -6px; }
  .chart-box { height: 260px; } .chart-box.tall { height: 400px; }
  .grid { gap: 12px; margin-bottom: 12px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .table { font-size: 12px; } .table th, .table td { padding: 8px 9px; }
  .search-box input, select, input[type=search], input[type=text] { min-width: 0; }
  .search-box, .search-box input { width: 100%; }
  .row > label, .row > .search-box { flex: 1 1 140px; }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  .onboard-card { padding: 24px 18px; } .modal-card { padding: 20px; }
  .pbi-pop { left: 8px; right: 8px; }
  .monitor-hero { padding: 20px 16px 40px; border-radius: 16px; gap: 18px; }
  .radar.big { width: min(220px, 70vw); }
  .dg-head h2 { font-size: 18px; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Pantallas táctiles: sin efectos de "hover" pegados */
@media (hover: none) {
  .kpi:hover, .btn:hover, .ind:hover, .formats label:hover { transform: none; }
  .card:hover .chip-ico, .kpi:hover::after { transform: none; }
}

/* ===== Inicio de sesión ===== */
.login-screen { background: radial-gradient(700px 420px at 50% 20%, rgba(0,130,154,.35), transparent 70%), linear-gradient(160deg, #0B2545, #050F1E);
  z-index: 70; }
.login-screen .onboard-card { max-width: 420px; background: rgba(12,32,56,.85); color: #fff; border-color: rgba(255,255,255,.1);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; justify-items: center; gap: 6px; }
.login-screen h2 { margin: 6px 0 0; font-size: 26px; }
.login-screen p { color: rgba(255,255,255,.7); margin: 4px 0 10px; }
.login-radar { width: 150px; margin-bottom: 10px; }
.btn-google { background: #fff; color: #1F2937; border-color: transparent; gap: 12px; max-width: 320px; }
.btn-google:hover { border-color: transparent; box-shadow: 0 10px 26px -10px rgba(0,0,0,.6); }
.g-logo { width: 20px; height: 20px; }
.login-msg { color: #FFB4AE !important; font-size: 13px; min-height: 18px; }
.session-card strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.session-card > div { min-width: 0; flex: 1; }
.session-card svg.i { opacity: .7; }
.session-card .btn-icon { padding: 6px; }
@media (min-width: 901px) and (max-width: 1180px) { .session-card { display: none !important; } }

/* ===== Gráficos: lectura, vacío ===== */
.chart-read { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px;
  background: var(--t-celeste); color: var(--text); font-size: 12.5px; line-height: 1.5; animation: rise .4s var(--ease); }
.chart-read svg.i { width: 15px; height: 15px; color: var(--celeste); margin-top: 2px; }
.chart-read b { color: var(--c-azul-txt); }
.chart-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; color: var(--text-3); }
.chart-empty svg.i { width: 30px; height: 30px; opacity: .5; margin-bottom: 4px; }
.chart-empty b { color: var(--text-2); font-size: 13px; }
.chart-empty span { font-size: 12px; }

/* ===== Tablas modernas ===== */
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--celeste); }
.table th.sortable::after { content: '↕'; opacity: .3; margin-left: 6px; font-size: 10px; }
.table th[data-dir="asc"]::after { content: '↑'; opacity: 1; color: var(--celeste); }
.table th[data-dir="desc"]::after { content: '↓'; opacity: 1; color: var(--celeste); }
.table thead th { backdrop-filter: blur(6px); }
.table td a { color: var(--celeste); font-weight: 600; text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.badge.pbar { position: relative; min-width: 66px; text-align: right; padding: 3px 9px;
  background: linear-gradient(90deg, var(--pb) var(--w), var(--pt) var(--w)); font-variant-numeric: tabular-nums; }
.badge.pbar.alto { --pb: rgba(76,175,80,.30); --pt: rgba(76,175,80,.08); }
.badge.pbar.medio { --pb: rgba(255,152,0,.32); --pt: rgba(255,152,0,.08); }
.badge.pbar.bajo { --pb: rgba(229,57,53,.26); --pt: rgba(229,57,53,.07); }

@media (max-width: 700px) {
  /* Tablas como tarjetas: cada fila es una tarjeta con "columna: valor" */
  .table-wrap { border: 0; max-height: 620px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-solid); }
  .table tbody tr:nth-child(even) td, .table tbody tr:hover td { background: transparent; }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--text-3); font-size: 11px; font-weight: 600; text-align: left; flex: 0 0 42%; }
  .table td:not([data-label])::before { content: none; }
  .table td:first-child { font-weight: 600; text-align: left; }
  .table td:first-child::before { display: none; }
  .table td:empty { display: none; }
  .table tr.grp { padding: 8px 12px; background: var(--t-azul); }
  .table tr.grp td { justify-content: flex-start; text-align: left; }
  .table tr.tot { border-color: var(--celeste); }
  .num { text-align: right; }
}

/* ===== Metodología e índices ===== */
.meto-hero { position: relative; overflow: hidden; padding: 26px 28px; border-radius: 20px; margin-bottom: var(--sp); color: #fff;
  background: radial-gradient(520px 300px at 90% 0%, rgba(0,130,154,.45), transparent 70%), linear-gradient(135deg, #0B2545, #061529); }
.meto-hero h2 { margin: 10px 0 8px; font-size: clamp(20px, 2.4vw, 27px); letter-spacing: -.02em; }
.meto-hero p { color: rgba(255,255,255,.75); max-width: 820px; line-height: 1.6; margin: 0; }
.meto-hero a { color: #7FD6E6; }
.meto-q { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 18px; }
.meto-q > div { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); }
.meto-q b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--celeste); flex: none; font-size: 13px; }
.meto-q span { font-size: 13px; font-weight: 600; line-height: 1.3; }
.meto-q small { display: block; font-weight: 500; color: #7FD6E6; font-size: 11px; }
.meto-b h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.meto-b p { margin: 0; line-height: 1.6; color: var(--text-2); }
.meto-b p b { color: var(--text); }
.meto-lv { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.meto-lv b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--t-celeste); color: var(--celeste); margin-right: 8px; }
.meto-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--text-2); line-height: 1.5; font-size: 13px; }
.meto-principios { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.meto-principios > div { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--verde); }
.meto-principios b { display: block; margin-bottom: 4px; }
.meto-principios span { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.formula { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-2);
  font: 500 13px/1.7 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--text); overflow-x: auto; }
.formula b { color: var(--celeste); }
.esc-bar { position: relative; display: flex; gap: 3px; margin: 12px 0 34px; }
.esc-bar span { padding: 6px 4px; border-radius: 8px; text-align: center; background: color-mix(in srgb, var(--c) 18%, transparent); border-top: 3px solid var(--c); min-width: 0; }
.esc-bar span b { display: block; font-size: 11px; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.esc-bar span small { font-size: 10px; color: var(--text-3); }
.esc-mark { position: absolute; top: -6px; bottom: -14px; width: 2px; background: var(--text); transform: translateX(-1px); }
.esc-mark em { position: absolute; bottom: -4px; left: 50%; transform: translate(-50%, 100%); font: 700 11px 'Inter', sans-serif; font-style: normal;
  background: var(--text); color: var(--surface-solid); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.table.mx td, .table.mx th { white-space: normal; }

/* Detalle del cálculo por entidad */
.calc { border: 1px solid var(--border); border-radius: 14px; margin-top: 10px; background: var(--surface-2); overflow: hidden; }
.calc summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; }
.calc summary::-webkit-details-marker { display: none; }
.calc summary > span::before { content: '›'; display: inline-block; margin-right: 10px; color: var(--celeste); transition: transform .25s var(--ease); font-size: 18px; line-height: 0; }
.calc[open] summary > span::before { transform: rotate(90deg); }
.calc summary b { font-size: 17px; margin-left: 6px; }
.calc > div { padding: 0 14px 14px; animation: rise .3s var(--ease); }
.calc-why { display: flex; gap: 8px; margin: 10px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.calc-why svg.i { width: 15px; height: 15px; color: var(--celeste); margin-top: 2px; }
@media (max-width: 700px) { .formula { font-size: 12px; } .esc-bar span b { font-size: 9.5px; } .meto-hero { padding: 20px 16px; } }

/* =====================================================================
   Rediseño 2026-10 · ECharts, mapas, herramientas y móvil más amplio
   ===================================================================== */
:root { --r: 22px; --sp: 20px; --head-font: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', sans-serif; }
h1, h2, h3, .kpi .value, .mini-kpis b, .gauge-val b, .pctl b, .brand strong { font-family: var(--head-font); }
h1 { font-weight: 800; letter-spacing: -.025em; }
h3 { font-size: 16px; font-weight: 700; }
.card { border-radius: var(--r); padding: 22px; }
.card-head { margin-bottom: 18px; }
.chip-ico { width: 38px; height: 38px; border-radius: 12px; }
.chip-ico svg.i { width: 19px; height: 19px; }
.chart-box { height: 330px; }
.chart-box.tall { height: 470px; }
.chart-box > .ec { position: absolute; inset: 0; }

/* Encabezado de módulo */
.page-head { position: relative; overflow: hidden; display: flex; gap: 18px; align-items: center; padding: 22px 24px; margin-bottom: var(--sp);
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: rise .5s var(--ease) both; }
.page-head::after { content: ''; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--ph, rgba(0,130,154,.22)), transparent 70%); pointer-events: none; }
.page-head .ph-ico { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--ph1, #00829A), var(--ph2, #005B6E)); box-shadow: 0 12px 26px -12px var(--ph1, #00829A); }
.page-head .ph-ico svg.i { width: 28px; height: 28px; }
.page-head small { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; }
.page-head h2 { margin: 2px 0 4px; font-size: clamp(19px, 2.1vw, 25px); font-weight: 800; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--text-2); line-height: 1.5; max-width: 760px; }
.ph-celeste { --ph1: #00829A; --ph2: #005B6E; --ph: rgba(0,130,154,.20); }
.ph-verde { --ph1: #3FA34D; --ph2: #23733A; --ph: rgba(76,175,80,.20); }
.ph-naranja { --ph1: #F59300; --ph2: #C26A00; --ph: rgba(255,152,0,.20); }
.ph-rojo { --ph1: #E53935; --ph2: #A82320; --ph: rgba(229,57,53,.18); }
.ph-azul { --ph1: #1B4F8A; --ph2: #0B2545; --ph: rgba(27,79,138,.22); }

/* Herramientas de cada gráfico */
.chart-tools { position: absolute; top: 0; right: 0; z-index: 3; display: flex; gap: 4px; opacity: 0; transition: opacity .2s var(--ease); }
.card:hover .chart-tools, .chart-tools:focus-within { opacity: 1; }
.chart-tools button { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--text-2);
  background: var(--surface-solid); border: 1px solid var(--border-2); box-shadow: var(--shadow); transition: color .2s, transform .25s var(--spring); }
.chart-tools button:hover { color: var(--celeste); transform: translateY(-2px); }
.chart-tools svg.i { width: 15px; height: 15px; }
@media (hover: none) { .chart-tools { opacity: 1; } }

.chart-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; background: rgba(4,16,32,.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: fadeIn .25s; }
.cm-card { width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); animation: rise .35s var(--spring); overflow: hidden; }
.cm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cm-head b { font-family: var(--head-font); font-size: 16px; }
.cm-head button { width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--border-2); background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.cm-body { padding: 16px 20px 20px; overflow: auto; }
.cm-chart { position: relative; height: min(70vh, 640px); }
.cm-body .table-wrap { max-height: 70vh; }

/* Mini tendencias en los indicadores */
.kpi .chart-box.spark { height: 44px; margin: 10px -4px -6px; position: relative; z-index: 1; }

/* Mapa del Perú por departamento (mosaicos) */
.map-box { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 24px; align-items: start; }
.peru-map { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 1fr; gap: 6px; aspect-ratio: 6 / 11; }
.pm-tile { all: unset; box-sizing: border-box; cursor: pointer; border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--c, var(--border)); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .25s var(--spring), box-shadow .25s; min-width: 0; }
.pm-tile b { font-family: var(--head-font); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.pm-tile span { font-size: 10.5px; font-weight: 600; opacity: .95; white-space: nowrap; }
.pm-tile:hover, .pm-tile.on { transform: scale(1.1); box-shadow: 0 10px 22px -8px rgba(0,0,0,.5), 0 0 0 3px var(--surface-solid), 0 0 0 5px var(--c); z-index: 2; }
.pm-tile.sin { background: var(--surface-2); color: var(--text-3); text-shadow: none; border: 1px dashed var(--border-2); }
.pm-side { display: grid; gap: 16px; }
.pm-legend span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pm-legend i { display: block; height: 12px; border-radius: 6px; margin: 8px 0 4px; }
.pm-legend small { display: flex; justify-content: space-between; color: var(--text-3); font-size: 11px; }
.pm-legend em { font-style: normal; }
.pm-detail { display: grid; gap: 6px; padding: 16px 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); min-height: 120px; }
.pm-detail b { font-family: var(--head-font); font-size: 17px; }
.pm-detail span { color: var(--text-2); font-size: 13px; }
.pm-detail span b { font-size: 13px; color: var(--text); }

/* Celular: más aire, letras más grandes, indicadores deslizables */
@media (max-width: 700px) {
  body { font-size: 15px; }
  .content { padding: 0 14px calc(100px + env(safe-area-inset-bottom)); }
  .card { padding: 18px 16px; border-radius: 20px; margin-bottom: 16px; }
  .grid { gap: 16px; margin-bottom: 16px; }
  h3 { font-size: 15.5px; }
  h3 small { font-size: 12px; padding-left: 48px; margin-top: -4px; }
  .chart-box { height: 310px; } .chart-box.tall { height: 450px; }
  .kpis { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin: 0 -14px 16px; padding: 4px 14px 8px; scrollbar-width: none; }
  .kpis::-webkit-scrollbar { display: none; }
  .kpis .kpi, .kpis .kpi:last-child:nth-child(odd) { flex: 0 0 80%; scroll-snap-align: center; grid-column: auto; min-height: 150px; padding: 18px; }
  .kpi .value { font-size: 26px; margin: 14px 0 4px; }
  .kpi .label { font-size: 13px; }
  .kpi .chip-ico { width: 34px; height: 34px; }
  .page-head { padding: 18px; gap: 14px; }
  .page-head .ph-ico { width: 48px; height: 48px; border-radius: 15px; }
  .page-head p { font-size: 13.5px; }
  .chart-read { font-size: 13.5px; padding: 12px 14px; }
  .map-box { grid-template-columns: 1fr; gap: 16px; }
  .peru-map { gap: 5px; max-width: 360px; margin: 0 auto; width: 100%; }
  .pm-tile b { font-size: 11.5px; } .pm-tile span { font-size: 9.5px; }
  .tabbar { height: 68px; } .tabbar a, .tabbar button { font-size: 11px; } .tabbar svg.i { width: 22px; height: 22px; }
  .topbar { padding: 12px 14px; } h1 { font-size: 19px; }
  .cm-card { border-radius: 20px; } .cm-chart { height: 70vh; } .chart-modal { padding: 10px; }
}
@media (max-width: 1180px) and (min-width: 701px) { .map-box { grid-template-columns: minmax(240px, 360px) 1fr; } }
