:root {
  --bg: #05080f;
  --panel: #0f1a27;
  --line: #1b2f45;
  --muted: #9aa8ba;
  --text: #d9e2ef;
  --green: #2fe08d;
  --amber: #d4b14f;
  --red: #de6473;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(circle at 12% 0%, #0c1624 0%, var(--bg) 60%, #02050a 100%);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Roboto Mono", monospace;
  font-size: 13px;
  line-height: 1.35;
}

.shell {
  width: min(1450px, 96vw);
  margin: 8px auto;
  display: grid;
  gap: 10px;
}

.ticker {
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(6, auto);
  align-items: center;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(19, 30, 45, 0.95), rgba(13, 19, 29, 0.95));
  padding: 7px 8px;
  gap: 6px;
}

.ticker-item {
  padding: 2px 10px;
  border-left: 1px solid rgba(156, 171, 189, 0.2);
  min-width: 140px;
}

.ticker-item:first-child {
  border-left: 0;
}

.ticker-item span {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.09em;
  margin-right: 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.ticker-item strong {
  font-weight: 600;
  font-size: 13px;
  display: inline-block;
}

.freshness {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-style: normal;
}

.freshness.fresh {
  color: #6ed6a9;
  border-color: rgba(110, 214, 169, 0.32);
}

.freshness.stale {
  color: #d7b95a;
  border-color: rgba(215, 185, 90, 0.34);
}

.freshness.old {
  color: #df8291;
  border-color: rgba(222, 130, 145, 0.34);
}

.grow {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
  background: linear-gradient(180deg, rgba(17, 26, 38, 0.95), rgba(11, 18, 26, 0.93));
  overflow: hidden;
}

.panel-title {
  color: var(--muted);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
}

.global-panel {
  display: grid;
  grid-template-columns: 290px 1fr;
  align-items: center;
  min-height: 330px;
}

.dial-wrap {
  display: grid;
  place-items: center;
}

.dial {
  width: 270px;
  height: 270px;
}

.dial-track,
.confidence-track {
  fill: none;
}

.dial-track {
  stroke: #1a2f45;
  stroke-width: 12;
}

.dial-tick {
  stroke: #4c6686;
  stroke-linecap: round;
}

.dial-arc {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
}

.confidence-track {
  stroke: #1c2f47;
  stroke-width: 6;
}

.confidence-ring {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.dial-score {
  font-size: 58px;
  font-weight: 700;
}

.global-metrics {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

.global-metrics strong {
  margin-left: 8px;
  font-weight: 600;
}

.window-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.info-trigger {
  display: inline-flex;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(157, 176, 196, 0.4);
  color: var(--muted);
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  line-height: 1;
  font-size: 10px;
  margin-left: 3px;
  vertical-align: 0;
}

.panel-stack {
  display: grid;
  gap: 10px;
}

.region-panel {
  min-height: 150px;
}

.region-stats {
  display: grid;
  gap: 5px;
  margin-bottom: 4px;
  font-size: 12px;
}

.region-stats div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 33, 48, 0.9);
  padding-bottom: 4px;
}

.region-stats span {
  color: var(--muted);
}

.region-stats strong {
  font-weight: 600;
}

.sparkline,
.line-chart {
  width: 100%;
  display: block;
}

.sparkline {
  height: 92px;
  margin-top: 6px;
}

.line-chart {
  height: 240px;
}

.line-wrap {
  position: relative;
}

.history-line,
.history-conf-line {
  fill: none;
  stroke-linecap: round;
}

.history-line {
  stroke: #6bc6ff;
  stroke-width: 2;
}

.history-conf-line {
  stroke: #7896ad;
  stroke-width: 1.2;
  opacity: 0.5;
}

.history-grid {
  stroke: #1b2e44;
  stroke-width: 1;
}

.history-grid.thick {
  stroke: #233a55;
  opacity: 0.85;
}

.history-grid.dashed {
  stroke-dasharray: 3 5;
  opacity: 0.35;
}

.chart-panel .panel-title {
  margin-bottom: 4px;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #0a121c;
  color: #e2ecfa;
  border: 1px solid #24364b;
  font-size: 11px;
  padding: 4px 7px;
  display: none;
  z-index: 5;
  border-radius: 3px;
}

.score-high { color: var(--green); }
.score-mid { color: var(--amber); }
.score-low { color: var(--red); }

.unavailable {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.86);
  color: #a3b3c3;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  z-index: 4;
}

.show-unavailable {
  display: flex;
}

.status {
  color: #95a5b8;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.status.ok { color: #43d89a; }
.status.warn { color: #d7b447; }
.status.err { color: #e87b87; }
.status-error {
  color: #f0b3bd;
  font-size: 11px;
  max-width: 75%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .global-panel {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .global-metrics {
    width: 100%;
    margin-top: 4px;
  }

  .ticker {
    grid-template-columns: repeat(3, auto);
  }
}
