:root {
  --bg: #111111;
  --panel: #1b1b1b;
  --panel-soft: #242424;
  --line: #343434;
  --line-strong: #4a4a4a;
  --gold: #f2a900;
  --yellow: #f5f20a;
  --green: #9cd483;
  --blue: #1880b8;
  --red: #e75d64;
  --white: #ffffff;
  --muted: #c9c9c9;
  --dim: #8c8c8c;
  --ink: #111820;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.35;
}

h1,
h2,
p {
  margin: 0;
}

button {
  font: inherit;
}

.ops-dashboard {
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  height: 100svh;
  min-width: 0;
  background: var(--bg);
}

.ops-header {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, auto);
  gap: 16px;
  align-items: center;
  padding: 10px 16px 10px 22px;
  border-bottom: 1px solid #000;
  background: #171717;
}

.title-block h1 {
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1;
}

.title-block p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.filter-bar div {
  min-width: 124px;
}

.filter-bar span,
.filter-bar strong {
  display: block;
}

.filter-bar span {
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 750;
}

.filter-bar strong {
  margin-top: 2px;
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 500;
}

.filter-bar button {
  min-height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #0f0f0f;
  color: var(--white);
  cursor: default;
  font-weight: 800;
}

.fullscreen-control {
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #202020;
  color: var(--muted);
  cursor: pointer;
}

.fullscreen-control:hover,
.fullscreen-control:focus-visible {
  border-color: var(--green);
  color: var(--green);
  outline: none;
}

.fullscreen-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.ops-grid {
  display: grid;
  grid-template-columns: clamp(280px, 22vw, 350px) minmax(360px, 1fr) clamp(280px, 23vw, 360px);
  grid-template-rows: minmax(0, 1fr) 220px;
  gap: 8px;
  min-height: 0;
  padding: 8px;
}

.left-rail,
.right-rail {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.left-rail {
  grid-template-rows: auto auto auto;
}

.right-rail {
  grid-template-rows: minmax(0, 1.05fr) minmax(0, 0.95fr) auto;
}

.panel,
.map-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel {
  padding: 12px;
  overflow: hidden;
}

.panel h2 {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 850;
  text-transform: none;
}

.panel-heading {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  min-width: 0;
}

.panel-heading span {
  min-width: 0;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-heading .chart-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.legend-temp {
  background: var(--red);
}

.legend-pop {
  background: var(--green);
}

.status-card {
  display: grid;
  gap: 8px;
}

.status-card h2,
.kpi-stack h2 {
  color: var(--muted);
}

.status-card strong {
  color: var(--white);
  font-size: 2.25rem;
  line-height: 1.02;
}

.status-card[data-level="watch"] strong {
  color: var(--yellow);
}

.status-card[data-level="alert"] strong {
  color: var(--red);
}

.status-card p {
  color: var(--muted);
  font-size: 0.94rem;
}

.kpi-stack {
  display: grid;
  align-content: start;
  gap: 6px;
}

.kpi-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.kpi-row:last-child {
  border-bottom: 0;
}

.kpi-row span {
  color: var(--muted);
  font-size: 0.95rem;
}

.kpi-row strong {
  grid-row: span 2;
  align-self: center;
  color: var(--gold);
  font-size: 1.95rem;
  line-height: 1;
}

.kpi-row small {
  color: var(--white);
  font-size: 0.82rem;
}

.forecast-now {
  display: grid;
  gap: 6px;
  min-height: 98px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
}

.forecast-now strong {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--red);
  font-size: 2.4rem;
  line-height: 1;
}

.temp-primary {
  color: var(--red);
}

.temp-secondary {
  color: var(--muted);
  font-size: 0.52em;
  font-weight: 700;
}

.forecast-now p {
  color: var(--muted);
}

.map-panel {
  position: relative;
  overflow: hidden;
}

.map-panel .fullscreen-control {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

#risk-map {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

.map-message {
  display: grid;
  height: 100%;
  min-height: 420px;
  place-items: center;
  color: var(--muted);
}

.leaflet-container {
  background: #151515;
  font: inherit;
}

.leaflet-control-attribution {
  background: rgba(17, 17, 17, 0.76) !important;
  color: var(--muted) !important;
}

.focus-popup {
  color: var(--ink);
}

.rank-list {
  display: grid;
  overflow: auto;
}

.rank-list article {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-strong);
}

.rank-list strong {
  display: block;
  color: var(--gold);
  font-size: clamp(0.88rem, 1.05vw, 1.02rem);
  font-weight: 650;
  text-transform: uppercase;
}

.rank-list span {
  display: block;
  margin-top: 5px;
  color: var(--white);
  font-size: clamp(0.8rem, 0.95vw, 0.9rem);
}

.source-list,
.decision-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.94rem;
  list-style: none;
}

.source-list li,
.decision-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.source-list span,
.decision-list li::before {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 0.4em;
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.source-list li:nth-child(2) span {
  background: var(--blue);
}

.source-list li:nth-child(3) span {
  background: var(--yellow);
}

.source-list li:nth-child(4) span {
  background: var(--gold);
}

.source-list li:nth-child(5) span {
  background: var(--muted);
}

.bottom-panel {
  grid-column: 1 / 4;
  min-height: 0;
}

.mini-chart {
  position: relative;
  height: calc(100% - 28px);
  min-height: 160px;
}

.mini-chart svg {
  width: 100%;
  height: 100%;
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.5;
}

.chart-temp {
  fill: none;
  stroke: var(--red);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-pop {
  fill: rgba(156, 212, 131, 0.16);
  stroke: rgba(156, 212, 131, 0.78);
  stroke-width: 2;
}

.chart-guide {
  opacity: 0;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-dasharray: 4 5;
  stroke-width: 1.5;
  pointer-events: none;
}

.chart-point {
  opacity: 0;
  stroke: var(--bg);
  stroke-width: 2;
  pointer-events: none;
}

.chart-point-temp {
  fill: var(--red);
}

.chart-point-pop {
  fill: var(--green);
}

.chart-hitbox {
  fill: transparent;
  cursor: crosshair;
  outline: none;
}

.chart-hover-zone:hover .chart-guide,
.chart-hover-zone:focus-within .chart-guide,
.chart-hover-zone:hover .chart-point,
.chart-hover-zone:focus-within .chart-point {
  opacity: 1;
}

.chart-label {
  fill: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 6px;
  min-width: 188px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(17, 17, 17, 0.96);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  color: var(--white);
  font-size: 0.82rem;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip[data-placement="above"] {
  transform: translate(-50%, calc(-100% - 12px));
}

.chart-tooltip[data-placement="below"] {
  transform: translate(-50%, 12px);
}

.chart-tooltip strong {
  color: var(--white);
  font-size: 0.86rem;
}

.chart-tooltip span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
}

.chart-tooltip i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
}

@media (max-width: 1220px) {
  .ops-grid {
    grid-template-columns: 280px minmax(320px, 1fr) 280px;
  }

  .filter-bar div:nth-child(2),
  .filter-bar div:nth-child(3) {
    display: none;
  }

  .status-card strong {
    font-size: 1.9rem;
  }

  .kpi-row strong {
    font-size: 1.8rem;
  }

  .panel {
    padding: 10px;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .ops-dashboard {
    min-width: 0;
    height: auto;
  }

  .ops-header,
  .ops-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .ops-grid {
    grid-template-rows: auto;
  }

  .map-panel {
    min-height: 520px;
  }

  .bottom-panel {
    grid-column: auto;
  }
}
