:root {
  --bg: #f7f8f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #5a6675;
  --line: #d8dee6;
  --accent: #1f6f5f;
  --warn-bg: #fff3e0;
  --warn-line: #e6a23c;
  --stale: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --panel: #1d232b;
    --text: #e6e9ed;
    --muted: #9aa5b1;
    --line: #323b46;
    --accent: #58b09c;
    --warn-bg: #33270f;
    --warn-line: #b98426;
    --stale: #e2726b;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--accent); }

.site-header {
  display: flex; flex-wrap: wrap; gap: .5rem 2rem;
  align-items: baseline; justify-content: space-between;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.site-header h1 { margin: 0; font-size: 1.25rem; }
.tagline { margin: 0; color: var(--muted); font-size: .85rem; }
.not-affiliated { margin: 0; font-size: .8rem; color: var(--muted); max-width: 34rem; }

.notice {
  padding: .6rem 1rem; background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line); font-size: .9rem;
}

.layout { display: flex; flex: 1; min-height: 0; }
.map { flex: 1; min-height: 420px; background: #a8c4d4; }
.sidebar {
  width: 340px; max-width: 45vw; overflow-y: auto;
  padding: .75rem 1rem 2rem; border-left: 1px solid var(--line); background: var(--panel);
}
.sidebar h2 { font-size: .95rem; margin: 1.1rem 0 .4rem; }
.sidebar section:first-child h2 { margin-top: .2rem; }

.layer-list { list-style: none; margin: 0; padding: 0; }
.layer-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.layer-list label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.layer-swatch { width: .75rem; height: .75rem; border-radius: 50%; flex: none; }
.layer-status { display: block; font-size: .78rem; color: var(--muted); margin: .15rem 0 0 1.7rem; }
.layer-status.stale { color: var(--stale); font-weight: 600; }
.layer-attr { font-size: .74rem; color: var(--muted); margin: .15rem 0 0 1.7rem; }

.fire-disclaimer {
  margin-top: 1rem; padding: .6rem .75rem; font-size: .84rem;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px;
}
.fire-disclaimer h2 { margin: 0 0 .3rem; font-size: .9rem; }
.fire-disclaimer p { margin: 0; }

#aemo-panel table { width: 100%; border-collapse: collapse; font-size: .84rem; }
#aemo-panel th, #aemo-panel td { text-align: right; padding: .25rem .3rem; border-bottom: 1px solid var(--line); }
#aemo-panel th:first-child, #aemo-panel td:first-child { text-align: left; }
#aemo-panel .meta { font-size: .74rem; color: var(--muted); margin-top: .35rem; }

.linkouts { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.linkouts li { padding: .2rem 0; }
.muted { color: var(--muted); font-size: .8rem; }

.site-footer {
  padding: .75rem 1rem; border-top: 1px solid var(--line);
  background: var(--panel); font-size: .8rem; color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .4rem; }

.page { max-width: 46rem; margin: 0 auto; padding: 1rem; flex: 1; }
.page h1 { font-size: 1.4rem; }
.page h2 { font-size: 1.05rem; margin-top: 1.6rem; }

.maplibregl-popup-content { color: #1c2430; font: 13px/1.45 system-ui, sans-serif; max-width: 320px; }
.popup-title { font-weight: 700; margin-bottom: .25rem; }
.popup-body { white-space: pre-wrap; word-break: break-word; }
.popup-approx { color: #8a5a00; font-style: italic; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .map { min-height: 55vh; }
  .sidebar { width: auto; max-width: none; border-left: none; border-top: 1px solid var(--line); }
}
