@font-face {
  font-family: "League Spartan";
  src: url("/static/assets/fonts/league-spartan-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* DataCaptive brand - https://www.datacaptive.com/brand/ */
  --surface-1: #ffffff;
  --page: #e3f3ff;
  --text-primary: #0d2f6f;
  --text-secondary: #3e5174;
  --text-muted: #737f96;
  --gridline: #e7ebf3;
  --baseline: #c4cdde;
  --border: rgba(13, 47, 111, 0.1);

  /* categorical chart palette - derived from brand accents, validated with
     the dataviz skill's palette checker (CVD-safe, in-band lightness/chroma) */
  --series-1: #0e78b6; /* deep sky blue (brand primary) */
  --series-2: #c1a30a; /* citrine */
  --series-3: #00a599; /* dark turquoise */
  --series-4: #056bf1; /* bright blue */
  --series-5: #f25836; /* shocking orange */
  --series-6: #8b5cf6; /* lavender indigo */

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --brand-accent: #32aaef;
  --brand-dark: #0d2f6f;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #161e2d;
    --page: #0f141f;
    --text-primary: #ffffff;
    --text-secondary: #c3cbdc;
    --text-muted: #8b95ac;
    --gridline: #2e394c;
    --baseline: #404c64;
    --border: rgba(255, 255, 255, 0.12);

    --series-1: #0f81c3;
    --series-2: #8f790c;
    --series-3: #009589;
    --series-4: #1974ec;
    --series-5: #d83611;
    --series-6: #8352f1;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #161e2d;
  --page: #0f141f;
  --text-primary: #ffffff;
  --text-secondary: #c3cbdc;
  --text-muted: #8b95ac;
  --gridline: #2e394c;
  --baseline: #404c64;
  --border: rgba(255, 255, 255, 0.12);

  --series-1: #0f81c3;
  --series-2: #8f790c;
  --series-3: #009589;
  --series-4: #1974ec;
  --series-5: #d83611;
  --series-6: #8352f1;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand img.logo {
  height: 26px;
}

.topbar-brand .logo-light {
  display: block;
}
.topbar-brand .logo-dark {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .topbar-brand .logo-light {
    display: none;
  }
  :root:where(:not([data-theme="light"])) .topbar-brand .logo-dark {
    display: block;
  }
}
:root[data-theme="dark"] .topbar-brand .logo-light {
  display: none;
}
:root[data-theme="dark"] .topbar-brand .logo-dark {
  display: block;
}

.topbar-brand .divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.topbar .meta {
  font-size: 14px;
  color: var(--text-muted);
}

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

button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 7px 14px;
  cursor: pointer;
}

button:hover {
  background: var(--gridline);
}

button.primary {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #ffffff;
}

button.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

nav.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

nav.tabs button {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 12px 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

nav.tabs button.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand-accent);
  font-weight: 600;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.module {
  display: none;
}

.module.active {
  display: block;
}

.module h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.module .purpose {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.note {
  font-size: 14px;
  color: var(--text-muted);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--status-warning);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat-tile .value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text-primary);
}

.stat-tile .value.unavailable {
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 500;
}

.stat-tile .label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 28px 0 10px;
}

.industry-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.industry-select-row label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.industry-select-row select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  min-width: 240px;
}

.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.chart-card canvas {
  max-height: 280px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 860px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--gridline);
  background: var(--page);
}

tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

.loading,
.empty {
  color: var(--text-muted);
  font-size: 15px;
  padding: 20px 0;
}
