:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1c2430;
  --muted: #687385;
  --line: #e3e6eb;
  --accent: #2f6fde;
}

* { box-sizing: border-box; }

/* .grid sets display, which would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

h1 { margin: 0; font-size: 18px; }

nav { display: flex; gap: 4px; margin-left: auto; }
nav a { padding: 4px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--text); background: var(--bg); }
nav a[aria-current="page"] { color: #fff; background: var(--accent); }
h1 a { color: inherit; text-decoration: none; }
h2 { margin: 8px 0 4px; font-size: 18px; }
.sub { margin: 0; color: var(--muted); }

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

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  header { flex-wrap: wrap; }
  nav { margin-left: 0; }
}

.card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.card:hover, .card:focus-visible { border-color: var(--accent); outline: none; }

.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head h2 { margin: 0; font-size: 16px; }
.total { font-size: 20px; font-weight: 600; }
.unit { color: var(--muted); font-size: 12px; font-weight: 400; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.change { font-size: 12px; font-weight: 500; }
.up { color: #c0392b; }
.down { color: #1e8449; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }

.chart { position: relative; height: 180px; margin-top: 8px; }
.chart-lg { height: 340px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

.back { color: var(--accent); text-decoration: none; }
.note { margin: 4px 0 8px; color: #8a5a00; }

.table-wrap { margin-top: 16px; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-weight: 500; }
tfoot td { font-weight: 600; border-bottom: 0; }
tbody tr.toggle { cursor: pointer; }
tbody tr.toggle:hover, tbody tr.toggle:focus-visible { background: var(--bg); outline: none; }
tbody tr.off { color: var(--muted); }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; }
