:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --surface-strong: #dfe9e4;
  --ink: #14211c;
  --muted: #66746e;
  --line: #d7dfda;
  --teal: #007f7a;
  --teal-soft: #dcefeb;
  --amber: #b66a16;
  --amber-soft: #fff0dc;
  --blue: #386fa4;
  --blue-soft: #e3eef8;
  --green: #2f7d4e;
  --green-soft: #e3f2e8;
  --red: #a84235;
  --red-soft: #fde8e5;
  --shadow: 0 18px 42px rgba(22, 34, 29, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  background: #16251f;
  color: #f5faf7;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: #24483d;
  color: #e4fff5;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #9eb3aa;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.05;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d4e5dd;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item svg,
.icon-button svg {
  width: 18px;
  height: 18px;
}

.sidebar-status {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.sidebar-status strong {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.sidebar-status span {
  color: #bad2c7;
  font-size: 0.86rem;
  line-height: 1.35;
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.station-title span {
  color: var(--muted);
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

select,
.segment,
.icon-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

select {
  max-width: 190px;
  padding: 0 34px 0 12px;
  border-radius: 8px;
}

.segmented-control {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segment {
  min-width: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--teal);
  color: #ffffff;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  border-radius: 8px;
}

.icon-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.data-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.data-status.live {
  border-color: #a8d5bf;
  background: var(--green-soft);
  color: var(--green);
}

.data-status.static {
  border-color: #b7ddd4;
  background: var(--teal-soft);
  color: var(--teal);
}

.data-status.missing {
  border-color: #f1c997;
  background: var(--amber-soft);
  color: var(--amber);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel,
.day-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 142px;
  padding: 18px;
}

.metric-card.primary {
  background: #f7fffc;
  border-color: #b7ddd4;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  font-size: clamp(2.3rem, 5vw, 3.2rem);
  font-weight: 850;
  line-height: 0.95;
}

.metric-value.compact {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.unit-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.metric-caption {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.forecast-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.day-tile {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 14px;
  box-shadow: none;
}

.day-tile span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.day-tile strong {
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  line-height: 1;
}

.day-tile small {
  color: var(--muted);
  font-weight: 700;
}

.day-tile.hot {
  background: var(--amber-soft);
  border-color: #f1c997;
}

.day-tile.wet {
  background: var(--blue-soft);
  border-color: #b8d3ee;
}

.day-tile.mild {
  background: var(--green-soft);
  border-color: #b9dfc6;
}

.day-tile.cool {
  background: var(--blue-soft);
  border-color: #b8d3ee;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.wide {
  grid-column: span 1;
}

.panel.full {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.toggle-row input {
  accent-color: var(--teal);
}

.chart-frame {
  position: relative;
  height: 360px;
  min-height: 280px;
}

.compact-chart {
  height: 270px;
  min-height: 240px;
}

.verification-chart {
  height: 300px;
  min-height: 240px;
}

.source-table {
  display: grid;
  gap: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: 1.35fr 0.8fr 1fr 110px;
  gap: 12px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.source-row.header {
  min-height: auto;
  border: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.status-pill.live {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.delayed {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.stable {
  background: var(--teal-soft);
  color: var(--teal);
}

.path-block {
  overflow-x: auto;
  margin: 0;
  min-height: 174px;
  padding: 14px;
  border-radius: 8px;
  background: #17231f;
  color: #dff7ef;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre;
}

.quality-list,
.diagnostic-grid {
  display: grid;
  gap: 10px;
}

.quality-list div,
.diagnostic-grid div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.quality-list div:last-child,
.diagnostic-grid div:last-child {
  border-bottom: 0;
}

.quality-list span,
.diagnostic-grid span {
  color: var(--muted);
  font-weight: 700;
}

.diagnostic-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.diagnostic-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.diagnostic-grid strong {
  font-size: 1.25rem;
}

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

.roadmap-step {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.roadmap-step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 850;
}

.roadmap-step.complete {
  border-color: #a8d5bf;
  background: var(--green-soft);
}

.roadmap-step small {
  color: var(--muted);
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(20px);
  padding: 12px 14px;
  border-radius: 8px;
  background: #14211c;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px 18px;
  }

  .brand-lockup,
  .sidebar-status {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .diagnostic-grid,
  .roadmap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main-panel {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  select {
    flex: 1 1 180px;
    max-width: none;
  }

  .metric-grid,
  .forecast-strip,
  .diagnostic-grid,
  .roadmap {
    grid-template-columns: 1fr;
  }

  .source-row,
  .source-row.header {
    grid-template-columns: 1fr;
  }

  .source-row.header {
    display: none;
  }

  .chart-frame {
    height: 300px;
  }
}
