:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #5f6f7a;
  --line: #c9d3d9;
  --quiet: #d8f0e2;
  --watch: #fff0b8;
  --active: #ffd2a6;
  --storm: #ffc4c4;
  --low: #dce6f7;
  --high: #cbe9ee;
  --na: #eceff1;
  --warn: #ffe0b2;
  --focus: #165a72;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--focus);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
}

nav a {
  text-decoration: none;
}

.page {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.dashboard-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1,
h2 {
  margin: 0 0 8px;
  letter-spacing: 0;
}

p {
  margin: 0 0 10px;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  background: var(--panel);
}

.metric-section {
  margin: 0 0 24px;
}

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

.metric {
  min-height: 132px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 8px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-top,
.metric-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.metric-top a {
  font-weight: 650;
  color: var(--text);
}

.metric-value {
  margin: 14px 0 10px;
  font-size: 30px;
  line-height: 1.05;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.warning,
.caveat {
  color: #7a3d00;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.doc-block,
.empty,
.source-list {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.lead {
  color: var(--text);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 170px);
  border: 1px solid var(--line);
  background: var(--panel);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

th,
td {
  min-width: 112px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  background: var(--panel);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f5;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 150px;
  background: #eef3f5;
}

.sticky-col span {
  display: block;
}

.state-quiet {
  border-left-color: #2f8f5b;
  background: var(--quiet);
}

.state-watch {
  border-left-color: #b88900;
  background: var(--watch);
}

.state-active {
  border-left-color: #c26414;
  background: var(--active);
}

.state-storm {
  border-left-color: #b91d1d;
  background: var(--storm);
}

.state-low {
  border-left-color: #446b9e;
  background: var(--low);
}

.state-high {
  border-left-color: #147184;
  background: var(--high);
}

.state-na {
  border-left-color: #7d878d;
  background: var(--na);
}

.state-warn {
  border-left-color: #c26414;
  background: var(--warn);
}

.trend-up {
  color: #0d6b3f;
}

.trend-down {
  color: #9d2b2b;
}

.trend-stable,
.trend-na {
  color: var(--muted);
}

.source-list {
  margin-bottom: 18px;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .topbar,
  .dashboard-head,
  .section-head {
    display: block;
  }

  nav {
    margin-top: 10px;
  }

  .page {
    padding: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-value {
    font-size: 26px;
  }
}
