/* Auditoría SEO Dashboard — IO (ioa.es)
   Sistema de diseño: sidebar oscuro + contenido claro.
   Basado en Design System Seobide v1.3.
   Sin webfonts, sin gradients decorativos, sin glassmorphism. */

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

:root {
  /* Surfaces */
  --bg:        #f5f6f8;
  --panel:     #ffffff;
  --panel-2:   #fbfcfd;
  --sidebar:   #0f1623;
  --sidebar-2: #18202f;
  --row-hover: #f4f7fb;
  --row-alt:   #fafbfc;

  /* Ink */
  --ink:       #1a2231;
  --ink-2:     #4a566b;
  --ink-3:     #76829a;
  --ink-on-dark:   #e8edf6;
  --ink-on-dark-2: #9aa6bd;
  --ink-on-dark-3: #5e6b85;

  /* Lines */
  --line:      #e4e8ee;
  --line-2:    #d4dae3;

  /* Accent verde */
  --accent:    #0f9266;
  --accent-dk: #0b7251;
  --accent-50: #e8f5ef;
  --accent-100:#cdebde;

  /* Table header oscuro */
  --th-bg:     #1b2436;
  --th-ink:    #e7ecf6;

  /* Estados semánticos */
  --ok:        #1a8a4f;   --ok-bg:        #e6f4ec;   --ok-line:        #bce3cd;
  --revisar:   #b5740a;   --revisar-bg:   #fcf2e1;   --revisar-line:   #f0dcae;
  --riesgo:    #c2410c;   --riesgo-bg:    #fdeadf;   --riesgo-line:    #f6cdb3;
  --oportun:   #0e7c86;   --oportun-bg:   #e1f3f4;   --oportun-line:   #b3e0e3;
  --bloqueado: #c23434;   --bloqueado-bg: #fbe9e9;   --bloqueado-line: #f1c9c9;
  --proxy:     #2f6fb3;   --proxy-bg:     #e9f1fa;   --proxy-line:     #c8ddf2;
  --muted-bg:  #eef0f3;   --muted-line:   #dde1e7;

  /* Layout */
  --sidebar-w: 240px;
  --r-sm: 6px;
  --r-md: 9px;
  --shadow: 0 1px 2px rgba(20,30,50,.05), 0 1px 1px rgba(20,30,50,.04);

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Segoe UI Variable',
               system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── APP SHELL ─────────────────────────────────────────────────────────────── */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  color: var(--ink-on-dark);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 30;
  flex-shrink: 0;
}

.sidebar-head {
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  border-radius: 10px;
  padding: 11px 13px;
  box-shadow: 0 4px 14px rgba(11,114,81,.35);
}

.brand-ico {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 15px; color: #fff;
}

.brand-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,.78);
  margin-top: 2px;
}

/* ── NAV ───────────────────────────────────────────────────────────────────── */

.nav {
  padding: 8px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  font-size: 12.5px;
  color: var(--ink-on-dark-2);
  cursor: pointer;
  user-select: none;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s;
}

.nav-item:hover {
  background: var(--sidebar-2);
  color: var(--ink-on-dark);
}

.nav-item.active {
  background: var(--sidebar-2);
  color: #fff;
  font-weight: 500;
  border-left-color: var(--accent);
}

.nav-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-on-dark-3);
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  letter-spacing: .02em;
}

.nav-badge.alta  { background: rgba(194,65,12,.22); color: #ec9a9a; }
.nav-badge.media { background: rgba(181,116,10,.22); color: #f0c074; }
.nav-badge.ok    { background: rgba(26,138,79,.22); color: #8ad4aa; }

/* ── SIDEBAR FOOTER ────────────────────────────────────────────────────────── */

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.btn-pdf {
  display: block;
  width: 100%;
  padding: 9px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .12s;
  text-align: center;
  letter-spacing: .01em;
}

.btn-pdf:hover { background: var(--accent-dk); }

.foot-fecha {
  margin-top: 9px;
  font-size: 11px;
  color: var(--ink-on-dark-2);
}

.foot-periodo {
  font-size: 10.5px;
  color: var(--ink-on-dark-3);
  margin-top: 2px;
}

/* ── MAIN AREA ─────────────────────────────────────────────────────────────── */

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
  padding: 24px 28px 40px;
}

.main-inner {
  max-width: 1280px;
  padding: 24px 24px 40px;
}

/* ── SCREEN HEADER ─────────────────────────────────────────────────────────── */

.screen-head {
  margin-bottom: 20px;
}

.screen-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--ink);
}

.screen-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  max-width: 80ch;
}

/* ── BLOCK (sección dentro de una pantalla) ────────────────────────────────── */

.block {
  margin-bottom: 18px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.block-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.block-note {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ── KPI TILES ─────────────────────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: var(--r-md);
  padding: 11px 13px 12px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 7px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-value.sm {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.kpi-foot {
  margin-top: 5px;
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-foot .delta-up   { color: var(--ok); font-weight: 600; }
.kpi-foot .delta-down { color: var(--bloqueado); font-weight: 600; }

/* ── TABLA ─────────────────────────────────────────────────────────────────── */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--th-bg);
  text-align: left;
  font-weight: 600;
  color: var(--th-ink);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 12px;
  white-space: nowrap;
}

table.data thead th.num { text-align: right; }

table.data tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:nth-child(even) { background: var(--row-alt); }
table.data tbody tr:hover { background: var(--row-hover); }

table.data td.num  { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.main { font-weight: 500; color: var(--ink); }
table.data td.dim  { color: var(--ink-3); font-size: 11.5px; }
table.data td.mono { font-family: ui-monospace,'SF Mono','Cascadia Code',Consolas,monospace; font-size: 11.5px; color: var(--ink-2); word-break: break-all; }
table.data td.url  { font-family: ui-monospace,'SF Mono',Consolas,monospace; font-size: 11px; color: var(--ink-2); max-width: 380px; word-break: break-all; }

/* mini bar inline en celda */
.cellbar { display: flex; align-items: center; gap: 7px; justify-content: flex-end; }
.cellbar .track { width: 52px; height: 5px; border-radius: 3px; background: var(--muted-bg); overflow: hidden; flex-shrink: 0; }
.cellbar .fill  { height: 100%; background: var(--accent); border-radius: 3px; }
.cellbar .pct   { min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ── BADGES ────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 100px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
  flex-shrink: 0;
}

.badge.ok          { color: var(--ok);        background: var(--ok-bg);        border-color: var(--ok-line); }
.badge.revisar     { color: var(--revisar);   background: var(--revisar-bg);   border-color: var(--revisar-line); }
.badge.riesgo      { color: var(--riesgo);    background: var(--riesgo-bg);    border-color: var(--riesgo-line); }
.badge.oportunidad { color: var(--oportun);   background: var(--oportun-bg);   border-color: var(--oportun-line); }
.badge.bloqueado   { color: var(--bloqueado); background: var(--bloqueado-bg); border-color: var(--bloqueado-line); }
.badge.proxy       { color: var(--proxy);     background: var(--proxy-bg);     border-color: var(--proxy-line); }
.badge.muted       { color: var(--ink-3);     background: var(--muted-bg);     border-color: var(--muted-line); }
.badge.muted::before { opacity: .4; }

/* tags inline */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .01em;
  white-space: nowrap;
  background: var(--muted-bg);
  color: var(--ink-2);
}

.tag.alta  { background: var(--riesgo-bg);  color: var(--riesgo); }
.tag.media { background: var(--revisar-bg); color: var(--revisar); }
.tag.baja  { background: var(--ok-bg);      color: var(--ok); }
.tag.oport { background: var(--oportun-bg); color: var(--oportun); }

/* ── FINDING CARDS (hallazgos expandibles) ─────────────────────────────────── */

.finding-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finding-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .12s;
}

.finding-card.alta   { border-color: var(--riesgo-line); }
.finding-card.media  { border-color: var(--revisar-line); }
.finding-card.baja   { border-color: var(--ok-line); }

.finding-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
}

.finding-head:hover { background: var(--row-hover); }

.finding-rank {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--muted-bg);
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
}

.finding-meta {
  flex: 1;
  min-width: 0;
}

.finding-titulo {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finding-area {
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 1px;
}

.finding-tail {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.finding-score {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.finding-toggle {
  color: var(--ink-3);
  font-size: 10px;
  width: 18px;
  text-align: center;
}

.finding-body {
  border-top: 1px solid var(--line);
  padding: 13px 14px 14px;
  display: none;
}

.finding-body.open { display: block; }

.finding-section {
  margin-bottom: 10px;
}

.finding-section:last-child { margin-bottom: 0; }

.finding-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: 3px;
}

.finding-section-text {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}

.finding-evidencia {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-family: ui-monospace,'SF Mono',Consolas,monospace;
  line-height: 1.5;
}

/* ── FILTER BAR ────────────────────────────────────────────────────────────── */

.filterbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 100px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  font-weight: 500;
}

.filter-btn:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.filter-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── CWV ITEMS ─────────────────────────────────────────────────────────────── */

.cwv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.cwv-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cwv-metric {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.cwv-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.cwv-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  width: fit-content;
}

.cwv-status.good { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); }
.cwv-status.poor { background: var(--riesgo-bg); color: var(--riesgo); border: 1px solid var(--riesgo-line); }
.cwv-status.needs { background: var(--revisar-bg); color: var(--revisar); border: 1px solid var(--revisar-line); }

.cwv-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}

.cwv-desc {
  font-size: 11px;
  color: var(--ink-3);
}

/* ── PROGRESS BAR (PSI scores) ─────────────────────────────────────────────── */

.psi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.psi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.psi-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 8px;
}

.psi-device {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--muted-bg);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
}

.progress-fill.good  { background: var(--ok); }
.progress-fill.needs { background: var(--revisar); }
.progress-fill.poor  { background: var(--riesgo); }

.progress-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

.progress-score.good  { color: var(--ok); }
.progress-score.needs { color: var(--revisar); }
.progress-score.poor  { color: var(--riesgo); }

/* ── SECURITY HEADERS ──────────────────────────────────────────────────────── */

.sec-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.sec-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.sec-row:last-child { border-bottom: none; }
.sec-row:nth-child(even) { background: var(--row-alt); }

.sec-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  font-family: ui-monospace,'SF Mono',Consolas,monospace;
}

.sec-desc {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.sec-recommend {
  font-size: 10.5px;
  color: var(--ink-3);
  font-family: ui-monospace,'SF Mono',Consolas,monospace;
  max-width: 240px;
}

/* ── DISTRIBUCIÓN DE HALLAZGOS ─────────────────────────────────────────────── */

.dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.dist-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dist-area {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

.dist-count {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.dist-urgencia {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── DOS COLUMNAS ──────────────────────────────────────────────────────────── */

.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}

/* ── ACTION BOX ────────────────────────────────────────────────────────────── */

.action-box {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--accent-50);
  border: 1px solid var(--accent-100);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.action-box .ico {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.action-box .ab-body { flex: 1; }
.action-box .ab-title { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-dk); }
.action-box .ab-text { margin-top: 3px; font-size: 12.5px; color: var(--ink); line-height: 1.45; }

/* ── EEAT / SCHEMA LIST ────────────────────────────────────────────────────── */

.checklist-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.checklist-group-head {
  padding: 9px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.checklist-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 120px;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.checklist-row:last-child { border-bottom: none; }
.checklist-row:nth-child(even) { background: var(--row-alt); }
.checklist-row:hover { background: var(--row-hover); }

.cl-id   { font-size: 11px; color: var(--ink-3); font-family: ui-monospace,'SF Mono',Consolas,monospace; }
.cl-item { font-size: 12px; color: var(--ink); font-weight: 400; }
.cl-valor { font-size: 11.5px; color: var(--ink-2); }

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.empty-state-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.empty-state-icon.ok      { background: var(--ok-bg);      color: var(--ok); }
.empty-state-icon.muted   { background: var(--muted-bg);   color: var(--ink-3); }
.empty-state-icon.riesgo  { background: var(--riesgo-bg);  color: var(--riesgo); }
.empty-state-icon.revisar { background: var(--revisar-bg); color: var(--revisar); }

.empty-state-text {
  font-size: 13px;
  color: var(--ink-3);
}

/* ── FEATURE CHIP (SERP) ───────────────────────────────────────────────────── */

.feature-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 1px;
  white-space: nowrap;
}

.fc-paa    { background: #eff6ff; color: #1d4ed8; }
.fc-ai     { background: #f3e8ff; color: #7e22ce; }
.fc-local  { background: #fef3c7; color: #92400e; }
.fc-video  { background: #fce7f3; color: #9d174d; }
.fc-feat   { background: var(--ok-bg); color: var(--ok); }
.fc-kg     { background: var(--oportun-bg); color: var(--oportun); }
.fc-other  { background: var(--muted-bg); color: var(--ink-3); }

/* ── STAT SUMMARY ROW ──────────────────────────────────────────────────────── */

.stat-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.stat-pill {
  flex: 1;
  min-width: 120px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: var(--r-md);
  padding: 10px 13px;
  box-shadow: var(--shadow);
}

.stat-pill-label {
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.stat-pill-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  margin-top: 5px;
  line-height: 1.1;
}

.stat-pill-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
}

/* ── FUENTES STATUS ────────────────────────────────────────────────────────── */

.fuentes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.fuente-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.fuente-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fuente-dot.ok    { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.fuente-dot.error { background: var(--riesgo); box-shadow: 0 0 0 3px var(--riesgo-bg); }
.fuente-dot.warn  { background: var(--revisar); box-shadow: 0 0 0 3px var(--revisar-bg); }

.fuente-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.fuente-sub {
  font-size: 10.5px;
  color: var(--ink-3);
}

/* ── PROBLEMS (hallazgos compactos) ────────────────────────────────────────── */

.problems {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.problem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  box-shadow: var(--shadow);
}

.problem-mark {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--ink-3);
}

.problem-mark.riesgo     { background: var(--riesgo); }
.problem-mark.revisar    { background: var(--revisar); }
.problem-mark.ok         { background: var(--ok); }
.problem-mark.oportunidad{ background: var(--oportun); }

.problem-body {
  flex: 1;
  min-width: 0;
}

.problem-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.problem-detail {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.45;
}

.problem-detail code {
  font-family: ui-monospace,'SF Mono',Consolas,monospace;
  font-size: 10.5px;
  background: var(--muted-bg);
  padding: 1px 4px;
  border-radius: 3px;
}

.problem-tail {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── MOBILE OVERLAY ────────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ── PRINT ─────────────────────────────────────────────────────────────────── */

@media print {
  .sidebar, .overlay { display: none !important; }

  .main {
    overflow: visible !important;
    height: auto !important;
  }

  .main-inner {
    max-width: 100%;
    padding: 0;
  }

  .app {
    height: auto;
    overflow: visible;
  }

  body {
    font-size: 11px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-section {
    page-break-after: always;
    padding: 20px 24px;
  }

  .print-section:last-child { page-break-after: avoid; }

  .table-wrap { box-shadow: none; }
  .kpi, .stat-pill, .cwv-item, .psi-card { box-shadow: none; }

  .finding-body.open { display: block !important; }

  a { color: inherit; text-decoration: none; }
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .cwv-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 2px 0 24px rgba(0,0,0,.25);
  }

  .sidebar.open { transform: translateX(0); }

  .main-inner { padding: 16px 16px 32px; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .checklist-row { grid-template-columns: 1fr auto; }
  .cl-id, .cl-valor { display: none; }

  .screen-title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
