@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #070711;
  --bg-2: #100a1f;
  --panel: rgba(13, 10, 30, 0.78);
  --panel-2: rgba(16, 12, 38, 0.92);
  --panel-3: rgba(19, 15, 44, 0.95);
  --line: rgba(148, 110, 255, 0.18);
  --line-strong: rgba(108, 237, 255, 0.28);
  --text: #f4f1ff;
  --muted: #aaa4c8;
  --purple: #9b6bff;
  --purple-2: #6e44ff;
  --cyan: #49e6ff;
  --teal: #52ffd8;
  --pink: #f05cff;
  --red: #ff6d8c;
  --green: #78f0ae;
  --shadow: 0 30px 80px rgba(2, 3, 12, 0.5);
  --glow: 0 0 0 1px rgba(155, 107, 255, 0.08), 0 0 30px rgba(73, 230, 255, 0.08), 0 0 54px rgba(155, 107, 255, 0.08);
  --radius: 30px;
  --radius-sm: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Outfit", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(240, 92, 255, 0.14), transparent 26%),
    radial-gradient(circle at 80% 15%, rgba(73, 230, 255, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(155, 107, 255, 0.12), transparent 30%),
    linear-gradient(155deg, #06050e 0%, #0a0817 32%, #0f0a20 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.bg-glow,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.glow-a {
  background: radial-gradient(circle at 18% 16%, rgba(240, 92, 255, 0.12), transparent 28%);
}

.glow-b {
  background: radial-gradient(circle at 82% 22%, rgba(73, 230, 255, 0.1), transparent 24%);
}

.bg-grid {
  opacity: 0.1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent 80%);
}

.app-shell {
  position: relative;
  padding: 20px 20px 28px;
}

.side-panel,
.panel,
.status-chip,
.info-card,
.summary-card,
.control-deck {
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(24px);
}

body.menu-open {
  overflow: hidden;
}

body[data-view="admin"] .control-deck {
  display: none;
}

.menu-toggle,
.sidebar-close,
.sidebar-nav-btn,
.profile-pill,
.primary-btn,
.ghost-btn,
.download-btn,
.symbol-pill {
  border: 0;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.menu-toggle:hover,
.sidebar-close:hover,
.sidebar-nav-btn:hover,
.profile-pill:hover,
.primary-btn:hover,
.ghost-btn:hover,
.download-btn:hover,
.symbol-pill:hover {
  transform: translateY(-1px);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 18px var(--teal);
  animation: pulseDot 1.8s ease infinite;
}

.side-panel {
  position: fixed;
  inset: 18px auto 18px 18px;
  width: min(328px, calc(100vw - 36px));
  z-index: 42;
  transform: translateX(calc(-100% - 32px));
  opacity: 0;
  visibility: hidden;
  transition: transform 220ms ease, opacity 220ms ease, visibility 220ms ease;
}

.side-panel-inner {
  height: 100%;
  padding: 22px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(13, 9, 30, 0.98), rgba(10, 8, 24, 0.96));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.menu-open .side-panel {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.sidebar-head,
.panel-head,
.sub-head,
.action-row,
.deck-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.sidebar-head {
  align-items: center;
}

.topbar-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.brand-copy h1,
.topbar h2,
.control-deck h3,
.panel h3 {
  margin: 0;
  letter-spacing: -0.045em;
}

.brand-copy h1 {
  font-size: 1.9rem;
  margin-top: 6px;
}

.muted,
.sidebar-copy,
.sidebar-nav-copy span {
  color: var(--muted);
}

.sidebar-close {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.sidebar-close span {
  position: absolute;
  left: 14px;
  top: 22px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.sidebar-close span:first-child {
  transform: rotate(45deg);
}

.sidebar-close span:last-child {
  transform: rotate(-45deg);
}

.sidebar-copy {
  margin: 0;
  line-height: 1.6;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 22px;
  text-align: left;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  background: rgba(14, 11, 29, 0.9);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-nav-code {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--cyan);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.sidebar-nav-copy {
  min-width: 0;
}

.sidebar-nav-copy strong,
.profile-pill strong {
  display: block;
  font-size: 0.9rem;
}

.sidebar-nav-copy span,
.profile-pill span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.sidebar-nav-btn.active {
  background: linear-gradient(140deg, rgba(155, 107, 255, 0.22), rgba(73, 230, 255, 0.18));
  box-shadow: 0 0 30px rgba(155, 107, 255, 0.1);
}

.sidebar-nav-btn.active .sidebar-nav-code {
  background: linear-gradient(145deg, rgba(155, 107, 255, 0.28), rgba(73, 230, 255, 0.22));
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-footer-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
}

.sidebar-mini-logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(73, 230, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sidebar-mini-logo span {
  color: rgba(201, 194, 235, 0.52);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(3, 4, 10, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 41;
}

body.menu-open .drawer-scrim {
  opacity: 1;
  visibility: visible;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-width: 1720px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.topbar-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.title-wrap h2 {
  font-size: clamp(1.7rem, 2.5vw, 2.9rem);
  margin-top: 4px;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 18px;
  background: rgba(18, 13, 38, 0.92);
  box-shadow: 0 0 24px rgba(155, 107, 255, 0.12);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px auto;
  background: var(--text);
  border-radius: 999px;
}

.topbar-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: min(720px, 60%);
}

.status-chip,
.panel,
.info-card,
.summary-card {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 13, 38, 0.86), rgba(11, 8, 24, 0.78));
}

.status-chip {
  padding: 12px 14px;
}

.status-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 0.94rem;
}

.status-chip-live {
  background: linear-gradient(145deg, rgba(155, 107, 255, 0.22), rgba(73, 230, 255, 0.2));
}

.eyebrow,
.status-chip span,
.field span,
.sub-head span,
th,
.badge,
.dock-live {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.eyebrow {
  margin: 0;
  color: var(--cyan);
}

.panel,
.control-deck {
  padding: 16px;
}

.control-deck {
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(14, 10, 30, 0.9), rgba(18, 12, 40, 0.75));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(24px);
}

.profile-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.profile-switch-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 170px));
  gap: 8px;
}

.profile-pill,
.primary-btn,
.ghost-btn,
.download-btn,
.symbol-pill {
  color: var(--text);
}

.profile-pill {
  min-width: 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(14, 11, 29, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-pill.active,
.symbol-pill.active {
  background: linear-gradient(140deg, rgba(155, 107, 255, 0.26), rgba(73, 230, 255, 0.22));
  box-shadow: 0 0 34px rgba(73, 230, 255, 0.12);
}

.deck-top-compact {
  align-items: flex-start;
  gap: 12px;
}

.deck-inline-tools {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1.05fr) auto;
  gap: 10px;
  align-items: end;
}

.field-inline {
  min-width: 0;
}

.field-inline input,
.field-inline select {
  min-height: 42px;
}

.field-inline-symbol {
  min-width: 0;
}

.deck-action-pack {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(9, 7, 20, 0.86);
  color: var(--text);
  padding: 10px 13px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(155, 107, 255, 0.05);
}

input:focus,
select:focus {
  border-color: rgba(73, 230, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(73, 230, 255, 0.08);
}

.toggle-field {
  justify-content: flex-end;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 18px;
  background: rgba(9, 7, 20, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.toggle-wrap input {
  width: 18px;
  min-height: auto;
  accent-color: var(--teal);
}

.action-row {
  margin-top: 12px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.download-btn,
.symbol-pill {
  padding: 10px 14px;
  border-radius: 14px;
}

.primary-btn {
  background: linear-gradient(145deg, rgba(155, 107, 255, 0.26), rgba(73, 230, 255, 0.2));
  box-shadow: 0 0 30px rgba(155, 107, 255, 0.12);
}

.ghost-btn,
.download-btn,
.symbol-pill {
  background: rgba(14, 11, 29, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.control-actions {
  justify-content: flex-start;
}

.export-panel {
  padding-bottom: 14px;
}

.export-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.export-toggle {
  min-height: 44px;
  padding: 0 12px;
}

.view {
  display: none;
  flex-direction: column;
  gap: 22px;
}

.view.active {
  display: flex;
  animation: fadeInUp 280ms ease;
}

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

.stat-grid-compact {
  margin-top: 12px;
}

.stat-grid-compact .info-card {
  padding: 11px 12px;
}

.stat-grid-compact .info-card strong {
  font-size: clamp(0.92rem, 1.2vw, 1.28rem);
}

.stat-grid-compact .muted {
  font-size: 0.76rem;
  line-height: 1.4;
}

.info-card,
.summary-card,
.signal-card {
  padding: 14px;
}

.info-card strong,
.summary-card strong,
.signal-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1rem, 1.6vw, 1.7rem);
}

.hero-grid,
.data-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.56fr) minmax(330px, 0.94fr);
  gap: 22px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-grid-after-chart {
  margin-top: 14px;
  margin-bottom: 0;
}

.summary-card {
  border-radius: 18px;
  padding: 12px;
}

.summary-card strong {
  font-size: clamp(0.94rem, 1.18vw, 1.16rem);
}

.summary-card .muted {
  font-size: 0.77rem;
  line-height: 1.42;
}

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

.signal-card {
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(18, 13, 38, 0.86), rgba(11, 8, 24, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.signal-card .muted {
  font-size: 0.8rem;
  line-height: 1.4;
}

.active-shell {
  max-height: 280px;
}

.active-shell table {
  min-width: 920px;
}

.matrix-panel table {
  min-width: 1380px;
}

.chart-canvas {
  min-height: 330px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(8, 6, 18, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.chart-canvas.compact {
  min-height: 260px;
}

.panel-subsection {
  margin-top: 18px;
}

.sub-head {
  margin-bottom: 12px;
}

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

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

.position-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 13, 38, 0.94), rgba(11, 8, 24, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.position-head,
.position-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.position-head {
  margin-bottom: 12px;
}

.position-row {
  padding-top: 8px;
  color: var(--muted);
}

.badge {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(73, 230, 255, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(73, 230, 255, 0.16);
}

.badge-wide {
  min-width: 104px;
  text-align: center;
}

.badge-busy {
  background: rgba(155, 107, 255, 0.18);
  border-color: rgba(155, 107, 255, 0.32);
  color: #dbc9ff;
}

.table-shell {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(8, 6, 18, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.table-shell.shallow {
  max-height: 260px;
}

.table-shell.medium {
  max-height: 360px;
}

.table-shell.deep {
  max-height: 640px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(17, 13, 37, 0.98), rgba(15, 11, 33, 0.98));
  color: #d1c9ff;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

tbody tr:hover {
  background: rgba(73, 230, 255, 0.04);
}

td {
  color: #ece9ff;
  font-size: 0.88rem;
}

.clickable-row {
  cursor: pointer;
}

.empty {
  color: var(--muted);
  padding: 18px 0;
}

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

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

.neutral {
  color: var(--muted);
}

svg {
  width: 100%;
  height: 100%;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}

.chart-level-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-toggle {
  min-height: 44px;
}

.admin-grid {
  display: grid;
  gap: 14px;
}

.admin-card {
  border-radius: 22px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 8, 24, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.admin-card-head h4 {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 500;
}

.admin-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-field span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-field-toggle {
  justify-content: space-between;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.7; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(155, 107, 255, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: rgba(12, 10, 26, 0.2);
}

@media (max-width: 1420px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-meta {
    min-width: 0;
    width: 100%;
  }

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

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

@media (max-width: 1200px) {
  .hero-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }

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

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

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

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

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

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

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .side-panel {
    inset: 14px auto 14px 14px;
    width: min(88vw, 360px);
    transform: translateX(calc(-100% - 22px));
  }

  body.menu-open .side-panel {
    transform: translateX(0);
  }

  .topbar-brand {
    min-width: 0;
  }

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

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

@media (max-width: 720px) {
  .title-wrap h2 {
    font-size: 1.7rem;
  }

  .topbar-left,
  .topbar-brand {
    align-items: flex-start;
  }

  .panel,
  .control-deck {
    padding: 16px;
    border-radius: 24px;
  }

  .signal-grid,
  .summary-grid,
  .topbar-meta,
  .stat-grid {
    grid-template-columns: 1fr;
  }

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

  .deck-top-compact {
    flex-direction: column;
  }

  .deck-inline-tools {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .profile-pill {
    min-width: 100%;
  }

  .download-row {
    margin-left: 0;
  }

  .export-toolbar {
    align-items: stretch;
  }

  .admin-fields {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 760px;
  }
}
