:root {
  --bg: #05070b;
  --panel: #0b1019;
  --panel-2: #101722;
  --panel-3: #151f2e;
  --line: #223047;
  --line-soft: #172235;
  --muted: #8fa0b8;
  --text: #eef4ff;
  --green: #15c784;
  --red: #f6465d;
  --yellow: #f0b90b;
  --orange: #f59e0b;
  --blue: #3861fb;
}

* { box-sizing: border-box; }

html,
body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
}

body {
  overflow-x: hidden;
  background: #05070b;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
  background: rgba(5, 7, 11, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 11px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #111;
  font-size: 13px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  color: #c7d1e1;
  font-size: 14px;
  scrollbar-width: none;
}

.nav-links a {
  white-space: nowrap;
  transition: color 0.18s ease;
}

.nav-links a:hover { color: var(--yellow); }

button,
.paper-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #111;
  font-weight: 800;
  font-size: 12px;
}

button:not(:disabled) { cursor: pointer; }

.paper-button {
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(240, 185, 11, 0.38);
}

.secondary-button {
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(240, 185, 11, 0.36);
}

.shell {
  width: 100%;
  min-height: 100vh;
  padding: 82px 18px 54px;
}

.market-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.headline h1 {
  margin: 0;
  font-size: clamp(24px, 2.8vw, 44px);
  line-height: 1.02;
  letter-spacing: 0;
}

.eyebrow,
.label {
  margin: 0 0 7px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.market-actions {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.market-actions label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

select {
  min-height: 38px;
  border: 1px solid #2d3c57;
  border-radius: 8px;
  padding: 0 12px;
  background: #080c13;
  color: var(--text);
  font-weight: 800;
}

.terminal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 28vw);
  gap: 14px;
  align-items: start;
}

.left-stack,
.right-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel,
.agent-card {
  background: linear-gradient(180deg, rgba(15, 22, 34, 0.98), rgba(10, 15, 24, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel { padding: 14px; }

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

.panel-head.compact { align-items: center; }

h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.account-head { align-items: end; }

.account-value {
  font-size: clamp(30px, 4.2vw, 58px);
  line-height: 0.95;
  font-weight: 950;
}

.best-agent {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(240, 185, 11, 0.38);
  border-radius: 8px;
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ticker-grid div {
  min-height: 66px;
  padding: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.ticker-grid span,
.settings-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ticker-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.signal-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
}

.signal-badge.buy { background: rgba(21, 199, 132, 0.14); color: var(--green); }
.signal-badge.sell { background: rgba(246, 70, 93, 0.14); color: var(--red); }
.signal-badge.neutral { background: rgba(143, 160, 184, 0.14); color: #c7d1e1; }

.chart-wrap {
  height: calc(100vh - 355px);
  min-height: 360px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(126px, 1fr));
  gap: 8px;
}

.agent-card {
  position: relative;
  min-height: 154px;
  padding: 12px;
  background: #0f1724;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.agent-card:hover,
.agent-card.copied {
  border-color: rgba(240, 185, 11, 0.7);
  background: #121d2c;
  transform: translateY(-1px);
}

.agent-card.best::before {
  content: "Meilleur";
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(240, 185, 11, 0.15);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 800;
  font-size: 12px;
}

.agent-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.agent-equity {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 950;
}

.copy-btn {
  width: 100%;
  margin-top: 10px;
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(240, 185, 11, 0.36);
}

.tab-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.tab-button {
  min-height: 34px;
  background: var(--panel-3);
  color: #cbd5e1;
  border: 1px solid var(--line-soft);
}

.tab-button.active {
  background: rgba(240, 185, 11, 0.14);
  color: var(--yellow);
  border-color: rgba(240, 185, 11, 0.42);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.positions-list,
.orders-list,
.history-list {
  display: grid;
  gap: 8px;
}

.position-row,
.order-row,
.history-row {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.position-top,
.order-top,
.history-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  font-size: 12px;
}

.position-meta,
.order-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

pre {
  max-height: 240px;
  overflow: auto;
  margin: 12px 0 0;
  white-space: pre-wrap;
  color: #d6e0ee;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

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

.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(21, 199, 132, 0.32);
  border-radius: 8px;
  background: rgba(21, 199, 132, 0.1);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  font-size: 12px;
}

.security-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 18px;
  background: rgba(5, 7, 11, 0.96);
  border-top: 1px solid var(--line);
}

.security-footer span {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 7px;
  background: #101827;
  color: #d5deeb;
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 40;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid rgba(240, 185, 11, 0.45);
  border-radius: 8px;
  background: #111827;
  color: var(--yellow);
  font-weight: 800;
  font-size: 12px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.settings-page h1 {
  margin: 0 0 18px;
}

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

.settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input {
  min-height: 38px;
  border: 1px solid #2d3c57;
  border-radius: 8px;
  padding: 0 12px;
  background: #080c13;
  color: var(--text);
  font-weight: 800;
}

textarea {
  min-height: 90px;
  border: 1px solid #2d3c57;
  border-radius: 8px;
  padding: 10px 12px;
  background: #080c13;
  color: var(--text);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  resize: vertical;
}

.prompt-card {
  display: grid;
  gap: 8px;
}

@media (min-width: 1700px) {
  .terminal-grid { grid-template-columns: minmax(0, 1fr) 480px; }
  .chart-wrap { min-height: 470px; }
}

@media (max-width: 1280px) {
  .terminal-grid { grid-template-columns: 1fr; }
  .right-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs-panel { grid-row: span 2; }
  .ticker-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .topbar {
    grid-template-columns: 1fr auto;
    height: auto;
    min-height: 64px;
    padding: 12px;
  }
  .nav-links {
    grid-column: 1 / -1;
    order: 3;
  }
  .shell { padding: 118px 10px 62px; }
  .market-bar,
  .terminal-grid,
  .right-stack,
  .ticker-grid,
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .market-actions { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .panel-head { display: grid; }
  .chart-wrap { height: 320px; min-height: 320px; }
  .security-footer { justify-content: start; overflow-x: auto; }
}

/* Live Control & Predictive Intelligence */
.live-controls { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.live-toggle, .kill-switch {
  border:0; border-radius:14px; padding:12px 18px; font-weight:900; letter-spacing:.04em;
  cursor:pointer; box-shadow:0 0 0 1px rgba(255,255,255,.08) inset, 0 12px 28px rgba(0,0,0,.35);
}
.live-toggle.off { background:linear-gradient(135deg,#7f1d1d,#ef4444); color:#fff; }
.live-toggle.on { background:linear-gradient(135deg,#991b1b,#dc2626); color:#fff; animation:pulse-live 1.4s infinite; }
.kill-switch { background:linear-gradient(135deg,#020617,#111827); color:#fca5a5; border:1px solid rgba(248,113,113,.55); }
.kill-switch.active { background:#dc2626; color:#fff; }
@keyframes pulse-live { 0%,100%{filter:brightness(1)} 50%{filter:brightness(1.28)} }
.live-status-panel, .forecast-panel, .audit-panel { border-color:rgba(239,68,68,.28); }
.ticker-grid.mini { grid-template-columns: repeat(2, minmax(0,1fr)); }
.audit-panel .history-row { font-size:.86rem; }
.single-page { max-width:1200px; margin:0 auto; }
pre#labResult { min-height:420px; overflow:auto; white-space:pre-wrap; }
@media (max-width: 920px) { .live-controls { width:100%; } .live-toggle, .kill-switch { flex:1; } }

.mode-switch-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.mode-toggle-box,
.safe-vault-box,
.capital-console,
.broker-flow {
  background: linear-gradient(180deg, rgba(15, 22, 34, 0.98), rgba(10, 15, 24, 0.98));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.mode-btn {
  min-height: 50px;
  border: 1px solid rgba(21, 199, 132, 0.38);
  background: rgba(21, 199, 132, 0.12);
  color: var(--green);
  letter-spacing: .02em;
}

.mode-btn.danger {
  border-color: rgba(246, 70, 93, 0.5);
  background: rgba(246, 70, 93, 0.14);
  color: var(--red);
}

.mode-btn.active {
  outline: 2px solid var(--yellow);
  box-shadow: 0 0 0 4px rgba(240, 185, 11, 0.12);
}

.vault-grid,
.capital-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.vault-grid div,
.capital-stats div {
  min-height: 78px;
  padding: 11px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.vault-grid span,
.capital-stats span,
.vault-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.vault-grid strong,
.capital-stats strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.vault-form,
.capital-credit-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.vault-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.capital-console {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
  margin-bottom: 14px;
}

.ledger-list {
  max-height: 125px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.flow-steps {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  color: #d6e0ee;
  font-weight: 800;
  font-size: 12px;
}

.flow-steps span {
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.flow-steps b { color: var(--yellow); }

@media (max-width: 1100px) {
  .mode-switch-panel,
  .capital-console { grid-template-columns: 1fr; }
  .vault-form,
  .capital-credit-form { grid-template-columns: 1fr; }
}

/* AI Market Brain */
.brain-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr 1.1fr;
  gap: 12px;
  margin: 12px;
}
.chief-panel {
  border-color: rgba(240, 185, 11, 0.55);
  background: radial-gradient(circle at top left, rgba(240, 185, 11, 0.14), rgba(13, 20, 33, 0.95) 42%);
}
.brain-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.brain-kpis div,
.war-card,
.opportunity-row {
  border: 1px solid #22324b;
  background: #101827;
  border-radius: 10px;
  padding: 10px;
}
.brain-kpis span,
.opportunity-row small {
  display: block;
  color: #8ea0bb;
  font-size: 11px;
}
.radar-score {
  font-size: 42px;
  font-weight: 800;
  font-size: 12px;
  color: #f0b90b;
  margin: 10px 0;
}
.meter {
  height: 8px;
  border: 1px solid #283956;
  background: #08111f;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}
.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #15c784, #f0b90b, #f6465d);
  transition: width .35s ease;
}
.meter.small { height: 5px; }
.war-room-list,
.opportunity-map {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}
.opportunity-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}
.opportunity-row span {
  color: #f0b90b;
  font-weight: 800;
}
.opportunity-row b {
  color: #15c784;
}
.portfolio-brain-panel,
.timeline-panel { min-height: 190px; }
@media (max-width: 1200px) {
  .brain-grid { grid-template-columns: 1fr; }
  .brain-kpis { grid-template-columns: 1fr; }
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(240,185,11,.18), transparent 28%), radial-gradient(circle at 80% 10%, rgba(246,70,93,.12), transparent 30%), #05070b;
}
.login-shell { width: min(520px, calc(100vw - 32px)); }
.login-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(16,23,34,.96), rgba(7,10,16,.98));
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
.login-brand { display:flex; align-items:center; gap:14px; margin-bottom:22px; }
.login-brand h1 { margin:0; font-size:34px; }
.login-brand p { margin:3px 0 0; color:var(--muted); }
.login-warning { border:1px solid rgba(246,70,93,.45); background:rgba(246,70,93,.10); color:#fecdd3; padding:12px; border-radius:12px; margin-bottom:20px; }
.login-card label { display:block; color:#c7d1e1; margin:14px 0; font-weight:800; }
.login-card input { width:100%; margin-top:8px; padding:14px 15px; border-radius:12px; border:1px solid var(--line); background:#080d15; color:var(--text); font-weight:800; }
.login-card button { width:100%; margin-top:14px; padding:14px; border-radius:12px; border:0; background:linear-gradient(135deg, var(--yellow), var(--orange)); color:#111; font-weight:1000; cursor:pointer; }
.terminal-box { white-space:pre-wrap; background:#05070b; border:1px solid var(--line); border-radius:12px; padding:14px; color:#c7d1e1; overflow:auto; max-height:260px; }
.logout-btn { border:1px solid var(--line); background:#101722; color:#eef4ff; border-radius:10px; padding:8px 10px; font-weight:900; cursor:pointer; }
.real-data-badge { display:inline-flex; gap:8px; align-items:center; border:1px solid rgba(21,199,132,.4); background:rgba(21,199,132,.08); color:#a7f3d0; border-radius:999px; padding:6px 10px; font-weight:900; }
.real-data-badge.bad { border-color:rgba(246,70,93,.45); background:rgba(246,70,93,.1); color:#fecdd3; }

/* account and broker polish */
.dashboard-shell {
  width: 100%;
  min-height: 100vh;
  padding: 88px 18px 54px;
}
.account-page, .broker-page { max-width: 1180px; margin: 0 auto; }
.account-card { margin-top: 18px; }
.account-form { display: grid; gap: 12px; max-width: 560px; }
.account-form label { color: var(--muted); font-weight: 800; }
.account-form input, .broker-tabs input, .broker-tabs textarea, .broker-tabs select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #070b12;
  color: var(--text);
  padding: 12px 13px;
}
.security-strip {
  margin-top: 14px;
  border: 1px solid rgba(240,185,11,.28);
  background: rgba(240,185,11,.08);
  border-radius: 12px;
  padding: 12px 14px;
}
.broker-tabs { margin-top: 18px; }
.oauth-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  border-top: 1px solid var(--line-soft);
}
.oauth-empty-card { max-width: 360px; }
.cdp-logo { font-size: 44px; letter-spacing: 4px; color: #637083; margin-bottom: 10px; }
.external-button { display:inline-flex; align-items:center; gap:8px; margin-top:14px; padding: 12px 18px; border-radius: 999px; background:#202631; font-weight:900; }


/* Simulation monitor */
.simulation-monitor { margin: 12px 0; }
.simulation-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.simulation-kpis > div {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #22304a;
  border-radius: 8px;
  padding: 10px;
}
.simulation-kpis span, .simulation-kpis small { display: block; color: #93a4bd; font-size: 12px; }
.simulation-kpis strong { display: block; color: #f8fafc; font-size: 18px; margin: 5px 0; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 6px; background: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.2); }
.status-dot.on { background: #00d084; box-shadow: 0 0 0 3px rgba(0,208,132,.18); }
.status-dot.off { background: #f6465d; box-shadow: 0 0 0 3px rgba(246,70,93,.18); }
.simulation-log { margin-top: 10px; max-height: 145px; overflow: auto; display: grid; gap: 6px; }
@media (max-width: 1200px) { .simulation-kpis { grid-template-columns: repeat(3, minmax(120px, 1fr)); } }
@media (max-width: 700px) { .simulation-kpis { grid-template-columns: 1fr; } }

/* Command Center */
.status-pill{display:inline-flex;align-items:center;gap:6px;border:1px solid #243450;border-radius:999px;padding:6px 10px;background:#111827;color:#c7d1e1;font-weight:800}.v9-memory-good{color:#00d18f}.v9-memory-warn{color:#f0b90b}


/* Trading Engine Pro */
.trading-engine-pro { border: 1px solid rgba(125, 211, 252, .22); }
.engine-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.danger-mini { background: rgba(239,68,68,.14); border:1px solid rgba(239,68,68,.35); color:#fecaca; border-radius:12px; padding:10px 12px; cursor:pointer; }
.engine-grid { display:grid; grid-template-columns: 1.15fr .85fr; gap:14px; margin-top:14px; }
.engine-card { background: rgba(15, 23, 42, .72); border:1px solid rgba(148,163,184,.16); border-radius:18px; padding:14px; min-height:180px; }
.engine-card.wide { grid-column: 1 / -1; }
.engine-list { display:flex; flex-direction:column; gap:10px; margin-top:10px; max-height:360px; overflow:auto; }
.engine-row { display:grid; grid-template-columns: 1.35fr repeat(5, minmax(90px, 1fr)); gap:10px; align-items:center; padding:10px; border-radius:14px; background: rgba(2,6,23,.48); border:1px solid rgba(148,163,184,.12); }
.engine-row.order { grid-template-columns: 1.25fr repeat(5, minmax(80px, 1fr)); }
.engine-row small, .engine-row span { display:block; color:#94a3b8; font-size:.78rem; }
.engine-row b { color:#e5e7eb; font-size:.88rem; }
.orderbook-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:10px; }
.orderbook-grid h4 { margin:0 0 8px; color:#cbd5e1; font-size:.88rem; }
.orderbook-list { display:flex; flex-direction:column; gap:6px; }
.book-row { display:grid; grid-template-columns: 1.1fr .8fr .9fr; gap:6px; padding:7px 8px; border-radius:10px; background:rgba(2,6,23,.5); border:1px solid rgba(148,163,184,.1); font-size:.78rem; }
.book-row span { color:#bfdbfe; }
.book-row b { color:#e5e7eb; }
.book-row small { color:#94a3b8; }
@media (max-width: 980px){ .engine-grid{grid-template-columns:1fr}.engine-row,.engine-row.order{grid-template-columns:1fr 1fr}.engine-card.wide{grid-column:auto} }

/* Market Intelligence */
.v92-shell { padding-top: 96px; }
.v92-grid { display:grid; grid-template-columns: 1.15fr .85fr; gap:16px; margin-top:16px; }
.v92-world-panel, .v92-heatmap-panel { grid-column: 1 / -1; }
.world-map { position:relative; min-height:360px; border:1px solid rgba(125,211,252,.20); border-radius:22px; overflow:hidden; background:radial-gradient(circle at 25% 45%, rgba(34,197,94,.15), transparent 15%), radial-gradient(circle at 50% 35%, rgba(59,130,246,.16), transparent 15%), radial-gradient(circle at 73% 47%, rgba(240,185,11,.14), transparent 15%), linear-gradient(135deg, rgba(15,23,42,.96), rgba(2,6,23,.98)); }
.map-bg:before { content:""; position:absolute; inset:26px; border:1px dashed rgba(148,163,184,.15); border-radius:45%; transform:rotate(-8deg); }
.map-node { position:absolute; transform:translate(-50%,-50%); min-width:160px; padding:12px; border-radius:16px; border:1px solid rgba(148,163,184,.22); background:rgba(2,6,23,.82); box-shadow:0 20px 50px rgba(0,0,0,.34); }
.map-node:before { content:""; display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:7px; background:#94a3b8; box-shadow:0 0 18px #94a3b8; }
.map-node.pos:before, .heat-tile.pos { background:linear-gradient(135deg, rgba(0,208,132,.28), rgba(2,6,23,.72)); border-color:rgba(0,208,132,.32); }
.map-node.neg:before, .heat-tile.neg { background:linear-gradient(135deg, rgba(246,70,93,.25), rgba(2,6,23,.72)); border-color:rgba(246,70,93,.32); }
.map-node.neu:before, .heat-tile.neu { background:linear-gradient(135deg, rgba(240,185,11,.20), rgba(2,6,23,.72)); border-color:rgba(240,185,11,.28); }
.map-node b, .map-node span, .map-node small { display:block; }
.map-node b { color:#f8fafc; }
.map-node span { color:#bfdbfe; font-weight:1000; margin-top:3px; }
.map-node small { color:#94a3b8; margin-top:4px; }
.macro-list { display:grid; gap:10px; margin-top:12px; }
.macro-row { display:grid; grid-template-columns: 1fr auto auto; gap:12px; align-items:center; padding:12px; border:1px solid rgba(148,163,184,.14); border-radius:14px; background:rgba(15,23,42,.68); }
.macro-row span { color:#cbd5e1; font-weight:800; }
.macro-row b { color:#f8fafc; }
.macro-row small { color:#94a3b8; }
.heatmap-grid { display:grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap:10px; margin-top:14px; }
.heat-tile { min-height:104px; border-radius:18px; border:1px solid rgba(148,163,184,.18); padding:14px; display:flex; flex-direction:column; justify-content:space-between; background:rgba(15,23,42,.78); }
.heat-tile strong { color:#fff; font-size:1rem; }
.heat-tile span { color:#f8fafc; font-weight:1000; font-size:1.35rem; }
.heat-tile small { color:#cbd5e1; }
@media (max-width: 1100px){ .v92-grid{grid-template-columns:1fr}.heatmap-grid{grid-template-columns:repeat(3,1fr)} }
@media (max-width: 700px){ .heatmap-grid{grid-template-columns:1fr}.macro-row{grid-template-columns:1fr}.map-node{position:relative; left:auto!important; top:auto!important; transform:none; margin:10px}.world-map{display:grid; align-content:start; padding:15px}.map-bg{display:none} }

/* === V10.4 professional ops panels === */
.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.chart-wrap.small {
  min-height: 220px;
}

.admin-only {
  border-color: rgba(240, 185, 11, .45);
}

.system-health-panel .ticker-grid strong.positive,
.capital-audit-panel .ticker-grid strong.positive {
  color: #15c784;
}

.system-health-panel .ticker-grid strong.negative,
.capital-audit-panel .ticker-grid strong.negative {
  color: #f6465d;
}

@media (max-width: 920px) {
  .ops-grid,
  .charts-three {
    grid-template-columns: 1fr;
  }
}


/* Portfolio Brain */
.v93-grid { display:grid; grid-template-columns: 1.35fr .65fr; gap:14px; align-items:start; }
.v93-grid .wide { grid-column:auto; }
.portfolio-table { display:grid; gap:8px; }
.portfolio-head, .portfolio-row { display:grid; grid-template-columns:1.2fr .7fr .9fr .9fr .7fr; gap:10px; align-items:center; padding:10px 12px; border:1px solid var(--line-soft); border-radius:8px; background:rgba(255,255,255,.025); }
.portfolio-head { color:var(--muted); font-size:12px; text-transform:uppercase; font-weight:900; }
.portfolio-row b { display:flex; flex-direction:column; gap:3px; }
.portfolio-row small { color:var(--muted); font-size:11px; }
.equity-chart { height:240px; display:flex; align-items:end; gap:4px; padding:14px; border:1px solid var(--line-soft); border-radius:8px; background:linear-gradient(180deg, rgba(21,199,132,.05), rgba(240,185,11,.03)); }
.equity-chart span { flex:1; min-width:3px; border-radius:4px 4px 0 0; background:linear-gradient(180deg, var(--green), rgba(21,199,132,.25)); }
.pos { color:var(--green)!important; }
.neg { color:var(--red)!important; }
.neu { color:var(--yellow)!important; }
@media (max-width: 980px){ .v93-grid{grid-template-columns:1fr}.portfolio-head,.portfolio-row{grid-template-columns:1fr 1fr}.portfolio-head b:nth-child(n+3){display:none} }


/* compact navigation */
.compact-nav { gap: 14px; overflow: visible; }
.nav-more { position: relative; }
.nav-more summary {
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
  color: #c7d1e1;
  font-weight: 700;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary:hover { color: var(--yellow); }
.nav-menu {
  position: absolute;
  top: 28px;
  left: 0;
  min-width: 250px;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 16, 25, 0.98);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.nav-menu a {
  padding: 9px 10px;
  border-radius: 8px;
  color: #dbe7fb;
}
.nav-menu a:hover { background: rgba(240,185,11,0.12); }
.system-monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.positive { color: var(--green); }
.negative { color: var(--red); }
@media (max-width: 1180px) {
  .compact-nav { overflow-x: auto; }
  .nav-menu { position: fixed; top: 58px; left: 12px; right: 12px; min-width: auto; }
  .system-monitor-grid { grid-template-columns: 1fr; }
}

.two-cols { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
.wide { grid-column: 1 / -1; }


/* === V10.2 phone + balance UI repair === */
.mode-btn.danger.active {
  border-color: rgba(246, 70, 93, 0.85);
  background: rgba(246, 70, 93, 0.22);
  color: #fecdd3;
}
.mode-btn:not(.active) { outline: 0; box-shadow: none; }
.vault-grid strong, .capital-stats strong { white-space: normal; line-height: 1.05; }
.vault-grid div, .capital-stats div { min-width: 0; }
.capital-block { min-width: 0; }
.capital-credit-form input, .capital-credit-form select, .vault-form input { min-width: 0; width: 100%; }

@media (max-width: 760px) {
  html, body { width: 100%; overflow-x: hidden; }
  .topbar { position: sticky; grid-template-columns: 1fr; gap: 10px; padding: 10px; }
  .brand { font-size: 13px; }
  .nav-links { width: 100%; gap: 12px; padding-bottom: 6px; overflow-x: auto; }
  .live-controls { width: 100%; display: grid; grid-template-columns: 1fr; }
  .live-toggle, .kill-switch, .logout-btn { width: 100%; min-height: 42px; }
  .shell { padding: 12px 10px 60px; }
  .mode-switch-panel, .capital-console, .vault-grid, .capital-stats { grid-template-columns: 1fr; }
  .mode-buttons { grid-template-columns: 1fr; }
  .mode-btn { min-height: 46px; }
  .safe-vault-box, .mode-toggle-box, .capital-console, .broker-flow, .panel { padding: 12px; border-radius: 12px; }
  .vault-form, .capital-credit-form { grid-template-columns: 1fr; }
  .vault-grid strong, .capital-stats strong { font-size: 24px; }
  .headline h1 { font-size: 28px; }
  .market-bar { grid-template-columns: 1fr; }
  .market-actions { grid-template-columns: 1fr; width: 100%; }
  .flow-steps { align-items: stretch; }
  .flow-steps span { white-space: normal; }
  .ledger-list { max-height: 260px; }
}
