:root {
  color-scheme: light dark;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;      /* categorical slot 1 (blue) — default bar color */
  --series-1-wash: #cde2fb; /* sequential step 100 */
  --status-good: #0ca30c;
  --status-good-text: #006300;
  --status-warn: #b7791e;
  --status-warn-wash: #fdf1dc;
  --status-bad: #d13b30;
  --status-bad-wash: #fce8e6;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px -12px rgba(11, 11, 11, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-1-wash: #184f95;
    --status-good: #0ca30c;
    --status-good-text: #0ca30c;
    --status-warn: #e0a539;
    --status-warn-wash: #3d2d0c;
    --status-bad: #ec5c50;
    --status-bad-wash: #3f1714;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-1-wash: #184f95;
  --status-good: #0ca30c;
  --status-good-text: #0ca30c;
  --status-warn: #e0a539;
  --status-warn-wash: #3d2d0c;
  --status-bad: #ec5c50;
  --status-bad-wash: #3f1714;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  margin: 0;
  padding: 2rem;
}

header h1 { margin-bottom: 0.25rem; font-size: 1.5rem; }

.subtitle { color: var(--text-secondary); margin-top: 0; }

.grid {
  display: grid;
  /* min(320px, 100%) lets a track shrink below its stated minimum on a
     viewport narrower than that, instead of forcing horizontal overflow -
     no separate small-screen breakpoint needed for the grid itself. */
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: start;
}

.grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }

@media (max-width: 640px) {
  body { padding: 1rem; }
  header h1 { font-size: 1.25rem; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem 1.25rem;
  overflow-x: auto;
}

.card h2 {
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card h2 .hint {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty { color: var(--text-muted); font-style: italic; font-size: 0.9rem; }

/* Chart */
.chart-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.chart-legend .key { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.bar-row { cursor: default; }
.bar-row rect.bar { transition: filter 0.1s ease; }
.bar-row:hover rect.bar, .bar-row:focus rect.bar { filter: brightness(1.12); }
.bar-row:focus { outline: none; }
.bar-label {
  fill: var(--text-primary);
  font-size: 12px;
  text-anchor: end;
  dominant-baseline: middle;
}
.bar-value {
  fill: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  dominant-baseline: middle;
  font-variant-numeric: tabular-nums;
}
.threshold-line { stroke: var(--text-muted); stroke-width: 1.5; }
.threshold-label { fill: var(--text-muted); font-size: 11px; }
.bar.default { fill: var(--series-1); }
.bar.good { fill: var(--status-good); }

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.08s ease;
  max-width: 240px;
}
.tooltip.visible { opacity: 1; }
.tooltip .tt-title { color: var(--text-primary); font-weight: 600; margin-bottom: 0.3rem; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 1rem; }
.tooltip .tt-row strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
  white-space: nowrap;
}
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; }
a.link { color: var(--series-1); text-decoration: none; }
a.link:hover { text-decoration: underline; }
.policy-summary {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: normal;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.pill.good { background: var(--series-1-wash); color: var(--status-good-text); }
.pill.muted { background: var(--gridline); color: var(--text-muted); }

/* ---------- VidPulse pages: score gauge + sub-score bars ---------- */
.vp-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.75rem;
  align-items: center;
}
@media (max-width: 560px) {
  .vp-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.vp-gauge { position: relative; width: 128px; height: 128px; flex: 0 0 auto; }
.vp-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.vp-gauge circle { fill: none; stroke-width: 11; }
.vp-gauge .track { stroke: var(--gridline); }
.vp-gauge .value-ring { stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.vp-gauge .value-ring.good { stroke: var(--status-good); }
.vp-gauge .value-ring.warn { stroke: var(--status-warn); }
.vp-gauge .value-ring.bad { stroke: var(--status-bad); }
.vp-gauge .readout {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.vp-gauge .readout .num { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.vp-gauge .readout .lbl { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 0.2rem; }

.vp-bars { display: flex; flex-direction: column; gap: 0.55rem; width: 100%; }
.vp-bar { display: grid; grid-template-columns: 5.5rem 1fr 2.4rem; align-items: center; gap: 0.6rem; }
.vp-bar .lbl { font-size: 0.78rem; color: var(--text-secondary); font-weight: 600; }
.vp-bar .track { height: 8px; border-radius: 999px; background: var(--gridline); overflow: hidden; }
.vp-bar .fill { height: 100%; border-radius: 999px; }
.vp-bar .fill.good { background: var(--status-good); }
.vp-bar .fill.warn { background: var(--status-warn); }
.vp-bar .fill.bad { background: var(--status-bad); }
.vp-bar .val { font-size: 0.8rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.vp-finding {
  border-left: 3px solid var(--status-warn);
  padding: 0.6rem 0.9rem;
  border-radius: 0 8px 8px 0;
  background: var(--page);
  margin-bottom: 0.55rem;
}
.vp-finding:last-child { margin-bottom: 0; }
.vp-finding .zaman { font-variant-numeric: tabular-nums; color: var(--series-1); font-weight: 700; font-size: 0.82rem; }
.vp-finding .sorun { font-weight: 600; margin: 0.2rem 0; font-size: 0.92rem; }
.vp-finding .cozum { color: var(--text-secondary); font-size: 0.85rem; }
