:root {
  color-scheme: dark;
  --bg: #061018;
  --bg-2: #081926;
  --panel: #0b1d2b;
  --panel-2: #102638;
  --panel-3: #111827;
  --line: #25425b;
  --line-soft: #1a3349;
  --text: #edf6ff;
  --muted: #9eb0bf;
  --soft: #ced9e3;
  --blue: #1d7ff2;
  --cyan: #27c7ff;
  --green: #35d66f;
  --amber: #f5b82e;
  --red: #ff5b55;
  --violet: #a573ff;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 42% 0%, rgba(29, 127, 242, 0.16), transparent 34%),
    linear-gradient(135deg, #050b12 0%, #081622 48%, #0d171c 100%);
  color: var(--text);
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.terminal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}

.sidebar {
  grid-row: 1 / 3;
  background: rgba(5, 15, 25, 0.96);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 18px 14px;
  gap: 18px;
}

.brand,
.asset-lockup,
.user-chip,
.status-strip,
.hero-actions,
.mode-card,
.metric-row,
.signal-bar,
.chart-legend,
.timeline-row,
.copy-header {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-height: 84px;
  justify-content: center;
}

.brand-logo {
  display: block;
  width: min(100%, 208px);
  height: auto;
  aspect-ratio: 1254 / 704;
  object-fit: contain;
  border-radius: 6px;
}

.mobile-brand-logo {
  display: none;
  width: 92px;
  height: auto;
  aspect-ratio: 1254 / 704;
  object-fit: contain;
  border-radius: 6px;
}

.brand strong {
  display: block;
  text-transform: uppercase;
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand span {
  color: var(--cyan);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.nav-group {
  display: grid;
  gap: 5px;
}

.nav-label,
.eyebrow,
.meta-label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0;
}

.nav-item {
  width: 100%;
  text-align: left;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
}

.nav-item.is-active,
.nav-item:hover,
.mode-card.is-active {
  background: rgba(29, 127, 242, 0.18);
  border-color: rgba(29, 127, 242, 0.42);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.user-chip {
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dce6f2;
  color: #101721;
  font-weight: 800;
  font-size: 12px;
}

.avatar.small {
  width: 28px;
  height: 28px;
}

.user-chip strong,
.user-chip small {
  display: block;
}

.user-chip small {
  color: var(--muted);
}

.read-only-note {
  border: 1px solid rgba(53, 214, 111, 0.3);
  background: rgba(53, 214, 111, 0.08);
  color: #c7f8d6;
  border-radius: var(--radius);
  padding: 11px;
  font-size: 12px;
}

.read-only-note strong,
.read-only-note span {
  display: block;
}

.read-only-note span {
  margin-top: 4px;
  color: var(--muted);
}

.workspace {
  min-width: 0;
  padding: 0 16px 100px;
}

.topbar {
  height: 54px;
  display: grid;
  grid-template-columns: minmax(240px, 620px) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.search {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-icon {
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -4px;
  transform: rotate(45deg);
  background: var(--muted);
}

.status-strip {
  justify-content: end;
  gap: 18px;
  color: var(--soft);
  font-size: 13px;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
}

.green {
  background: var(--green);
}

.amber {
  background: var(--amber);
}

.red {
  background: var(--red);
}

.blue {
  background: var(--blue);
}

.hero-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
}

.asset-lockup {
  gap: 14px;
  min-width: 0;
}

.asset-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  border: 1px solid var(--line);
  background: #0e1722;
  font-weight: 900;
  font-size: 22px;
  flex: 0 0 auto;
}

.asset-lockup h1 {
  margin: 2px 0 4px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
  letter-spacing: 0;
}

.asset-lockup p,
.quote-lockup small {
  margin: 0;
  color: var(--muted);
}

.quote-lockup {
  display: grid;
  gap: 2px;
  text-align: left;
}

.quote-price {
  font-size: 30px;
  font-weight: 800;
}

.quote-change {
  color: var(--green);
  font-weight: 700;
}

.hero-actions {
  gap: 8px;
  justify-content: end;
}

.icon-button,
.ghost-button,
.primary-button,
.mini-button,
.segmented button {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  min-height: 34px;
  cursor: pointer;
}

.icon-button {
  width: 34px;
}

.ghost-button,
.primary-button,
.mini-button {
  padding: 0 13px;
}

.primary-button {
  background: #0f65d8;
  border-color: #2d8bff;
}

.signal-bar {
  min-height: 46px;
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(7, 23, 34, 0.84);
}

.signal-bar div {
  padding: 9px 13px;
  border-right: 1px solid var(--line-soft);
}

.signal-bar div:last-child {
  border-right: 0;
}

.signal-bar span,
.signal-bar strong {
  display: block;
}

.signal-bar span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.signal-bar strong {
  margin-top: 3px;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: 16px;
  margin-top: 14px;
}

.main-panel,
.right-rail,
.panel,
.rail-section {
  min-width: 0;
}

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

.panel,
.rail-section {
  border: 1px solid var(--line-soft);
  background: rgba(9, 27, 40, 0.88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.panel h2,
.rail-section h2 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.review-state {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.state-mark {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgba(53, 214, 111, 0.6);
  color: var(--green);
  font-weight: 900;
}

.state-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
}

.state-title.amber-text,
.amber-text {
  color: var(--amber);
}

.blue-text {
  color: var(--cyan);
}

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

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

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

.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.metric-number {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.metric-number.green-text {
  color: var(--green);
}

.metric-row {
  gap: 12px;
  justify-content: space-between;
  margin-top: 14px;
}

.meter,
.bar {
  height: 8px;
  background: #172a3b;
  border-radius: 999px;
  overflow: hidden;
}

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

.ring {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 6px auto 12px;
  background:
    radial-gradient(circle at center, var(--panel) 54%, transparent 55%),
    conic-gradient(var(--green) 0 78%, var(--red) 78% 92%, var(--amber) 92% 100%);
}

.ring strong {
  font-size: 28px;
}

.evidence-list,
.compact-list,
.timeline,
.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.evidence-list li,
.compact-list li,
.check-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  color: var(--soft);
  font-size: 13px;
}

.badge {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.badge.good {
  color: #062012;
  background: var(--green);
}

.badge.bad {
  color: #2b0605;
  background: var(--red);
}

.badge.warn {
  color: #2a1b00;
  background: var(--amber);
}

.badge.info {
  color: #031324;
  background: var(--cyan);
}

.tag {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 4px 7px;
  white-space: nowrap;
  font-size: 11px;
}

.chart {
  min-height: 128px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 32px, 64px 100%;
  padding: 10px;
}

.chart svg {
  width: 100%;
  height: 116px;
  display: block;
}

.chart-legend {
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.driver-list {
  display: grid;
  gap: 10px;
}

.driver-row {
  display: grid;
  grid-template-columns: 1fr 82px 58px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.right-rail {
  display: grid;
  gap: 12px;
  align-content: start;
}

.rail-section {
  padding: 14px;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  gap: 12px;
}

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

.summary-list dd {
  margin: 0;
  text-align: right;
  color: var(--soft);
}

.policy-note {
  border-color: rgba(39, 199, 255, 0.32);
  background: rgba(29, 127, 242, 0.1);
}

.policy-note p {
  margin: 0;
  color: #b8ddff;
  line-height: 1.45;
}

.mode-switcher {
  position: fixed;
  inset: auto 0 0 248px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: rgba(6, 16, 24, 0.96);
  backdrop-filter: blur(12px);
}

.mode-card {
  min-width: 0;
  min-height: 62px;
  justify-content: start;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
}

.mode-icon {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.mode-card strong,
.mode-card small {
  display: block;
}

.mode-card small {
  color: var(--muted);
  margin-top: 2px;
}

.lesson-grid,
.api-grid,
.enterprise-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.code-block {
  background: #07111b;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  min-height: 150px;
  color: #d8e7f5;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.segmented button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
}

.segmented .is-active {
  background: var(--blue);
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr 96px 84px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.copy-header {
  justify-content: space-between;
  margin-bottom: 8px;
}

@media (max-width: 1180px) {
  .terminal-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px 8px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
    object-fit: cover;
    object-position: left center;
    border: 1px solid rgba(39, 199, 255, 0.38);
  }

  .nav-label,
  .nav-item,
  .user-chip span,
  .read-only-note {
    display: none;
  }

  .brand {
    justify-content: center;
  }

  .mode-switcher {
    left: 76px;
  }

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

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

@media (max-width: 880px) {
  .terminal-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 0 10px 270px;
  }

  .topbar,
  .hero-row,
  .signal-bar {
    grid-template-columns: 1fr;
    height: auto;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 10px 0;
  }

  .mobile-brand-logo {
    display: block;
    width: 82px;
    align-self: center;
  }

  .search {
    min-width: 0;
  }

  .status-strip,
  .hero-actions {
    justify-content: start;
    flex-wrap: wrap;
  }

  .status-strip {
    grid-column: 1 / -1;
  }

  .signal-bar div {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .signal-bar div:last-child {
    border-bottom: 0;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12,
  .lesson-grid > *,
  .api-grid > *,
  .enterprise-grid > * {
    grid-column: 1 / -1;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }

  .mode-switcher {
    left: 0;
    grid-template-columns: 1fr;
  }
}
