/* AI Observatory sample dashboard: tokens first, components second.
   Light values on :root, dark values under both the OS media query and the manual toggle. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6;   /* EU27 / primary */
  --series-2: #eb6834;   /* United States */
  --series-3: #1baf7a;   /* China */
  --neutral-dark: #898781;  /* fourth group, de-emphasis */
  --neutral-light: #c3c2b7; /* "Other" */
  --neutral-faint: #e1e0d9; /* "Unknown" */
  --seq-1: #b7d3f6; --seq-2: #86b6ef; --seq-3: #5598e7; --seq-4: #256abf; --seq-5: #104281;
  --good-text: #006300;
  --bad-text: #a32626;
  --accent: #2a78d6;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
    --grid: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --neutral-dark: #898781; --neutral-light: #52514e; --neutral-faint: #383835;
    --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #b7d3f6;
    --good-text: #0ca30c; --bad-text: #e66767; --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #898781;
  --grid: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --neutral-dark: #898781; --neutral-light: #52514e; --neutral-faint: #383835;
  --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #b7d3f6;
  --good-text: #0ca30c; --bad-text: #e66767; --accent: #3987e5;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text-primary); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); }
.site-header { background: var(--surface-1); border-bottom: 1px solid var(--border); padding: 14px 16px; }
.site-header .inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 36px; height: 36px; border-radius: 6px; background: var(--series-1); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.brand h1 { font-size: 18px; margin: 0; font-weight: 600; }
.brand .sub { color: var(--text-secondary); font-size: 13px; }
.header-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn { font: inherit; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--baseline); }
.btn.small { font-size: 12px; padding: 4px 8px; color: var(--text-secondary); }
a.btn { text-decoration: none; display: inline-block; }

main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.banner { background: var(--surface-1); border: 1px solid var(--border); border-left: 4px solid var(--series-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 4px 0 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.filters select { font: inherit; font-size: 14px; padding: 6px 10px; border: 1px solid var(--baseline); border-radius: 6px; background: var(--surface-1); color: var(--text-primary); min-width: 200px; }
.filters .hint { font-size: 12px; color: var(--text-muted); margin-left: auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; min-height: 104px; }
.tile .label { font-size: 13px; color: var(--text-secondary); }
.tile .value { font-size: 30px; font-weight: 600; margin: 4px 0 2px; }
.tile.hero .value { font-size: 48px; }
.tile .delta { font-size: 13px; color: var(--text-secondary); }
.tile .delta.up { color: var(--good-text); }
.tile .delta.down { color: var(--bad-text); }
.tile .foot { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

h2.section { font-size: 15px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; margin: 28px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px 10px; grid-column: span 12; display: flex; flex-direction: column; }
.card.half { grid-column: span 6; }
.card.third { grid-column: span 4; }
.card h3 { font-size: 16px; font-weight: 600; margin: 0 0 2px; }
.card .sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.card .chart { width: 100%; min-height: 340px; }
.card .chart.tall { min-height: 420px; }
.card .map { width: 100%; height: 460px; border-radius: 6px; background: var(--page); }
.card .foot { font-size: 12px; color: var(--text-muted); margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card .foot .src { flex: 1 1 60%; }
.card .caveat { font-size: 12px; color: var(--text-secondary); background: var(--page); border-radius: 6px; padding: 6px 10px; margin-top: 8px; }
.card .controls { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-secondary); margin: 2px 0 8px; }
.card.loading .chart, .card.loading .map { opacity: .5; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
table.data th { text-align: left; color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--baseline); padding: 6px 8px; }
table.data td { padding: 5px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
table.data td.num { text-align: right; }

/* Leaflet overrides so the map wears the page tokens */
.leaflet-container { background: var(--page); font-family: var(--font); }
.leaflet-tooltip { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; box-shadow: none; font-size: 13px; }
.leaflet-tooltip b { font-size: 15px; }
.map-legend { background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; color: var(--text-secondary); line-height: 1.3; }
.map-legend .row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.map-legend .sw { width: 18px; height: 12px; border-radius: 2px; border: 1px solid var(--border); }
.map-legend .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-1); }
.leaflet-control-attribution { background: var(--surface-1); color: var(--text-muted); font-size: 10px; }
.leaflet-control-attribution a { color: var(--text-secondary); }
.leaflet-bar a { background: var(--surface-1); color: var(--text-primary); border-color: var(--border); }

/* Reports list: newest first, type filter, download button per PDF */
.seg { flex-wrap: wrap; gap: 6px; }
.seg .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text-primary); background: var(--page); }
ul.reports { list-style: none; margin: 0 0 8px; padding: 0; }
.report { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--grid); }
.report:first-child { border-top: 0; }
.report .r-date { width: 52px; flex: none; text-align: center; line-height: 1.15; }
.report .r-date .m { display: block; font-size: 15px; font-weight: 600; }
.report .r-date .y { font-size: 12px; color: var(--text-muted); }
.report .r-main { flex: 1 1 auto; min-width: 0; }
.report .r-meta { display: flex; gap: 6px; margin-bottom: 3px; }
.report .tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--page); color: var(--text-secondary); border: 1px solid var(--border); }
.report .r-title { font-size: 15px; font-weight: 600; }
.report .r-sum { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.report .r-dl { flex: none; text-align: right; }
.report .r-dl .size { display: block; font-size: 11px; color: var(--text-muted); }
ul.reports .empty { padding: 10px 0; color: var(--text-muted); font-size: 13px; }

footer.site-footer { max-width: 1280px; margin: 24px auto 40px; padding: 0 16px; font-size: 12px; color: var(--text-muted); }
footer.site-footer ul { padding-left: 18px; }

@media (max-width: 900px) {
  .card.half, .card.third { grid-column: span 12; }
  .tile.hero .value { font-size: 40px; }
}
@media (max-width: 600px) {
  .report { flex-wrap: wrap; }
  .report .r-main { flex-basis: calc(100% - 66px); }
  .report .r-dl { margin-left: 66px; text-align: left; }
}

/* Highcharts export-data table view (the WCAG twin of each chart) */
.highcharts-data-table table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; font-family: var(--font); color: var(--text-primary); }
.highcharts-data-table th, .highcharts-data-table td { padding: 4px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
.highcharts-data-table th { color: var(--text-secondary); border-bottom-color: var(--baseline); }
.highcharts-data-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.highcharts-data-table caption { text-align: left; font-size: 12px; color: var(--text-muted); padding: 4px 0; }
