/* ============================================
   Security Dashboard - Modern SOC Theme
   No Gridstack. Static responsive CSS Grid.
   ============================================ */

:root {
  /* SOC theme - neutral dark base, indigo accent, green = healthy only */
  --bg-0: #0a0e12;
  --bg-1: #0d1217;
  --bg-2: #131a21;

  --line-soft: rgba(148, 163, 184, 0.07);
  --line: #1e2930;

  --text-1: #dbe7f0;
  --text-2: #8ba0b3;
  --text-3: #5c7184;

  /* Indigo accent - actions/links/highlights */
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.12);

  /* Accent glows (follow the active theme accent) */
  --glow: rgba(129, 140, 248, 0.35);
  --glow-strong: rgba(129, 140, 248, 0.5);
  --glow-line: rgba(129, 140, 248, 0.16);

  /* Green for healthy status only */
  --ok: #22e584;
  --ok-soft: rgba(34, 229, 132, 0.12);

  /* Amber for warnings */
  --warn: #ffc24b;
  --warn-soft: rgba(255, 194, 75, 0.12);

  /* Red for critical/severity */
  --crit: #f43f5e;
  --crit-soft: rgba(244, 63, 94, 0.12);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 10px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.45), 0 6px 16px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

.soc-dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   A. HEADER COMPACTO
   ============================================ */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}

.dashboard-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 14px var(--glow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px var(--glow-strong));
  cursor: pointer;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-tagline {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
  font-family: var(--font-mono);
}

/* A2. Sticky mini-nav (quick section links) */
.mini-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 7px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mini-nav a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.mini-nav a:hover,
.mini-nav a:focus-visible {
  color: var(--accent);
  border-color: var(--line);
  background: var(--bg-2);
  outline: none;
}
@media (max-width: 767px) {
  .mini-nav {
    gap: 2px;
    padding: 6px 14px;
  }
  .mini-nav a {
    font-size: 9px;
    padding: 3px 8px;
  }
}

/* Anchor targets clear the sticky mini-nav */
.dashboard-row,
.kpi-bar,
.row-viz2 {
  scroll-margin-top: 52px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-2);
}

.feed-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.status-dot.warning {
  background: var(--warn);
}

.status-dot.critical {
  background: var(--crit);
}

.status-label {
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px;
  font-weight: 600;
}

.header-clock {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-1);
  white-space: nowrap;
}

.header-sync {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ============================================
   B. KPI BAR
   ============================================ */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px 0;
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text-1);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-3);
}

.kpi-value.crit { color: var(--crit); }
.kpi-value.warn { color: var(--warn); }
.kpi-value.ok { color: var(--ok); }
.kpi-value.accent { color: var(--accent); }

.kpi-value.unavailable {
  color: var(--text-3);
  font-size: 18px;
  align-self: flex-start;
}

/* Skeleton */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.kpi-skeleton {
  width: 70%;
  height: 30px;
}

.kpi-label-skeleton {
  width: 55%;
  height: 12px;
}

/* Row Visual: threat landscape donuts (full width) */
.row-visual {
  grid-template-columns: 1fr;
}

.viz-body {
  padding: 14px 20px 18px;
}

.viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  flex-wrap: wrap;
}

.viz-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.viz-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viz-divider {
  width: 1px;
  height: 96px;
  background: var(--line);
}

.viz-chart {
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}

.donut {
  width: 100%;
  height: 100%;
  display: block;
}

.donut circle {
  transition: stroke-width .15s ease, filter .15s ease;
  cursor: pointer;
}

.donut circle:hover {
  stroke-width: 18;
  filter: drop-shadow(0 0 6px var(--glow));
}

.donut text {
  fill: var(--text-1);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.donut .donut-total-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  fill: var(--text-3);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Linked data sources strip (threat landscape) */
.viz-sources {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.viz-sources a {
  color: var(--accent);
  text-decoration: none;
}
.viz-sources a:hover {
  text-decoration: underline;
}

/* Caption under threat landscape charts */
.viz-caption {
  max-width: 148px;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-3);
  cursor: default;
}

.viz-caption-wide {
  max-width: none;
}

/* B3. Analytics bar charts (Top Ransom Groups / KEV / Breaches) */
.row-viz2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}
@media (max-width: 1299px) {
  .row-viz2 {
    grid-template-columns: 1fr 1fr;
  }
  .row-viz2 .panel:last-child {
    grid-column: 1 / -1;
  }
}
@media (max-width: 899px) {
  .row-viz2 {
    grid-template-columns: 1fr;
  }
  .row-viz2 .panel:last-child {
    grid-column: auto;
  }
}
.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 30px;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
}
.bar-row-sm {
  grid-template-columns: 86px 1fr 24px;
  margin: 3px 0;
}
.bar-more {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}
.bar-more a {
  color: var(--accent);
  text-decoration: none;
}
.bar-more a:hover {
  text-decoration: underline;
}
.bar-label {
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-label a.panel-link {
  color: var(--accent);
  text-decoration: none;
}
.bar-label a.panel-link:hover {
  text-decoration: underline;
}
.bar-row-link,
.bar-v-link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.bar-row-link:hover .bar-fill,
.bar-v-link:hover .bar-fill {
  filter: brightness(1.35);
}
.bar-row-link:hover .bar-label,
.bar-v-link:hover .bar-v-label {
  color: var(--accent);
}
.count-link {
  text-decoration: none;
  color: inherit;
}
.count-link:hover b {
  color: var(--accent);
  text-decoration: underline;
}
.bar-track {
  height: 10px;
  background: var(--bg-dark);
  border-radius: 5px;
  overflow: hidden;
  display: block;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
}
.bar-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.bar-v-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 4px;
  position: relative;
}
/* Midpoint gridline (max/2) drawn behind the bars */
.bar-v-wrap::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--grid, 76px);
  border-top: 1px dashed var(--glow-line);
  pointer-events: none;
  z-index: 0;
}
/* Max value tick pinned at the bar top (100% height = height-24) */
.bar-v-max {
  position: absolute;
  right: 2px;
  bottom: var(--grid, 76px);
  transform: translateY(50%);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.2;
  color: var(--text-3);
  background: var(--bg-1);
  padding: 0 4px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}
.bar-v-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}
/* Rich tooltip */
.bar-v-tip {
  position: absolute;
  bottom: calc(var(--tip-h, 42px) + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--accent);
  color: var(--text-1);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 30;
}
.bar-v-tip b {
  color: var(--accent);
}
.bar-v-tip small {
  display: block;
  font-size: 9px;
  color: var(--text-3);
  margin-top: 2px;
}
.bar-v-col:hover .bar-v-tip,
.bar-v-col:focus-visible .bar-v-tip {
  opacity: 1;
  visibility: visible;
}
.bar-v-col .bar-v-tip {
  bottom: calc(100% + 8px);
}
.bar-v-val {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.bar-v-fill {
  width: 70%;
  max-width: 26px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.bar-v-label {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Clickable bars (Breaches by Year -> detail modal) */
.bar-v-col.clickable {
  cursor: pointer;
}
.bar-v-col.clickable:hover .bar-v-fill {
  filter: brightness(1.2);
}
.bar-v-col.clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.bar-v-col.clickable .bar-v-tip small {
  color: var(--accent);
}
.viz-source {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}
.viz-source a {
  color: var(--accent);
  text-decoration: none;
}
.viz-source a:hover {
  text-decoration: underline;
}
.viz-note {
  color: var(--text-dim);
}
/* Breach heat legend (severity color scale) */
.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-3);
}
.heat-legend .hl-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.heat-legend .hl-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* Ransomware Tracking enhancements */
.ransom-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.rs-chip {
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}
a.rs-chip {
  display: inline-block;
  text-decoration: none;
}
a.rs-chip:hover {
  border-color: var(--accent);
}
.rs-chip b {
  color: var(--accent);
}
.rs-chip.rs-hot b {
  color: var(--warn);
}
.ransom-groups {
  margin-bottom: 12px;
}

.viz-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.viz-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 42px 34px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s ease, color .15s ease;
}

.viz-legend li:hover {
  background: var(--bg-2);
  color: var(--text-1);
}

.viz-legend li.is-active {
  background: var(--accent-soft);
  color: var(--text-1);
  box-shadow: inset 2px 0 0 var(--accent);
}

.viz-legend .viz-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.viz-legend .viz-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viz-legend .viz-val {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  color: var(--text-3);
}

.viz-legend .viz-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  color: var(--text-1);
}

/* ============================================
   C. ROWS GRID
   ============================================ */
.dashboard-row {
  display: grid;
  gap: 16px;
  padding: 16px 20px 0;
}

/* Row 1: three equal columns */
.row-1 {
   grid-template-columns: repeat(3, 1fr);
}

/* Row 2: two equal columns */
.row-2 {
   grid-template-columns: repeat(2, 1fr);
}

/* Row 3: full width (1 column) */
.row-3 {
   grid-template-columns: 1fr;
}

/* Row 4: two equal columns */
.row-4 {
   grid-template-columns: repeat(2, 1fr);
}

/* Row 5: two equal columns */
.row-5 {
   grid-template-columns: repeat(2, 1fr);
}

.dashboard-row:last-of-type {
  padding-bottom: 24px;
}

/* ============================================
   PANELS
   ============================================ */
.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  min-height: 36px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-right .viz-source {
  margin-top: 0;
}

.panel-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--text-3);
  border-radius: 2px;
  opacity: 0.5;
}

.panel.panel-primary .panel-header h2::before {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 6px var(--accent-soft);
}

.panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Compact count badge in panel header */
.panel-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.panel-count b {
  color: var(--text-1);
  font-weight: 600;
}

/* Panel freshness ("updated Xm ago" + stale dot) */
.panel-fresh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.panel-fresh::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(34, 229, 132, 0.5);
}
.panel-fresh.stale::before {
  background: var(--warn);
  box-shadow: 0 0 6px rgba(255, 194, 75, 0.5);
}

/* Filters */
.filters {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-btn:hover {
  background: var(--bg-2);
  color: var(--text-1);
}

.filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  z-index: 1;
}

tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  font-size: 12px;
}

/* Zebra striping for tables */
tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: var(--bg-2);
}

/* Sortable table headers */
button.th-sort {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
button.th-sort:hover {
  color: var(--accent);
}
button.th-sort.sort-active {
  color: var(--accent);
}
.sort-arrow {
  font-size: 9px;
  color: var(--text-3);
}
button.th-sort.sort-active .sort-arrow {
  color: var(--accent);
}
button.th-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

td.mono, .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.cell-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Severity badges */
.sev-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sev-badge.critical { background: var(--crit-soft); color: var(--crit); }
.sev-badge.high { background: var(--warn-soft); color: var(--warn); }
.sev-badge.medium { background: var(--accent-soft); color: var(--accent); }
.sev-badge.low { background: var(--ok-soft); color: var(--ok); }

/* CVE link */
.cve-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.cve-link:hover {
  text-decoration: underline;
}

/* Global link base - keep same color as text, no blue/gray visited */
a {
  color: inherit;
  text-decoration: none;
}

a:visited {
  color: inherit;
}

a:active {
  color: inherit;
}

/* Panel links - discreet styling */
.panel-link {
  color: var(--text-1);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.15s ease;
}

.panel-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-soft);
}

/* Feed item links - already styled appropriately */
.feed-item .feed-title a {
  color: inherit;
  text-decoration: none;
}

.feed-item .feed-title a:hover {
  color: var(--accent);
}

/* Required action text limiting */
.action-limit {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 3.6em;
  line-height: 1.8;
}

.action-expanded {
  -webkit-line-clamp: unset;
  max-height: unset;
}

.expand-toggle {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.expand-toggle:hover {
  color: var(--accent);
}

/* Recency badge for ransomware */
.recency-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.recency-badge.recent {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.recency-badge.historical {
  color: var(--text-3);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* ============================================
   STATE: LOADING / EMPTY / ERROR
   ============================================ */
.state-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  text-align: center;
  color: var(--text-2);
  font-size: 12px;
}

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

.state-block .state-hint {
  font-size: 11px;
  color: var(--text-3);
  max-width: 280px;
  line-height: 1.4;
}

.state-block button.retry-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  min-width: 80px;
}

.state-block button.retry-btn:hover {
  opacity: 0.9;
}

/* Table skeleton rows */
.table-skeleton td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.skeleton-row {
  width: 100%;
  height: 12px;
}

/* Feed items */
.feed-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: 560px;
  padding: 2px 0;
}

/* Feed toolbar: kind filter pills */
.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.feed-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.feed-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

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

.feed-filter.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.feed-filter .ff-count {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--text-3);
}

.feed-filter.active .ff-count {
  background: var(--accent);
  color: var(--bg);
}

.feed-filter-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.feed-empty {
  padding: 16px 12px;
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
}

.feed-item {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.feed-kind {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 5px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: 1px;
}

.feed-kind.news { background: var(--line-soft); color: var(--text-2); }
.feed-kind.leak { background: var(--warn-soft); color: var(--warn); }
.feed-kind.ransom { background: var(--crit-soft); color: var(--crit); }
.feed-kind.kev { background: var(--accent-soft); color: var(--accent); }

.feed-item:last-child {
  border-bottom: none;
}

.feed-item .feed-title {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.4;
  margin-bottom: 2px;
  overflow-wrap: break-word;
}

.feed-item .feed-title a {
  color: inherit;
  text-decoration: none;
}

.feed-item .feed-title a:hover {
  color: var(--accent);
}

.feed-item .feed-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.feed-item .feed-source {
  color: var(--accent);
  font-weight: 500;
}

/* Feed skeleton cards */
.feed-skel {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-skel-line {
  width: 100%;
  height: 10px;
  border-radius: 3px;
}

.feed-skel-line.short {
  width: 40%;
}

.feed-skel-line.mid {
  width: 70%;
}

/* ============================================
   SEARCH / INPUTS
   ============================================ */
.search-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

input[type="text"],
input[type="email"],
select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-1);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  width: 100%;
  min-height: 32px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  min-height: 32px;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.9;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.result-item {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.result-item .result-title {
  font-size: 12px;
  color: var(--text-1);
  font-weight: 500;
}

.result-item .result-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

/* ============================================
   REPUTATION / BREACH
   ============================================ */
.rep-search-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.rep-search-row select {
  flex: 0 0 auto;
  width: auto;
}

.rep-result, .breach-result {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 6px;
}

.verdict {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.verdict.clean { background: var(--ok-soft); color: var(--ok); }
.verdict.suspicious { background: var(--warn-soft); color: var(--warn); }
.verdict.malicious { background: var(--crit-soft); color: var(--crit); }

.verdict-card {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verdict-card .detail {
  font-size: 11px;
  color: var(--text-2);
}

.verdict-card .score {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-1);
}

/* ============================================
   ACTIVITY LOG (no fake terminal)
   ============================================ */
.log-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.log-filters {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.log-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 2px 0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.log-entry {
  padding: 4px 10px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.log-entry .log-time {
  color: var(--text-3);
  flex-shrink: 0;
  font-size: 10px;
}

.log-entry .log-level {
  flex-shrink: 0;
  width: 48px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.4px;
}

.log-entry.info .log-level { color: var(--accent); }
.log-entry.success .log-level { color: var(--ok); }
.log-entry.warning .log-level { color: var(--warn); }
.log-entry.error .log-level { color: var(--crit); }

.log-entry .log-msg {
  color: var(--text-2);
  overflow-wrap: break-word;
}

/* ============================================
   CVSS CALCULATOR
   ============================================ */
.cvss-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
  overflow-y: auto;
}

.cvss-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.cvss-prompt {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  padding: 16px 0;
}

.cvss-score {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.cvss-score.crit { color: var(--crit); }
.cvss-score.high { color: var(--warn); }
.cvss-score.medium { color: var(--accent); }
.cvss-score.low { color: var(--ok); }

.cvss-severity {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.cvss-vector {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  overflow-wrap: break-word;
}

.cvss-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.cvss-controls label {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================
   FOOTER
   ============================================ */
.dashboard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  font-size: 11px;
  color: var(--text-3);
  flex-wrap: wrap;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1199px) {
  .kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .row-1 {
    grid-template-columns: repeat(2, 1fr);
  }
  .row-1 .panel:last-child {
    grid-column: 1 / -1;
  }

  .dashboard-main {
    grid-template-columns: 1fr;
  }

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

  .section-tertiary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 899px) {
  .row-1,
  .row-2,
  .row-4,
  .row-5 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .kpi-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px 14px 0;
  }

  .kpi-value {
    font-size: 24px;
  }

  .dashboard-main,
  .section-secondary,
  .section-tertiary {
    grid-template-columns: 1fr;
    padding-left: 14px;
    padding-right: 14px;
    gap: 12px;
  }

  .section-tertiary {
    padding-bottom: 16px;
  }

  .rep-search-row,
  .search-row {
    flex-wrap: wrap;
  }

  .rep-search-row select {
    flex: 1;
    width: 100%;
  }

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

  .cvss-controls {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-wrap: wrap;
  }

  .header-sync {
    display: none;
  }

  .dashboard-row {
    padding: 12px 14px 0;
  }

  .viz {
    gap: 14px;
  }

  .modal {
    max-width: 100%;
    max-height: 94vh;
  }
}

/* ============================================
   Ransomware 7d KPI + detail modal
   ============================================ */
.kpi-clickable {
  cursor: pointer;
  transition: filter 0.15s ease;
}
.kpi-clickable:hover,
.kpi-clickable:focus-visible {
  filter: brightness(1.25);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
/* Affordance icon for clickable KPI numbers */
.kpi-icon {
  font-size: 11px;
  vertical-align: 3px;
  margin-left: 2px;
  opacity: 0.75;
}

.chip {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  margin: 1px 3px 1px 0;
  border-radius: 10px;
  background: var(--line-soft);
  color: var(--text-2);
  white-space: nowrap;
}
.chip-more {
  opacity: .7;
}
.muted {
  color: var(--text-2);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay[hidden] {
  display: none;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.5);
  max-width: 780px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-1);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
}
.modal-close:hover {
  color: var(--text-1);
  background: var(--accent-soft);
}
.modal-body {
  overflow: auto;
  padding: 6px 18px 18px;
}
.modal-body .table-wrap {
  max-height: none;
}
.modal-body table th,
.modal-body table td {
  padding: 8px 10px;
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  text-align: right;
  background: var(--bg-1);
}
.btn {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
}
.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ============================================
   LIGHT THEME — override for data-theme="light"
   Dark is default. Indigo accent is fixed.
   ============================================ */
:root[data-theme="light"] {
  --bg-0: #f8fafc;
  --bg-1: #ffffff;
  --bg-2: #f1f5f9;
  --line: #e2e8f0;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --shadow: 0 1px 4px rgba(15, 23, 42, 0.08), 0 6px 16px rgba(15, 23, 42, 0.06);
}

.theme-toggle {
  min-height: 26px;
  width: 36px;
  padding: 3px 6px;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.lang-toggle {
  min-height: 26px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-1);
  cursor: pointer;
}
.lang-toggle:hover,
.lang-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  max-width: 800px;
  margin: 0 auto;
}
.hero h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-1);
  margin: 0 0 12px;
}
.hero-sub {
  font-size: clamp(0.875rem, 1.75vw, 1rem);
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ============================================
   TOOLTIPS (accessible, keyboard + hover)
   ============================================ */
.tip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--accent);
}
.tip:focus,
.tip:hover {
  outline: none;
}
.tip:focus .tip-bubble,
.tip:hover .tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}
.tip-bubble {
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  max-width: 280px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  color: var(--bg-0);
  background: var(--text-1);
  border-radius: 8px;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.tip-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-1);
}
[data-theme="light"] .tip-bubble {
  background: var(--text-1);
  color: var(--bg-0);
}
[data-theme="light"] .tip-bubble::after {
  border-top-color: var(--text-1);
}

/* ============================================
   ABOUT PAGE
   ============================================ */
.about-page {
  padding: 40px 24px;
  max-width: 900px;
  margin: 0 auto;
}
.about-hero {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.about-hero h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 12px;
}
.about-hero p {
  font-size: 1.125rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 680px;
  margin: 0 auto;
}
.about-section {
  margin-bottom: 40px;
}
.about-section h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.about-steps {
  padding-left: 20px;
  line-height: 1.8;
}
.about-steps li {
  margin-bottom: 12px;
  color: var(--text-2);
}
.about-steps b {
  color: var(--text-1);
}
.about-sources {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.about-sources li {
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.6;
  color: var(--text-2);
}
.about-sources a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.about-sources a:hover {
  text-decoration: underline;
}
.about-faq-q {
  font-weight: 600;
  color: var(--text-1);
  margin: 20px 0 6px;
}
.about-faq-a {
  color: var(--text-2);
  margin: 0 0 4px;
}
.about-cta {
  text-align: center;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

/* Footer columns for richer footer */
.dashboard-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-3);
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-title {
  font-weight: 600;
  color: var(--text-1);
  font-size: 14px;
}
.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .hero {
    padding: 24px 16px;
  }
  .hero-cta {
    flex-direction: column;
    align-items: center;
  }
  .hero-cta .btn {
    width: 100%;
    max-width: 280px;
  }
  .about-page {
    padding: 24px 16px;
  }
  .dashboard-footer {
    flex-direction: column;
    text-align: center;
  }
  .footer-col {
    align-items: center;
  }
}
