:root {
  --crt-black: #070b0e;
  --crt-panel: #0b1216;
  --crt-panel-2: #0e181d;
  --phosphor: #00ff88;
  --phosphor-dim: #00a85e;
  --cyan: #38bdf8;
  --ice: #e6f7f2;
  --muted: #72857f;
  --crimson: #ff3b30;
  --amber: #ffb020;
  --line: rgba(0, 255, 136, 0.19);
  --line-cyan: rgba(56, 189, 248, 0.2);
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --sans: "Space Grotesk", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--crt-black);
  color: var(--ice);
  scrollbar-color: var(--phosphor-dim) var(--crt-black);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(0, 255, 136, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 78% 8%, rgba(0, 255, 136, 0.06), transparent 30rem),
    var(--crt-black);
  background-size: 42px 42px, 42px 42px, auto, auto;
  font-family: var(--sans);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 79px,
    rgba(0, 255, 136, 0.025) 80px
  );
  content: "";
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button,
label.terminal-button {
  -webkit-tap-highlight-color: transparent;
}

.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 3px,
    rgba(0, 0, 0, 0.15) 4px
  );
  content: "";
  opacity: 0.42;
  pointer-events: none;
}

.crt-vignette {
  position: fixed;
  inset: 0;
  z-index: 99;
  box-shadow: inset 0 0 120px 24px rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.terminal-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  min-height: 106px;
  padding: 18px clamp(18px, 3vw, 48px);
  border-bottom: 1px solid var(--phosphor);
  background: rgba(7, 11, 14, 0.94);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.42);
}

.terminal-header::before,
.terminal-header::after {
  position: absolute;
  bottom: -1px;
  width: 32%;
  height: 2px;
  background: var(--crt-black);
  content: "";
}

.terminal-header::before {
  left: 0;
}

.terminal-header::after {
  right: 0;
}

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

.brand-logo {
  width: 46px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(126, 162, 255, 0.45));
}

.brand-copy {
  display: grid;
  gap: 3px;
}

.brand-lockup h1 {
  margin: 0;
  color: var(--ice);
  font-family: var(--mono);
  font-size: clamp(1.55rem, 2.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
  text-shadow: 0 0 14px rgba(0, 255, 136, 0.24);
}

.brand-lockup h1 span {
  color: var(--phosphor);
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
}

.brand-sub strong {
  color: #a9c6d9;
  font-weight: 500;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 120;
  padding: 9px 14px;
  border: 1px solid var(--phosphor);
  background: var(--crt-black);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-decoration: none;
  transition: top 140ms ease;
}

.skip-link:focus-visible {
  top: 12px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(0, 255, 136, 0.025);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.status-copy {
  display: grid;
  gap: 2px;
}

.status-label,
.system-status strong {
  font-family: var(--mono);
}

.status-label {
  color: var(--muted);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
}

.system-status strong {
  color: var(--phosphor);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 9px var(--phosphor);
  animation: pulse 1.8s infinite;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.terminal-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--phosphor-dim);
  background: rgba(0, 255, 136, 0.03);
  color: var(--phosphor);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: 140ms ease;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.terminal-button::before {
  position: absolute;
  inset: 3px;
  border-top: 1px solid transparent;
  border-right: 1px solid transparent;
  content: "";
  pointer-events: none;
}

.terminal-button:hover,
.terminal-button:focus-visible {
  border-color: var(--phosphor);
  background: rgba(0, 255, 136, 0.11);
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.11);
  outline: none;
}

.terminal-button--alert {
  border-color: rgba(255, 59, 48, 0.48);
  background: rgba(255, 59, 48, 0.025);
  color: #ff7b73;
}

.terminal-button--alert:hover,
.terminal-button--alert:focus-visible {
  border-color: var(--crimson);
  background: rgba(255, 59, 48, 0.11);
}

.terminal-button--ghost {
  border-color: rgba(169, 198, 217, 0.42);
  background: transparent;
  color: #a9c6d9;
}

.terminal-button--ghost:hover,
.terminal-button--ghost:focus-visible {
  border-color: #a9c6d9;
  background: rgba(169, 198, 217, 0.1);
  box-shadow: none;
}

.terminal-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

main {
  width: min(1640px, calc(100% - clamp(24px, 5vw, 80px)));
  margin: 26px auto 50px;
}

/* ---------- Onboarding guide ---------- */

.guide {
  margin-bottom: 16px;
  padding: 22px clamp(16px, 2.4vw, 28px);
  border-color: rgba(56, 189, 248, 0.28);
  background:
    radial-gradient(circle at 12% 0%, rgba(126, 162, 255, 0.08), transparent 26rem),
    linear-gradient(180deg, rgba(13, 22, 28, 0.96), rgba(9, 16, 20, 0.94));
}

.guide[hidden] {
  display: none;
}

.guide__head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-cyan);
}

.guide__logo {
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(126, 162, 255, 0.4));
}

.guide__intro h2 {
  margin: 5px 0 8px;
  color: var(--ice);
  font-family: var(--mono);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.guide__lede {
  max-width: 78ch;
  margin: 0;
  color: #c4d6d2;
  font-size: 0.86rem;
  line-height: 1.65;
}

.guide__lede strong {
  color: var(--cyan);
  font-weight: 600;
}

.guide__close {
  padding: 6px 10px;
  border: 1px solid var(--line-cyan);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  transition: 140ms ease;
}

.guide__close:hover,
.guide__close:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: none;
}

.guide__steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.guide__step {
  padding: 14px 15px 16px;
  border: 1px solid var(--line);
  background: rgba(0, 255, 136, 0.022);
}

.guide__num {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
}

.guide__step h3 {
  margin: 0 0 7px;
  color: var(--ice);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.guide__step p {
  margin: 0;
  color: #a9bcb7;
  font-size: 0.75rem;
  line-height: 1.62;
}

.guide__step strong {
  color: var(--phosphor);
  font-weight: 600;
}

.guide__step em {
  color: #a9c6d9;
  font-style: italic;
}

.guide__step code {
  padding: 1px 4px;
  border: 1px solid var(--line-cyan);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.guide__glossary {
  margin-top: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}

.guide__glossary summary {
  padding: 12px 15px;
  color: var(--cyan);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
}

.guide__glossary summary::marker {
  color: var(--phosphor);
}

.guide__glossary dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  background: var(--line);
}

.guide__glossary dl > div {
  padding: 12px 15px;
  background: rgba(9, 16, 20, 0.96);
}

.guide__glossary dt {
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.guide__glossary dd {
  margin: 5px 0 0;
  color: #a9bcb7;
  font-size: 0.73rem;
  line-height: 1.58;
}

.guide__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-cyan);
}

.guide__note {
  max-width: 72ch;
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--amber);
  color: #d9c8a6;
  font-size: 0.74rem;
  line-height: 1.6;
}

.guide__note strong,
.guide__note em {
  color: var(--amber);
  font-family: var(--mono);
  font-style: normal;
}

.guide__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.guide__cta {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  transition: 150ms ease;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.guide__cta:hover,
.guide__cta:focus-visible {
  background: var(--cyan);
  color: var(--crt-black);
  outline: none;
}

.guide__cta--ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.guide__cta--ghost:hover,
.guide__cta--ghost:focus-visible {
  border-color: var(--phosphor-dim);
  background: rgba(0, 255, 136, 0.08);
  color: var(--phosphor);
}

.status-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.07), rgba(0, 255, 136, 0.015));
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.status-banner__code,
.status-banner__message,
.status-banner__meta {
  font-family: var(--mono);
}

.status-banner__code {
  color: var(--phosphor);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.status-banner__message {
  color: var(--ice);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.status-banner__meta {
  color: var(--muted);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
}

.status-banner[data-state="error"] {
  border-color: rgba(255, 59, 48, 0.55);
  background: rgba(255, 59, 48, 0.07);
}

.status-banner[data-state="error"] .status-banner__code {
  color: var(--crimson);
}

.status-banner[data-state="warn"] {
  border-color: rgba(255, 176, 32, 0.5);
  background: rgba(255, 176, 32, 0.06);
}

.status-banner[data-state="warn"] .status-banner__code {
  color: var(--amber);
}

.telemetry-strip {
  display: grid;
  grid-template-columns: 1.25fr 1.15fr 0.85fr 0.95fr;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: rgba(11, 18, 22, 0.76);
}

.telemetry-cell {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.telemetry-cell:last-child {
  border-right: 0;
}

.telemetry-cell__index {
  color: var(--phosphor-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.telemetry-cell > div {
  display: grid;
  gap: 4px;
}

.telemetry-cell__label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.14em;
}

.telemetry-cell strong {
  overflow: hidden;
  color: var(--ice);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-cell__state {
  padding: 3px 5px;
  border: 1px solid var(--line);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.06em;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 14px;
}

.panel-frame {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(9, 16, 20, 0.9);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.34);
}

.panel-frame::before,
.panel-frame::after {
  position: absolute;
  width: 11px;
  height: 11px;
  border-color: var(--phosphor);
  content: "";
  pointer-events: none;
}

.panel-frame::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.panel-frame::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 255, 136, 0.025);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.panel-heading__id {
  color: var(--muted);
  font-size: 0.54rem;
}

.control-panel {
  align-self: start;
}

.panel-section {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
  color: var(--ice);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
}

.section-label span {
  color: var(--cyan);
  font-size: 0.58rem;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.53rem;
  letter-spacing: 0.1em;
}

.terminal-input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--phosphor-dim);
  border-radius: 0;
  outline: none;
  background: var(--crt-black);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.7rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--phosphor) 50%),
    linear-gradient(135deg, var(--phosphor) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.terminal-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.field-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.56rem;
}

.range-readout {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.07em;
}

.range-readout output {
  color: var(--phosphor);
  font-size: 0.65rem;
}

.terminal-range {
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 0;
  outline: none;
  background: linear-gradient(90deg, var(--phosphor) 0 22%, #1d2b30 22% 100%);
  cursor: pointer;
  appearance: none;
}

.terminal-range--cyan {
  background: linear-gradient(90deg, var(--cyan) 0 25%, #1d2b30 25% 100%);
}

.terminal-range::-webkit-slider-thumb {
  width: 10px;
  height: 18px;
  border: 1px solid var(--phosphor);
  border-radius: 0;
  background: var(--crt-black);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.55);
  appearance: none;
}

.terminal-range--cyan::-webkit-slider-thumb {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.55);
}

.terminal-range::-moz-range-thumb {
  width: 9px;
  height: 17px;
  border: 1px solid var(--phosphor);
  border-radius: 0;
  background: var(--crt-black);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #42544f;
  font-family: var(--mono);
  font-size: 0.5rem;
}

.run-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: calc(100% - 32px);
  min-height: 47px;
  margin: 18px 16px 12px;
  border: 1px solid var(--phosphor);
  background: rgba(0, 255, 136, 0.08);
  color: var(--phosphor);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: 150ms ease;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}

.run-button:hover,
.run-button:focus-visible {
  background: var(--phosphor);
  color: var(--crt-black);
  box-shadow: 0 0 22px rgba(0, 255, 136, 0.22);
  outline: none;
}

.run-button:active {
  transform: translateY(1px);
}

.run-button__brackets {
  color: var(--cyan);
  font-size: 1rem;
}

.run-button:hover .run-button__brackets {
  color: var(--crt-black);
}

.run-button__hint {
  margin: -4px 16px 14px;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.5;
  text-align: center;
}

.preset-row {
  display: grid;
  gap: 7px;
}

.preset-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--phosphor-dim);
  background: rgba(0, 255, 136, 0.03);
  color: var(--phosphor-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  transition: 140ms ease;
}

.preset-button:hover,
.preset-button:focus-visible {
  border-color: var(--phosphor);
  color: var(--phosphor);
  outline: none;
}

.preset-button.is-active {
  border-color: var(--phosphor);
  background: rgba(0, 255, 136, 0.12);
  color: var(--phosphor);
  box-shadow: inset 0 0 14px rgba(0, 255, 136, 0.12);
}

.control-footnote {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px 17px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.05em;
}

.footnote-rule {
  width: 20px;
  height: 1px;
  background: var(--cyan);
}

.analysis-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.kpi-panel {
  position: relative;
  min-height: 108px;
  padding: 12px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(11, 18, 22, 0.84);
}

.kpi-panel::after {
  position: absolute;
  right: -12px;
  bottom: -29px;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(0, 255, 136, 0.1);
  content: "";
  transform: rotate(45deg);
}

.kpi-panel__header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.1em;
}

.kpi-panel__header span:last-child {
  color: var(--phosphor-dim);
}

.kpi-panel strong {
  display: block;
  margin: 12px 0 3px;
  overflow: hidden;
  color: var(--ice);
  font-family: var(--mono);
  font-size: clamp(0.94rem, 1.4vw, 1.25rem);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-panel small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.06em;
}

.kpi-panel--alert {
  border-color: rgba(255, 59, 48, 0.32);
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.05), rgba(11, 18, 22, 0.9));
}

.kpi-panel--alert strong,
.kpi-panel--alert .kpi-panel__header span:last-child {
  color: #ff6b63;
}

.chart-wrap {
  position: relative;
  width: 100%;
}

.chart-wrap--primary {
  height: 340px;
  padding: 14px 16px 4px;
}

.chart-wrap--secondary {
  height: 260px;
  padding: 12px 12px 3px;
}

.chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.empty-chart {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding: 9px 16px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.05em;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-mark {
  display: inline-block;
  width: 16px;
  height: 2px;
  background: var(--phosphor);
}

.legend-mark--cyan {
  background: var(--cyan);
}

.legend-mark--red {
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 7px rgba(255, 59, 48, 0.65);
}

.secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.anomaly-log {
  margin-top: 14px;
}

.grounding-note {
  margin: 12px 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(255, 176, 32, 0.055);
  color: #d9c8a6;
  font-size: 0.72rem;
  line-height: 1.5;
}

.grounding-note strong,
.grounding-note em {
  color: var(--amber);
  font-family: var(--mono);
  font-style: normal;
}

.table-wrap {
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.68rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #0c1519;
  color: var(--cyan);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(0, 255, 136, 0.09);
  color: var(--ice);
}

tbody tr:hover {
  background: rgba(0, 255, 136, 0.035);
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  color: var(--phosphor);
}

.direction-up {
  color: var(--crimson) !important;
}

.direction-down {
  color: var(--amber) !important;
}

.table-empty td {
  height: 90px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.08em;
}

.terminal-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 11px clamp(18px, 3vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.53rem;
  letter-spacing: 0.08em;
}

.help-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 101;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--cyan);
  background: rgba(9, 16, 20, 0.92);
  color: var(--cyan);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  transition: 140ms ease;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.help-fab:hover,
.help-fab:focus-visible {
  background: var(--cyan);
  color: var(--crt-black);
  outline: none;
}

.help-fab[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .help-fab span {
    display: none;
  }

  .help-fab {
    padding: 0 12px;
    font-size: 0.8rem;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.28;
  }
}

@media (max-width: 1400px) {
  .terminal-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .system-status {
    display: none;
  }

  .workspace-grid {
    grid-template-columns: 250px minmax(0, 1fr);
  }

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

@media (max-width: 1040px) {
  .guide__head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .guide__close {
    grid-column: 2;
    justify-self: end;
  }

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

  .guide__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .terminal-header {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workspace-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .telemetry-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .telemetry-cell:nth-child(2) {
    border-right: 0;
  }

  .telemetry-cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .chart-wrap--primary {
    height: 300px;
  }
}

@media (max-width: 560px) {
  main {
    width: calc(100% - 20px);
    margin-top: 14px;
  }

  .terminal-header {
    padding: 15px 12px;
  }

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

  .guide {
    padding: 18px 14px;
  }

  .guide__head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .guide__logo {
    width: 58px;
    height: 58px;
  }

  .guide__close {
    grid-column: 1;
    justify-self: start;
  }

  .status-banner {
    grid-template-columns: auto 1fr;
  }

  .status-banner__meta {
    display: none;
  }

  .telemetry-strip,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .telemetry-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .telemetry-cell:last-child {
    border-bottom: 0;
  }

  .chart-wrap--primary {
    height: 260px;
  }

  .chart-wrap--secondary {
    height: 230px;
  }

  .terminal-footer {
    flex-direction: column;
    gap: 5px;
  }
}
