:root {
  --bg0: #0c1412;
  --bg1: #12201c;
  --panel: rgba(18, 32, 28, 0.9);
  --ink: #e8f2ec;
  --muted: #9bb3a8;
  --line: rgba(232, 242, 236, 0.12);
  --ok: #3dbe84;
  --warn: #e0a45a;
  --bad: #e06b6b;
  --ema9: #5cc8ff;
  --ema21: #c9a227;
  --side: 220px;
  --radius: 14px;
  --focus: #7ee0b0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--bg0);
}
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(61, 190, 132, 0.16), transparent 60%),
    radial-gradient(700px 420px at 92% 0%, rgba(92, 200, 255, 0.08), transparent 55%),
    linear-gradient(180deg, #12201c, #0c1412 72%);
  z-index: -1;
}

.shell {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem 0.9rem;
  border-right: 1px solid var(--line);
  background: rgba(8, 14, 12, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ok);
  font-size: 0.8rem;
  font-weight: 700;
}
.brand-sub { margin: 0.25rem 0 0; color: #c5d8ce; font-size: 0.8rem; }
.nav { display: grid; gap: 0.35rem; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-btn:hover { color: var(--ink); background: rgba(255,255,255,0.04); }
.nav-btn.active {
  color: var(--ink);
  background: rgba(61, 190, 132, 0.12);
  border-color: rgba(61, 190, 132, 0.35);
}
.nav-btn:focus-visible,
button:focus-visible,
input:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.nav-ico { width: 1rem; opacity: 0.8; }
.side-live {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.55rem 0.4rem;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(224, 164, 90, 0.5);
}
.live-dot.on {
  background: var(--ok);
  animation: pulse 1.8s ease infinite;
}
.live-dot.off { background: var(--bad); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 190, 132, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(61, 190, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 190, 132, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot.on { animation: none; }
  .module { animation: none; }
  .toast { animation: none; }
}

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding: 1.2rem 1.4rem 0.6rem;
}
h1 { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.7rem); }
.sub { margin: 0.2rem 0 0; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: rgba(0,0,0,0.22);
}
.badge.on { color: var(--ok); border-color: rgba(61,190,132,0.4); }
.badge.warn { color: var(--warn); border-color: rgba(224,164,90,0.4); }

main { padding: 0.6rem 1.4rem 1.2rem; flex: 1; }
.module { display: none; animation: fadeIn 0.22s ease; }
.module.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.8rem;
}
.symbol-row, .tf-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  cursor: pointer;
  min-height: 40px;
}
.chip.active {
  color: #062015;
  background: linear-gradient(135deg, #2f9e6d, #3dbe84);
  border-color: transparent;
  font-weight: 700;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0.9rem;
}
.chart-panel, .panel, .analysis-rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  position: relative;
}
.chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: baseline;
  margin-bottom: 0.55rem;
}
.chart-meta .mono { font-family: "IBM Plex Mono", monospace; font-size: 1.1rem; }
.hint-live {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: "IBM Plex Mono", monospace;
}
.chart-box {
  width: 100%;
  height: 360px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}
.chart-box.rsi { height: 140px; margin-top: 0.55rem; }
.chart-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8,14,12,0.72);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.chart-loading.hidden { display: none; }

.chart-closed-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  text-align: center;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: rgba(8, 14, 12, 0.72);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.chart-closed-overlay.hidden { display: none; }
.chart-closed-overlay strong {
  color: var(--warn);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chart-closed-overlay p {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  max-width: 28rem;
}

.session-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.22);
}
.session-strip.open { border-color: rgba(61,190,132,0.35); }
.session-strip.closed { border-color: rgba(224,164,90,0.35); }
.session-strip-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.cycle-runner-bar {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(61, 190, 132, 0.1), rgba(18, 32, 28, 0.55));
}
.cycle-runner-bar.running {
  border-color: rgba(61, 190, 132, 0.45);
  box-shadow: 0 0 0 1px rgba(61, 190, 132, 0.18);
}
.cycle-runner-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
}
.cycle-runner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.cycle-runner-actions input[type="number"] {
  width: 4.5rem;
  background: rgba(12, 20, 18, 0.65);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.4rem 0.45rem;
  font-family: "IBM Plex Mono", monospace;
}
.cycle-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(232, 242, 236, 0.08);
  overflow: hidden;
}
.cycle-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f9e6b, #7ee0b0);
  transition: width 0.35s ease;
}

.auto-armed-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin: 0 1.4rem 0.4rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(224,107,107,0.5);
  background: rgba(224,107,107,0.12);
  color: var(--ink);
  font-size: 0.9rem;
}
.auto-armed-banner strong { color: #ffb4b4; }
.auto-armed-banner.hidden { display: none; }
.auto-armed-banner .banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-gate.hidden { display: none !important; }
.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  background: rgba(12, 20, 18, 0.92);
}
.auth-card .brand {
  margin: 0 0 0.35rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ok);
  font-size: 0.78rem;
}
.auth-card h1 { margin: 0 0 0.35rem; font-size: 1.45rem; }
.auth-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.auth-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-form input {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--ink);
}
.auth-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.side-user {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
}
.tiny-btn { font-size: 0.78rem; padding: 0.25rem 0.5rem; }
.journal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.journal-filters select,
.journal-filters input {
  flex: 1;
  min-width: 120px;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
}
.journal-dates { align-items: end; margin-bottom: 0.35rem; }
.journal-dates label {
  flex: 1;
  min-width: 120px;
  display: grid;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.journal-dates input { width: 100%; }
.journal-dates button {
  flex: 0 0 auto;
  padding: 0.4rem 0.7rem;
  line-height: 1.2;
  font-size: 0.8rem;
}
#journalFilterSummary { margin: 0 0 0.65rem; }
.cred-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0.75rem 0;
}
.cred-block legend { padding: 0 0.35rem; color: var(--muted); }
.cred-block label {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.cred-block input {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
}
.ops-dash-more { grid-column: 1 / -1; justify-self: start; }
.warn-inline { color: var(--warn); }
.cycle-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0.55rem 0;
}
.cycle-inputs label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.cycle-inputs input {
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
}

.ctrl-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.75rem 0.75rem;
  margin-bottom: 0.7rem;
  background: rgba(0,0,0,0.14);
}
.ctrl-section > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0;
  list-style: none;
  color: var(--ink);
}
.ctrl-section > summary::-webkit-details-marker { display: none; }
.ctrl-section > summary::before {
  content: "▸ ";
  color: var(--muted);
}
.ctrl-section[open] > summary::before { content: "▾ "; }
.toggle.danger { color: #ffb4b4; }
.toggle.danger span { font-weight: 600; }

.control-summary {
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  font-size: 0.92rem;
  line-height: 1.45;
}

.control-guide {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(61, 190, 132, 0.06);
}
.control-guide-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.control-guide-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}
.control-guide-top .help { margin: 0; }
.control-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}
.step-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.step-btn:hover { color: var(--ink); border-color: rgba(126, 224, 176, 0.35); }
.step-btn.active {
  color: var(--ink);
  border-color: rgba(61, 190, 132, 0.55);
  background: rgba(61, 190, 132, 0.12);
}
.step-btn.done .step-num {
  background: var(--ok);
  color: #062016;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(232, 242, 236, 0.12);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}
.step-label { font-size: 0.82rem; font-weight: 600; }
.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.ctrl-section[data-step-panel].guide-dim {
  opacity: 0.45;
}
.ctrl-section[data-step-panel].guide-focus {
  border-color: rgba(61, 190, 132, 0.45);
  box-shadow: 0 0 0 1px rgba(61, 190, 132, 0.12);
}
.ctrl-advanced {
  margin: 0.75rem 0;
  padding: 0.45rem 0.65rem 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.ctrl-advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0;
}
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.55rem 0 0.35rem;
}
.preset-chip {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.preset-chip:hover { color: var(--ink); }
.preset-chip.active {
  color: var(--ink);
  border-color: rgba(61, 190, 132, 0.55);
  background: rgba(61, 190, 132, 0.14);
}
.control-ready {
  margin-bottom: 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(61, 190, 132, 0.28);
  background: rgba(61, 190, 132, 0.08);
  font-size: 0.92rem;
  line-height: 1.5;
}
.control-ready ul {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
}
.control-ready li { margin: 0.2rem 0; }
.control-side-sub {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.term-tip {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--ok);
  font: inherit;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 0.15em;
  cursor: help;
}
.term-tip:hover,
.term-tip:focus-visible {
  color: var(--focus);
  outline: none;
}
.term-popover {
  position: fixed;
  z-index: 80;
  max-width: min(320px, calc(100vw - 1.5rem));
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(61, 190, 132, 0.4);
  background: #12201c;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.term-popover-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.term-popover-body {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}
.json-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.45rem;
}
.json-details .mono.block { min-height: 120px; }

.skeleton-board { display: grid; gap: 0.75rem; }
.skeleton-card {
  height: 88px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-card { animation: none; background: rgba(255,255,255,0.06); }
}

.market-row-main {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 0.55rem;
  align-items: center;
}
.market-row-score {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 110px;
}
.market-row-detail {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}
.market-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.4rem;
  background: rgba(0,0,0,0.12);
  cursor: pointer;
}
.market-item:hover { border-color: rgba(61,190,132,0.35); }
.market-item summary { cursor: pointer; list-style: none; }
.market-item summary::-webkit-details-marker { display: none; }

.analysis-rail h2, .panel h2 {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.snap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}
.snap-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(0,0,0,0.16);
}
.snap-grid span { display: block; color: var(--muted); font-family: "DM Sans", sans-serif; font-size: 0.72rem; margin-bottom: 0.15rem; }
.live-advice .reason { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0; }
.legend {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.legend span { display: flex; align-items: center; gap: 0.4rem; }
.lg { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.lg.ema9 { background: var(--ema9); }
.lg.ema21 { background: var(--ema21); }
.lg.sl { background: var(--bad); }
.lg.tp { background: var(--ok); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.ops-dashboard-panel { margin-bottom: 0.85rem; }
.ops-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}
.ops-dash-hero {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  background: rgba(12, 20, 18, 0.55);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
}
.ops-dash-hero span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ops-dash-hero strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
}
.ops-dash-hero em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.82rem;
  margin-left: auto;
}
.ops-dash-hero.pos strong { color: var(--ok); }
.ops-dash-hero.neg strong { color: var(--bad); }
.ops-dash-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: rgba(12, 20, 18, 0.45);
}
.ops-dash-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}
.ops-dash-card strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.15rem;
  font-weight: 600;
}
.ops-dash-card small {
  display: block;
  margin-top: 0.2rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--muted);
}
.ops-dash-card.pos strong,
.ops-dash-card.pos small { color: var(--ok); }
.ops-dash-card.neg strong,
.ops-dash-card.neg small { color: var(--bad); }
.ops-dash-wide {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.55rem;
  margin-top: 0.15rem;
}
.ops-dash-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}
.ops-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.3fr);
  gap: 0.9rem;
  align-items: start;
}
.open-live-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.open-live-strip:empty { display: none; }
.open-live-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  background: linear-gradient(160deg, rgba(61, 190, 132, 0.12), rgba(18, 32, 28, 0.55));
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}
.open-live-card.selected {
  border-color: rgba(61, 190, 132, 0.65);
  box-shadow: 0 0 0 1px rgba(61, 190, 132, 0.28);
}
.open-live-card .ol-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-weight: 600;
}
.open-live-card .ol-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  color: var(--muted);
}
.open-live-card .ol-pos { color: var(--ok); }
.open-live-card .ol-neg { color: var(--bad); }
.open-live-card .ol-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}
.open-live-card .ol-stop {
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  line-height: 1.2;
}
.open-live-meta {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.ops-detail-panel { min-height: 520px; }
.ops-detail.hidden, .hidden { display: none !important; }
.ops-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}
.chart-box.trade-chart {
  height: 320px;
  margin-bottom: 0.75rem;
}
.chart-box.review-chart {
  height: 340px;
}
.trade-analysis-inline {
  margin: 0.75rem 0 0.5rem;
}
.review-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}
.review-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: rgba(0, 0, 0, 0.14);
}
.review-panel h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-family: "DM Sans", sans-serif;
}
.review-panel-compact {
  margin-top: 0.5rem;
}
.review-sub {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
}
.review-kv {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.22rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(232, 242, 236, 0.06);
}
.review-kv span {
  color: var(--muted);
}
.review-kv strong {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  text-align: right;
}
.review-snap {
  display: grid;
  gap: 0.1rem;
}
.contrib-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.contrib-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.55rem;
  align-items: baseline;
  font-size: 0.86rem;
}
.contrib-list em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.75rem;
}
.review-samples {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
}
.review-samples th,
.review-samples td {
  padding: 0.28rem 0.35rem;
  text-align: right;
  border-bottom: 1px solid rgba(232, 242, 236, 0.08);
}
.review-samples th:first-child,
.review-samples td:first-child {
  text-align: left;
}
.review-samples th {
  color: var(--muted);
  font-weight: 500;
  font-family: "DM Sans", sans-serif;
}
.review-samples tr.pos td:last-child { color: var(--ok); }
.review-samples tr.neg td:last-child { color: var(--bad); }
@media (max-width: 960px) {
  .review-panels { grid-template-columns: 1fr; }
}
.card.selected {
  border-color: rgba(61, 190, 132, 0.55);
  box-shadow: 0 0 0 1px rgba(61, 190, 132, 0.25);
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: rgba(61, 190, 132, 0.35); }
.markets-board { display: grid; gap: 0.9rem; margin-top: 0.8rem; }
.market-segment {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(0,0,0,0.16);
}
.market-segment h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.segment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.55rem;
}
.risk-bajo { color: var(--ok); border-color: rgba(61,190,132,0.4); }
.risk-medio { color: var(--warn); border-color: rgba(224,164,90,0.4); }
.risk-alto { color: var(--bad); border-color: rgba(224,107,107,0.45); }
.market-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.market-table th, .market-table td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.market-table th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.score-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  min-width: 70px;
}
.score-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f9e6d, #3dbe84);
}
.score-bar.mid > span { background: linear-gradient(90deg, #b8843d, #e0a45a); }
.score-bar.low > span { background: linear-gradient(90deg, #8a4444, #e06b6b); }
.market-table tr.clickable-row { cursor: pointer; }
.market-table tr.clickable-row:hover { background: rgba(61,190,132,0.08); }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.panel-head h2 { margin: 0; }
.hint { color: var(--muted); font-size: 0.8rem; }
.field-hint { color: var(--muted); font-size: 0.78rem; margin: 0.35rem 0 0; line-height: 1.35; }
.row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

.status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
}
.status span { color: var(--muted); font-family: "DM Sans", sans-serif; font-size: 0.75rem; }
.toggles { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  min-height: 44px;
}
.toggle.warn { color: var(--warn); }
.help { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.82rem; }
.field {
  display: grid;
  gap: 0.35rem;
  margin: 0.35rem 0 0.75rem;
}
.field label {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}
.field input[type="number"] {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.22);
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-family: "IBM Plex Mono", monospace;
}
.field input[type="number"]:disabled {
  opacity: 0.45;
}
.field input[type="number"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

button, .ghost, .primary {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  cursor: pointer;
  min-height: 44px;
  transition: transform 0.12s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:hover { border-color: rgba(61,190,132,0.45); }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
button.primary {
  background: linear-gradient(135deg, #2f9e6d, #3dbe84);
  border: none;
  color: #062015;
  font-weight: 700;
}
button.danger {
  border-color: rgba(224,107,107,0.45);
  color: #ffb4b4;
}
.ghost { background: transparent; }
.learn-broker-tab.is-active,
.learn-broker-tab[aria-pressed="true"] {
  background: linear-gradient(135deg, #2f9e6d, #3dbe84);
  border: none;
  color: #062015;
  font-weight: 700;
}

.list { display: grid; gap: 0.65rem; }
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: rgba(0,0,0,0.18);
}
.card .meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}
.card .reason { margin: 0.45rem 0; color: var(--muted); font-size: 0.92rem; }
.card .row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.trade-pnl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(12, 20, 18, 0.4);
}
.trade-pnl span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
}
.trade-pnl strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  font-weight: 600;
}
.trade-pnl.pos strong { color: var(--ok); }
.trade-pnl.neg strong { color: var(--bad); }
.trade-times {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px dashed var(--line);
}
.trade-times span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 0.1rem;
}
.trade-times strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  font-weight: 600;
}
.trade-times small {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
}
.snap-grid .pos strong,
.snap-grid div.pos { color: var(--ok); }
.snap-grid .neg strong,
.snap-grid div.neg { color: var(--bad); }
.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
}
.pill.buy { color: var(--ok); }
.pill.sell { color: var(--bad); }
.pill.warn { color: var(--warn); }
.pill.down { color: var(--bad); }

.mono { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; color: var(--muted); }
.mono.block {
  white-space: pre-wrap;
  margin: 0;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(0,0,0,0.2);
}
.empty {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  padding: 0.8rem 0.2rem;
}
.empty-cta {
  display: grid;
  gap: 0.55rem;
  justify-items: start;
  padding: 0.4rem 0;
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: grid;
  gap: 0.45rem;
  width: min(360px, calc(100vw - 2rem));
}
.toast {
  border: 1px solid var(--line);
  background: rgba(14, 24, 20, 0.95);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: fadeIn 0.2s ease;
}
.toast.success { border-color: rgba(61,190,132,0.45); }
.toast.error { border-color: rgba(224,107,107,0.5); }
.toast.info { border-color: rgba(92,200,255,0.35); }
.toast.warn { border-color: rgba(224,164,90,0.5); }

footer {
  padding: 0 1.4rem 1.2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.learn-layout { display: grid; gap: 0.9rem; }
.learn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  align-items: start;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.kpi-grid > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(0,0,0,0.18);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.35;
}
.kpi-grid > div span {
  display: block;
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-grid > div br { display: none; }
.kpi-grid > div span.kpi-foot {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.68rem;
  margin-top: 0.15rem;
  opacity: 0.85;
}

.market-table { display: grid; gap: 0.4rem; }
.mkt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,0.16);
}
.mkt-id strong { display: block; font-size: 0.9rem; }
.mkt-id span { color: var(--muted); font-size: 0.72rem; font-family: "IBM Plex Mono", monospace; }
.mkt-wr { display: grid; gap: 0.3rem; }
.mkt-wr span { color: var(--muted); font-size: 0.72rem; font-family: "IBM Plex Mono", monospace; }
.mkt-bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.mkt-bar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.pill.ok { color: var(--ok); border-color: rgba(61,190,132,0.4); }

.learn-graph-panel {
  --g-agent: #3dbe84;
  --g-market: #a88cff;
  --g-router: #e0a45a;
  --g-bundle: #5cc8ff;
  --g-model: #4ec9d8;
  --g-universe: #9bb3a8;
  --g-input: #c9a227;
  --g-params: #e07bb0;
  --g-decision: #e8f2ec;
  --g-exit: #ff9d7a;
  --g-support: #7dd3c0;
}
.learn-graph {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
  padding: 0.35rem;
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(70vh, 720px);
}
.learn-graph svg { width: 100%; height: auto; display: block; }
.learn-graph text { pointer-events: none; }
.learn-graph .col-head {
  fill: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.node-agent { --gc: var(--g-agent); }
.node-market { --gc: var(--g-market); }
.node-router { --gc: var(--g-router); }
.node-bundle { --gc: var(--g-bundle); }
.node-model { --gc: var(--g-model); }
.node-universe { --gc: var(--g-universe); }
.node-input { --gc: var(--g-input); }
.node-params { --gc: var(--g-params); }
.node-decision { --gc: var(--g-decision); }
.node-exit { --gc: var(--g-exit); }
.node-support { --gc: var(--g-support); }

.learn-graph .node-box {
  fill: color-mix(in srgb, var(--gc, var(--ok)) 14%, rgba(9,16,14,0.92));
  stroke: color-mix(in srgb, var(--gc, var(--ok)) 62%, transparent);
  stroke-width: 1.2;
  transition: fill 0.15s ease, stroke-width 0.15s ease;
}
.learn-graph .graph-node:hover .node-box,
.learn-graph .graph-node:focus .node-box {
  fill: color-mix(in srgb, var(--gc, var(--ok)) 26%, rgba(9,16,14,0.92));
  stroke-width: 2;
}
.learn-graph .graph-node:focus { outline: none; }
.learn-graph .graph-node { transition: opacity 0.15s ease; }
.learn-graph .graph-node.faded { opacity: 0.16; }
.learn-graph .graph-node.is-dim .node-box { stroke-dasharray: 4 3; }
.learn-graph .graph-node.is-dim .node-label { fill: var(--muted); }
.learn-graph .node-label {
  fill: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
}
.learn-graph .node-meta {
  fill: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
}
.learn-graph .node-track { fill: rgba(255,255,255,0.1); }
.learn-graph .node-gauge { fill: var(--gc, var(--ok)); }
.learn-graph .bundle-label {
  fill: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
}
.learn-graph .bundle-val {
  fill: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
}
.learn-graph .bundle-track { fill: rgba(255,255,255,0.1); }
.learn-graph .bundle-bar { fill: var(--g-bundle); }

.learn-graph .edge {
  fill: none;
  stroke: rgba(155, 179, 168, 0.38);
  transition: stroke 0.15s ease;
}
.learn-graph .edge-group { transition: opacity 0.15s ease; }
.learn-graph .edge-group.faded { opacity: 0.12; }
.learn-graph .edge-group.on .edge { stroke: var(--focus); }
.learn-graph .edge-group.on .edge-label { opacity: 1; }
.learn-graph .edge-label {
  fill: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  opacity: 0;
  transition: opacity 0.15s ease;
  paint-order: stroke;
  stroke: #0b1310;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.graph-foot { display: grid; gap: 0.4rem; margin-top: 0.6rem; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; }
.lg-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.74rem;
}
.lg-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--gc, var(--muted)) 30%, transparent);
  border: 1px solid var(--gc, var(--muted));
}
.lg-item.is-dim .lg-dot { background: transparent; border-style: dashed; }
.learn-graph-tooltip {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.learn-runs .card { font-size: 0.86rem; }
.learn-agents .card { font-size: 0.86rem; }
.learn-agents .card .hint { margin: 0.35rem 0 0; font-family: "IBM Plex Mono", monospace; font-size: 0.72rem; }

.broker-pros {
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
.broker-pros summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.broker-pros ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}
.broker-pros li { margin: 0.2rem 0; }

@media (max-width: 980px) {
  .learn-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-btn { flex-direction: column; gap: 0.2rem; font-size: 0.72rem; padding: 0.55rem 0.3rem; text-align: center; }
  .side-live { margin-top: 0; }
  .chart-layout, .split, .ops-layout { grid-template-columns: 1fr; }
  .chart-box { height: 280px; }
  .control-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .nav { grid-template-columns: repeat(3, 1fr); }
  .topbar { flex-direction: column; align-items: start; }
  .status { grid-template-columns: 1fr; }
  .control-guide-top { flex-direction: column; }
  .control-steps { grid-template-columns: 1fr 1fr; }
}
