:root {
  color-scheme: dark;
  --ink: #dce3ea;
  --muted: #94a3b5;
  --line: #263442;
  --blue: #88b6e4;
  --green: #79c9b5;
  --red: #d49aa9;
  --bg: #10171f;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* {
  box-sizing: border-box;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
nav {
  margin-top: 24px;
  overflow-y: auto;
}
.brand > svg {
  vertical-align: middle;
  margin-right: 4px;
}
.sidebar-footer a {
  color: var(--muted);
  display: block;
  margin-top: 10px;
}
.download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
}
.chart-data {
  margin-top: 12px;
  font-size: 12px;
}
.chart-data summary,
details summary {
  color: var(--muted);
  cursor: pointer;
}
details p {
  color: var(--muted);
  max-width: 85ch;
}
input {
  color: var(--ink);
  background: #121c26;
  border: 1px solid var(--line);
  padding: 7px 9px;
  border-radius: 3px;
}
.map-svg image {
  filter: brightness(0.65) saturate(0.65);
}
.selected-detail {
  background: #17232e !important;
}
.map-svg text {
  fill: #dce3ea;
}
.map-svg circle:hover {
  stroke: #dce3ea;
}
@media (max-height: 760px) {
  aside {
    padding-top: 20px;
    padding-bottom: 15px;
  }
  nav a {
    padding-top: 6px;
    padding-bottom: 6px;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-variant-numeric: tabular-nums;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  border: 1px solid #334454;
  border-radius: 4px;
  background: #17212b;
  padding: 7px 11px;
  color: var(--ink);
}
button {
  cursor: pointer;
}
button:hover {
  background: #202f3b;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
input:focus-visible,
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
aside {
  width: 215px;
  position: fixed;
  inset: 0 auto 0 0;
  background: #17212b;
  border-right: 1px solid var(--line);
  padding: 29px 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  color: var(--ink);
  font-size: 21px;
  font-weight: 650;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand span {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 2px;
}
nav {
  display: grid;
  gap: 3px;
  margin-top: 36px;
}
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: #b8c3cf;
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
}
nav a.active {
  background: #22303d;
  color: #88b6e4;
  font-weight: 600;
}
.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
}
.sidebar-footer small {
  display: block;
  margin-top: 9px;
  font-size: 10px;
}
main {
  margin-left: 215px;
  padding: 28px 36px;
  max-width: 1900px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
h1 {
  font-size: 25px;
  font-weight: 600;
  margin: 0 0 5px;
}
header span {
  color: var(--muted);
  font-size: 12px;
}
.toolbar,
.controls {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.toolbar select {
  font-size: 12px;
}
.toolbar button {
  font-size: 12px;
}
#content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  background: #17212b;
  border: 1px solid var(--line);
  padding: 18px 19px;
  border-radius: 5px;
}
.metric label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.metric strong {
  display: block;
  font-size: 27px;
  font-weight: 600;
  margin: 7px 0;
  letter-spacing: -0.02em;
}
.metric strong small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.metric .comparison {
  color: var(--muted);
  font-size: 11px;
}
.good {
  color: var(--green);
}
.bad {
  color: var(--red);
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.wide {
  grid-column: 1/-1;
}
.panel {
  min-width: 0;
  background: #17212b;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 21px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 18px;
}
.panel h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.panel-head small,
.subtle,
.footnote {
  color: var(--muted);
  font-size: 11px;
}
.panel-head small {
  display: block;
  margin-top: 4px;
}
.footnote {
  margin: 14px 0 0;
}
.chart {
  position: relative;
  min-height: 230px;
}
.chart svg {
  width: 100%;
  display: block;
  touch-action: pan-y;
}
.chart-grid {
  stroke: #263442;
  stroke-width: 1;
}
.chart-axis {
  fill: #96a6b8;
  font: 12px var(--mono);
}
.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.crosshair {
  stroke: #7d8795;
  stroke-dasharray: 3 3;
  display: none;
}
.chart:hover .crosshair {
  display: block;
}
.legend {
  display: flex;
  gap: 17px;
  flex-wrap: wrap;
  margin: 6px 0;
  font-size: 11px;
  color: var(--muted);
}
.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend i {
  width: 15px;
  height: 2px;
  display: inline-block;
}
.axis-label {
  font: 10px var(--mono);
  color: var(--muted);
}
.empty {
  padding: 40px 20px;
  text-align: center;
  color: #828b96;
  background: #131e28;
  font-size: 12px;
  min-height: 150px;
  display: grid;
  place-content: center;
}
.table-scroll {
  max-height: 405px;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
th {
  text-align: left;
  font-weight: 500;
  color: #77818d;
  background: #192530;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
}
td,
th {
  padding: 10px 9px;
  border-bottom: 1px solid #263442;
}
td.num,
th.num {
  text-align: right;
  font-family: var(--mono);
}
td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.tag {
  font-size: 10px;
  background: #243542;
  color: #9bacc0;
  padding: 3px 7px;
  border-radius: 3px;
}
.bars {
  display: grid;
  gap: 14px;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.bar-track {
  background: #263b48;
  height: 7px;
  margin-top: 5px;
}
.bar-fill {
  height: 100%;
  background: var(--blue);
}
#tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  display: none;
  background: #17212b;
  border: 1px solid #334454;
  border-radius: 4px;
  box-shadow: 0 3px 12px #0001;
  padding: 10px 13px;
  font-size: 11px;
  min-width: 150px;
  max-width: 320px;
}
#tooltip strong {
  display: block;
  font-size: 12px;
  margin-bottom: 7px;
}
#tooltip .tip-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 3px 0;
}
#tooltip small {
  color: var(--muted);
}
.map-shell {
  position: relative;
  min-height: 395px;
  background: #121c26;
  border: 1px solid #263442;
}
.map-svg {
  width: 100%;
  height: 420px;
  display: block;
}
.map-shape {
  stroke: white;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.map-shape:hover {
  stroke: #263d5d;
  stroke-width: 2;
}
.map-city,
.map-node {
  cursor: pointer;
}
.map-node:hover {
  stroke: #111;
  stroke-width: 1.5;
}
.map-label {
  font: 12px sans-serif;
  fill: #3c4654;
  pointer-events: none;
}
.map-controls {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
input[type="range"] {
  flex: 1;
  accent-color: var(--blue);
  min-width: 100px;
}
.map-controls output {
  font: 11px var(--mono);
  min-width: 145px;
  text-align: right;
}
.map-scale span {
  display: block;
  flex: 1;
  height: 7px;
  background: linear-gradient(90deg, #2c689f, #efdeb9, #b13a37);
}
.map-scale {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 10px var(--mono);
  color: var(--muted);
  margin-top: 10px;
}
.scale-ramp {
  width: 140px;
  height: 7px;
  background: linear-gradient(
    to right,
    #315c94,
    #aec9df,
    #eee1b3,
    #da8a66,
    #a53e41
  );
}
.selected-detail {
  padding: 12px 15px;
  background: #17232e;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.map-caption {
  position: static;
  margin-top: 8px;
  font-size: 10px;
  color: #7d8591;
}
.map-time-note {
  color: var(--muted);
  font-size: 11px;
  margin-top: 9px;
}
.filters label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #657180;
  font-size: 11px;
  margin-right: 12px;
}
.filters input {
  accent-color: var(--blue);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.form-grid input,
.form-grid select {
  width: 100%;
  border: 1px solid #334454;
  padding: 7px;
  border-radius: 3px;
  background: #17212b;
  color: var(--ink);
}
.form-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.summary-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.summary-row label {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.summary-row strong {
  font-size: 22px;
  font-weight: 600;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.status-grid strong {
  display: block;
  font-size: 20px;
}
.error-text {
  color: var(--red);
  font-size: 11px;
}
#notice {
  padding: 12px 15px;
  border: 1px solid #dfc6ad;
  background: #302923;
  font-size: 12px;
  margin-bottom: 18px;
}
.loading {
  padding: 80px 20px;
  color: var(--muted);
  text-align: center;
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  color: var(--muted);
  font-size: 11px;
}
footer button {
  font-size: 11px;
}
.period-tabs {
  display: flex;
  gap: 4px;
}
.period-tabs button {
  padding: 4px 9px;
  font-size: 11px;
}
.period-tabs .active {
  border-color: var(--blue);
  color: var(--blue);
}
.plant-filter {
  width: 180px;
}
.chart-note {
  font-size: 10px;
  color: var(--muted);
}
nav a[aria-current="page"] {
  background: #22303d;
  color: #88b6e4;
  font-weight: 600;
}
.metric > small {
  display: block;
  overflow-wrap: anywhere;
}
.map-svg text {
  fill: #dce3ea;
}
.empty {
  padding: 36px 12px;
  color: var(--muted);
}
@media (min-width: 1500px) {
  .map-svg {
    height: 465px;
  }
  .chart {
    min-height: 260px;
  }
}
@media (max-width: 1100px) {
  main {
    padding: 25px 20px;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  aside {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 15px;
  }
  .brand {
    font-size: 17px;
  }
  .brand span,
  .sidebar-footer {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
    margin-top: 12px;
    gap: 4px;
  }
  nav a {
    white-space: nowrap;
    padding: 6px 10px;
  }
  main {
    margin: 0;
    padding: 18px 12px;
  }
  header {
    gap: 15px;
  }
  h1 {
    font-size: 21px;
  }
  .toolbar {
    justify-content: flex-end;
  }
  .metrics {
    gap: 9px;
  }
  .metric {
    padding: 13px;
  }
  .metric strong {
    font-size: 23px;
  }
  .panel {
    padding: 15px;
  }
  .map-svg {
    height: 350px;
  }
  .map-controls {
    flex-wrap: wrap;
  }
  .map-controls output {
    min-width: 100px;
  }
  .status-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-action {
    align-items: flex-start;
    flex-direction: column;
  }
  td,
  th {
    padding: 8px 5px;
    font-size: 11px;
  }
}

/* Flexible numbers and touch targets, without masking horizontal overflow. */
main,
header > div,
#content > *,
.controls > *,
.metrics > *,
.grid > *,
.status-grid > * {
  min-width: 0;
}
.controls > * {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.metric strong {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  overflow-wrap: anywhere;
}
.metric strong small {
  margin: 0;
}
.summary-row strong,
.status-grid strong,
.comparison,
#as-of,
#history-status {
  overflow-wrap: anywhere;
}
.panel-head {
  flex-wrap: wrap;
}
.panel-head small {
  max-width: 100%;
}
.legend span {
  max-width: 100%;
}
.bar-head {
  gap: 12px;
  flex-wrap: wrap;
}
.bar-head strong {
  white-space: nowrap;
}
.map-svg {
  width: 100%;
  max-width: 100%;
}
.map-controls {
  min-width: 0;
}
.map-controls input {
  min-width: 60px;
}
#tooltip {
  max-width: min(380px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overflow-wrap: anywhere;
  pointer-events: none;
}
footer {
  gap: 16px;
  flex-wrap: wrap;
}
.chart:focus-within .crosshair {
  display: block;
}
@media (max-width: 700px) {
  header {
    align-items: flex-start;
    flex-direction: column;
  }
  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }
  button,
  select,
  input:not([type="range"]),
  nav a {
    min-height: 44px;
  }
  nav {
    max-width: 100%;
    flex-shrink: 0;
  }
  nav a {
    flex-shrink: 0;
  }
  .chart {
    min-height: 240px;
  }
  .chart-axis {
    font-size: 12px;
  }
  .map-svg {
    height: auto;
    min-height: 280px;
    max-height: 450px;
  }
  .map-controls input {
    flex: 1 1 100%;
  }
  .map-controls output {
    width: 100%;
  }
  .panel-head {
    gap: 6px;
  }
  .controls > label,
  .filters > label {
    max-width: 100%;
  }
  .form-grid input,
  .form-grid select {
    font-size: 16px;
  }
}
@media (max-width: 420px) {
  .metrics,
  .form-grid,
  .status-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolbar select {
    flex: 1 1 120px;
    max-width: 100%;
  }
  .metric strong {
    font-size: 26px;
  }
  .summary-row {
    gap: 16px;
  }
}
