:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 28% 8%, var(--sky-glow), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  color: var(--text);
}

body[data-theme="night-ops"] {
  --bg: #03131f;
  --bg-deep: #02070d;
  --panel: rgba(6, 27, 43, 0.72);
  --panel-strong: rgba(10, 38, 58, 0.9);
  --border: rgba(78, 181, 255, 0.3);
  --text: #e8f6ff;
  --muted: #8eabc1;
  --blue: #38a8ff;
  --green: #67e48a;
  --amber: #f4ba25;
  --red: #ff5570;
  --violet: #a571ff;
  --sky-glow: rgba(39, 141, 255, 0.26);
}

body[data-theme="red-observatory"] {
  --bg: #12070a;
  --bg-deep: #040204;
  --panel: rgba(31, 9, 13, 0.74);
  --panel-strong: rgba(48, 12, 18, 0.9);
  --border: rgba(255, 91, 110, 0.28);
  --text: #ffecef;
  --muted: #c28d95;
  --blue: #73b7ff;
  --green: #77d98d;
  --amber: #ffbd4a;
  --red: #ff4f68;
  --violet: #c790ff;
  --sky-glow: rgba(255, 45, 82, 0.2);
}

body[data-theme="control-room"] {
  color-scheme: light;
  --bg: #eef5f7;
  --bg-deep: #dce8ec;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(38, 105, 150, 0.22);
  --text: #0d2635;
  --muted: #537082;
  --blue: #117bc0;
  --green: #16834d;
  --amber: #b67800;
  --red: #c9344d;
  --violet: #6a49c7;
  --sky-glow: rgba(17, 123, 192, 0.18);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
}

select {
  color: var(--text);
  border-color: color-mix(in srgb, var(--blue) 48%, transparent);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--blue) 16%, transparent), transparent 70%),
    color-mix(in srgb, var(--panel-strong) 88%, #000);
  box-shadow: inset 0 0 16px color-mix(in srgb, var(--blue) 10%, transparent);
}

select:focus {
  outline: 2px solid color-mix(in srgb, var(--blue) 70%, transparent);
  outline-offset: 2px;
}

select option {
  color: var(--text);
  background: #061927;
}

button {
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
}

.app-shell {
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(270px, 0.9fr) minmax(390px, auto) minmax(620px, 1.1fr);
  gap: 16px;
  align-items: center;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--bg-deep) 84%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  overflow-x: auto;
}

.brand,
.top-actions,
nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  min-width: 335px;
  overflow: hidden;
}

.brand-logo {
  flex: 0 0 auto;
  width: clamp(280px, 20vw, 315px);
  max-width: 100%;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--blue) 38%, transparent));
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

nav {
  justify-content: center;
  min-width: 0;
}

nav button.active,
.theme-button.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 55%, transparent), 0 0 18px color-mix(in srgb, var(--blue) 20%, transparent);
}

.top-actions {
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.top-actions select:first-child {
  width: clamp(150px, 13vw, 230px);
}

.top-actions button {
  flex: 0 0 auto;
}

.auto-refresh-toggle {
  min-height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  white-space: nowrap;
}

.auto-refresh-toggle input {
  min-height: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.refresh-interval {
  flex: 0 0 76px;
  width: 76px;
}

.refresh-stamp {
  flex: 0 0 auto;
  min-width: 88px;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.content {
  width: min(1640px, calc(100% - 44px));
  margin: 22px auto 60px;
  min-width: 0;
}

.forecast-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.forecast-card,
.metric-card,
.glass-panel {
  min-width: 0;
  border: 1px solid var(--border);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--panel-strong) 85%, transparent), var(--panel)),
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.1), transparent 42%);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), inset 0 0 32px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
}

.forecast-card {
  min-height: 134px;
  padding: 14px;
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.forecast-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.forecast-card-body {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.forecast-card strong {
  display: block;
  font-size: clamp(1.02rem, 1vw, 1.22rem);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forecast-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.forecast-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.forecast-svg {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--icon-tone) 70%, transparent);
  background:
    radial-gradient(circle at 34% 24%, color-mix(in srgb, var(--icon-tone) 34%, transparent), transparent 36%),
    linear-gradient(145deg, color-mix(in srgb, var(--icon-tone) 13%, transparent), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--icon-tone) 15%, transparent), 0 0 22px color-mix(in srgb, var(--icon-tone) 20%, transparent);
}

.forecast-svg svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.forecast-svg path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 0 5px currentColor);
}

.forecast-svg .blue {
  color: var(--blue);
  stroke: var(--blue);
}

.forecast-svg .green {
  color: var(--green);
  stroke: var(--green);
}

.forecast-svg .amber {
  color: var(--amber);
  stroke: var(--amber);
}

.forecast-svg .red {
  color: var(--red);
  stroke: var(--red);
}

.forecast-svg .blue-fill {
  fill: color-mix(in srgb, var(--blue) 28%, transparent);
  stroke: var(--blue);
}

.forecast-svg .amber-fill {
  fill: color-mix(in srgb, var(--amber) 70%, transparent);
  stroke: var(--amber);
}

.forecast-svg .red-fill {
  fill: color-mix(in srgb, var(--red) 65%, transparent);
  stroke: var(--red);
}

.forecast-svg.rain-heavy,
.forecast-svg.storm-severe,
.forecast-svg.dew-high,
.forecast-svg.astro-bad {
  --icon-tone: var(--red);
}

.forecast-svg.rain-watch,
.forecast-svg.storm-watch,
.forecast-svg.dew-watch,
.forecast-svg.astro-mixed {
  --icon-tone: var(--amber);
}

.forecast-svg.rain-clear,
.forecast-svg.storm-calm,
.forecast-svg.dew-clear,
.forecast-svg.astro-good {
  --icon-tone: var(--green);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 20px 0 12px;
}

.section-head h2,
.glass-panel h2,
.glass-panel h3 {
  margin: 0;
  font-weight: 650;
}

.section-head span {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(120px, 1fr));
  gap: 10px;
}

.metric-card {
  min-height: 118px;
  padding: 18px 14px;
  border-radius: 8px;
  display: grid;
  align-content: center;
  text-align: center;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: clamp(1.8rem, 2.2vw, 2.7rem);
  line-height: 1.05;
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.good {
  --tone: var(--green);
  border-color: color-mix(in srgb, var(--tone) 55%, transparent);
}

.warn {
  --tone: var(--amber);
  border-color: color-mix(in srgb, var(--tone) 60%, transparent);
}

.danger,
.unsafe {
  --tone: var(--red);
  border-color: color-mix(in srgb, var(--tone) 60%, transparent);
}

.info,
.safe {
  --tone: var(--blue);
  border-color: color-mix(in srgb, var(--tone) 55%, transparent);
}

.neutral,
.warning {
  --tone: var(--violet);
}

.good strong,
.good em {
  color: var(--green);
}

.warn strong,
.warn em {
  color: var(--amber);
}

.danger strong,
.danger em,
.unsafe {
  color: var(--red);
}

.info strong,
.safe {
  color: var(--blue);
}

.trend-row {
  display: grid;
  grid-template-columns: 86px repeat(3, minmax(130px, 1fr)) 42px repeat(3, minmax(130px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}

.trend-label {
  color: var(--text);
  align-self: center;
}

.trend-label span {
  display: block;
  color: var(--blue);
  margin-top: 4px;
}

.divider-line {
  align-self: center;
  height: 4px;
  border-radius: 999px;
  background: var(--violet);
  box-shadow: 0 0 16px var(--violet);
}

.slp-trend-icon {
  align-self: center;
  justify-self: center;
  min-width: 42px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--violet);
  font-size: 1.6rem;
  font-weight: 800;
  text-shadow: 0 0 16px var(--violet);
  white-space: nowrap;
}

.slp-trend-icon.falling_fast,
.slp-trend-icon.falling_slightly {
  color: var(--blue);
  text-shadow: 0 0 14px var(--blue);
}

.slp-trend-icon.rising_fast,
.slp-trend-icon.rising_slightly {
  color: var(--blue);
  text-shadow: 0 0 14px var(--blue);
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.6fr;
  gap: 14px;
  margin-top: 20px;
}

.glass-panel {
  border-radius: 8px;
  padding: 20px;
}

.glass-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.glass-panel small {
  color: var(--muted);
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.panel-title span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-window-select {
  min-height: 34px;
  width: 78px;
  padding: 0 8px;
  font-size: 0.9rem;
}

.compact-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  margin: 14px 0 0;
}

.compact-kv dt {
  color: var(--muted);
}

.compact-kv dd {
  margin: 0;
}

.safety-explanation-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.safety-explanation-panel.good {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), inset 0 0 30px color-mix(in srgb, var(--green) 7%, transparent);
}

.safety-explanation-panel.warn {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), inset 0 0 30px color-mix(in srgb, var(--amber) 9%, transparent);
}

.safety-explanation-panel.danger {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), inset 0 0 30px color-mix(in srgb, var(--red) 10%, transparent);
}

.safety-explanation-panel.info {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), inset 0 0 30px color-mix(in srgb, var(--blue) 8%, transparent);
}

.verdict.good {
  color: var(--green);
}

.verdict.info {
  color: var(--blue);
}

.verdict.warn {
  color: var(--amber);
}

.verdict.danger {
  color: var(--red);
}

.safety-evidence-list {
  display: grid;
  gap: 8px;
}

.safety-evidence {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone) 8%, transparent);
}

.safety-evidence span {
  color: var(--tone);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.safety-evidence p {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
}

.risk-meter,
.mini-bar {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.risk-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
}

.risk-meter.confidence span {
  background: linear-gradient(90deg, color-mix(in srgb, var(--amber) 42%, var(--green)), var(--amber));
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.health-grid > div {
  min-height: 104px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.health-grid span,
.health-grid small {
  display: block;
  color: var(--muted);
}

.health-grid strong {
  display: block;
  margin: 8px 0;
  font-size: 1.6rem;
}

.station-health-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.health-readiness-line {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--tone) 42%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone) 7%, transparent);
}

.health-readiness-line strong {
  color: var(--tone);
}

.health-readiness-line small {
  color: var(--muted);
  line-height: 1.35;
}

.health-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.health-detail-grid > div {
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.health-detail-grid span,
.health-detail-grid small {
  display: block;
  color: var(--muted);
}

.health-detail-grid span {
  font-size: 0.78rem;
  text-transform: uppercase;
}

.health-detail-grid strong {
  display: block;
  margin: 6px 0 3px;
  font-size: 1.05rem;
}

.health-note-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.health-note-list span {
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--tone) 38%, transparent);
  border-radius: 999px;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 8%, transparent);
  font-size: 0.82rem;
}

.system-health-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.system-component-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.system-component {
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--tone) 42%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone) 6%, transparent);
}

.system-component span,
.system-component small,
.system-component em {
  min-width: 0;
  color: var(--muted);
}

.system-component span {
  text-transform: uppercase;
  font-size: 0.76rem;
}

.system-component strong {
  color: var(--tone);
  font-size: 1rem;
  text-transform: uppercase;
}

.system-component small {
  line-height: 1.3;
}

.system-component em {
  font-size: 0.76rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.system-health-empty {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--tone) 36%, transparent);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--tone) 6%, transparent);
}

.mini-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-legend {
  margin-top: 16px;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 7px;
  vertical-align: middle;
  border-radius: 99px;
}

.chart-legend .temp::before {
  background: var(--blue);
}

.chart-legend .rh::before {
  background: var(--red);
}

.chart-legend .dew::before {
  background: var(--green);
}

.chart-legend .slp::before {
  background: var(--violet);
}

.chart-legend .battery::before {
  background: var(--amber);
}

.telemetry-legend span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--border) 74%, transparent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.telemetry-chart {
  width: 100%;
  height: clamp(260px, 28vw, 360px);
  display: block;
  margin-top: 12px;
}

.telemetry-chart-bg {
  fill: color-mix(in srgb, var(--panel-strong) 92%, #000);
  stroke: color-mix(in srgb, var(--blue) 28%, transparent);
  stroke-width: 1.1;
}

.telemetry-plot-frame {
  fill: color-mix(in srgb, var(--blue) 5%, transparent);
  stroke: color-mix(in srgb, var(--border) 76%, transparent);
  stroke-width: 1;
}

.telemetry-grid-line {
  stroke: color-mix(in srgb, var(--border) 58%, transparent);
  stroke-width: 0.8;
}

.telemetry-grid-line.vertical {
  stroke-dasharray: 5 9;
  opacity: 0.72;
}

.telemetry-y-label,
.telemetry-x-label {
  fill: var(--muted);
  font-size: 13px;
}

.telemetry-y-label {
  text-transform: uppercase;
}

.telemetry-series polyline {
  fill: none;
  stroke: var(--series-color);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--series-color) 42%, transparent));
}

.telemetry-series circle {
  fill: var(--series-color);
  stroke: color-mix(in srgb, var(--bg-deep) 86%, transparent);
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.telemetry-chart-state {
  min-height: clamp(240px, 26vw, 330px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  margin-top: 12px;
  border: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 7%, transparent), transparent 76%),
    rgba(0, 0, 0, 0.08);
  text-align: center;
}

.telemetry-chart-state strong {
  color: var(--text);
}

.chart-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.chart-stat {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.chart-stat small {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.chart-stat strong {
  color: var(--text);
  font-size: clamp(0.92rem, 1vw, 1.08rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.chart-stat em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.chart-stat em.positive {
  color: var(--green);
}

.chart-stat em.negative {
  color: var(--red);
}

.chart-axis {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-axis span {
  text-align: center;
}

.chart-axis span:first-child {
  text-align: left;
}

.chart-axis span:last-child {
  text-align: right;
}

.verdict,
.state-badge {
  display: inline-block;
  margin: 16px 0 8px;
  font-size: clamp(2rem, 3vw, 4rem);
  line-height: 1;
  text-transform: uppercase;
}

.sparkline {
  width: 100%;
  height: 48px;
  display: block;
  margin-top: 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.history-lab {
  display: grid;
  gap: 14px;
}

.history-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.history-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  min-width: 120px;
}

.history-controls span {
  margin-left: auto;
  color: var(--muted);
}

.history-chart-panel {
  min-height: 430px;
}

.history-legend span::before {
  background: var(--legend-color);
}

.history-series-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--legend-color) 44%, transparent);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.history-series-toggle.active {
  color: var(--text);
  background: color-mix(in srgb, var(--legend-color) 12%, transparent);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--legend-color) 12%, transparent);
}

.history-series-toggle input {
  min-height: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--legend-color);
}

.history-series-toggle span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 7px;
  vertical-align: middle;
  border-radius: 99px;
  background: var(--legend-color);
}

.history-chart {
  width: 100%;
  height: clamp(260px, 32vw, 430px);
  display: block;
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent),
    rgba(0, 0, 0, 0.12);
}

.history-grid line {
  stroke: color-mix(in srgb, var(--border) 55%, transparent);
  stroke-width: 0.35;
}

.history-cursor-line {
  stroke: var(--amber);
  stroke-width: 0.65;
  filter: drop-shadow(0 0 4px var(--amber));
}

.history-incident-band {
  opacity: 0.14;
  cursor: pointer;
}

.history-incident-band.info {
  fill: var(--blue);
}

.history-incident-band.watch {
  fill: var(--amber);
}

.history-incident-band.warning {
  fill: var(--red);
}

.history-incident-band.critical {
  fill: #ff225d;
}

.history-incident-band.selected {
  opacity: 0.32;
}

.history-incident-dot {
  cursor: pointer;
  stroke: rgba(2, 10, 18, 0.95);
  stroke-width: 0.35;
  filter: drop-shadow(0 0 4px currentColor);
}

.history-incident-dot.info {
  fill: var(--blue);
}

.history-incident-dot.watch {
  fill: var(--amber);
}

.history-incident-dot.warning {
  fill: var(--red);
}

.history-incident-dot.critical {
  fill: #ff225d;
}

.history-incident-dot.selected {
  r: 2.15;
}

.history-scrubber {
  width: 100%;
  padding: 0;
  accent-color: var(--amber);
  margin-top: 10px;
}

.history-replay-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(520px, 2fr);
  gap: 10px;
}

.history-snapshot-grid,
.history-event-grid {
  display: grid;
  gap: 10px;
}

.history-snapshot-grid {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
}

.history-event-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  margin-top: 14px;
}

.history-replay-narrative,
.history-snapshot-card,
.history-event-card {
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 8px;
  padding: 14px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--blue) 14%, transparent), transparent 44%),
    rgba(255, 255, 255, 0.035);
}

.history-replay-narrative {
  min-height: 100%;
  display: grid;
  align-content: center;
  border-color: color-mix(in srgb, var(--blue) 55%, transparent);
}

.history-replay-narrative.watch {
  border-color: color-mix(in srgb, var(--amber) 65%, transparent);
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--amber) 8%, transparent);
}

.history-replay-narrative.warning,
.history-replay-narrative.critical {
  border-color: color-mix(in srgb, var(--red) 65%, transparent);
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--red) 9%, transparent);
}

.history-snapshot-card span,
.history-snapshot-card small,
.history-replay-narrative span,
.history-replay-narrative small,
.history-event-card span,
.history-event-card small {
  display: block;
  color: var(--muted);
}

.history-snapshot-card strong,
.history-replay-narrative strong,
.history-event-card strong {
  display: block;
  margin: 6px 0;
  font-size: clamp(1.2rem, 1.4vw, 1.9rem);
  color: var(--text);
}

.history-replay-narrative strong {
  font-size: clamp(1.05rem, 1.25vw, 1.45rem);
  line-height: 1.35;
}

.history-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.history-filter-row button {
  min-height: 32px;
  padding: 0 12px;
}

.history-filter-row button span {
  margin-left: 6px;
  color: var(--muted);
}

.history-event-card {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.history-event-card:hover,
.history-event-card.selected {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 0 18px color-mix(in srgb, var(--blue) 14%, transparent);
}

.history-event-card.watch {
  border-color: color-mix(in srgb, var(--amber) 58%, transparent);
}

.history-event-card.warning,
.history-event-card.critical {
  border-color: color-mix(in srgb, var(--red) 58%, transparent);
}

.history-event-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.empty-history {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-top: 14px;
}

.replay-theater {
  display: grid;
  gap: 14px;
}

.replay-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  border-color: color-mix(in srgb, var(--tone) 58%, transparent);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--tone) 13%, transparent), transparent 62%),
    linear-gradient(145deg, color-mix(in srgb, var(--panel-strong) 88%, transparent), var(--panel));
}

.replay-hero > div,
.replay-verdict {
  display: grid;
  align-content: center;
}

.replay-hero span,
.replay-verdict span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.replay-hero h2 {
  margin: 8px 0;
  font-size: clamp(2.2rem, 4.2vw, 5.6rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.replay-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.replay-verdict {
  min-height: 180px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--tone) 58%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone) 9%, transparent);
}

.replay-verdict strong {
  display: block;
  margin: 9px 0;
  color: var(--tone);
  font-size: clamp(1.65rem, 2.4vw, 3.2rem);
  line-height: 0.98;
}

.replay-verdict small {
  line-height: 1.45;
}

.replay-controls label {
  min-width: 260px;
}

.replay-stage {
  display: grid;
  grid-template-columns: minmax(560px, 1.6fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: stretch;
}

.replay-chart-panel {
  min-height: 540px;
}

.replay-chart {
  height: clamp(330px, 34vw, 520px);
  border-color: color-mix(in srgb, var(--amber) 42%, var(--border));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--amber) 6%, transparent), transparent 70%),
    rgba(0, 0, 0, 0.14);
}

.replay-cursor-line {
  stroke-width: 0.9;
}

.replay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.replay-legend span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--legend-color) 44%, transparent);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--legend-color) 8%, transparent);
}

.replay-legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 3px;
  margin-right: 7px;
  border-radius: 99px;
  background: var(--legend-color);
}

.replay-narrative-panel {
  display: grid;
  align-content: start;
  gap: 16px;
  border-color: color-mix(in srgb, var(--tone) 58%, transparent);
}

.replay-narrative-panel > span {
  color: var(--muted);
}

.replay-narrative-panel h3 {
  font-size: clamp(1.6rem, 2vw, 2.6rem);
}

.replay-narrative-panel strong {
  color: var(--text);
  font-size: clamp(1.05rem, 1.25vw, 1.45rem);
  line-height: 1.38;
}

.replay-evidence-grid {
  grid-template-columns: repeat(8, minmax(130px, 1fr));
}

.replay-evidence-grid .metric-card {
  min-height: 104px;
}

.replay-evidence-grid .metric-card strong {
  font-size: clamp(1.25rem, 1.55vw, 2rem);
}

.replay-lower-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
  gap: 16px;
}

.replay-milestone-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.replay-milestone {
  min-height: 94px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 68%),
    rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.replay-milestone:hover,
.replay-milestone.selected {
  transform: translateY(-1px);
  border-color: var(--amber);
  box-shadow: 0 0 18px color-mix(in srgb, var(--amber) 13%, transparent);
}

.replay-milestone span,
.replay-milestone small {
  color: var(--muted);
}

.replay-milestone strong {
  color: var(--text);
  font-size: 1.2rem;
}

.replay-event-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.network-lab {
  display: grid;
  gap: 14px;
}

.network-summary {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.network-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.6fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: stretch;
}

.network-map-panel,
.network-detail-panel {
  min-height: 100%;
}

.network-map {
  width: 100%;
  height: clamp(360px, 40vw, 560px);
  display: block;
  margin-top: 16px;
}

.network-map-bg {
  fill: color-mix(in srgb, var(--panel-strong) 94%, #000);
  stroke: color-mix(in srgb, var(--blue) 32%, transparent);
  stroke-width: 1.4;
}

.network-plot-frame {
  fill: color-mix(in srgb, var(--blue) 6%, transparent);
  stroke: color-mix(in srgb, var(--border) 86%, transparent);
  stroke-width: 1.2;
}

.network-grid-line {
  stroke: color-mix(in srgb, var(--border) 62%, transparent);
  stroke-width: 1;
  stroke-dasharray: 6 12;
}

.network-axis-label {
  fill: var(--muted);
  font-size: 13px;
}

.network-marker {
  cursor: pointer;
}

.network-marker-ring {
  fill: color-mix(in srgb, var(--tone) 11%, transparent);
  stroke: color-mix(in srgb, var(--tone) 74%, transparent);
  stroke-width: 2;
}

.network-marker-core {
  fill: var(--tone);
  stroke: color-mix(in srgb, var(--text) 88%, transparent);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px var(--tone));
}

.network-marker text {
  fill: var(--text);
  font-size: 16px;
  font-weight: 700;
  paint-order: stroke;
  stroke: color-mix(in srgb, var(--bg-deep) 92%, transparent);
  stroke-width: 4;
  stroke-linejoin: round;
}

.network-marker.selected .network-marker-ring {
  fill: color-mix(in srgb, var(--tone) 20%, transparent);
  stroke-width: 4;
}

.empty-network-map {
  min-height: 380px;
  display: grid;
  place-items: center;
  margin-top: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.network-station-name {
  display: block;
  margin: 16px 0 18px;
  font-size: clamp(1.8rem, 2.4vw, 3.2rem);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.network-stations-panel {
  margin-top: 2px;
}

.network-station-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.network-station-card {
  min-height: 122px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--tone) 56%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--tone) 12%, transparent), transparent 74%),
    rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.network-station-card:hover,
.network-station-card.selected {
  transform: translateY(-1px);
  border-color: var(--tone);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 34%, transparent), 0 0 20px color-mix(in srgb, var(--tone) 16%, transparent);
}

.network-station-card span,
.network-station-card small {
  color: var(--muted);
}

.network-station-card strong {
  color: var(--text);
  font-size: clamp(1.05rem, 1.1vw, 1.35rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(300px, 0.8fr) minmax(380px, 1fr);
  gap: 16px;
  align-items: start;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.stack-form input,
.stack-form select {
  width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-row {
  min-height: 40px;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: start;
}

.checkbox-row input {
  min-height: 0;
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
}

.station-location-summary {
  margin-top: 16px;
}

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

.table > div {
  display: grid;
  grid-template-columns: 1fr 130px 90px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.table span,
.table small {
  color: var(--muted);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.error-banner,
.form-error {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
}

.error-banner {
  width: min(1640px, calc(100% - 44px));
  margin: 14px auto 0;
}

.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  animation: scan 1.4s linear infinite;
}

.dashboard-loading {
  display: grid;
  gap: 18px;
}

.dashboard-loader {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}

.dashboard-loader strong,
.session-loader h2 {
  display: block;
  color: var(--text);
  font-size: 1.15rem;
}

.dashboard-loader span,
.session-copy {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
}

.loading-orbit {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--blue) 22%, transparent);
  border-top-color: var(--blue);
  border-right-color: color-mix(in srgb, var(--green) 75%, var(--blue));
  box-shadow: 0 0 22px color-mix(in srgb, var(--blue) 20%, transparent);
  animation: spin 0.95s linear infinite;
}

.skeleton-card,
.skeleton-panel {
  position: relative;
  overflow: hidden;
}

.skeleton-card::after,
.skeleton-panel::after,
.skeleton-line::after,
.skeleton-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--blue) 16%, transparent), transparent);
  animation: shimmer 1.25s ease-in-out infinite;
}

.skeleton-line,
.skeleton-icon {
  position: relative;
  overflow: hidden;
  display: block;
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel-strong) 72%, var(--blue));
  opacity: 0.42;
}

.skeleton-line.tiny {
  width: 44px;
  height: 12px;
}

.skeleton-line.short {
  width: 76px;
  height: 13px;
}

.skeleton-line.small {
  width: 64px;
  height: 12px;
}

.skeleton-line.medium {
  width: min(100%, 132px);
  height: 20px;
}

.skeleton-line.value {
  width: 72px;
  height: 34px;
  justify-self: center;
  margin: 10px 0;
}

.skeleton-line.timestamp {
  width: 160px;
  height: 14px;
}

.skeleton-icon {
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--blue) 38%, transparent);
}

.skeleton-panel {
  min-height: 260px;
}

.skeleton-panel.wide {
  min-height: 320px;
}

.syncing {
  position: relative;
  padding-left: 18px;
}

.syncing::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 12px var(--blue);
  animation: pulse 1.1s ease-in-out infinite;
}

.session-loading {
  align-content: center;
}

.session-loader {
  justify-items: start;
  align-content: center;
}

@keyframes scan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-bar,
  .loading-orbit,
  .skeleton-card::after,
  .skeleton-panel::after,
  .skeleton-line::after,
  .skeleton-icon::after,
  .syncing::before {
    animation: none;
  }
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(380px, 460px);
  gap: 76px;
  align-items: center;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.login-visual {
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  isolation: isolate;
}

.login-brand-block {
  display: flex;
  align-items: center;
  gap: 0;
  width: min(820px, 112%);
  max-width: none;
  height: 210px;
  margin-bottom: 22px;
  position: relative;
  transform: translateX(-112px);
}

.login-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--blue) 42%, transparent));
}

.login-visual h2 {
  margin: 0;
  max-width: 690px;
  font-size: 1.72rem;
  line-height: 1.14;
  font-weight: 500;
  color: var(--text);
  transform: translateX(-72px);
}

.login-copy {
  margin: 18px 0 0;
  max-width: 540px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  transform: translateX(-72px);
}

.login-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  transform: translateX(-72px);
}

.login-signals span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 34%, transparent);
  border-radius: 8px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--blue) 8%, transparent);
}

.station-orbit {
  display: none;
}

.login-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--blue) 10%, transparent), transparent 54%),
    var(--panel);
  padding: 28px;
  border-radius: 8px;
  backdrop-filter: blur(18px);
  box-shadow: 0 28px 70px color-mix(in srgb, #000 44%, transparent);
}

.login-panel h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-panel button {
  min-height: 46px;
  background: color-mix(in srgb, var(--blue) 24%, transparent);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 18px;
    overflow-x: visible;
  }

  .brand {
    min-width: 0;
  }

  .brand-logo {
    width: clamp(220px, 42vw, 300px);
    height: 54px;
  }

  nav,
  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  nav {
    gap: 8px;
  }

  nav button {
    min-height: 36px;
    padding: 0 11px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions select:first-child {
    width: clamp(220px, 40vw, 320px);
  }

  .forecast-strip {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .trend-row,
  .two-col,
  .admin-grid,
  .replay-hero,
  .replay-stage,
  .replay-lower-grid,
  .replay-event-grid,
  .network-layout,
  .network-station-grid,
  .history-replay-grid,
  .history-snapshot-grid,
  .history-event-grid {
    grid-template-columns: 1fr;
  }

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

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

  .chart-summary {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

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

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

  .history-snapshot-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .history-event-grid,
  .replay-event-grid,
  .network-station-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .divider-line {
    display: none;
  }
}

@media (max-width: 760px) {
  .content,
  .error-banner {
    width: min(100% - 24px, 1640px);
  }

  .content {
    margin-top: 14px;
  }

  .forecast-strip,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .forecast-card {
    min-height: 118px;
    padding: 12px;
  }

  .forecast-card-body {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
  }

  .forecast-svg {
    width: 44px;
    height: 44px;
  }

  .metric-card {
    min-height: 104px;
    padding: 14px 10px;
  }

  .metric-card strong {
    font-size: clamp(1.55rem, 7vw, 2.1rem);
  }

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

  .login-screen {
    grid-template-columns: 1fr;
    align-content: center;
    padding: 22px 0;
    gap: 28px;
  }

  .login-visual {
    min-height: 0;
  }

  .login-brand-block {
    gap: 0;
    width: 100%;
    max-width: 100%;
    height: 128px;
    margin-bottom: 18px;
    transform: none;
  }

  .login-visual h2 {
    font-size: 1.35rem;
    transform: none;
  }

  .login-copy,
  .login-signals {
    transform: none;
  }

  .topbar {
    position: static;
    padding: 12px;
  }

  .brand {
    justify-content: center;
    width: 100%;
  }

  .brand-logo {
    width: min(250px, 72vw);
    height: 48px;
  }

  nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  nav button {
    min-width: 0;
    min-height: 34px;
    padding: 0 7px;
    font-size: 0.88rem;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(78px, 0.44fr);
    width: 100%;
    gap: 8px;
  }

  .top-actions select:first-child,
  .refresh-stamp {
    grid-column: 1 / -1;
    width: 100%;
  }

  .refresh-stamp {
    min-width: 0;
    text-align: center;
  }

  .auto-refresh-toggle {
    justify-content: center;
  }

  .refresh-interval {
    width: 100%;
    flex-basis: auto;
  }

  .top-actions button {
    width: 100%;
    padding: 0 10px;
  }

  .panel-title {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .chart-controls {
    width: 100%;
    justify-content: space-between;
  }

  .telemetry-chart {
    height: 300px;
  }

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

  .analysis-grid,
  .health-grid,
  .health-detail-grid,
  .system-component-list {
    grid-template-columns: 1fr;
  }

  .glass-panel {
    padding: 16px;
  }

  .compact-kv {
    grid-template-columns: 1fr;
  }

  .verdict,
  .state-badge {
    font-size: clamp(1.7rem, 10vw, 2.6rem);
  }

  .history-controls span {
    width: 100%;
    margin-left: 0;
  }

  .network-summary,
  .replay-evidence-grid,
  .replay-event-grid,
  .network-station-grid {
    grid-template-columns: 1fr;
  }

  .replay-chart {
    height: 340px;
  }

  .replay-controls label {
    min-width: 100%;
  }

  .network-map {
    height: 340px;
  }

  .table > div,
  .kv {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) and (max-height: 480px) {
  .topbar {
    position: static;
    gap: 7px;
    padding: 8px 10px;
  }

  .brand-logo {
    width: 190px;
    height: 36px;
  }

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

  nav button {
    min-height: 30px;
    padding: 0 5px;
    font-size: 0.78rem;
  }

  .top-actions {
    grid-template-columns: minmax(150px, 1fr) auto auto auto auto;
    align-items: center;
  }

  .top-actions select:first-child,
  .refresh-stamp {
    grid-column: auto;
  }

  .refresh-stamp {
    text-align: left;
    font-size: 0.78rem;
  }

  .auto-refresh-toggle,
  .refresh-interval,
  .top-actions button {
    min-height: 32px;
  }

  .content {
    margin-top: 12px;
  }
}
