@import url("tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base) / 1.55 var(--font);
}
a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1 { font-size: var(--text-xl); margin: 0 0 var(--space-4); }
h2 { font-size: var(--text-lg); margin: var(--space-6) 0 var(--space-3); padding-bottom: var(--space-1); border-bottom: 1px solid var(--border); }
code { font-family: var(--font-mono); font-size: 0.92em; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5);
  max-width: var(--measure); margin: 0 auto; padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; color: var(--text); text-decoration: none; margin-right: auto; }
.site-header nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.site-header nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
main { max-width: var(--measure); margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-6); }
.env-banner {
  margin: 0; padding: var(--space-2) var(--space-4); text-align: center; font-size: var(--text-sm); font-weight: 600;
  background: var(--warn-bg); color: var(--warn);
}
.lead { color: var(--muted); max-width: 40rem; }
.muted { color: var(--muted); }

/* forms */
label { display: block; margin: var(--space-4) 0; font-weight: 550; }
input, textarea {
  display: block; width: 100%; margin-top: var(--space-1); padding: var(--space-2) var(--space-3);
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
button, .button {
  font: inherit; padding: var(--space-2) var(--space-4); border-radius: var(--radius); cursor: pointer;
  color: var(--bg); background: var(--accent); border: 0;
}
.ok { color: var(--ok); }
.err { color: var(--err); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--space-2) var(--space-3) var(--space-2) 0; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* dashboard */
.ranges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); }
.ranges a {
  padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; color: var(--text); font-size: var(--text-sm);
}
.ranges a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); margin: var(--space-3) 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: var(--space-3); margin: var(--space-4) 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
.card .label { color: var(--muted); font-size: var(--text-sm); }
.card .value { font-size: var(--text-lg); font-weight: 650; font-variant-numeric: tabular-nums; }
.card .sub { color: var(--muted); font-size: var(--text-sm); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: var(--space-4); }
figure.panel { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
figure.panel figcaption { font-weight: 600; margin-bottom: var(--space-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: var(--space-2) 0 0; padding: 0; list-style: none; font-size: var(--text-sm); color: var(--muted); }
.legend li::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: var(--space-2); border-radius: 2px; background: currentColor; }
.legend li.s1::before { background: var(--c1); }
.legend li.s2::before { background: var(--c2); }
.legend li.s3::before { background: var(--c3); }
.legend li.s4::before { background: var(--c4); }

svg.chart { display: block; width: 100%; height: auto; }
svg.chart text { fill: var(--muted); font: 11px var(--font); }
svg.chart text.empty { font-size: 13px; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .line.s1 { stroke: var(--c1); }
svg.chart .line.s2 { stroke: var(--c2); }
svg.chart .line.s3 { stroke: var(--c3); }
svg.chart .line.s4 { stroke: var(--c4); }
svg.chart .bar.s1 { fill: var(--c1); }
svg.chart .bar.s2 { fill: var(--c2); }
svg.chart .bar.s3 { fill: var(--c3); }
svg.chart .bar.s4 { fill: var(--c4); }
