:root {
  color-scheme: dark;
  --bg: #070809;
  --surface: #0d1115;
  --surface-2: #111821;
  --surface-3: #17202b;
  --line: rgba(230, 238, 247, 0.10);
  --line-strong: rgba(230, 238, 247, 0.18);
  --text: #eef4f8;
  --muted: #8d9aa8;
  --soft: #c8d3de;
  --good: #3fd49d;
  --warn: #efb85d;
  --bad: #ff6b72;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), transparent 260px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.018) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 44px 44px, 44px 44px, auto;
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button {
  border: 1px solid var(--line-strong);
  background: #151d26;
  color: var(--text);
  min-height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
}

.shell {
  width: min(1320px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 11, 14, .82);
  backdrop-filter: blur(12px);
}

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

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #202a34, #11171e);
  font-weight: 800;
  color: #dff7ee;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; letter-spacing: 0; }
h2 { font-size: 21px; letter-spacing: 0; }
h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.brand p, .muted { color: var(--muted); }
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}
.nav-tabs a {
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
}
.nav-tabs a.active {
  color: var(--text);
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.hero-strip,
.charon-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(67,214,162,.11), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.022));
}
.hero-strip h2,
.charon-hero h2 {
  margin-top: 4px;
  font-size: 24px;
}
.charon-hero p:not(.eyebrow) {
  margin-top: 5px;
  color: var(--muted);
}
.hero-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.agent-card, .panel, .side-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 24, 31, .96), rgba(10, 13, 17, .98));
  border-radius: 10px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .24);
}

.agent-card {
  min-height: 390px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.agent-card::before, .side-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
}

.agent-topline, .section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.badge.good { color: var(--good); border-color: rgba(74, 214, 160, .24); }
.badge.warn { color: var(--warn); border-color: rgba(242, 185, 95, .26); }
.badge.bad { color: var(--bad); border-color: rgba(255, 109, 115, .28); }

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

.big-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.052), rgba(255,255,255,.025));
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.stat strong {
  display: block;
  margin-top: 7px;
  font-size: 19px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.stat em {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.activity {
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, .035);
  padding: 12px;
  min-height: 78px;
  border-radius: 0 8px 8px 0;
}
.activity span {
  color: var(--muted);
  font-size: 12px;
}
.activity p {
  margin-top: 5px;
  color: #d7e1ed;
  overflow-wrap: anywhere;
}
.activity.large { min-height: 120px; }

.actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}
.actions a {
  flex: 1;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
}
.actions .primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, white), var(--accent));
  color: #06100c;
  border-color: transparent;
  font-weight: 800;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}
.status-line span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}
.status-line span.good { background: var(--good); box-shadow: 0 0 18px rgba(63,212,157,.55); }
.status-line span.warn { background: var(--warn); box-shadow: 0 0 18px rgba(239,184,93,.45); }
.status-line span.bad { background: var(--bad); box-shadow: 0 0 18px rgba(255,107,114,.5); }
.status-line strong {
  font-size: 13px;
}
.status-line em {
  margin-left: auto;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.micro-chart {
  height: 72px;
  display: flex;
  align-items: end;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
}
.micro-chart i {
  flex: 1;
  display: block;
  min-width: 8px;
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--accent) 76%, white);
  opacity: .88;
}

.detail-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
}

.side-panel {
  position: relative;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
}

.back {
  display: inline-flex;
  width: fit-content;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

.kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.kv span, .kv small {
  color: var(--muted);
}
.kv small {
  grid-column: 1 / -1;
  font-size: 12px;
}
.kv strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.main-panel { min-width: 0; }
.native-wrap, .panel {
  padding: 16px;
}
.full-native {
  padding: 0;
}
.native-back {
  margin-bottom: 12px;
}
.frame {
  width: 100%;
  min-height: calc(100vh - 116px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1018;
}

.charon-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.charon-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.charon-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.chart-panel .micro-chart {
  height: 150px;
  margin-top: 12px;
}
.chart-panel .micro-chart i:nth-child(1),
.chart-panel .micro-chart i:nth-child(2),
.chart-panel .micro-chart i:nth-child(3) {
  background: rgba(67, 214, 162, .86);
}
.chart-panel .micro-chart i:nth-child(4),
.chart-panel .micro-chart i:nth-child(5),
.chart-panel .micro-chart i:nth-child(6) {
  background: rgba(255, 191, 95, .9);
}
.strategy-list {
  margin-top: 10px;
  display: grid;
}
.chart-shell {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  overflow: hidden;
}
.pnl-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 250px;
}
.chart-grid {
  stroke: rgba(230, 238, 247, .1);
  stroke-width: 1;
}
.chart-zero {
  stroke: rgba(239, 184, 93, .65);
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
}
.chart-line {
  fill: none;
  stroke: #43d6a2;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(67, 214, 162, .32));
}
.pnl-chart circle {
  stroke: #0a0f12;
  stroke-width: 2;
}
.pnl-chart circle.gain {
  fill: var(--good);
}
.pnl-chart circle.loss {
  fill: var(--bad);
}
.chart-y-label,
.chart-x-label {
  fill: var(--muted);
  font-size: 12px;
  text-anchor: end;
}
.chart-x-label {
  text-anchor: middle;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
  padding: 9px 12px 12px;
  color: var(--muted);
  font-size: 12px;
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-legend strong {
  color: var(--soft);
  font-weight: 600;
}
.gain-dot,
.loss-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.gain-dot { background: var(--good); }
.loss-dot { background: var(--bad); }
.chart-empty {
  margin-top: 12px;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
}
.panel.wide { min-height: 250px; }
.feed-card {
  margin-top: 12px;
}
.trade-box {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.process-list, .warning-list {
  display: grid;
  gap: 8px;
}
.process-row, .warning-line, .empty, .health-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: #cbd6e3;
  overflow-wrap: anywhere;
}
.health-card {
  display: grid;
  gap: 6px;
}
.health-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.health-card span,
.health-card small {
  color: var(--muted);
}
.health-card strong {
  color: var(--good);
}
.process-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.position-table {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  max-width: 100%;
}
.perf-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.perf-table.compact .perf-row {
  grid-template-columns: 86px 1fr repeat(4, minmax(80px, 1fr));
}
.perf-row {
  display: grid;
  grid-template-columns: 90px 1.2fr repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: #d9e3ef;
}
.perf-row strong {
  color: var(--text);
  font-size: 18px;
}
.perf-row span {
  overflow-wrap: anywhere;
}
.position-head,
.position-row {
  display: grid;
  grid-template-columns: 64px 1fr 110px 100px 100px 120px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.position-head {
  color: var(--muted);
  background: rgba(255,255,255,.025);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.position-row {
  background: rgba(255,255,255,.04);
  color: #d9e3ef;
}
.warning-line {
  color: var(--warn);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.empty { color: var(--muted); }

@media (max-width: 980px) {
  .overview-band, .agent-grid, .detail-shell, .trade-box, .charon-two-col { grid-template-columns: 1fr; }
  .charon-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big-stats, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-strip, .charon-hero { flex-direction: column; }
  .hero-metrics { justify-content: flex-start; }
  .position-head { display: none; }
  .position-row { grid-template-columns: 1fr 1fr; }
  .perf-row, .perf-table.compact .perf-row { grid-template-columns: 1fr 1fr; }
  .side-panel { order: 2; }
  .main-panel { order: 1; }
}

@media (max-width: 620px) {
  body {
    background-size: auto, 32px 32px, 32px 32px, auto;
    font-size: 13px;
  }
  .shell {
    width: min(100vw - 14px, 1240px);
    padding-top: 8px;
    padding-bottom: 24px;
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 9px;
    margin-bottom: 10px;
  }
  .brand {
    gap: 10px;
    min-width: 0;
  }
  .brand h1 {
    font-size: 17px;
  }
  .brand p {
    font-size: 12px;
  }
  .mark {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
  }
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tabs a {
    flex: 1 0 auto;
    min-width: 92px;
    padding: 0 10px;
  }
  .toolbar {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .toolbar span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .toolbar button {
    flex: 0 0 auto;
  }
  .hero-strip,
  .charon-hero {
    padding: 13px;
    margin-bottom: 10px;
  }
  .hero-strip h2,
  .charon-hero h2 {
    font-size: 19px;
    line-height: 1.18;
  }
  .overview-band {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .agent-card,
  .panel,
  .side-panel {
    border-radius: 8px;
  }
  .agent-card,
  .panel,
  .native-wrap {
    padding: 12px;
  }
  .agent-card {
    min-height: auto;
    gap: 12px;
  }
  .agent-topline,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .big-stats, .stat-grid { grid-template-columns: 1fr; }
  .charon-kpis { grid-template-columns: 1fr; }
  .stat {
    min-height: 72px;
    padding: 10px;
  }
  .stat strong {
    font-size: 18px;
  }
  .micro-chart {
    height: 58px;
    gap: 5px;
    padding: 10px;
  }
  .chart-panel .micro-chart {
    height: 112px;
  }
  .pnl-chart {
    min-height: 220px;
  }
  .chart-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .activity {
    padding: 10px;
  }
  .detail-shell {
    gap: 10px;
  }
  .side-panel {
    padding: 12px;
  }
  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .kv strong {
    text-align: left;
  }
  .perf-row,
  .perf-table.compact .perf-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
  }
  .position-table {
    gap: 8px;
  }
  .position-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 10px;
  }
  .position-row span {
    overflow-wrap: anywhere;
  }
  .actions { flex-direction: column; }
  .frame {
    min-height: calc(100vh - 134px);
    border-radius: 8px;
  }
}

@media (max-width: 380px) {
  .overview-band {
    grid-template-columns: 1fr;
  }
  .badge-row,
  .hero-metrics {
    align-items: stretch;
    flex-direction: column;
  }
  .badge,
  .status-line {
    width: 100%;
  }
}

/* Professional UX refresh — clearer hierarchy, calmer surfaces, mobile-first readability */
:root {
  --bg: #06070a;
  --surface: #0c0f14;
  --surface-2: #121722;
  --surface-3: #182032;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.14);
  --text: #f7f8fb;
  --muted: #98a2b3;
  --soft: #d7dce7;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --accent-blue: #7c8cff;
}
body {
  background:
    radial-gradient(circle at 15% -10%, rgba(124,140,255,.18), transparent 34rem),
    radial-gradient(circle at 86% 4%, rgba(34,197,94,.10), transparent 30rem),
    linear-gradient(180deg, rgba(255,255,255,.035), transparent 22rem),
    var(--bg);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv01", "ss03";
}
button, .actions a, .back, .nav-tabs a { transition: border-color .16s ease, background .16s ease, transform .16s ease; }
button:hover, .actions a:hover, .back:hover, .nav-tabs a:hover { border-color: rgba(124,140,255,.45); background: rgba(255,255,255,.075); transform: translateY(-1px); }
.shell { width: min(1440px, calc(100vw - 32px)); }
.topbar {
  position: sticky; top: 12px; z-index: 30;
  margin-bottom: 18px; border-radius: 16px;
  background: rgba(8,10,14,.78); box-shadow: 0 18px 50px rgba(0,0,0,.24);
}
.mark { border-radius: 12px; background: linear-gradient(135deg, #7c8cff, #54e1a6); color: #05070a; box-shadow: 0 0 28px rgba(124,140,255,.25); }
h1 { font-size: 21px; letter-spacing: -.03em; }
h2 { letter-spacing: -.035em; }
.eyebrow { color: #aeb7ff; font-weight: 800; }
.nav-tabs { border-radius: 999px; padding: 5px; background: rgba(255,255,255,.045); }
.nav-tabs a { border-radius: 999px; font-weight: 700; }
.nav-tabs a.active { background: linear-gradient(180deg, rgba(124,140,255,.28), rgba(124,140,255,.14)); box-shadow: inset 0 0 0 1px rgba(124,140,255,.22); }
.hero-strip, .charon-hero {
  border-radius: 18px; padding: 24px;
  background: linear-gradient(135deg, rgba(124,140,255,.16), rgba(34,197,94,.08) 42%, rgba(255,255,255,.035));
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
}
.hero-strip h2, .charon-hero h2 { font-size: clamp(24px, 3.2vw, 38px); line-height: 1.04; }
.overview-band, .agent-grid, .charon-kpis, .charon-two-col { gap: 16px; }
.agent-card, .panel, .side-panel { border-radius: 18px; background: linear-gradient(180deg, rgba(17,22,32,.94), rgba(9,12,18,.98)); box-shadow: 0 20px 70px rgba(0,0,0,.26); overflow: hidden; }
.agent-card { min-height: 420px; padding: 22px; }
.agent-card::before, .side-panel::before { height: 4px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.badge { min-height: 28px; padding: 5px 10px; border-radius: 999px; font-weight: 700; }
.badge.good { background: rgba(34,197,94,.12); color: #86efac; }
.badge.warn { background: rgba(245,158,11,.12); color: #facc15; }
.badge.bad { background: rgba(239,68,68,.12); color: #fca5a5; }
.status-line, .stat, .activity, .micro-chart, .chart-shell { border-radius: 14px; background: rgba(255,255,255,.04); }
.status-line { min-height: 42px; }
.stat { min-height: 96px; padding: 15px; }
.stat strong { font-size: clamp(20px, 2.2vw, 28px); letter-spacing: -.03em; }
.stat span, .stat em, .activity span, .kv span, .kv small { color: var(--muted); }
.actions a { min-height: 44px; border-radius: 12px; font-weight: 700; }
.actions .primary { background: linear-gradient(135deg, #7c8cff, #54e1a6); color: #05070a; }
.frame { border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.32); }
.position-head, .position-row, .perf-row { border-radius: 12px; }
@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .topbar { top: 8px; border-radius: 14px; }
  .hero-strip, .charon-hero { padding: 18px; }
  .overview-band { grid-template-columns: 1fr; }
  .agent-grid, .charon-two-col { grid-template-columns: 1fr; }
}

/* V2 clarity pass: visible structural redesign for Meridian + Charon */
.hero-note { margin-top: 10px; max-width: 780px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.detail-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-bottom: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(135deg, rgba(124,140,255,.18), rgba(84,225,166,.09) 48%, rgba(255,255,255,.035));
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
}
.detail-hero h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1; margin-top: 6px; }
.detail-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.detail-kpis .stat { min-height: 112px; background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)); }
.native-frame-panel { padding: 18px; }
.native-frame-panel .frame { min-height: calc(100vh - 260px); }
.charon-layout .charon-hero { border-radius: 20px; padding: 24px; }
.charon-layout .panel { padding: 20px; }
.agent-card.meridian { --accent: #54e1a6; }
.agent-card.charon { --accent: #fbbf24; }
.agent-card h2 { font-size: 30px; }
.agent-card .activity p { font-size: 14px; line-height: 1.55; }
@media (max-width: 900px) { .detail-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .detail-hero { align-items: flex-start; flex-direction: column; } }
@media (max-width: 560px) { .detail-kpis { grid-template-columns: 1fr; } .detail-hero h2 { font-size: 28px; } }

/* STRUCTURAL REBUILD V3: sidebar console + workspace pages */
#app { min-height: 100vh; }
.console-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.console-sidebar { position: sticky; top: 0; height: 100vh; padding: 18px; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(8,10,15,.96), rgba(6,7,10,.98)); display: flex; flex-direction: column; gap: 18px; }
.brand-panel { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.04); }
.brand-panel h1 { font-size: 18px; letter-spacing: -.04em; } .brand-panel p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, #7c8cff, #54e1a6); color: #05070a; }
.side-nav { display: grid; gap: 8px; }
.side-nav a { display: grid; gap: 2px; padding: 13px 14px; border-radius: 14px; border: 1px solid transparent; background: rgba(255,255,255,.025); }
.side-nav a span { font-weight: 800; } .side-nav a em { color: var(--muted); font-size: 12px; font-style: normal; }
.side-nav a.active { border-color: rgba(124,140,255,.35); background: linear-gradient(135deg, rgba(124,140,255,.22), rgba(84,225,166,.08)); }
.sidebar-health { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); }
.sidebar-health h3, .panel-card h3, .ops-board h3 { margin: 0 0 12px; font-size: 15px; letter-spacing: -.02em; }
.health-line { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.health-line:first-of-type { border-top: 0; } .health-line span { color: var(--muted); } .health-line strong { font-size: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--muted); box-shadow: 0 0 18px currentColor; } .status-dot.good { background: var(--good); color: var(--good); } .status-dot.warn { background: var(--warn); color: var(--warn); } .status-dot.bad { background: var(--bad); color: var(--bad); }
.console-main { min-width: 0; padding: 18px 22px 34px; }
.workspace-topbar { position: sticky; top: 12px; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(8,10,15,.78); backdrop-filter: blur(16px); box-shadow: 0 18px 55px rgba(0,0,0,.24); }
.workspace-topbar h2 { font-size: 24px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
#refresh { border-radius: 999px; min-height: 38px; font-weight: 800; }
.overview-hero, .workspace-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(135deg, rgba(124,140,255,.18), rgba(84,225,166,.08) 48%, rgba(255,255,255,.035)); box-shadow: 0 22px 70px rgba(0,0,0,.26); }
.overview-hero h2, .workspace-hero h2 { font-size: clamp(32px, 4vw, 56px); line-height: .98; max-width: 980px; }
.overview-hero p, .workspace-hero p { max-width: 850px; margin-top: 12px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.hero-stack { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 220px; }
.ops-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.055); color: var(--soft); font-size: 12px; font-weight: 800; white-space: nowrap; }
.ops-badge.good { color: #86efac; background: rgba(34,197,94,.13); border-color: rgba(34,197,94,.28); } .ops-badge.warn { color: #fde68a; background: rgba(245,158,11,.13); border-color: rgba(245,158,11,.28); } .ops-badge.bad { color: #fca5a5; background: rgba(239,68,68,.13); border-color: rgba(239,68,68,.30); }
.metric-grid { display: grid; gap: 14px; margin-bottom: 16px; } .metric-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { min-height: 118px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.062), rgba(255,255,255,.026)); box-shadow: 0 16px 45px rgba(0,0,0,.18); }
.metric-card span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 850; letter-spacing: .065em; }
.metric-card strong { display: block; margin-top: 9px; font-size: clamp(24px, 2.6vw, 36px); line-height: 1; letter-spacing: -.04em; overflow-wrap: anywhere; }
.metric-card small { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; } .metric-card.good { border-color: rgba(34,197,94,.22); } .metric-card.warn { border-color: rgba(245,158,11,.24); } .metric-card.bad { border-color: rgba(239,68,68,.26); }
.workspace-grid { display: grid; gap: 16px; margin-bottom: 16px; } .workspace-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .workspace-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bot-summary, .panel-card, .ops-board { border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, rgba(16,21,31,.94), rgba(8,11,17,.98)); box-shadow: 0 22px 70px rgba(0,0,0,.22); }
.bot-summary { position: relative; overflow: hidden; padding: 22px; display: flex; min-height: 360px; flex-direction: column; gap: 18px; }
.bot-summary::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.bot-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; } .bot-head > div { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; } .bot-head .eyebrow, .bot-head h3 { grid-column: 2; } .bot-head h3 { margin: 2px 0 0; font-size: 34px; }
.hero-number strong { font-size: 64px; line-height: .9; letter-spacing: -.06em; } .hero-number span { display: block; margin-top: 8px; color: var(--muted); text-transform: uppercase; font-size: 12px; font-weight: 850; }
.bot-body p { margin-top: 14px; color: var(--soft); line-height: 1.6; }
.bot-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.open-workspace { display: grid; place-items: center; min-height: 46px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 76%, white), var(--accent)); color: #05070a; font-weight: 900; }
.ops-board { display: grid; grid-template-columns: .85fr 1.15fr; gap: 1px; overflow: hidden; background: var(--line); }
.board-column { padding: 20px; background: rgba(10,13,19,.96); } .board-column p { color: var(--muted); line-height: 1.55; } .check-list { display: grid; gap: 9px; } .check-list span { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); }
.panel-card { padding: 20px; min-width: 0; } .panel-card + .panel-card { margin-top: 16px; }
.kv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); } .kv-row span, .kv-row small { color: var(--muted); } .kv-row small { grid-column: 1 / -1; font-size: 12px; } .kv-row strong { text-align: right; overflow-wrap: anywhere; }
.warning-stack { display: grid; gap: 8px; } .warning-stack p, .decision-box, .empty-box, .empty-chart { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); color: var(--soft); line-height: 1.55; overflow-wrap: anywhere; }
.section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; } .section-title h3 { margin: 3px 0 0; font-size: 22px; }
.mini-link { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--soft); font-weight: 800; font-size: 12px; }
.native-shell { padding: 18px; } .native-frame { width: 100%; min-height: calc(100vh - 300px); border: 1px solid var(--line); border-radius: 18px; background: #05070a; }
.charon-layout-v3 { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; } .control-rail { position: sticky; top: 110px; } .charon-main-v3 { min-width: 0; }
.chart-shell { border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.03); overflow: hidden; } .chart-shell svg { width: 100%; min-height: 240px; display: block; } .chart-zero { stroke: rgba(245,158,11,.65); stroke-dasharray: 6 7; } .chart-line { fill: none; stroke: #54e1a6; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 8px rgba(84,225,166,.25)); } .chart-shell circle { stroke: #05070a; stroke-width: 2; } .chart-shell circle.gain { fill: var(--good); } .chart-shell circle.loss { fill: var(--bad); }
.trade-table { display: grid; gap: 8px; } .trade-head, .trade-row { display: grid; grid-template-columns: .55fr 1fr .8fr .8fr .7fr 1.7fr; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 12px; } .trade-head { color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 850; letter-spacing: .06em; } .trade-row { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--soft); }
@media (max-width: 1100px) { .console-layout { grid-template-columns: 1fr; } .console-sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .side-nav { grid-template-columns: repeat(3, 1fr); } .sidebar-health { margin-top: 0; } .metric-grid.four, .workspace-grid.thirds { grid-template-columns: repeat(2, minmax(0, 1fr)); } .charon-layout-v3 { grid-template-columns: 1fr; } .control-rail { position: static; } }
@media (max-width: 720px) { .console-main, .console-sidebar { padding: 12px; } .workspace-topbar, .overview-hero, .workspace-hero { align-items: flex-start; flex-direction: column; } .side-nav, .metric-grid.four, .workspace-grid.two, .workspace-grid.thirds, .ops-board { grid-template-columns: 1fr; } .hero-stack { justify-content: flex-start; } .bot-head { flex-direction: column; } .hero-number strong { font-size: 48px; } .trade-head { display: none; } .trade-row { grid-template-columns: 1fr; gap: 4px; } .kv-row { grid-template-columns: 1fr; } .kv-row strong { text-align: left; } }

/* V3 final polish: reduce hero wrapping and improve scan density */
.workspace-hero { align-items: flex-start; }
.workspace-hero h2 { font-size: clamp(30px, 3.2vw, 46px); max-width: 860px; }
.overview-hero h2 { font-size: clamp(30px, 3.4vw, 50px); }
.decision-box { font-size: 14px; }
.control-rail { min-height: 520px; }
@media (min-width: 1101px) { .charon-main-v3 .workspace-grid.two { grid-template-columns: 1fr 1fr; } }

/* CHARON TERMINAL V4: priority sections for open positions and trade history */
.priority-panel { border-color: rgba(124,140,255,.20); }
.open-empty { display: grid; gap: 6px; padding: 18px; border: 1px dashed rgba(255,255,255,.18); border-radius: 16px; background: rgba(255,255,255,.035); }
.open-empty strong { font-size: 20px; } .open-empty span { color: var(--muted); }
.open-position-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.open-position-card { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.028)); }
.open-position-card.good { border-color: rgba(34,197,94,.26); box-shadow: inset 0 0 0 1px rgba(34,197,94,.06); }
.open-position-card.bad { border-color: rgba(239,68,68,.28); box-shadow: inset 0 0 0 1px rgba(239,68,68,.06); }
.open-pos-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.mini-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 850; letter-spacing: .07em; }
.open-pos-head h4 { margin: 4px 0 0; font-size: 26px; letter-spacing: -.04em; }
.open-pos-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.open-pos-metrics div { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.15); }
.open-pos-metrics span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.open-pos-metrics strong { display: block; margin-top: 5px; font-size: 15px; overflow-wrap: anywhere; }
.open-position-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.history-list { display: grid; gap: 8px; }
.history-item { display: grid; grid-template-columns: 1.3fr .75fr .65fr 1.8fr; gap: 10px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); }
.history-main strong { display: block; font-size: 16px; } .history-main span, .history-size span, .history-pnl span, .history-reason span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: .055em; }
.history-size strong, .history-pnl strong, .history-reason strong { display: block; margin-top: 4px; color: var(--soft); overflow-wrap: anywhere; }
.history-pnl.good strong { color: #86efac; } .history-pnl.bad strong { color: #fca5a5; }
.charon-main-v3 > .priority-panel:first-child { box-shadow: 0 0 0 1px rgba(84,225,166,.08), 0 22px 70px rgba(0,0,0,.24); }
@media (max-width: 900px) { .open-position-grid, .history-item { grid-template-columns: 1fr; } .open-pos-metrics { grid-template-columns: 1fr; } }

/* MERIDIAN TERMINAL V5: LP positions, screening, decisions first */
.terminal-hero h2 { max-width: 960px; }
.meridian-terminal-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.meridian-main-v4 { min-width: 0; }
.meridian-position-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.meridian-position-card { padding: 16px; border: 1px solid rgba(84,225,166,.24); border-radius: 18px; background: linear-gradient(180deg, rgba(84,225,166,.08), rgba(255,255,255,.028)); }
.screening-grid-v4 { display: grid; gap: 2px; }
.decision-list-v4 { display: grid; gap: 8px; }
.decision-row-v4 { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); }
.decision-row-v4 strong { display: block; font-size: 15px; } .decision-row-v4 span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; } .decision-row-v4 p { margin: 0; color: var(--soft); line-height: 1.5; overflow-wrap: anywhere; }
.meridian-main-v4 > .priority-panel:first-child { box-shadow: 0 0 0 1px rgba(84,225,166,.08), 0 22px 70px rgba(0,0,0,.24); }
@media (max-width: 1100px) { .meridian-terminal-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .meridian-position-grid, .decision-row-v4 { grid-template-columns: 1fr; } }

/* V9 synchronized theme + sticky Meridian sub-navigation polish */
.theme-toggle { border-radius: 999px; min-height: 38px; display: inline-flex; align-items: center; gap: 7px; font-weight: 800; background: rgba(255,255,255,.055); }
.theme-toggle .theme-dot { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; background: rgba(255,255,255,.08); }
.theme-toggle span:not(.theme-dot) { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.theme-toggle strong { color: var(--text); font-size: 13px; }
.sub-nav { position: sticky; top: 92px; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 16px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: rgba(8,10,15,.86); backdrop-filter: blur(16px); box-shadow: 0 14px 42px rgba(0,0,0,.20); }
.sub-nav a { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--soft); font-size: 12px; font-weight: 850; background: rgba(255,255,255,.04); }
.sub-nav a:hover, .sub-nav a:focus-visible { border-color: rgba(84,225,166,.44); color: var(--text); background: rgba(84,225,166,.12); outline: none; }
#meridian-summary, #meridian-runtime, #meridian-positions, #meridian-screening, #meridian-decisions, #meridian-native { scroll-margin-top: 160px; }
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #eef4f9;
  --line: rgba(30, 46, 68, 0.13);
  --line-strong: rgba(30, 46, 68, 0.24);
  --text: #102033;
  --muted: #627086;
  --soft: #334155;
  --good: #059669;
  --warn: #b7791f;
  --bad: #dc2626;
}
html[data-theme="light"] body { background: radial-gradient(circle at top left, rgba(84,225,166,.15), transparent 32%), radial-gradient(circle at 70% 0, rgba(124,140,255,.12), transparent 30%), linear-gradient(180deg, #fbfdff, #eef3f8 72%, #e9eff5); color: var(--text); }
html[data-theme="light"] button { background: #ffffff; color: var(--text); border-color: var(--line); box-shadow: 0 8px 24px rgba(15,23,42,.055); }
html[data-theme="light"] .theme-toggle { background: #ffffff; border-color: rgba(30,46,68,.14); box-shadow: 0 10px 26px rgba(15,23,42,.07); }
html[data-theme="light"] .theme-toggle .theme-dot { background: linear-gradient(135deg, #fef3c7, #bbf7d0); color: #713f12; }
html[data-theme="light"] .console-sidebar { background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(245,248,252,.99)); }
html[data-theme="light"] .brand-panel, html[data-theme="light"] .sidebar-health, html[data-theme="light"] .side-nav a { background: rgba(255,255,255,.72); border-color: var(--line); }
html[data-theme="light"] .side-nav a.active { background: linear-gradient(135deg, rgba(124,140,255,.16), rgba(84,225,166,.12)); border-color: rgba(84,125,225,.25); }
html[data-theme="light"] .workspace-topbar, html[data-theme="light"] .sub-nav { background: rgba(255,255,255,.88); border-color: rgba(30,46,68,.13); box-shadow: 0 18px 55px rgba(15,23,42,.10); }
html[data-theme="light"] .sub-nav a { background: #f8fbff; color: #40516a; border-color: rgba(30,46,68,.13); }
html[data-theme="light"] .sub-nav a:hover, html[data-theme="light"] .sub-nav a:focus-visible { color: #075f49; background: rgba(5,150,105,.10); border-color: rgba(5,150,105,.24); }
html[data-theme="light"] .bot-summary, html[data-theme="light"] .panel-card, html[data-theme="light"] .metric-card { background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,251,254,.98)); border-color: rgba(30,46,68,.12); box-shadow: 0 18px 52px rgba(15,23,42,.09); }
html[data-theme="light"] .ops-board { background: rgba(30,46,68,.12); box-shadow: 0 18px 52px rgba(15,23,42,.09); }
html[data-theme="light"] .board-column { background: rgba(255,255,255,.96); }
html[data-theme="light"] .overview-hero, html[data-theme="light"] .workspace-hero { background: linear-gradient(135deg, rgba(124,140,255,.14), rgba(84,225,166,.14) 48%, rgba(255,255,255,.92)); box-shadow: 0 20px 58px rgba(15,23,42,.11); }
html[data-theme="light"] .ops-badge { background: #f8fbff; color: #40516a; border-color: rgba(30,46,68,.12); }
html[data-theme="light"] .ops-badge.good { color: #047857; background: rgba(16,185,129,.13); border-color: rgba(16,185,129,.24); }
html[data-theme="light"] .ops-badge.warn { color: #92400e; background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.24); }
html[data-theme="light"] .ops-badge.bad { color: #b91c1c; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.22); }
html[data-theme="light"] .open-empty, html[data-theme="light"] .warning-stack p, html[data-theme="light"] .decision-box, html[data-theme="light"] .empty-box, html[data-theme="light"] .empty-chart, html[data-theme="light"] .history-item, html[data-theme="light"] .decision-row-v4, html[data-theme="light"] .chart-shell, html[data-theme="light"] .check-list span, html[data-theme="light"] .open-pos-metrics div, html[data-theme="light"] .kv-row { background: rgba(30,46,68,.035); }
html[data-theme="light"] .open-workspace { color: #05251b; box-shadow: 0 10px 30px rgba(5,150,105,.16); }
html[data-theme="light"] .native-frame { background: #ffffff; border-color: rgba(30,46,68,.14); }
@media (max-width: 720px) { .top-actions { width: 100%; flex-wrap: wrap; } .sub-nav { top: 82px; overflow-x: auto; flex-wrap: nowrap; border-radius: 14px; padding: 8px; } .sub-nav a { white-space: nowrap; flex: 0 0 auto; } #meridian-summary, #meridian-runtime, #meridian-positions, #meridian-screening, #meridian-decisions, #meridian-native { scroll-margin-top: 136px; } }

