:root {
  --bg: #07111b;
  --panel: #0f1b28;
  --panel-2: #122334;
  --stroke: rgba(150, 208, 255, 0.16);
  --text: #eef6ff;
  --muted: #94abc2;
  --cyan: #35d8ff;
  --green: #65db85;
  --amber: #ffb84c;
  --red: #ff6f66;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(53, 216, 255, 0.08), transparent 34%),
    radial-gradient(circle at 100% 10%, rgba(255, 184, 76, 0.1), transparent 26%),
    linear-gradient(180deg, #06101a 0%, #09131f 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}

.app-shell,
.admin-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

[hidden] {
  display: none !important;
}

.hero-panel,
.toolbar-card,
.panel-card,
.module-banner {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(15, 27, 40, 0.96), rgba(11, 21, 32, 0.96));
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
  border-radius: 28px;
  padding: 26px 28px;
}

.eyebrow,
.panel-kicker,
.label {
  margin: 0 0 6px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}

.hero-panel h1,
.panel-card h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-weight: 700;
}

.hero-panel h1 {
  font-size: clamp(32px, 5vw, 54px);
}

.lead {
  margin: 14px 0 0;
  max-width: 860px;
  color: var(--muted);
  line-height: 1.58;
}

.hero-status {
  display: grid;
  gap: 12px;
  align-content: start;
}

.status-chip {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 16px;
  color: var(--muted);
  font-size: 14px;
}

.status-chip.is-good {
  color: #a4f2bf;
  border-color: rgba(101, 219, 133, 0.34);
  background: rgba(101, 219, 133, 0.12);
}

.status-chip.is-warn {
  color: #ffe79c;
  border-color: rgba(255, 184, 76, 0.34);
  background: rgba(255, 184, 76, 0.12);
}

.status-chip.is-bad {
  color: #ffb0a9;
  border-color: rgba(255, 111, 102, 0.34);
  background: rgba(255, 111, 102, 0.12);
}

.module-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.module-pill,
button,
.file-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.module-pill {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.module-pill.is-active {
  color: #00131a;
  background: linear-gradient(135deg, #7bf2ff, #35d8ff);
}

.toolbar-card {
  border-radius: 28px;
  padding: 22px 24px;
}

.toolbar-main,
.toolbar-grid,
.session-summary,
.workspace {
  display: grid;
  gap: 18px;
}

.toolbar-main {
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
}

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

.action-group.compact {
  justify-content: flex-end;
}

button,
.file-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

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

button.accent {
  background: linear-gradient(135deg, #7af785, #38cf74);
  color: #072110;
}

button.danger {
  background: linear-gradient(135deg, #ff8e7c, #ff6258);
  color: #250302;
}

button.warning {
  background: linear-gradient(135deg, #ffd175, #ffaf33);
  color: #201100;
}

button.ghost,
button.toggle,
.file-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

button.toggle.is-active {
  background: rgba(53, 216, 255, 0.14);
  color: #8de9ff;
  border-color: rgba(53, 216, 255, 0.3);
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.inline-field {
  min-width: 260px;
}

.toolbar-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  margin-top: 16px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field input[type="text"] {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
}

.field select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 0 14px;
  font: inherit;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.field strong {
  color: var(--text);
  font-size: 16px;
}

.session-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.session-summary div {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px 16px;
}

.module-banner {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--muted);
}

.module-stage {
  margin-top: 18px;
}

.module-view {
  display: none;
}

.module-view.is-visible {
  display: block;
}

.workspace {
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.95fr);
  align-items: start;
}

.charts-column,
.side-column {
  display: grid;
  gap: 18px;
}

.panel-card {
  border-radius: 24px;
  padding: 20px;
}

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

.metric-group {
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted);
  text-align: right;
  font-size: 13px;
}

.metric-group strong {
  color: var(--text);
  font-size: 18px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  background: #07111b;
}

.tool-panel {
  display: grid;
  gap: 18px;
}

.tool-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tool-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.band-note {
  margin: -4px 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.band-note-under {
  height: 82px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(53, 216, 255, 0.12);
  background: rgba(53, 216, 255, 0.045);
  overflow: auto;
}

.tool-grid,
.plotter-layout {
  display: grid;
  gap: 18px;
}

.tool-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.7fr);
  align-items: start;
}

.plotter-layout {
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.5fr);
  align-items: start;
}

.tool-canvas-card,
.tool-side-card,
.plotter-stage {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
}

.plotter-stage {
  min-height: 620px;
}

.plot-surface {
  min-height: 620px;
  border-radius: 18px;
  overflow: hidden;
  background: #07111b;
}

.is-hidden {
  display: none !important;
}

.legend-grid,
.series-toggle-list {
  display: grid;
  gap: 12px;
}

.legend-item,
.series-toggle {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 18px currentColor;
}

.legend-meta {
  color: var(--muted);
  font-size: 12px;
}

.series-toggle input {
  margin: 0;
  width: 18px;
  height: 18px;
}

.bands-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 10px;
  min-height: 360px;
}

.band-card.is-muted .band-note {
  color: #ffcf89;
}

.band-card.is-cautious .band-note {
  color: #bfefff;
}

.bands-grid.is-muted .band-item {
  opacity: 0.42;
}

.band-item {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 8px;
  align-items: end;
  justify-items: center;
}

.band-label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.band-range,
.band-freq,
.band-value {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.band-item.is-soft .band-fill {
  filter: saturate(0.72);
}

.band-meter {
  width: 100%;
  min-height: 228px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  position: relative;
  overflow: hidden;
}

.band-meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 100% 20%;
}

.band-fill {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  border-radius: 18px 18px 0 0;
  box-shadow: inset 0 -24px 44px rgba(0, 0, 0, 0.12), 0 0 20px currentColor;
}

.status-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 14px;
  margin: 0;
}

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

.status-list dd {
  margin: 0;
  text-align: right;
}

.events {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.events li {
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #d6e6f8;
  line-height: 1.4;
}

.admin-hero {
  margin-bottom: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.admin-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 240px;
}

.admin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-card button {
  align-self: end;
  justify-self: start;
}

.admin-card-accent {
  border-color: rgba(101, 219, 133, 0.28);
  background:
    linear-gradient(180deg, rgba(101, 219, 133, 0.09), rgba(15, 27, 40, 0.96)),
    rgba(15, 27, 40, 0.96);
}

.admin-list {
  margin: 0;
  padding-left: 18px;
  color: #d6e6f8;
  line-height: 1.7;
}

@media (max-width: 1220px) {
  .toolbar-main,
  .workspace,
  .hero-panel,
  .tool-grid,
  .plotter-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 16px;
  }

  .toolbar-grid,
  .session-summary {
    grid-template-columns: 1fr;
  }

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

  .plot-surface,
  .plotter-stage {
    min-height: 460px;
  }
}
