/* Shared by /datagov/ and the five sites it backs. Rules: site\datagov\README.md */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f2f1ed;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #e7f0fc;
  --series-1: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-ink: #006300;
  --critical-ink: #b02a2a;
  --banner-warn: #fff4d6;
  --banner-warn-ring: #f0d58a;
  --banner-err: #fde8e8;
  --banner-err-ring: #f2b8b8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a988f;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: #16263a; --series-1: #3987e5;
    --good-ink: #0ca30c; --critical-ink: #e66767;
    --banner-warn: #2e2610; --banner-warn-ring: #5c4a14;
    --banner-err: #331616; --banner-err-ring: #6b2a2a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a988f;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: #16263a; --series-1: #3987e5;
  --good-ink: #0ca30c; --critical-ink: #e66767;
  --banner-warn: #2e2610; --banner-warn-ring: #5c4a14;
  --banner-err: #331616; --banner-err-ring: #6b2a2a;
  --shadow: none;
}

/* Load-bearing: a component's own display:flex must never beat [hidden]
   (the census page's loading pill never went away without this). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.5 var(--font);
}
a { color: var(--accent-ink); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: .4em 0; }
code { font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--ring);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 260px; }
.brand-mark { font-size: 28px; line-height: 1; }
.brand h1 { font-size: 1.25rem; }
.brand .sub { margin: 0; color: var(--muted); font-size: .85rem; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sitenav { display: flex; gap: 4px; flex-wrap: wrap; }
.sitenav a {
  text-decoration: none; color: var(--ink-2); font-size: .85rem;
  padding: 5px 9px; border-radius: 999px;
}
.sitenav a:hover { background: var(--surface-2); }
.sitenav a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }

/* ---- layout ---- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; }
.card {
  background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; min-width: 0;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row > .field { flex: 1 1 160px; min-width: 0; }
.field label, .lbl { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }

input[type="text"], input[type="search"], input[type="date"], input[type="number"], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; min-height: 40px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button, .btn {
  font: inherit; font-size: .92rem; cursor: pointer; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--ring); border-radius: 8px; padding: 8px 14px; min-height: 40px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--axis); }
button.primary, .btn.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; }
.iconbtn { padding: 8px; min-width: 40px; justify-content: center; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; font-size: .92rem; }
.checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

.seg { display: inline-flex; border: 1px solid var(--ring); border-radius: 999px; padding: 3px; background: var(--surface-2); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; min-height: 34px; padding: 6px 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); font-weight: 600; }

/* ---- banners & status ---- */
.banner { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: .92rem; border: 1px solid; }
.banner.warn { background: var(--banner-warn); border-color: var(--banner-warn-ring); }
.banner.err { background: var(--banner-err); border-color: var(--banner-err-ring); }
.banner.info { background: var(--accent-wash); border-color: var(--ring); }
.banner > b { display: block; margin-bottom: 2px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--ring); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ring); background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.badge .dot { width: 9px; height: 9px; }

.busy { display: flex; gap: 8px; align-items: center; color: var(--muted); padding: 18px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--axis); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--axis); border-radius: var(--radius); }

/* ---- stat tiles ---- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tile .v { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.tile .d { font-size: .82rem; color: var(--ink-2); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }

/* ---- charts (single-series bars, SVG) ---- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--series-1); }
.chart .bar.hl, .chart .hit:hover + .bar { fill: var(--accent-ink); }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lab { fill: var(--ink-2); font-size: 12px; }
.chart .val { fill: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink);
  border: 1px solid var(--ring); box-shadow: 0 4px 18px rgba(0,0,0,.14); border-radius: 8px;
  padding: 6px 10px; font-size: .82rem; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}
.tip b { font-variant-numeric: tabular-nums; }
details.twin { margin-top: 8px; }
details.twin summary { cursor: pointer; color: var(--muted); font-size: .82rem; }

/* ---- collapsible sections: native <details class="sec">, closed on load ----
   House convention, see site\M365Dashboard\README.md and site\datagov\README.md. */
.sec-tools { display: flex; gap: 8px; justify-content: flex-end; margin: 0 0 10px; flex-wrap: wrap; }
.sec-tools button { min-height: 34px; padding: 5px 12px; font-size: .85rem; }
details.sec {
  background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px; min-width: 0;
}
details.sec > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  border-radius: var(--radius);
}
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary:hover { background: var(--surface-2); }
details.sec > summary::before {
  content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s; justify-self: center; grid-row: 1 / span 2;
}
details.sec[open] > summary::before { transform: rotate(45deg); }
details.sec[open] > summary { border-bottom: 1px solid var(--grid); border-radius: var(--radius) var(--radius) 0 0; }
details.sec > summary h2 { font-size: 1.08rem; display: flex; align-items: center; gap: 8px; min-width: 0; }
details.sec > summary .badge-slot { grid-column: 3; grid-row: 1; justify-self: end; }
details.sec > summary .tease { grid-column: 2 / span 2; color: var(--muted); font-size: .85rem; overflow-wrap: break-word; }
details.sec > .body { padding: 14px 16px 16px; min-width: 0; }
@media (max-width: 640px) {
  details.sec > summary { grid-template-columns: 18px minmax(0, 1fr); padding: 12px; }
  details.sec > summary .badge-slot { grid-column: 2; grid-row: auto; justify-self: start; }
  details.sec > summary .tease { grid-column: 2; }
  details.sec > .body { padding: 12px; }
}
@media print {
  details.sec > .body { display: block !important; }
  details.sec > summary::before, .sec-tools, .top-actions, .sitenav { display: none !important; }
}

/* ---- footer ---- */
.foot { color: var(--muted); font-size: .8rem; margin-top: 24px; border-top: 1px solid var(--ring); padding-top: 12px; }

.fatal { position: fixed; inset: auto 16px 16px 16px; background: var(--banner-err); border: 1px solid var(--banner-err-ring); border-radius: 10px; padding: 12px 16px; z-index: 50; }

@media (max-width: 640px) {
  .wrap { padding: 14px 12px 40px; }
  .card { padding: 14px 12px; }
  .brand h1 { font-size: 1.1rem; }
  .tile .v { font-size: 1.35rem; }
}
