:root {
  --bg: #f7f4ee;
  --card: #ffffff;
  --text: #1f2a30;
  --text-soft: #52606a;
  --muted: #86929a;
  --accent: #1d5f7a;
  --accent-2: #b5562f;
  --tag-bg: #e4eef2;
  --border: #e3ddd2;
  --grid: #ece7de;
  --warn-bg: #fbeee3;
  --radius: 12px;
  --max: 1040px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
  /* chart series: validated as a set (CVD + normal vision) on both surfaces */
  --s-conv: #4a3aa7;
  --s-wind: #1baf7a;
  --s-solar: #eda100;
  --s-line: #52606a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11181c;
    --card: #182227;
    --text: #e6ecef;
    --text-soft: #a9b6bd;
    --muted: #74838b;
    --accent: #6fb3cf;
    --accent-2: #e08a64;
    --tag-bg: #1f3540;
    --border: #26343b;
    --grid: #222f35;
    --warn-bg: #3a2a20;
    --s-conv: #9085e9;
    --s-wind: #199e70;
    --s-solar: #c98500;
    --s-line: #a9b6bd;
  }
}
:root[data-theme="dark"] {
  --bg: #11181c;
  --card: #182227;
  --text: #e6ecef;
  --text-soft: #a9b6bd;
  --muted: #74838b;
  --accent: #6fb3cf;
  --accent-2: #e08a64;
  --tag-bg: #1f3540;
  --border: #26343b;
  --grid: #222f35;
  --warn-bg: #3a2a20;
  --s-conv: #9085e9;
  --s-wind: #199e70;
  --s-solar: #c98500;
  --s-line: #a9b6bd;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
}
a { color: var(--accent); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.brand {
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-2); font-weight: 600; text-decoration: none;
}
.site { font: 700 20px/1.2 var(--font-display); color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px; border-radius: 999px; color: var(--text-soft);
  text-decoration: none; font-size: 15px;
}
.nav a[aria-current="page"] { background: var(--tag-bg); color: var(--accent); font-weight: 600; }

.hero { padding: 40px 0 24px; }
h1 { margin: 0 0 12px; font: 700 clamp(30px, 5.5vw, 46px)/1.12 var(--font-display); }
h2 { margin: 40px 0 14px; font: 700 26px/1.25 var(--font-display); }
.lead { margin: 0; max-width: 660px; font-size: 18px; color: var(--text-soft); }

.btn {
  display: inline-block; margin-top: 18px; padding: 10px 18px; border-radius: 999px;
  background: var(--accent); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 16px;
}
.btn:hover { filter: brightness(1.08); }

.meta { color: var(--muted); font-size: 14px; }
.warn {
  margin: 16px 0 0; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-bg); color: var(--text); font-size: 15px;
}

.strip {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  margin: 8px 0 0; padding: 14px 18px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-soft); text-decoration: none; font-size: 16px;
}
.strip strong { color: var(--text); font-size: 20px; }
.strip:hover { border-color: var(--accent); }
.strip .go { margin-left: auto; color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; align-items: center; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text-soft); text-decoration: none; font-size: 15px;
}
.chip[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.search {
  flex: 1 1 220px; min-width: 0; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; font-size: 15px;
}

.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.row {
  display: grid; grid-template-columns: 150px 1fr; gap: 4px 18px;
  padding: 14px 18px; border-top: 1px solid var(--border);
}
.row:first-child { border-top: 0; }
.row .time { font-variant-numeric: tabular-nums; font-weight: 600; }
.row .dur { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.row .town { font-weight: 600; }
.row .alt { color: var(--muted); font-size: 14px; font-weight: 400; }
.row .where { color: var(--text-soft); font-size: 15px; }
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 999px; margin-right: 6px;
  background: var(--tag-bg); color: var(--accent); font-size: 13px; font-weight: 600;
}
.fault .time { color: var(--accent-2); }
@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
}
.empty { padding: 22px 18px; color: var(--text-soft); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* grid dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 8px; }
.tile { padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.tile .label { color: var(--text-soft); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 4px; }
.tile .sub { color: var(--muted); font-size: 13px; }
.tile.hero-tile { grid-column: span 2; }
@media (min-width: 900px) {
  .tiles { grid-template-columns: 2fr repeat(4, 1fr); }
  .tile.hero-tile { grid-column: auto; }
}
.tile.hero-tile .value { font-size: 52px; }
@media (max-width: 420px) {
  .tile.hero-tile { grid-column: auto; }
  .tile.hero-tile .value { font-size: 40px; }
}
.key { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.key.line { width: 14px; height: 0; border-top: 2px dashed var(--s-line); border-radius: 0; }

.card { padding: 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card .meta { margin: 0 0 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font-size: 14px; color: var(--text-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.axis text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.axis line { stroke: var(--grid); stroke-width: 1; }
.cross { stroke: var(--text-soft); stroke-width: 1; }
.cap { fill: var(--text-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 170px;
  padding: 10px 12px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--border); box-shadow: 0 6px 20px rgba(0,0,0,.12);
  font-size: 14px; line-height: 1.45;
}
.tip .h { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r b { font-weight: 600; min-width: 64px; font-variant-numeric: tabular-nums; }
.tip .r i { width: 12px; height: 0; border-top: 2px solid; flex: none; }
.tip .r span { color: var(--text-soft); }
.tip .total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

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

.records { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-soft); font-weight: 600; font-size: 13px; }
.scroll { overflow-x: auto; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); font-size: 15px; }

.note { color: var(--text-soft); font-size: 15px; max-width: 720px; }
.prose { max-width: 720px; }
.prose p, .prose li { color: var(--text-soft); }

.foot { margin: 56px 0 0; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.foot a { color: var(--text-soft); }
