:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #17202c;
  --muted: #667386;
  --line: #d7dde5;
  --line-strong: #c6ced9;
  --accent: #0e7490;
  --accent-dark: #155e75;
  --danger: #b42318;
  --warning: #b45309;
  --success: #087443;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111827;
  --panel-soft: #172033;
  --text: #e5eef8;
  --muted: #9aa8bc;
  --line: #293449;
  --line-strong: #3a4860;
  --accent: #22a6c7;
  --accent-dark: #67d3ea;
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #34d399;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eef3f7 0, #f7f9fb 280px, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, #07111f 0, #0b1220 280px, var(--bg) 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: #111827;
  color: #ffffff;
  border-bottom: 3px solid #0e7490;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions span {
  color: #d7eef4;
  font-size: 0.9rem;
  font-weight: 800;
}

.theme-toggle {
  min-width: 112px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

h2 {
  font-size: 0.98rem;
}

.layout {
  width: 100%;
  margin: 0;
  padding: 14px clamp(14px, 3vw, 36px) 42px;
}

.app-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  width: min(1760px, 100%);
  margin: 0 auto;
  transition: grid-template-columns 0.22s ease;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 42px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 0px);
  padding: 10px 8px;
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.86);
  overflow: hidden;
  transition: padding 0.22s ease;
}
.sidebar.sidebar-collapsed {
  padding: 10px 6px;
}
.sidebar.sidebar-collapsed nav {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar nav {
  opacity: 1;
  transition: opacity 0.18s ease;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0 0 8px auto;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: 1rem;
  line-height: 1;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: var(--panel-soft, #f3f4f6);
  color: var(--fg, #0f172a);
}
.sidebar.sidebar-collapsed .sidebar-toggle {
  margin: 0 auto;
}

/* Nav groups accordion */
.nav-group {
  margin-top: 2px;
}
.nav-group-hdr {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .28rem .6rem;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted, #64748b);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: background 0.12s, color 0.12s;
}
.nav-group-hdr:hover {
  background: var(--panel-soft, #f3f4f6);
  color: var(--fg, #0f172a);
}
.ngc {
  font-size: .6rem;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.nav-group:not(.open) .ngc {
  transform: rotate(-90deg);
}
.nav-group-body {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.22s ease;
}
.nav-group:not(.open) .nav-group-body {
  max-height: 0;
}

.sidebar nav {
  display: grid;
  gap: 2px;
}

.sidebar a {
  display: flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0 10px;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.sidebar a:hover {
  border-color: var(--line);
  background: #ffffff;
  color: var(--accent-dark);
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: min(720px, 100%);
}

.upload-form input[type="file"] {
  min-height: 36px;
  padding: 6px 8px;
}

.url-import-form {
  grid-template-columns: minmax(260px, 1fr) auto;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

/* ── URL deduplication bar ──────────────────────────────────── */
.dedupe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.dedupe-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dedupe-label {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.dedupe-bar label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.dedupe-bar select {
  width: auto;
  min-height: 30px;
  padding: 3px 7px;
  font-size: 0.82rem;
}

:root[data-theme="dark"] .dedupe-bar {
  background: var(--panel-soft);
}

.surface-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.surface-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.surface-form:last-child {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
}

.checkbox-inline {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.indicio-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 120px 130px minmax(260px, 1fr) minmax(260px, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.indicio-form textarea {
  min-height: 52px;
}

.subheader {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.job-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.job-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 110px minmax(130px, 0.8fr) 90px 90px minmax(120px, 0.8fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--panel-soft);
}

.job-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.job-main strong,
.job-main span,
.job-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-main span,
.job-row small,
.job-meta span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-queued,
.status-uploaded {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #075985;
}

.status-running {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.status-analyzed {
  background: #dcfce7;
  border-color: #86efac;
  color: var(--success);
}

.status-failed {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.job-progress {
  position: relative;
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
}

.job-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.job-meta {
  display: grid;
  gap: 1px;
}

.job-meta strong {
  font-size: 0.95rem;
  line-height: 1;
}

.global-filters {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto 1fr;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.button.secondary:hover {
  background: #f8fafc;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stats article,
.tables,
.analysis-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.stats article {
  position: relative;
  overflow: hidden;
  padding: 10px 11px;
  border-left: 3px solid #94a3b8;
}

.stats span {
  display: block;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.stats p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats article[data-nav],
.stats article[data-alert-type],
.stats article[data-url-source] {
  cursor: pointer;
  transition: border-left-color .15s, box-shadow .15s, transform .1s;
}

.stats article[data-nav]:hover,
.stats article[data-alert-type]:hover,
.stats article[data-url-source]:hover {
  border-left-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #6366f1) 20%, transparent);
  transform: translateY(-1px);
}

.risk-stat {
  border-color: #fed7aa;
  border-left-color: #f97316 !important;
  background: #fff7ed !important;
}

.risk-stat[data-nav]:hover {
  border-left-color: #ea580c !important;
  box-shadow: 0 0 0 2px #fed7aa;
}

.risk-stat span {
  color: #9a3412;
}

/* ── Dashboard charts ─────────────────────────────────────── */
.dash-charts {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 1100px) { .dash-charts { grid-template-columns: 1fr 1fr; } .dash-card-wide { grid-column: 1 / -1; } }
@media (max-width: 720px)  { .dash-charts { grid-template-columns: 1fr; } }

/* Tabla de alertas plegable (el dashboard prioriza gráficas/cards sobre tablas) */
.dash-table-collapse { margin-top: 2px; }
.dash-table-collapse > summary {
  cursor: pointer;
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 2px;
  list-style: none;
  user-select: none;
}
.dash-table-collapse > summary::-webkit-details-marker { display: none; }
.dash-table-collapse > summary::before { content: '▾ '; }
.dash-table-collapse:not([open]) > summary::before { content: '▸ '; }

.dash-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  min-height: 168px;
  display: flex;
  flex-direction: column;
}
.dash-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dash-card h3 {
  margin: 0;
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--muted);
}
.dash-legend { font-size: .68rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.dash-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-left: 8px; }
.dash-legend i.lg-subs { background: #2563eb; }
.dash-legend i.lg-urls { background: #d97706; }
.dash-chart-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.dash-svg { width: 100%; height: 120px; display: block; }
.dash-axis { display: flex; justify-content: space-between; align-items: center; font-size: .68rem; color: var(--muted); margin-top: 4px; }
.dash-peaks b { font-variant-numeric: tabular-nums; }

.dash-bars { display: flex; flex-direction: column; gap: 9px; }
.dash-bar-row { display: grid; grid-template-columns: 76px 1fr 42px; align-items: center; gap: 8px; }
.dash-bar-label { font-size: .74rem; color: var(--text); font-weight: 600; }
.dash-bar-track { background: color-mix(in srgb, var(--muted) 18%, transparent); border-radius: 6px; height: 14px; overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; border-radius: 6px; min-width: 2px; transition: width .4s ease; }
.dash-bar-val { font-size: .76rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.dash-donut-wrap { display: flex; align-items: center; gap: 12px; }
.dash-donut { width: 108px; height: 108px; flex-shrink: 0; }
.dash-donut-total { font-size: 20px; font-weight: 800; fill: var(--text); }
.dash-donut-sub { font-size: 9px; fill: var(--muted); text-transform: uppercase; }
.dash-legend-list { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; }
.dash-leg-row { display: flex; align-items: center; gap: 6px; color: var(--text); }
.dash-leg-row i { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.dash-leg-row b { margin-left: auto; font-variant-numeric: tabular-nums; }

.analysis-panel {
  margin-bottom: 10px;
  overflow: hidden;
}

.analysis-panel.muted-panel {
  opacity: 0.82;
}

.analysis-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.analysis-body h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.analysis-metrics {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
}

.analysis-metrics article {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--panel-soft);
}

.analysis-metrics span {
  display: block;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.1;
}

.analysis-metrics p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.analysis-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-list {
  display: grid;
  gap: 5px;
}

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 9px;
  background: var(--panel);
  font-size: 0.86rem;
}

.compact-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-row strong {
  flex: 0 0 auto;
}

.compact-table {
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-table table {
  min-width: 900px;
}

.url-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
}

.url-list a {
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-inline {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 9px;
  color: var(--text);
  font: inherit;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 10px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input {
  width: 16px;
  min-height: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  padding: 0 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, opacity 0.15s;
}

.button:hover {
  background: var(--accent-dark);
}

.button:active {
  opacity: 0.85;
}

.button.ghost {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
}

.tables {
  margin-top: 10px;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.table-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: min(560px, 100%);
}

.table-tools input {
  min-width: 240px;
}

.table-tools select {
  width: 86px;
}

/* Inputs inside filter rows — sin contorno blanco sobre el header */
.table-tools input,
.table-tools select {
  background: var(--panel);
  border-color: var(--line);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.table-tools input:focus,
.table-tools select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.section-wrap { min-width: 0; overflow: hidden; }
.table-wrap {
  overflow-x: auto;
  max-height: 520px;
}
.ua-table td:nth-child(4) { max-width: 420px; overflow: hidden; text-overflow: ellipsis; word-break: break-word; }
.ua-table td:nth-child(4) small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }
.ua-table td:last-child { white-space: nowrap; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  white-space: nowrap;
}

tr:hover td {
  background: rgba(14, 116, 144, 0.03);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.sort-button::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.28;
}

.sort-button[data-dir="asc"]::after {
  border-bottom: 6px solid currentColor;
  opacity: 0.9;
}

.sort-button[data-dir="desc"]::after {
  border-top: 6px solid currentColor;
  opacity: 0.9;
}

.sort-button.active {
  color: var(--accent-dark);
}

td a {
  display: block;
  margin-top: 3px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

td small {
  display: block;
  max-width: 680px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 5px;
  padding: 0 7px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.alive {
  background: #dcfce7;
  color: var(--success);
}

.risk-alto {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.risk-count-button {
  cursor: pointer;
  font-family: inherit;
}

.risk-count-button:hover,
.risk-count-button:focus-visible {
  filter: brightness(0.97);
  text-decoration: underline;
}

.risk-medio {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.risk-bajo {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

.risk-table .table-header {
  border-bottom-color: #fed7aa;
  background: #fff7ed;
}

.risk-table {
  border-color: #fed7aa;
}

#risks,
#takeovers,
#indicios,
#info-leaks,
#surface,
#overview,
#burp,
#urls {
  scroll-margin-top: 14px;
}

/* ── Takeover section ────────────────────────────────────── */
#takeovers { margin-top: 10px; }

.takeover-section { border-color: var(--line-strong); }

tr.row-fp td {
  opacity: 0.45;
}

tr.row-confirmed td {
  background: rgba(8, 116, 67, 0.04);
}

:root[data-theme="dark"] tr.row-confirmed td {
  background: rgba(52, 211, 153, 0.06);
}

.muted-block {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.monospace {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.indicio-text {
  max-width: 520px;
}

.indicio-state-activo {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #075985;
}

.indicio-state-revisando {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.indicio-state-validado {
  background: #dcfce7;
  border-color: #86efac;
  color: var(--success);
}

.indicio-state-descartado {
  background: #f1f5f9;
  color: #64748b;
}

.severity-info {
  background: #edf2f7;
  color: #475569;
}

.severity-bajo {
  background: #e0f2fe;
  color: #075985;
}

.severity-medio {
  background: #fef3c7;
  color: #92400e;
}

.severity-alto {
  background: #ffedd5;
  color: #9a3412;
}

.severity-critico {
  background: #fee2e2;
  color: #991b1b;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.state-select {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 6px;
  cursor: pointer;
}

.state-select.state-confirmed {
  background: #dcfce7;
  color: var(--success);
  border-color: #86efac;
}

.state-select.state-false_positive {
  background: #edf2f7;
  color: #64748b;
  border-color: var(--line-strong);
}

.state-select.state-reviewed {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.state-select.indicio-state-activo {
  background: #e0f2fe;
  color: #075985;
  border-color: #bae6fd;
}

.state-select.indicio-state-revisando {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.state-select.indicio-state-validado {
  background: #dcfce7;
  color: var(--success);
  border-color: #86efac;
}

.state-select.indicio-state-descartado {
  background: #f1f5f9;
  color: #64748b;
  border-color: var(--line-strong);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  background: #fbfcfe;
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Filter tag bar ──────────────────────────────────────── */
.filter-tag-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.filter-tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.filter-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-tag.severity-critico.active { background: #991b1b; border-color: #991b1b; color: #fff; }
.filter-tag.severity-alto.active    { background: #9a3412; border-color: #9a3412; color: #fff; }
.filter-tag.severity-medio.active   { background: #92400e; border-color: #92400e; color: #fff; }
.filter-tag.severity-bajo.active    { background: #075985; border-color: #075985; color: #fff; }

:root[data-theme="dark"] .filter-tag {
  background: var(--panel);
  color: var(--muted);
  border-color: var(--line);
}

:root[data-theme="dark"] .filter-tag.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 6px;
  padding: 12px 14px;
  background: #13231f;
  color: #ffffff;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: var(--danger);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #14213d;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel .eyebrow {
  color: var(--accent-dark);
}

.login-panel h1 {
  color: var(--text);
  font-size: 1.8rem;
}

.alert {
  margin: 0;
  border: 1px solid #f2b8b5;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff1f0;
  color: var(--danger);
  font-weight: 800;
}

:root[data-theme="dark"] .topbar {
  background: #070d18;
  border-bottom-color: #22a6c7;
}

:root[data-theme="dark"] .topbar-actions span {
  color: #b8d7e6;
}

:root[data-theme="dark"] .eyebrow {
  color: #7dd3fc;
}

:root[data-theme="dark"] .sidebar {
  background: rgba(11, 18, 32, 0.9);
}

:root[data-theme="dark"] .sidebar a {
  color: #cbd5e1;
}

:root[data-theme="dark"] .sidebar a:hover,
:root[data-theme="dark"] .sidebar a:focus-visible {
  border-color: var(--line-strong);
  background: #172033;
  color: #67d3ea;
}

:root[data-theme="dark"] .sidebar-toggle {
  border-color: rgba(255,255,255,.15);
  color: #94a3b8;
}
:root[data-theme="dark"] .sidebar-toggle:hover {
  background: #172033;
  color: #67d3ea;
}
:root[data-theme="dark"] .nav-group-hdr {
  color: #64748b;
}
:root[data-theme="dark"] .nav-group-hdr:hover {
  background: #172033;
  color: #94a3b8;
}

:root[data-theme="dark"] .subheader,
:root[data-theme="dark"] .job-list,
:root[data-theme="dark"] .compact-row,
:root[data-theme="dark"] .surface-forms,
:root[data-theme="dark"] .indicio-form,
:root[data-theme="dark"] .button.secondary,
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .mini-button,
:root[data-theme="dark"] .sidebar a {
  background-color: #111827;
}

:root[data-theme="dark"] .button.secondary:hover,
:root[data-theme="dark"] .mini-button:hover {
  background: #172033;
}

:root[data-theme="dark"] .button.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: #78869a;
}

:root[data-theme="dark"] .table-header,
:root[data-theme="dark"] th {
  background: var(--panel-soft);
}

:root[data-theme="dark"] .table-tools input,
:root[data-theme="dark"] .table-tools select {
  background: var(--panel);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] th {
  color: #b8c3d5;
}

:root[data-theme="dark"] tr:hover td {
  background: #142033;
}

:root[data-theme="dark"] .pager {
  background: #101724;
}

:root[data-theme="dark"] td a,
:root[data-theme="dark"] .url-list a,
:root[data-theme="dark"] .sort-button.active {
  color: #67d3ea;
}

:root[data-theme="dark"] .badge,
:root[data-theme="dark"] .severity-info {
  background: #253044;
  color: #b8c3d5;
}

:root[data-theme="dark"] .badge.alive,
:root[data-theme="dark"] .status-analyzed,
:root[data-theme="dark"] .state-select.state-confirmed {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.36);
  color: #6ee7b7;
}

:root[data-theme="dark"] .risk-stat {
  border-color: rgba(251, 146, 60, 0.36);
  border-left-color: #fb923c !important;
  background: rgba(251, 146, 60, 0.12) !important;
}

:root[data-theme="dark"] .risk-stat span,
:root[data-theme="dark"] .risk-medio,
:root[data-theme="dark"] .severity-alto {
  color: #fdba74;
}

:root[data-theme="dark"] .risk-table {
  border-color: rgba(251, 146, 60, 0.36);
}

:root[data-theme="dark"] .risk-table .table-header {
  border-bottom-color: rgba(251, 146, 60, 0.36);
  background: rgba(251, 146, 60, 0.1);
}

:root[data-theme="dark"] .status-pill {
  background: #172033;
  border-color: var(--line-strong);
  color: #b8c3d5;
}

:root[data-theme="dark"] .status-queued,
:root[data-theme="dark"] .status-uploaded,
:root[data-theme="dark"] .risk-bajo,
:root[data-theme="dark"] .severity-bajo {
  background: rgba(34, 166, 199, 0.15);
  border-color: rgba(34, 166, 199, 0.38);
  color: #7dd3fc;
}

:root[data-theme="dark"] .status-running,
:root[data-theme="dark"] .severity-medio,
:root[data-theme="dark"] .state-select.state-reviewed {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.36);
  color: #fcd34d;
}

:root[data-theme="dark"] .status-failed,
:root[data-theme="dark"] .risk-alto,
:root[data-theme="dark"] .severity-critico {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.36);
  color: #fca5a5;
}

:root[data-theme="dark"] .state-select,
:root[data-theme="dark"] .state-select.state-false_positive {
  background: #172033;
  border-color: var(--line-strong);
  color: #b8c3d5;
}

:root[data-theme="dark"] .job-progress {
  background: #293449;
}

:root[data-theme="dark"] .login-page {
  background: #070d18;
}

:root[data-theme="dark"] .login-panel .eyebrow {
  color: #67d3ea;
}

:root[data-theme="dark"] .alert {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.38);
}

/* ── Tech tags ─────────────────────────────────────────── */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.tech-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
}

.tag-blue   { background: #dbeafe; color: #1e40af; }
.tag-green  { background: #dcfce7; color: #166534; }
.tag-orange { background: #ffedd5; color: #9a3412; }
.tag-purple { background: #ede9fe; color: #5b21b6; }
.tag-cyan   { background: #cffafe; color: #155e75; }
.tag-pink   { background: #fce7f3; color: #9d174d; }
.tag-yellow { background: #fef9c3; color: #854d0e; }
.tag-slate  { background: #f1f5f9; color: #334155; }

/* ── Status code badges ─────────────────────────────────── */
.sc-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sc-2xx { background: #dcfce7; color: #166534; }
.sc-3xx { background: #dbeafe; color: #1e40af; }
.sc-4xx { background: #fef9c3; color: #854d0e; }
.sc-5xx { background: #fee2e2; color: #991b1b; }
.sc-0   { background: #f1f5f9; color: #64748b; }

/* ── Domain links – inline inside td ───────────────────── */
a.domain-link {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

a.domain-link:hover {
  text-decoration-thickness: 2px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 8px clamp(14px, 3vw, 36px) 0;
    border-right: 0;
    background: transparent;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
  }

  .sidebar a {
    flex: 0 0 auto;
    background: #ffffff;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analysis-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .job-row {
    grid-template-columns: minmax(220px, 1fr) 110px minmax(130px, 0.8fr);
  }

}

@media (max-width: 680px) {
  .topbar,
  .table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats,
  .analysis-metrics,
  .analysis-columns,
  .url-list,
  .upload-form,
  .surface-forms,
  .surface-form,
  .surface-form:last-child,
  .indicio-form,
  .global-filters,
  .split {
    grid-template-columns: 1fr;
  }

  .button.ghost,
  .table-tools,
  .table-tools input,
  .table-tools select {
    max-width: none;
    width: 100%;
  }

  .pager {
    align-items: stretch;
    flex-direction: column;
  }

  .pager-actions {
    justify-content: space-between;
  }

  .job-row {
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-content: flex-start;
    width: max-content;
  }
}

@media (max-width: 980px) {
  :root[data-theme="dark"] .sidebar {
    background: transparent;
  }

  :root[data-theme="dark"] .sidebar a {
    background: #111827;
  }
}

/* ── Dark mode: tech tags ───────────────────────────────── */
:root[data-theme="dark"] .tag-blue   { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
:root[data-theme="dark"] .tag-green  { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
:root[data-theme="dark"] .tag-orange { background: rgba(251, 146, 60, 0.18); color: #fdba74; }
:root[data-theme="dark"] .tag-purple { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
:root[data-theme="dark"] .tag-cyan   { background: rgba(34, 211, 238, 0.15); color: #67e8f9; }
:root[data-theme="dark"] .tag-pink   { background: rgba(244, 114, 182, 0.15); color: #f9a8d4; }
:root[data-theme="dark"] .tag-yellow { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
:root[data-theme="dark"] .tag-slate  { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }

/* ── Dark mode: status code badges ─────────────────────── */
:root[data-theme="dark"] .sc-2xx { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }
:root[data-theme="dark"] .sc-3xx { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
:root[data-theme="dark"] .sc-4xx { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
:root[data-theme="dark"] .sc-5xx { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
:root[data-theme="dark"] .sc-0   { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

/* ══════════════════════════════════════════════════════════
   H1 Knowledge section
   ══════════════════════════════════════════════════════════ */

#h1knowledge {
  scroll-margin-top: 14px;
  margin-top: 10px;
}

.h1k-header {
  flex-wrap: wrap;
  gap: 10px;
}

.h1k-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Stats row ──────────────────────────────────────────── */
.h1k-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.h1k-stat {
  padding: 10px 14px;
  background: var(--panel);
}

.h1k-stat span {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.h1k-stat p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.h1k-stat.is-critical span { color: #991b1b; }
.h1k-stat.is-high span     { color: #9a3412; }
.h1k-stat.is-bounty span   { color: var(--success); }

.h1k-bounty-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-transform: none;
}

/* ── Detalle de corrida de agente (click en una fila de Agentes) ─────────── */
.ag-run-row:hover { background: var(--panel-soft); }
.ag-run-detail-inner {
  padding: 0.75rem 1rem 0.9rem;
  background: var(--panel-soft);
  border-top: 1px solid var(--line);
}
.ag-run-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.ag-run-stat {
  flex: 0 0 auto;
  min-width: 88px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ag-run-stat span {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ag-run-stat p {
  margin: 2px 0 0;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}
.ag-run-summary-head {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.ag-run-summary-head small { color: var(--muted); font-weight: 500; }
.ag-run-summary {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 0.6rem 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.ag-run-meta {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
}

/* ── Two-column body ────────────────────────────────────── */
.h1k-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.h1k-col {
  padding: 12px 14px;
}

.h1k-col + .h1k-col {
  border-left: 1px solid var(--line);
}

.h1k-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Distribution bars ──────────────────────────────────── */
.h1k-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.8rem;
}

.h1k-bar-label {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h1k-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.h1k-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

.h1k-bar-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: right;
}

/* ── Pattern cards ──────────────────────────────────────── */
.h1k-patterns {
  display: grid;
  gap: 6px;
}

.h1k-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  overflow: hidden;
}

.h1k-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
}

.h1k-card-head:hover {
  background: rgba(14, 116, 144, 0.05);
}

.h1k-card-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.83rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h1k-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform 0.18s ease;
}

.h1k-card.open .h1k-chevron {
  transform: rotate(180deg);
}

.h1k-card-body {
  display: none;
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
}

.h1k-card.open .h1k-card-body {
  display: block;
}

.h1k-card-body p {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.h1k-card-body .h1k-test {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.h1k-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.h1k-signal {
  display: inline-flex;
  align-items: center;
  height: 20px;
  border-radius: 4px;
  padding: 0 7px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: ui-monospace, monospace;
}

/* ── Report rows ────────────────────────────────────────── */
#h1kRows tr { cursor: default; }

.h1k-bounty {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.h1k-summary {
  display: none;
  max-width: 800px;
}

.h1k-summary.open {
  display: block;
}

/* ── Severity badges for H1 ─────────────────────────────── */
.sev-critical { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.sev-high     { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.sev-medium   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.sev-low      { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.sev-none     { background: #f1f5f9; color: #64748b; }

/* ── Dark mode overrides ─────────────────────────────────── */
:root[data-theme="dark"] .h1k-stat         { background: var(--panel); }
:root[data-theme="dark"] .h1k-stat.is-critical span { color: #fca5a5; }
:root[data-theme="dark"] .h1k-stat.is-high span     { color: #fdba74; }
:root[data-theme="dark"] .h1k-stat.is-bounty span   { color: #6ee7b7; }
:root[data-theme="dark"] .h1k-card         { background: var(--panel-soft); }
:root[data-theme="dark"] .h1k-signal       { background: rgba(59,130,246,0.16); color: #93c5fd; }
:root[data-theme="dark"] .h1k-bar-fill     { background: var(--accent); }
:root[data-theme="dark"] .sev-critical { background: rgba(248,113,113,0.16); border-color: rgba(248,113,113,0.36); color: #fca5a5; }
:root[data-theme="dark"] .sev-high     { background: rgba(251,146,60,0.16);  border-color: rgba(251,146,60,0.36);  color: #fdba74; }
:root[data-theme="dark"] .sev-medium   { background: rgba(251,191,36,0.14);  border-color: rgba(251,191,36,0.36);  color: #fcd34d; }
:root[data-theme="dark"] .sev-low      { background: rgba(34,166,199,0.15);  border-color: rgba(34,166,199,0.38);  color: #7dd3fc; }

@media (max-width: 980px) {
  .h1k-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .h1k-body  { grid-template-columns: 1fr; }
  .h1k-col + .h1k-col { border-left: 0; border-top: 1px solid var(--line); }
  .h1k-bar-row { grid-template-columns: 120px 1fr 28px; }
}

/* ══════════════════════════════════════════════════════════
   Secret Discovery section
   ══════════════════════════════════════════════════════════ */

#secrets { scroll-margin-top: 14px; margin-top: 10px; }

.sd-section { border-color: #fed7aa; }

.sd-header {
  flex-wrap: wrap;
  gap: 10px;
  border-bottom-color: #fed7aa;
  background: #fff7ed;
}

.sd-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sd-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.sd-stat {
  padding: 9px 12px;
  background: var(--panel);
}

.sd-stat span {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sd-stat p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sd-stat.critical span { color: #991b1b; }
.sd-stat.high span     { color: #9a3412; }
.sd-stat.medium span   { color: #92400e; }

/* Impact class badges */
.impact-confirmed  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.impact-likely     { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.impact-possible   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.impact-public     { background: #dcfce7; color: #166534; border-color: #86efac; }
.impact-analytics  { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }
.impact-ignored    { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }

/* Context expandible */
.sd-context {
  display: none;
  margin-top: 5px;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--panel-soft);
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 700px;
}

.sd-context.open { display: block; }

.sd-actions { display: flex; gap: 5px; flex-wrap: wrap; }

.sd-btn {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  cursor: pointer;
}

.sd-btn:hover { background: var(--panel-soft); color: var(--text); }
.sd-btn.danger { color: var(--danger); border-color: #fecaca; }
.sd-btn.danger:hover { background: #fff1f0; }

/* JS scan progress bar */
.sd-js-progress {
  padding: .6rem 1rem .4rem;
  border-bottom: 1px solid var(--border);
}
.js-scan-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  margin-bottom: .3rem;
  color: var(--muted);
}
.js-scan-label  { font-weight: 600; color: var(--text); }
.js-scan-counts { font-family: var(--mono, monospace); font-size: .78rem; }
.js-scan-pct    { font-weight: 700; color: var(--text); min-width: 3rem; text-align: right; }
.js-scan-status { font-size: .72rem; }
.js-scan-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.js-scan-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}
.js-scan-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.js-scan-dot.running {
  background: var(--green);
  box-shadow: 0 0 0 0 var(--green);
  animation: js-pulse 1.4s infinite;
}
.js-scan-dot.idle { background: var(--muted); }
@keyframes js-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
  70%  { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* Dark mode */
:root[data-theme="dark"] .sd-section { border-color: rgba(251,146,60,0.36); }
:root[data-theme="dark"] .sd-header  { background: rgba(251,146,60,0.1); border-bottom-color: rgba(251,146,60,0.36); }
:root[data-theme="dark"] .sd-stat    { background: var(--panel); }
:root[data-theme="dark"] .impact-confirmed { background: rgba(248,113,113,0.16); border-color: rgba(248,113,113,0.36); color: #fca5a5; }
:root[data-theme="dark"] .impact-likely    { background: rgba(251,146,60,0.16);  border-color: rgba(251,146,60,0.36);  color: #fdba74; }
:root[data-theme="dark"] .impact-possible  { background: rgba(251,191,36,0.14);  border-color: rgba(251,191,36,0.36);  color: #fcd34d; }
:root[data-theme="dark"] .impact-public    { background: rgba(52,211,153,0.14);  border-color: rgba(52,211,153,0.36);  color: #6ee7b7; }
:root[data-theme="dark"] .impact-analytics,:root[data-theme="dark"] .impact-ignored { background: rgba(148,163,184,0.12); border-color: var(--line); color: #94a3b8; }

@media (max-width: 980px) {
  .sd-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ══════════════════════════════════════════════════════════
   OOB DNS Callbacks
   ══════════════════════════════════════════════════════════ */

#oob { scroll-margin-top: 14px; margin-top: 10px; }

.oob-section { border-color: #a5b4fc; }

.oob-header {
  flex-wrap: wrap;
  gap: 10px;
  border-bottom-color: #a5b4fc;
  background: #eef2ff;
}

.oob-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.oob-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
  animation: oob-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

.oob-live-dot.paused {
  background: #94a3b8;
  box-shadow: none;
  animation: none;
}

@keyframes oob-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,.25); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,.08); }
}

.oob-toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.oob-toggle-label input { width: 16px; min-height: 16px; }

/* Stats */
.oob-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.oob-stat {
  padding: 9px 12px;
  background: var(--panel);
}

.oob-stat span {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.oob-stat p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

/* Token bar */
.oob-token-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.oob-token-label {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.oob-token-field {
  font-family: ui-monospace, monospace;
  font-size: 0.84rem;
  min-width: 200px;
  flex: 2;
}

/* Blacklist panel */
.oob-blacklist-panel {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.oob-blacklist-panel > summary {
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.oob-blacklist-panel > summary::before {
  content: '▶ ';
  font-size: 0.7rem;
}

.oob-blacklist-panel[open] > summary::before { content: '▼ '; }

.oob-blacklist-body { padding: 10px 12px; }

.oob-bl-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.oob-bl-form input { flex: 1; min-width: 180px; }

.oob-bl-list { display: flex; flex-wrap: wrap; gap: 6px; }

.oob-bl-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  background: var(--panel-soft);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.oob-bl-tag button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* Table */
.oob-table-wrap { max-height: 480px; border-bottom: 1px solid var(--line); }

.oob-row-new td { background: rgba(99,102,241,.07); }
.oob-row-new:hover td { background: rgba(99,102,241,.12); }

.oob-token-cell {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4f46e5;
}

.oob-copy-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0 4px;
}
.oob-copy-btn:hover { color: var(--accent-dark); }

/* DNS type badges */
.dns-A     { background:#dbeafe; color:#1e40af; }
.dns-AAAA  { background:#ede9fe; color:#5b21b6; }
.dns-NS    { background:#fef3c7; color:#92400e; }
.dns-TXT   { background:#dcfce7; color:#166534; }
.dns-CNAME { background:#ffedd5; color:#9a3412; }
.dns-MX    { background:#fce7f3; color:#9d174d; }
.dns-HTTPS { background:#cffafe; color:#155e75; }
.dns-OTHER { background:#f1f5f9; color:#64748b; }

/* Dark mode */
:root[data-theme="dark"] .oob-section   { border-color: rgba(99,102,241,.4); }
:root[data-theme="dark"] .oob-header    { background: rgba(99,102,241,.1); border-bottom-color: rgba(99,102,241,.4); }
:root[data-theme="dark"] .oob-stat      { background: var(--panel); }
:root[data-theme="dark"] .oob-token-cell { color: #818cf8; }
:root[data-theme="dark"] .oob-row-new td { background: rgba(99,102,241,.1); }
:root[data-theme="dark"] .dns-A     { background:rgba(59,130,246,.16);  color:#93c5fd; }
:root[data-theme="dark"] .dns-AAAA  { background:rgba(139,92,246,.16);  color:#c4b5fd; }
:root[data-theme="dark"] .dns-NS    { background:rgba(245,158,11,.14);   color:#fcd34d; }
:root[data-theme="dark"] .dns-TXT   { background:rgba(34,197,94,.14);   color:#6ee7b7; }
:root[data-theme="dark"] .dns-CNAME { background:rgba(249,115,22,.14);  color:#fdba74; }
:root[data-theme="dark"] .dns-MX    { background:rgba(244,114,182,.14); color:#f9a8d4; }
:root[data-theme="dark"] .dns-HTTPS { background:rgba(34,211,238,.14);  color:#67e8f9; }
:root[data-theme="dark"] .dns-OTHER { background:rgba(148,163,184,.12); color:#94a3b8; }

@media (max-width: 980px) {
  .oob-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

/* ══════════════════════════════════════════════════════════
   APK Analysis
   ══════════════════════════════════════════════════════════ */

#apk { scroll-margin-top: 14px; margin-top: 10px; }

.apk-section { border-color: #6ee7b7; }

.apk-header {
  border-bottom-color: #6ee7b7;
  background: rgba(16,185,129,.07);
}

.apk-title-row { display: flex; align-items: center; gap: 12px; }

.apk-mode-label {
  display: flex; align-items: center; gap: 5px;
  font-size: .83rem; font-weight: 700; color: var(--muted); cursor: pointer;
}

/* Drop zone */
.apk-upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: 8px;
  margin: 12px;
  background: var(--panel-soft);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}

.apk-upload-zone.drag-over {
  border-color: #10b981;
  background: rgba(16,185,129,.08);
}

.apk-upload-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 32px 20px; text-align: center;
}

.apk-upload-icon { font-size: 2.4rem; line-height: 1; }

.apk-upload-title {
  margin: 0; font-size: .95rem; font-weight: 700; color: var(--text);
}

.apk-upload-sub {
  margin: 0; font-size: .8rem; color: var(--muted);
}

/* Progress */
.apk-progress-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.apk-progress-phases {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}

.apk-phase {
  font-size: .78rem; font-weight: 800; color: var(--muted);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-soft);
}

.apk-phase.active {
  border-color: #10b981; color: #065f46; background: rgba(16,185,129,.12);
}

.apk-progress-track {
  height: 8px; border-radius: 999px;
  background: var(--line); overflow: hidden; margin-bottom: 6px;
}

.apk-progress-fill {
  height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width .4s ease;
}

.apk-progress-info {
  display: flex; justify-content: space-between;
  font-size: .78rem; font-weight: 800; color: var(--muted);
  margin-bottom: 6px;
}

.apk-log {
  max-height: 160px; overflow-y: auto;
  font-family: ui-monospace, monospace; font-size: .73rem;
  line-height: 1.5; color: var(--muted);
  background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: 8px; margin: 0;
}

/* Details / collapsible sections */
.apk-details {
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.apk-details-head {
  padding: 10px 14px;
  font-size: .9rem; font-weight: 800;
  cursor: pointer; list-style: none; user-select: none;
  display: flex; align-items: center; gap: 8px;
}

.apk-details-head::before { content: '▶ '; font-size: .7rem; color: var(--muted); }
details[open] > .apk-details-head::before { content: '▼ '; }

.apk-details-body { padding: 0 14px 14px; }

/* ── Checklist de APKs en scope ──────────────────────────────── */
.apk-checklist { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; background: var(--panel); }
.apk-checklist-head { padding: 11px 14px; cursor: pointer; list-style: none; user-select: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; font-size: .92rem; }
.apk-checklist-head::-webkit-details-marker { display: none; }
.apk-checklist-head::before { content: '▶'; font-size: .7rem; color: var(--muted); margin-right: 4px; }
details[open] > .apk-checklist-head::before { content: '▼'; }
.apk-checklist-summary { font-weight: 600; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.apk-checklist-body { padding: 4px 14px 14px; }
.apk-checklist-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.apk-checklist-tools input[type="search"] { flex: 1; min-width: 220px; border: 1px solid var(--border);
  border-radius: 6px; padding: .4rem .6rem; font-size: .82rem; background: var(--bg); color: var(--fg); }
.apk-checklist-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.apk-checklist-hint { font-size: .74rem; color: var(--muted); margin: 0 0 10px; line-height: 1.5; }
.apk-checklist-hint code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.apk-checklist-groups { display: flex; flex-direction: column; gap: 8px; }
.apk-checklist-empty { color: var(--muted); font-size: .85rem; padding: 1rem 0; text-align: center; }

.apk-chk-group { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.apk-chk-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; cursor: pointer; list-style: none; user-select: none; background: var(--bg); font-size: .84rem; }
.apk-chk-group-head::-webkit-details-marker { display: none; }
.apk-chk-group-head::before { content: '▸'; color: var(--muted); margin-right: 6px; }
details[open] > .apk-chk-group-head::before { content: '▾'; }
.apk-chk-group-name { font-weight: 700; }
.apk-chk-group-shown { font-weight: 600; color: var(--muted); font-size: .76rem; }
.apk-chk-group-count { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.apk-chk-pager { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line, var(--border)); }
.apk-chk-pager-info { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.apk-chk-pager .button[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.apk-chk-list { list-style: none; margin: 0; padding: 0; }
.apk-chk-item { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 12px; border-top: 1px solid var(--line); }
.apk-chk-item.is-server { background: color-mix(in srgb, #22c55e 7%, transparent); }
.apk-chk-label { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; cursor: pointer; }
.apk-chk-label input { flex-shrink: 0; width: 15px; height: 15px; cursor: pointer; }
.apk-chk-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apk-chk-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.apk-chk-kind { font-size: .68rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; }
.apk-chk-sev { font-size: .68rem; color: var(--muted); text-transform: lowercase; }
.apk-chk-joblink { border: 1px solid var(--border); background: var(--bg); color: var(--fg); cursor: pointer;
  border-radius: 5px; font-size: .72rem; padding: 1px 6px; }
.apk-chk-joblink:hover { border-color: var(--accent); }
.apk-chk-note { font-size: .72rem; }
.apk-chk-badge { font-size: .7rem; font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.apk-chk-ok   { background: #dcfce7; color: #15803d; }
.apk-chk-warn { background: #fef9c3; color: #854d0e; }
.apk-chk-err  { background: #ffedd5; color: #c2410c; }
.apk-chk-miss { background: #fee2e2; color: #b91c1c; }
:root[data-theme="dark"] .apk-chk-ok   { background: #052e16; color: #86efac; }
:root[data-theme="dark"] .apk-chk-warn { background: #422006; color: #fde68a; }
:root[data-theme="dark"] .apk-chk-err  { background: #431407; color: #fdba74; }
:root[data-theme="dark"] .apk-chk-miss { background: #450a0a; color: #fca5a5; }

/* Finding cards */
.apk-finding {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--panel-soft);
}

.apk-finding-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  flex-wrap: wrap;
}

.apk-finding-head:hover { background: rgba(0,0,0,.03); }

.apk-finding.critical { border-color: #fecaca; }
.apk-finding.high     { border-color: #fed7aa; }
.apk-finding.medium   { border-color: #fde68a; }
.apk-finding.low      { border-color: #bae6fd; }

.apk-finding-title {
  flex: 1; font-size: .88rem; font-weight: 700; min-width: 200px;
}

.apk-finding-component {
  font-family: ui-monospace, monospace; font-size: .74rem;
  color: var(--muted); max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.apk-finding-body {
  padding: 10px 12px; border-top: 1px solid var(--line);
  display: none; font-size: .85rem; line-height: 1.6;
}

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

.apk-finding-body p { margin: 0 0 6px; }
.apk-finding-body strong { color: var(--text); }

.apk-finding-body .apk-poc {
  background: #0f172a; color: #e2e8f0;
  border-radius: 6px; padding: 10px 12px; margin: 8px 0;
  font-family: ui-monospace, monospace; font-size: .78rem;
  line-height: 1.5; overflow-x: auto; white-space: pre;
}

.apk-finding-body .apk-code-snippet {
  background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: 8px 10px; margin: 6px 0;
  font-family: ui-monospace, monospace; font-size: .75rem;
  line-height: 1.45; overflow-x: auto; white-space: pre;
  color: var(--text); max-height: 220px; overflow-y: auto;
}

/* Summary cards */
.apk-summary-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px; margin-bottom: 10px;
}

.apk-summary-card {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; background: var(--panel);
}

.apk-summary-card span {
  display: block; font-size: 1.4rem; font-weight: 800; line-height: 1.1;
}

.apk-summary-card p { margin: 3px 0 0; color: var(--muted); font-size: .73rem; font-weight: 800; text-transform: uppercase; }

/* Global stats cards */
.apk-global-stats { margin-bottom: 12px; }
.apk-stats-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 8px; margin-bottom: 8px;
}
.apk-stat-card {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; background: var(--panel);
}
.apk-stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.apk-stat-label { margin-top: 2px; color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; }
.apk-stat-sub { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.apk-top-findings { padding: 6px 0; }
.apk-top-finding { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
@media (max-width: 900px) { .apk-stats-grid { grid-template-columns: repeat(3, 1fr); } }

/* Findings table (expandable rows) */
.apk-find-row { cursor: pointer; }
.apk-find-row:hover { background: var(--hover); }
.apk-find-detail { display: none; }
.apk-find-detail.open { display: table-row; }
.apk-find-detail-inner { padding: 8px 12px; font-size: .85rem; line-height: 1.6; background: var(--bg); border-left: 3px solid var(--accent); }
.apk-find-detail-inner pre { margin: 4px 0 8px; padding: 8px; font-size: .78rem; overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.apk-find-detail-inner p { margin: 4px 0; }

/* IPC component risk badges */
.risk-none     { color: var(--success); }
.risk-low      { color: var(--accent); }
.risk-medium   { color: var(--warning); }
.risk-high     { color: #9a3412; }
.risk-critical { color: var(--danger); }

/* Dark mode */
:root[data-theme="dark"] .apk-section   { border-color: rgba(52,211,153,.36); }
:root[data-theme="dark"] .apk-header    { background: rgba(52,211,153,.07); border-bottom-color: rgba(52,211,153,.36); }
:root[data-theme="dark"] .apk-upload-zone { border-color: var(--line-strong); }
:root[data-theme="dark"] .apk-upload-zone.drag-over { border-color: #34d399; background: rgba(52,211,153,.1); }
:root[data-theme="dark"] .apk-poc       { background: #020617; color: #94a3b8; }
:root[data-theme="dark"] .apk-finding.critical { border-color: rgba(248,113,113,.4); }
:root[data-theme="dark"] .apk-finding.high     { border-color: rgba(251,146,60,.4); }

@media (max-width:980px) {
  .apk-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ── System Monitor ──────────────────────────────────────────── */
.sysmon-section { border-left: 3px solid var(--line); }

.sysmon-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sysmon-refresh-label {
  font-size: .78rem;
  color: var(--muted);
}

.sysmon-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--surface-alt, var(--bg));
  border-bottom: 1px solid var(--line);
}
.sysmon-stat {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}
.sysmon-stat-label {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sysmon-stat-value { font-size: .9rem; font-weight: 600; margin-top: 2px; }
.sysmon-warn       { color: var(--warning, #d97706); }

.sysmon-status-ok      { color: var(--success, #16a34a); }
.sysmon-status-alerta  { color: var(--warning, #d97706); }
.sysmon-status-critico { color: var(--danger,  #dc2626); }

/* Alert rows */
#sysmonAlerts { display: flex; flex-direction: column; }

.sysmon-alert-row {
  display: grid;
  grid-template-columns: 68px 24px 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.sysmon-alert-row:last-child { border-bottom: none; }

.sysmon-alert-sev {
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
  letter-spacing: .04em;
}
.sev-critico .sysmon-alert-sev { background: #fee2e2; color: #991b1b; }
.sev-alto    .sysmon-alert-sev { background: #ffedd5; color: #9a3412; }
.sev-medio   .sysmon-alert-sev { background: #fef9c3; color: #854d0e; }
.sev-bajo    .sysmon-alert-sev { background: #dcfce7; color: #166534; }
.sev-info    .sysmon-alert-sev { background: var(--line); color: var(--muted); }

.sev-critico { background: rgba(220,38,38,.04); }
.sev-alto    { background: rgba(234,88,12,.03); }

.sysmon-alert-icon { font-size: 1rem; text-align: center; }
.sysmon-alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sysmon-alert-title  { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sysmon-alert-detail { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sysmon-alert-ts     { font-size: .76rem; color: var(--muted); white-space: nowrap; }

.sysmon-ok { color: var(--success, #16a34a); font-weight: 600; }

/* Dark mode */
:root[data-theme="dark"] .sev-critico .sysmon-alert-sev { background: rgba(248,113,113,.2); color: #fca5a5; }
:root[data-theme="dark"] .sev-alto    .sysmon-alert-sev { background: rgba(251,146,60,.2);  color: #fdba74; }
:root[data-theme="dark"] .sev-medio   .sysmon-alert-sev { background: rgba(250,204,21,.15); color: #fde047; }
:root[data-theme="dark"] .sev-critico { background: rgba(220,38,38,.07); }
:root[data-theme="dark"] .sev-alto    { background: rgba(234,88,12,.05); }

@media (max-width: 640px) {
  .sysmon-alert-row { grid-template-columns: 60px 20px 1fr; }
  .sysmon-alert-ts  { display: none; }
}

/* Section stats bars */
.section-stats-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-height: 32px;
  padding: 5px 12px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--line);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}
.stat-chip-label { color: var(--muted); font-weight: 600; }
.stat-chip-count { font-weight: 800; color: var(--text); }
.stat-chip.risk-critico { background: #fee2e2; border-color: #fca5a5; }
.stat-chip.risk-critico .stat-chip-count { color: #991b1b; }
.stat-chip.risk-alto    { background: #ffedd5; border-color: #fdba74; }
.stat-chip.risk-alto    .stat-chip-count { color: #9a3412; }
.stat-chip.risk-medio   { background: #fef9c3; border-color: #fde047; }
.stat-chip.risk-medio   .stat-chip-count { color: #854d0e; }
.stat-chip.risk-bajo    { background: #dcfce7; border-color: #86efac; }
.stat-chip.risk-bajo    .stat-chip-count { color: #166534; }
.stat-chip.stat-chip-alto      { background: #ffedd5; border-color: #fdba74; }
.stat-chip.stat-chip-alto      .stat-chip-count { color: #9a3412; }
.stat-chip.stat-chip-medio     { background: #fef9c3; border-color: #fde047; }
.stat-chip.stat-chip-medio     .stat-chip-count { color: #854d0e; }
.stat-chip.stat-chip-bajo      { background: #dcfce7; border-color: #86efac; }
.stat-chip.stat-chip-bajo      .stat-chip-count { color: #166534; }
.stat-chip.stat-chip-confirmed { background: #dcfce7; border-color: #86efac; }
.stat-chip.stat-chip-confirmed .stat-chip-count { color: #166534; font-weight: 900; }
.stat-chip.stat-chip-fp        { opacity: .55; }
.stat-chip.stat-chip-alive     { background: #dcfce7; border-color: #86efac; }
.stat-chip.stat-chip-alive     .stat-chip-count { color: #166534; }
.stat-chip.stat-chip-dead      { background: var(--line); }
.stat-chip.stat-chip-dead      .stat-chip-count { color: var(--muted); }
.stat-sep {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
  margin: 0 3px;
  flex-shrink: 0;
}
.stat-empty { color: var(--muted); font-size: .78rem; }
.stat-chip-clickable {
  cursor: pointer;
  transition: opacity .12s, box-shadow .12s;
}
.stat-chip-clickable:hover {
  opacity: .8;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.stat-chip-active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.stat-chip-active .stat-chip-label,
.stat-chip-active .stat-chip-count { color: var(--accent-dark); }
:root[data-theme="dark"] .stat-chip-active .stat-chip-label,
:root[data-theme="dark"] .stat-chip-active .stat-chip-count { color: var(--accent); }
:root[data-theme="dark"] .stat-chip.risk-critico { background: rgba(153,27,27,.25); border-color: rgba(252,165,165,.3); }
:root[data-theme="dark"] .stat-chip.risk-critico .stat-chip-count { color: #fca5a5; }
:root[data-theme="dark"] .stat-chip.risk-alto    { background: rgba(154,52,18,.25); border-color: rgba(253,186,116,.3); }
:root[data-theme="dark"] .stat-chip.risk-alto    .stat-chip-count { color: #fdba74; }
:root[data-theme="dark"] .stat-chip.risk-medio   { background: rgba(133,77,14,.2);  border-color: rgba(253,224,71,.25); }
:root[data-theme="dark"] .stat-chip.risk-medio   .stat-chip-count { color: #fde047; }
:root[data-theme="dark"] .stat-chip.risk-bajo    { background: rgba(22,101,52,.2);  border-color: rgba(134,239,172,.25); }
:root[data-theme="dark"] .stat-chip.risk-bajo    .stat-chip-count { color: #86efac; }

/* Takeover PoC */
.poc-toggle-wrap { margin-top: 4px; }
.poc-toggle-btn {
  font-size: .72rem;
  padding: 2px 7px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  line-height: 1.4;
}
.poc-toggle-btn:hover { background: var(--accent); color: #fff; }
.poc-steps {
  margin: 6px 0 0 0;
  padding: .6rem .8rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: .74rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 520px;
  max-height: 320px;
  overflow-y: auto;
  color: var(--text);
}

/* Bitácora */
.bitacora-add-form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 1rem;
}
.bitacora-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-start;
}
.bitacora-title-input { flex: 2 1 200px; min-width: 150px; }
.bitacora-form-row input[type=url] { flex: 2 1 180px; min-width: 140px; }
.bitacora-form-row select { flex: 0 1 130px; }
.bitacora-form-row input[type=text] { flex: 1 1 140px; min-width: 120px; }
.bitacora-form-row textarea { flex: 3 1 260px; min-width: 180px; resize: vertical; }
.bitacora-file-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  cursor: pointer;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.bitacora-file-label:hover { border-color: var(--accent); color: var(--accent); }
.bitacora-title-cell { max-width: 260px; word-break: break-word; }
.bitacora-title-cell a { color: var(--accent); text-decoration: none; }
.bitacora-title-cell a:hover { text-decoration: underline; }
.bitacora-tags-cell { max-width: 180px; }
.bitacora-notes-cell { max-width: 260px; font-size: .82rem; color: var(--muted); }
.bitacora-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.download-link { font-size: .8rem; color: var(--accent); text-decoration: none; white-space: nowrap; }
.download-link:hover { text-decoration: underline; }
.tag-pill {
  display: inline-block;
  background: var(--line);
  color: var(--muted);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .74rem;
  margin: 1px;
}
.bitacora-cat {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line);
  color: var(--muted);
}
.bitacora-cat-tecnica    { background: #dbeafe; color: #1e40af; }
.bitacora-cat-writeup    { background: #dcfce7; color: #166534; }
.bitacora-cat-cve        { background: #fee2e2; color: #991b1b; }
.bitacora-cat-herramienta{ background: #fef9c3; color: #854d0e; }
.bitacora-cat-payload    { background: #fae8ff; color: #7e22ce; }
.bitacora-cat-referencia { background: #e0f2fe; color: #075985; }
.bitacora-cat-documento  { background: #f1f5f9; color: #475569; }
.bitacora-cat-recon      { background: #ccfbf1; color: #115e59; }
.bitacora-cat-metodologia{ background: #ffedd5; color: #9a3412; }
:root[data-theme="dark"] .bitacora-cat-tecnica    { background: rgba(30,64,175,.3); color: #93c5fd; }
:root[data-theme="dark"] .bitacora-cat-writeup    { background: rgba(22,101,52,.3); color: #86efac; }
:root[data-theme="dark"] .bitacora-cat-cve        { background: rgba(153,27,27,.3); color: #fca5a5; }
:root[data-theme="dark"] .bitacora-cat-herramienta{ background: rgba(133,77,14,.3); color: #fde68a; }
:root[data-theme="dark"] .bitacora-cat-payload    { background: rgba(126,34,206,.3); color: #d8b4fe; }
:root[data-theme="dark"] .bitacora-cat-referencia { background: rgba(7,89,133,.3);  color: #7dd3fc; }
:root[data-theme="dark"] .bitacora-cat-recon      { background: rgba(17,94,89,.3);  color: #5eead4; }
:root[data-theme="dark"] .bitacora-cat-metodologia{ background: rgba(154,52,18,.3); color: #fdba74; }

.intel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 14px;
}
.intel-grid h3,
.template-card h3,
.sd-dashboard h3 {
  margin: 0 0 8px;
  font-size: .92rem;
}
.score-pill {
  display: inline-flex;
  min-width: 38px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pattern-code {
  display: block;
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.template-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.template-card-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.template-card-header h3 { margin: 0; flex: 1; font-size: .95rem; }
.template-impact { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.45; }
.template-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.template-block { font-size: .8rem; }
.template-block strong { display: inline-block; margin-bottom: 3px; }
.template-kill { color: #9a3412; background: #fff7ed; border-radius: 4px; padding: 4px 8px; }
.template-donts ul { margin: 4px 0 0 16px; padding: 0; }
.template-donts li { margin-bottom: 2px; }
.template-steps { font-size: .82rem; }
.template-steps summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.template-steps ol { margin: 0 0 0 16px; padding: 0; }
.template-steps li { margin-bottom: 4px; line-height: 1.4; }
.template-actions { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.template-next { font-size: .8rem; color: var(--muted); flex: 1; font-style: italic; }
.template-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}
.sd-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.sd-dashboard-col {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.health-summary {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}
.health-ok      { border-color: rgba(22, 163, 74, .22); color: var(--success, #16a34a); }
.health-alerta  { border-color: rgba(217, 119, 6, .32); color: var(--warning, #d97706); }
.health-critico { border-color: rgba(220, 38, 38, .38); color: var(--danger, #dc2626); }
.health-bad { border-color: rgba(220, 38, 38, .28); }
.health-list {
  display: grid;
  gap: 8px;
}
.health-row {
  display: grid;
  grid-template-columns: 58px minmax(160px, 1fr) minmax(220px, 1.3fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.health-row span {
  font-weight: 800;
  color: var(--accent);
}
.health-bad span {
  color: var(--danger);
}
.health-row small {
  color: var(--muted);
}
.report-draft {
  width: min(900px, 82vw);
  max-height: 64vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg, #0f172a);
  color: var(--code-fg, #e2e8f0);
  font-size: .82rem;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .intel-grid,
  .health-row {
    grid-template-columns: 1fr;
  }
}
.danger-ghost { color: var(--danger) !important; }
.danger-ghost:hover { background: rgba(180,35,24,.08); }
.date-cell { white-space: nowrap; font-size: .82rem; color: var(--muted); }
.notes-snippet { display: block; }

/* Settings dialog */
#settingsDialog {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 1.5rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
#settingsDialog::backdrop {
  background: rgba(0, 0, 0, .45);
}
.settings-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.settings-dialog-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.settings-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
  margin-bottom: 1.25rem;
}
.settings-check-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .875rem;
  cursor: pointer;
  user-select: none;
}
.settings-check-item input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.settings-footer {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

/* ── Export buttons ──────────────────────────────────────────── */
.export-btn {
  font-size: .78rem;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ── Splash / loading overlay ────────────────────────────────── */
/* ── Table row spinner ───────────────────────────────────── */
.table-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-cell { color: var(--muted) !important; }

/* ── Top loading bar ─────────────────────────────────────── */
#topLoader {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 10000;
  background: linear-gradient(90deg, var(--accent), #60a5fa, var(--accent));
  background-size: 200% 100%;
  transition: width 0.25s ease, opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}
#topLoader.loading {
  opacity: 1;
  width: 85%;
  animation: topLoaderSlide 1.4s ease infinite;
}
#topLoader.done {
  width: 100%;
  opacity: 0;
  transition: width 0.15s ease, opacity 0.4s ease 0.1s;
}
@keyframes topLoaderSlide {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .45s ease, visibility .45s ease;
}

#splash.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-card {
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 2rem 2.4rem 1.6rem;
  width: min(420px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  text-align: center;
}

.splash-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 .2rem;
}

.splash-sub {
  font-size: .8rem;
  color: var(--muted);
  margin: 0 0 1.2rem;
  min-height: 1.1rem;
  transition: opacity .2s;
}

.splash-bar-wrap {
  height: 6px;
  background: var(--border, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: .6rem;
}

.splash-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent, #1da462);
  border-radius: 3px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}

.splash-pct {
  font-size: .75rem;
  color: var(--muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .splash-card {
  background: var(--panel, #1e2026);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

:root[data-theme="dark"] #splash {
  background: rgba(0, 0, 0, .35);
}

/* ── JS Monitor ──────────────────────────────────────────────── */
.jsmon-section  { border-color: #bfdbfe; }
.jsmon-header   {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border-bottom: 1px solid #bfdbfe;
}
.jsmon-title-row {
  display: flex; align-items: center; gap: .75rem;
}

/* Stats bar */
.jsmon-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.jsmon-stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 80px; padding: .5rem .8rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; text-align: center;
}
.jsmon-stat span { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.jsmon-stat p    { font-size: .7rem; color: var(--muted); margin: .2rem 0 0; }
.jsmon-stat.ok        span { color: #15803d; }
.jsmon-stat.warn      span { color: #b45309; }
.jsmon-stat.err       span { color: #b91c1c; }
.jsmon-stat.findings  span { color: #7c3aed; }
.jsmon-stat.muted     span { color: var(--text); font-size: 1rem; }

/* Progress bar */
.jsmon-progress-wrap {
  padding: .5rem 1rem .4rem;
  border-bottom: 1px solid var(--border);
}
.jsmon-prog-inner {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; color: var(--muted); margin-bottom: .25rem;
}
.jsmon-prog-label  { font-weight: 600; color: var(--text); }
.jsmon-prog-counts { font-family: var(--mono, monospace); font-size: .76rem; }
.jsmon-prog-pct    { font-weight: 700; color: var(--text); margin-left: auto; }
.jsmon-prog-bar-wrap {
  height: 5px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.jsmon-prog-bar-fill {
  height: 100%; background: #3b82f6; border-radius: 3px;
  transition: width .5s ease;
}

/* Top programs strip */
.jsmon-top-programs {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .4rem 0 .1rem; font-size: .72rem;
}
.jsmon-prog-program {
  display: flex; gap: .3rem; align-items: center;
  background: var(--panel-soft, #f8f9fa);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px;
}
.jsmon-prog-program em { color: var(--accent); font-style: normal; }

/* Table cells */
#jsmonitor .url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
#jsmonitor .num-cell { text-align: right; font-variant-numeric: tabular-nums; font-size: .8rem; white-space: nowrap; }

/* Badges */
.badge-green  { background: #dcfce7; color: #15803d; padding: 1px 6px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; padding: 1px 6px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-orange { background: #ffedd5; color: #c2410c; padding: 1px 6px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-red    { background: #fee2e2; color: #b91c1c; padding: 1px 6px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge-muted  { background: var(--border); color: var(--muted); padding: 1px 6px; border-radius: 4px; font-size: .75rem; }

:root[data-theme="dark"] .jsmon-section { border-color: rgba(59,130,246,.35); }
:root[data-theme="dark"] .jsmon-header  { background: rgba(59,130,246,.08); border-bottom-color: rgba(59,130,246,.35); }
:root[data-theme="dark"] .jsmon-stat    { background: var(--panel); }

/* JS Findings table */
.jsf-table td { vertical-align: top; padding: 6px 8px; }
.jsf-host-cell { display: flex; flex-direction: column; gap: 2px; }
.jsf-host-cell strong { font-size: .82rem; }
.jsf-url { font-size: .72rem; color: var(--muted); word-break: break-all; text-decoration: none; max-width: 350px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jsf-url:hover { color: var(--accent); text-decoration: underline; white-space: normal; }
.jsf-finding-cell { max-width: 450px; }
.jsf-title { font-weight: 600; font-size: .82rem; margin-bottom: 2px; }
.jsf-detail { font-size: .75rem; color: var(--muted); display: block; margin-bottom: 3px; word-break: break-all; }
.jsf-snippet { font-size: .72rem; font-family: 'SF Mono', 'Fira Code', monospace; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; margin: 3px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 80px; overflow: auto; color: #c7254e; }
:root[data-theme="dark"] .jsf-snippet { background: rgba(0,0,0,.2); color: #f8d7da; }
.jsf-status-sel { font-size: .75rem; padding: 2px 4px; border-radius: 4px; border: 1px solid var(--border); background: var(--panel); }

/* ══════════════════════════════════════════════════════════
   Recon DB
   ══════════════════════════════════════════════════════════ */

.rdb-section { padding: 1.5rem; }

/* Tabs */
.rdb-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.rdb-tab  { display: flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 6px;
            border: 1px solid var(--border); background: var(--panel); cursor: pointer;
            font-size: .82rem; font-weight: 500; color: var(--muted); transition: all .15s; }
.rdb-tab:hover  { border-color: var(--accent); color: var(--fg); }
.rdb-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.rdb-tab-icon   { font-size: .95rem; }
.rdb-tab-count  { background: rgba(255,255,255,.3); border-radius: 10px; padding: 0 6px; font-size: .72rem; }
.rdb-tab.active .rdb-tab-count { background: rgba(255,255,255,.25); }

/* Cards grid */
.rdb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 1rem; }
.rdb-empty { color: var(--muted); font-size: .9rem; padding: 2rem 0; text-align: center; grid-column: 1/-1; }

/* Card */
.rdb-card { border-radius: 8px; border: 1px solid var(--border); background: var(--panel); overflow: hidden;
            transition: box-shadow .15s; }
.rdb-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }

.rdb-card-dead_ends       { border-left: 3px solid #ef4444; }
.rdb-card-meta_behaviors  { border-left: 3px solid #f97316; }
.rdb-card-noise_findings  { border-left: 3px solid #6b7280; }
.rdb-card-promising_paths { border-left: 3px solid #22c55e; }

.rdb-card-head { display: flex; align-items: center; gap: .5rem; padding: .65rem .85rem;
                 background: var(--panel-soft, #f8f9fa); cursor: pointer; list-style: none;
                 user-select: none; }
/* Ocultar el triángulo nativo de <summary>: usamos nuestro propio chevron. */
.rdb-card-head::-webkit-details-marker { display: none; }
.rdb-card-head::marker { content: ""; }
.rdb-chevron { flex-shrink: 0; color: var(--muted); font-size: .75rem; transition: transform .15s; }
.rdb-card[open] > .rdb-card-head { border-bottom: 1px solid var(--border); }
.rdb-card[open] > .rdb-card-head .rdb-chevron { transform: rotate(90deg); }
.rdb-card-name { flex: 1; font-size: .84rem; font-weight: 600; line-height: 1.3;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rdb-card-actions { display: flex; align-items: center; gap: .4rem; margin-left: auto; flex-shrink: 0; }

.rdb-card-body { padding: .75rem .85rem; display: flex; flex-direction: column; gap: .55rem; }
.rdb-desc { font-size: .82rem; color: var(--fg); line-height: 1.5; margin: 0; }

/* Signals */
.rdb-signals { display: flex; flex-wrap: wrap; gap: .3rem; }
.rdb-signal  { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
               border-radius: 4px; padding: 2px 7px; font-size: .72rem; font-family: monospace; }

/* Actions list */
.rdb-actions-label { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rdb-action-list   { margin: .2rem 0 0 1rem; padding: 0; font-size: .8rem; line-height: 1.6; color: var(--fg); }

/* Revisit / bounty */
.rdb-revisit       { font-size: .78rem; color: var(--muted); }
.rdb-revisit-label { font-weight: 600; color: var(--fg); }

/* Examples */
.rdb-examples { display: flex; flex-wrap: wrap; gap: .3rem; }
.rdb-target   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0;
                border-radius: 4px; padding: 1px 6px; font-size: .72rem; }

/* Time cost badge */
.rdb-cost        { font-size: .7rem; padding: 2px 7px; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.rdb-cost-muy    { background: #fee2e2; color: #b91c1c; }
.rdb-cost-alto   { background: #ffedd5; color: #c2410c; }
.rdb-cost-medio  { background: #fef3c7; color: #92400e; }
.rdb-cost-bajo   { background: #dcfce7; color: #15803d; }

/* Modal */
.rdb-modal-box { max-width: 600px; width: 95%; }
.rdb-modal-box label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted);
                       text-transform: uppercase; letter-spacing: .04em; margin: .8rem 0 .25rem; }
.rdb-modal-box .field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .72rem; }
.rdb-modal-box select,
.rdb-modal-box input[type="text"],
.rdb-modal-box textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border);
                           border-radius: 5px; padding: .45rem .6rem; font-size: .84rem;
                           background: var(--bg); color: var(--fg); }
.rdb-modal-box textarea { resize: vertical; font-family: monospace; }

/* Tag colors */
.tag-red    { background: #fee2e2; color: #b91c1c; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-gray   { background: #f3f4f6; color: #374151; }
.tag-green  { background: #dcfce7; color: #15803d; }

/* Dark mode */
:root[data-theme="dark"] .rdb-signal  { background: #1e293b; color: #94a3b8; border-color: #334155; }
:root[data-theme="dark"] .rdb-target  { background: #052e16; color: #4ade80; border-color: #14532d; }
:root[data-theme="dark"] .rdb-card-head { background: var(--panel); }
:root[data-theme="dark"] .rdb-modal-box select,
:root[data-theme="dark"] .rdb-modal-box input,
:root[data-theme="dark"] .rdb-modal-box textarea { background: var(--panel); }

/* ── Reportes (sección + modal) ──────────────────────────────── */
.report-modal-box { max-width: 880px; width: 96%; }
.report-modal-box label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted);
                          text-transform: uppercase; letter-spacing: .04em; margin: .8rem 0 .25rem; }
.report-modal-box .field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: .72rem; }
.report-modal-box select,
.report-modal-box input[type="text"],
.report-modal-box textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border);
                             border-radius: 5px; padding: .45rem .6rem; font-size: .84rem;
                             background: var(--bg); color: var(--fg); }
.report-modal-box .modal-body { max-height: 72vh; overflow: auto; }
.report-content-textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
                           font-size: .8rem; line-height: 1.45; }
.report-modal-grid { display: grid; grid-template-columns: 2fr 1fr; gap: .2rem 1rem; }
.report-modal-grid > div:nth-child(n+3) { grid-column: span 1; }
:root[data-theme="dark"] .report-modal-box select,
:root[data-theme="dark"] .report-modal-box input,
:root[data-theme="dark"] .report-modal-box textarea { background: var(--panel); }

/* Agrupación de reportes por programa: desplegable colapsado por defecto */
details.report-prog-group { margin-bottom: .6rem; border: 1px solid var(--border); border-radius: 8px;
                            overflow: hidden; }
details.report-prog-group > summary { list-style: none; cursor: pointer; display: flex;
                            align-items: center; gap: .5rem; padding: .45rem .65rem;
                            border-left: 3px solid var(--accent);
                            background: color-mix(in srgb, var(--accent) 9%, transparent);
                            font-size: .9rem; user-select: none; }
details.report-prog-group > summary::-webkit-details-marker { display: none; }
details.report-prog-group > summary > .rdb-chevron { transition: transform .15s; font-size: .7rem; color: var(--muted); }
details.report-prog-group[open] > summary > .rdb-chevron { transform: rotate(90deg); }
details.report-prog-group > summary:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.report-prog-name  { font-weight: 700; color: var(--accent-dark); letter-spacing: .01em; }
.report-prog-count { margin-left: auto; min-width: 1.5rem; text-align: center; padding: .05rem .45rem;
                     border-radius: 999px; background: var(--accent); color: #fff;
                     font-size: .72rem; font-weight: 700; }
details.report-prog-group > .rdb-card { border-radius: 0; border-left: none; border-right: none;
                            border-top: 1px solid var(--border); margin: 0; }
details.report-prog-group > .rdb-card:last-child { border-bottom: none; }
/* Tabla sent-reports dentro de un desplegable */
details.report-prog-group .sent-reports-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
details.report-prog-group .sent-reports-table th { text-align: left; padding: .35rem .5rem;
                            background: var(--panel); border-bottom: 1px solid var(--border);
                            font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
                            color: var(--muted); font-weight: 600; }
details.report-prog-group .sent-reports-table td { padding: .35rem .5rem;
                            border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
details.report-prog-group .sent-reports-table tr:last-child td { border-bottom: none; }

/* Tarjeta de reporte (reutiliza .rdb-card como contenedor) */
.report-card-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
                    margin: 0 0 .6rem; font-size: .76rem; color: var(--muted); }
.report-card-meta .report-prog { font-weight: 600; color: var(--fg); }
.report-status-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem;
                      border-radius: 999px; font-size: .7rem; font-weight: 600; border: 1px solid var(--border); }
.report-status-pending        { background: #fef9c3; color: #854d0e; }
.report-status-draft          { background: #f3f4f6; color: #374151; }
.report-status-sent           { background: #dbeafe; color: #1e40af; }
.report-status-triaged        { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.report-status-resolved       { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.report-status-accepted       { background: #dcfce7; color: #15803d; }
.report-status-informative    { background: #f1f5f9; color: #475569; }
.report-status-not_applicable { background: #fef3c7; color: #92400e; }
.report-status-needs_more_info{ background: #fff7ed; color: #c2410c; }
.report-status-rejected       { background: #fee2e2; color: #b91c1c; }
.report-status-duplicate      { background: #ede9fe; color: #6d28d9; }
.sev-critical { background: #fee2e2; color: #991b1b; }
.sev-high     { background: #ffedd5; color: #c2410c; }
.sev-medium   { background: #fef9c3; color: #854d0e; }
.sev-low      { background: #e0f2fe; color: #075985; }
.sev-info     { background: #f3f4f6; color: #374151; }
.report-md { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
             font-size: .78rem; line-height: 1.5; background: var(--bg); border: 1px solid var(--border);
             border-radius: 6px; padding: .7rem .85rem; max-height: 460px; overflow: auto; margin: 0; }
.report-card-tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.report-card-tools select { border: 1px solid var(--border); border-radius: 5px; padding: .25rem .45rem;
                            font-size: .76rem; background: var(--bg); color: var(--fg); }
/* Botones scoped: la sección reusa clases btn-* (que el resto de la app deja
   como botón por defecto); aquí les damos aspecto de pill compacta sin tocar
   el resto del ASM. */
.report-card-tools button,
.report-modal-box .modal-footer button {
  cursor: pointer; border-radius: 5px; border: 1px solid var(--border);
  padding: .3rem .6rem; font-size: .76rem; background: var(--panel); color: var(--fg);
}
.report-card-tools button:hover,
.report-modal-box .modal-footer button:hover { border-color: var(--accent); }
.report-card-tools .btn-danger,
.report-modal-box .btn-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.report-modal-box .btn-primary { background: var(--accent); color: #fff; border-color: transparent; padding: .35rem .9rem; }
.reports-section .rdb-cards { grid-template-columns: 1fr; }
:root[data-theme="dark"] .report-card-tools button,
:root[data-theme="dark"] .report-modal-box .modal-footer button { background: var(--panel); }
:root[data-theme="dark"] .report-card-tools .btn-danger,
:root[data-theme="dark"] .report-modal-box .btn-danger { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
:root[data-theme="dark"] .report-md { background: var(--panel); }
:root[data-theme="dark"] .report-status-pending        { background: #422006; color: #fde68a; }
:root[data-theme="dark"] .report-status-draft          { background: #1f2937; color: #d1d5db; }
:root[data-theme="dark"] .report-status-sent           { background: #1e3a5f; color: #bfdbfe; }
:root[data-theme="dark"] .report-status-triaged        { background: #1e3a8a; color: #93c5fd; }
:root[data-theme="dark"] .report-status-resolved       { background: #052e16; color: #86efac; }
:root[data-theme="dark"] .report-status-accepted       { background: #052e16; color: #86efac; }
:root[data-theme="dark"] .report-status-informative    { background: #1e293b; color: #94a3b8; }
:root[data-theme="dark"] .report-status-not_applicable { background: #422006; color: #fbbf24; }
:root[data-theme="dark"] .report-status-needs_more_info{ background: #431407; color: #fb923c; }
:root[data-theme="dark"] .report-status-rejected       { background: #450a0a; color: #fca5a5; }
:root[data-theme="dark"] .report-status-duplicate      { background: #2e1065; color: #c4b5fd; }
:root[data-theme="dark"] .sev-critical { background: #450a0a; color: #fca5a5; }
:root[data-theme="dark"] .sev-high     { background: #431407; color: #fdba74; }
:root[data-theme="dark"] .sev-medium   { background: #422006; color: #fde68a; }
:root[data-theme="dark"] .sev-low      { background: #082f49; color: #7dd3fc; }
:root[data-theme="dark"] .sev-info     { background: #1f2937; color: #d1d5db; }

/* ── Sent reports table ─────────────────────────────────────── */
.sent-reports-tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sent-reports-tbl th { text-align: left; padding: .45rem .6rem; border-bottom: 2px solid var(--border);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.sent-reports-tbl td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sent-reports-tbl tr:hover td { background: var(--row-hover, rgba(0,0,0,.03)); }
.sent-report-title { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sent-report-title a { color: var(--accent); text-decoration: none; }
.sent-report-title a:hover { text-decoration: underline; }
.bounty-cell { font-weight: 700; color: #16a34a; }
:root[data-theme="dark"] .bounty-cell { color: #86efac; }
.sent-state-chip { display: inline-block; padding: .1rem .45rem; border-radius: 4px; font-size: .76rem; font-weight: 600; }
.st-new        { background: #dbeafe; color: #1e40af; }
.st-editing    { background: #e0e7ff; color: #3730a3; }
.st-triaged    { background: #cffafe; color: #155e75; }
.st-needs      { background: #ffedd5; color: #9a3412; }
.st-pending    { background: #fef3c7; color: #92400e; }
.st-retesting  { background: #e0e7ff; color: #3730a3; }
.st-resolved   { background: #dcfce7; color: #166534; }
.st-informative{ background: #f1f5f9; color: #475569; }
.st-na         { background: #fef3c7; color: #92400e; }
.st-duplicate  { background: #ede9fe; color: #5b21b6; }
.st-spam       { background: #fee2e2; color: #991b1b; }
:root[data-theme="dark"] .st-new        { background: #1e3a8a; color: #93c5fd; }
:root[data-theme="dark"] .st-editing    { background: #312e81; color: #c7d2fe; }
:root[data-theme="dark"] .st-triaged    { background: #164e63; color: #a5f3fc; }
:root[data-theme="dark"] .st-needs      { background: #431407; color: #fb923c; }
:root[data-theme="dark"] .st-pending    { background: #422006; color: #fde68a; }
:root[data-theme="dark"] .st-retesting  { background: #312e81; color: #c7d2fe; }
:root[data-theme="dark"] .st-resolved   { background: #052e16; color: #86efac; }
:root[data-theme="dark"] .st-informative{ background: #1e293b; color: #94a3b8; }
:root[data-theme="dark"] .st-na         { background: #422006; color: #fbbf24; }
:root[data-theme="dark"] .st-duplicate  { background: #2e1065; color: #c4b5fd; }
:root[data-theme="dark"] .st-spam       { background: #450a0a; color: #fca5a5; }
:root[data-theme="dark"] .sent-reports-tbl tr:hover td { background: rgba(255,255,255,.04); }

/* ── Lazy section states ─────────────────────────────────────── */
[data-lazy="pending"] { opacity: .97; }
[data-lazy="loading"] { opacity: .97; }

.lazy-pending {
  color: var(--muted) !important;
  font-style: italic;
  font-size: .78rem;
  letter-spacing: .02em;
}

/* Barra de progreso fina en la sección que está cargando */
[data-lazy="loading"]::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
  animation: lazy-sweep 1.2s ease-in-out infinite;
  border-radius: 1px;
  margin-bottom: .25rem;
}
@keyframes lazy-sweep {
  0%   { transform: scaleX(0); transform-origin: left; opacity: 1; }
  60%  { transform: scaleX(1); transform-origin: left; opacity: 1; }
  100% { transform: scaleX(1); transform-origin: left; opacity: 0; }
}

/* ── CORS PoC link ───────────────────────────────────────────── */
a.poc-link {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  text-decoration: none;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
  margin-left: .25rem;
  transition: background .12s;
}
a.poc-link:hover { background: #dbeafe; }
:root[data-theme="dark"] a.poc-link {
  background: #1e3a5f;
  color: #93c5fd;
  border-color: #1d4ed8;
}
:root[data-theme="dark"] a.poc-link:hover { background: #1e40af; }

/* ── SPA Navigation ─────────────────────────────────────────── */
#sideNav a { display: block; padding: .32rem .65rem; border-radius: 5px;
             text-decoration: none; color: var(--muted); font-size: .8rem;
             transition: background .12s, color .12s; }
#sideNav a:hover { background: var(--panel-soft,#f3f4f6); color: var(--fg); }
#sideNav a.nav-active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-sep { border: none; border-top: 1px solid var(--border); margin: .4rem .5rem; }
/* items inside groups are slightly indented */
.nav-group-body a { padding-left: 1rem; font-size: .78rem; }

/* ── Unified Alerts table ────────────────────────────────────── */
.host-code { font-size: .72rem; background: var(--panel-soft,#f3f4f6);
             padding: 1px 5px; border-radius: 3px; font-family: monospace; }
.mini-link { font-size: .75rem; margin-left: .2rem; color: var(--accent); }
.ua-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .56);
}
.ua-detail-dialog {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, var(--line));
  border-radius: 8px;
  background: var(--card-bg, #fff);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .28);
}
.ua-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, var(--line));
  background: var(--panel-soft, #f8fafc);
}
.ua-detail-head h3 {
  margin: 0;
  font-size: 1rem;
}
.ua-detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .78rem;
  overflow-wrap: anywhere;
}
.ua-detail-body {
  overflow: auto;
  padding: 14px 16px 16px;
}
.ua-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .78rem;
}
.ua-raw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ua-raw-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border, var(--line));
  border-radius: 6px;
  background: #0f172a;
}
.ua-raw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, .28);
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.ua-raw-panel pre {
  margin: 0;
  max-height: 58vh;
  overflow: auto;
  padding: 12px;
  color: #e5e7eb;
  font-size: .76rem;
  line-height: 1.45;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] #sideNav a:hover { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] #sideNav a.nav-active { background: var(--accent); }
:root[data-theme="dark"] .host-code { background: #1e293b; }
:root[data-theme="dark"] .ua-detail-dialog { background: var(--panel); border-color: rgba(255,255,255,.14); }
:root[data-theme="dark"] .ua-detail-head { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }
@media (max-width: 840px) {
  .ua-detail-overlay { align-items: stretch; padding: 10px; }
  .ua-detail-dialog { width: 100%; max-height: calc(100vh - 20px); }
  .ua-raw-grid { grid-template-columns: 1fr; }
  .ua-raw-panel pre { max-height: 42vh; }
}

/* Baseline para cualquier <pre> que no fije color/fondo propios (p.ej. .prompt-text
   o los <pre> crudos de callbacks). Especificidad 0,0,1: las clases con estilo
   propio (.fd-match-box pre, .ua-raw-panel pre, .poc-steps…) la sobrescriben. */
pre { color: var(--text); background: var(--panel-soft); }

/* ── Impact Graph — nuevas secciones ─────────────────────────────── */
.stat-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.stat-chips .stat-chip { padding: .3rem .7rem; background: var(--card-bg, #f8fafc); border: 1px solid var(--border, #e2e8f0); border-radius: 6px; font-size: .82rem; color: #1e293b; }
/* El fondo de estos chips es claro y fijo en ambos temas (#f8fafc), así que el
   texto debe ser oscuro siempre — sin esto en tema oscuro hereda --text (casi
   blanco) y queda ilegible. Las variantes risk-*/stat-chip-* tienen mayor
   especificidad y conservan sus propios colores. */
.stat-chips .stat-chip-label { color: #475569; }
.stat-chips .stat-chip-count { color: #0f172a; }

.section-hint { color: var(--muted); font-size: .85rem; margin: -.5rem 0 1rem; }

/* Card list (test-contexts) */
.card-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.card { border: 1px solid var(--border, #e2e8f0); border-radius: 8px; overflow: hidden; }
.card-header { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; background: var(--header-bg, #f1f5f9); flex-wrap: wrap; }
.card-header strong { font-size: .95rem; }
.card-actions { display: flex; gap: .3rem; margin-left: auto; }
.card-body { padding: .75rem 1rem; font-size: .85rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: .5rem; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* Form panel */
.form-panel { background: var(--card-bg, #f8fafc); border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.form-panel h3 { margin: 0 0 .75rem; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.form-grid label, .form-panel label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea,
.form-panel input, .form-panel select, .form-panel textarea { font-size: .88rem; padding: .3rem .5rem; border: 1px solid var(--border, #e2e8f0); border-radius: 4px; background: var(--input-bg, #fff); color: var(--text); }
.form-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* Table row highlight */
.row-highlight-info td { background: rgba(59,130,246,.05); }
:root[data-theme="dark"] .row-highlight-info td { background: rgba(59,130,246,.1); }

/* Dark mode adjustments for new components */
:root[data-theme="dark"] .card { border-color: rgba(255,255,255,.12); }
:root[data-theme="dark"] .card-header { background: rgba(255,255,255,.05); }
:root[data-theme="dark"] .form-panel { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.12); }
:root[data-theme="dark"] .form-grid input,
:root[data-theme="dark"] .form-grid select,
:root[data-theme="dark"] .form-grid textarea,
:root[data-theme="dark"] .form-panel input,
:root[data-theme="dark"] .form-panel select,
:root[data-theme="dark"] .form-panel textarea { background: #1e293b; border-color: rgba(255,255,255,.15); color: #e2e8f0; }

/* Prompt library */

.focus-panel {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.focus-panel td small {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  margin-top: 3px;
}

/* ── Finding detail view ──────────────────────────────────── */
.finding-detail-view {
  --fd-bg: #05070b;
  --fd-panel: #0d131c;
  --fd-panel-2: #090d13;
  --fd-line: #223047;
  --fd-line-2: #334155;
  --fd-text: #e7edf7;
  --fd-muted: #7d8da6;
  --fd-cyan: #67d8ff;
  --fd-green: #67f0b4;
  color: var(--fd-text);
}

.fd-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 2px 0 24px;
  font-size: .94rem;
}

.fd-hero,
.fd-panel,
.fd-glance {
  border: 1px solid var(--fd-line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(13, 19, 28, .96), rgba(7, 10, 15, .96));
  box-shadow: 0 18px 55px rgba(0, 0, 0, .28);
}

.fd-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
}

.fd-hero-main p,
.fd-glance h3 {
  margin: 0 0 8px;
  color: var(--fd-cyan);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.fd-hero h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  letter-spacing: 0;
}

.fd-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 14px;
}

.fd-url {
  min-width: 0;
  max-width: 72ch;
  overflow: hidden;
  color: #bfdbfe;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-url[data-expanded="1"] {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.fd-hero-badges {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.fd-warning {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 6px;
  background: rgba(245, 158, 11, .12);
  color: #fde68a;
}

.fd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.fd-main,
.fd-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fd-side {
  position: sticky;
  top: 14px;
  align-self: start;
}

.fd-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--fd-line);
  cursor: pointer;
  list-style: none;
}

.fd-panel summary::-webkit-details-marker {
  display: none;
}

.fd-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f1f5f9;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.fd-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, .9);
}

.fd-panel-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fd-muted);
}

.fd-chevron::before {
  content: "+";
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.fd-panel[open] .fd-chevron::before {
  content: "-";
}

.fd-panel-body {
  padding: 16px;
}

.fd-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 12px;
  border: 1px solid var(--fd-line-2);
  border-radius: 999px;
  background: rgba(15, 23, 42, .85);
  color: #e2e8f0;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fd-sev-medium {
  border-color: rgba(56, 189, 248, .45);
  background: rgba(14, 165, 233, .16);
  color: #dff6ff;
}

.fd-sev-high {
  border-color: rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .14);
  color: #fde68a;
}

.fd-sev-critical,
.fd-sensitive {
  border-color: rgba(251, 113, 133, .45);
  background: rgba(244, 63, 94, .15);
  color: #ffe4e6;
}

.fd-analyzer {
  border-color: rgba(96, 165, 250, .5);
  background: rgba(37, 99, 235, .2);
  color: #dbeafe;
}

.fd-http-ok,
.fd-valid {
  border-color: rgba(52, 211, 153, .45);
  background: rgba(16, 185, 129, .15);
  color: #bbf7d0;
}

.fd-http-redirect {
  border-color: rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .14);
  color: #fde68a;
}

.fd-http-error {
  border-color: rgba(248, 113, 113, .45);
  background: rgba(239, 68, 68, .14);
  color: #fecaca;
}

.fd-muted {
  color: var(--fd-muted);
  font-size: .78rem;
}

.fd-kv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.fd-kv,
.fd-analysis-list article,
.fd-remediation li,
.fd-evidence {
  border: 1px solid var(--fd-line);
  border-radius: 6px;
  background: rgba(0, 0, 0, .22);
}

.fd-kv {
  min-width: 0;
  padding: 12px;
}

.fd-kv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.fd-kv-head span {
  color: var(--fd-muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fd-kv-value {
  overflow: hidden;
  color: #f8fafc;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-mono,
.fd-url,
.fd-terminal,
.fd-kv code,
.fd-evidence code,
.fd-match-box pre,
.fd-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.fd-copy,
.fd-mini,
.fd-danger-btn,
.fd-actions button {
  border: 1px solid var(--fd-line-2);
  border-radius: 6px;
  background: rgba(15, 23, 42, .9);
  color: #dbe4f0;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.fd-copy,
.fd-mini,
.fd-danger-btn {
  padding: 6px 10px;
  font-size: .76rem;
}

.fd-copy:hover,
.fd-mini:hover,
.fd-actions button:hover {
  border-color: rgba(56, 189, 248, .65);
  background: rgba(14, 165, 233, .12);
  color: #f0f9ff;
}

.fd-danger-btn,
.fd-actions .fd-danger {
  border-color: rgba(251, 113, 133, .45);
  background: rgba(244, 63, 94, .14);
  color: #ffe4e6;
}

.fd-danger-btn:hover,
.fd-actions .fd-danger:hover {
  background: rgba(244, 63, 94, .22);
}

.fd-match-box {
  padding: 14px;
  border: 1px solid rgba(251, 113, 133, .28);
  border-radius: 8px;
  background: rgba(76, 5, 25, .12);
}

.fd-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #cbd5e1;
}

.fd-match-head span:last-child {
  display: inline-flex;
  gap: 8px;
}

.fd-match-box pre,
.fd-body-excerpt pre {
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
}

.fd-match-box pre {
  padding: 14px;
  border: 1px solid var(--fd-line);
  border-radius: 6px;
  background: rgba(0, 0, 0, .48);
  color: #f8fafc;
}

.fd-terminal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.fd-terminal {
  overflow: hidden;
  border: 1px solid var(--fd-line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .42);
}

.fd-terminal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--fd-line);
  color: #94a3b8;
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fd-terminal-head .fd-copy {
  margin-left: auto;
}

.fd-lights {
  display: inline-flex;
  gap: 7px;
}

.fd-lights i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.fd-lights i:nth-child(1) { background: #fb7185; }
.fd-lights i:nth-child(2) { background: #facc15; }
.fd-lights i:nth-child(3) { background: #34d399; }

.fd-terminal-body {
  padding: 14px;
}

.fd-line {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
}

.fd-line span,
.fd-body-excerpt > span {
  color: #64748b;
}

.fd-line code {
  overflow-wrap: anywhere;
  color: #e2e8f0;
}

.fd-body-excerpt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--fd-line);
}

.fd-body-excerpt > span {
  display: block;
  margin-bottom: 8px;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fd-body-excerpt mark {
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(250, 204, 21, .22);
  color: #fde68a;
}

.fd-evidence-list,
.fd-analysis-list,
.fd-remediation,
.fd-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fd-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  padding: 12px;
}

.fd-evidence strong {
  display: block;
  color: #f8fafc;
}

.fd-evidence small {
  display: block;
  margin-top: 4px;
  color: var(--fd-muted);
}

.fd-evidence-actions {
  display: inline-flex;
  gap: 8px;
  align-items: start;
}

.fd-evidence code {
  grid-column: 1 / -1;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--fd-line);
  border-radius: 5px;
  background: rgba(0, 0, 0, .45);
  color: #e2e8f0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-analysis-list article {
  padding: 13px;
}

.fd-analysis-list h3 {
  margin: 0 0 8px;
  color: var(--fd-cyan);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fd-analysis-list p {
  margin: 0;
  color: #dbe4f0;
  line-height: 1.55;
}

.fd-remediation {
  margin: 0;
  padding: 0;
  list-style: none;
}

.fd-remediation li {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 12px;
}

.fd-remediation span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 5px;
  background: rgba(14, 165, 233, .18);
  color: #bae6fd;
  font-weight: 900;
}

.fd-remediation p {
  margin: 1px 0 0;
}

.fd-glance {
  padding: 16px;
}

.fd-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fd-metrics article {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(56, 189, 248, .28);
  border-radius: 6px;
  background: rgba(14, 165, 233, .1);
}

.fd-metrics article.ok {
  border-color: rgba(52, 211, 153, .28);
  background: rgba(16, 185, 129, .1);
}

.fd-metrics article.warn {
  border-color: rgba(251, 191, 36, .28);
  background: rgba(251, 191, 36, .1);
}

.fd-metrics span {
  display: block;
  margin-bottom: 6px;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fd-metrics strong {
  display: block;
  overflow: hidden;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 1.1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fd-tags span {
  padding: 5px 9px;
  border: 1px solid var(--fd-line-2);
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #cbd5e1;
  font-size: .78rem;
}

.fd-actions button {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  font-size: .88rem;
}

.fd-actions .fd-primary {
  border-color: rgba(56, 189, 248, .6);
  background: rgba(14, 165, 233, .18);
  color: #e0f2fe;
}

@media (max-width: 1180px) {
  .fd-layout,
  .fd-hero {
    grid-template-columns: 1fr;
  }

  .fd-side {
    position: static;
  }
}

@media (max-width: 820px) {
  .fd-kv-grid,
  .fd-terminal-grid,
  .fd-metrics {
    grid-template-columns: 1fr;
  }

  .fd-url-row,
  .fd-match-head,
  .fd-evidence {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .fd-url-row {
    flex-wrap: wrap;
  }

  .fd-url {
    flex-basis: 100%;
  }
}

/* ── Script Health Grid ─────────────────────────────────────────────────── */
.sh-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.sh-summary-ok    { color: var(--success, #087443); background: rgba(8, 116, 67, .06); }
.sh-summary-stale { color: var(--warning, #b45309); background: rgba(180, 83, 9, .06); }
.sh-summary-err   { color: var(--danger,  #b42318); background: rgba(180, 35, 24, .06); }
.sh-summary-ts    { font-weight: 400; color: var(--muted); font-size: .72rem; }

.sh-wrap {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .75rem 1rem .9rem;
}

.sh-group { margin-bottom: .55rem; }

.sh-group-label {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: .4rem;
}

.sh-cards {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.sh-card {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  padding: .32rem .65rem .32rem .48rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  cursor: default;
  max-width: 220px;
  transition: filter .1s;
}
.sh-card:hover { filter: brightness(1.04); }

.sh-card-error   { border-color: rgba(180, 35, 24, .4);  background: rgba(180, 35, 24, .05); }
.sh-card-stale   { border-color: rgba(180, 83,  9, .4);  background: rgba(180, 83,  9, .05); }
.sh-card-running { border-color: rgba(14, 165, 233, .4); background: rgba(14, 165, 233, .05); }

.sh-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.sh-dot-ok      { background: var(--success, #087443); }
.sh-dot-error   { background: var(--danger,  #b42318); }
.sh-dot-stale   { background: var(--warning, #b45309); }
.sh-dot-unknown { background: #94a3b8; }
.sh-dot-running {
  background: #0ea5e9;
  animation: sh-pulse 1.5s ease-in-out infinite;
}
@keyframes sh-pulse {
  0%, 100% { opacity: 1;  transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

.sh-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sh-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.3;
}

.sh-age {
  font-size: .66rem;
  color: var(--muted);
  line-height: 1.2;
}

.sh-snippet {
  font-size: .62rem;
  color: var(--danger, #b42318);
  margin-top: 2px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  opacity: .85;
}
.sh-card-stale .sh-snippet { color: var(--warning, #b45309); }

/* ── Scope por plataforma (tarjeta del dashboard) ───────────────────── */
.platform-stats-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.platform-stats-table thead th {
  text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--border, #e2e8f0);
  color: #64748b; font-weight: 600; white-space: nowrap;
}
.platform-stats-table th.num, .platform-stats-table td.num {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.platform-stats-table tbody td { padding: .4rem .5rem; border-bottom: 1px solid var(--border-soft, #f1f5f9); }
.platform-stats-table tbody tr:hover { background: var(--row-hover, rgba(99,102,241,.06)); }

/* ── Superficie de ataque: barras superpuestas (vivos/total) + KPIs ───── */
.dash-bar-track { position: relative; }
.dash-bar-fill  { position: absolute; left: 0; top: 0; }
.dash-bar-val-tot { color: var(--muted); font-weight: 600; font-size: .72rem; }
.dash-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; width: 100%; }
.dash-kpi { display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px 8px; border-radius: 10px; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.dash-kpi-val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-kpi-lbl { font-size: .72rem; color: var(--muted); margin-top: 4px; text-align: center; }

/* ── Anti-desborde de texto en cards del dashboard ───────────────────── */
.dash-bar-label { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bars-dual .dash-bar-row { grid-template-columns: 84px 1fr 74px; }
.dash-bars-dual .dash-bar-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi { min-width: 0; overflow: hidden; }
.dash-kpi-val { font-size: 1.35rem; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dash-legend-list { min-width: 0; }
.dash-leg-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#platformStats { overflow-x: auto; }

/* ── BXSS Pipeline ─────────────────────────────── */
.bxss-hit-card { border:1px solid var(--border); border-radius:8px; margin:8px 12px; overflow:hidden; }
.bxss-hit-header { display:flex; align-items:center; gap:8px; padding:8px 12px; background:rgba(220,38,38,.06); flex-wrap:wrap; }
.bxss-hit-body { padding:8px 12px; font-size:.82rem; }
.bxss-hit-detail { margin-bottom:4px; }
.bxss-hit-detail strong { color:var(--fg); margin-right:4px; }
.row-hit { background:rgba(220,38,38,.05) !important; }
.row-hit td { border-bottom-color:rgba(220,38,38,.15); }

/* ── Markdown Viewer ──────────────────────────── */
.md-rendered { line-height:1.6; word-wrap:break-word; }
.md-rendered h1,.md-rendered h2,.md-rendered h3 { margin:1em 0 .3em; border-bottom:1px solid var(--border); padding-bottom:.2em; }
.md-rendered pre { background:var(--bg); padding:.8em; border-radius:4px; overflow-x:auto; font-size:.85rem; }
.md-rendered code { background:var(--bg); padding:.1em .3em; border-radius:3px; font-size:.9em; }
.md-rendered pre code { background:none; padding:0; }
.md-rendered table { border-collapse:collapse; width:100%; margin:.5em 0; }
.md-rendered th,.md-rendered td { border:1px solid var(--border); padding:.4em .6em; text-align:left; }
.md-rendered blockquote { border-left:3px solid var(--accent,#3b82f6); margin:.5em 0; padding:.3em .8em; color:var(--muted); }
.md-rendered img { max-width:100%; }
