/* Operator Dashboard — calm neutral surface, tabular numerals for prices */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --border: #e2e2e0;
  --text: #1c1c1a;
  --text-muted: #6b6b67;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warn: #d97706;
  --ok: #16a34a;
  --kill-bg: #fef2f2;
  --kill-border: #fca5a5;
  --paper-badge: #f59e0b;
  --radius: 4px;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", ui-monospace, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html {
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- header ---- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.badge-paper {
  background: var(--paper-badge);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}

/* Header status chips: data source (live/sim) + AI (live/mock). Same shape as
   .badge-paper; colour signals state — green = live/real, neutral = simulated. */
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}
.badge-live, .badge-ai { background: var(--ok); color: #fff; }
.badge-sim, .badge-mock {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

nav {
  display: flex;
  gap: 0.1rem;
  margin-left: 0.5rem;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 0.1s, color 0.1s;
}

nav a:hover, nav a.active {
  background: var(--bg);
  color: var(--text);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.token-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.token-form input[type="password"] {
  width: 160px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  background: var(--bg);
}

/* ---- kill-switch banner ---- */
.kill-banner {
  background: var(--kill-bg);
  border-bottom: 2px solid var(--kill-border);
  padding: 10px 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
}

.kill-banner.hidden {
  display: none;
}

/* ---- main content ---- */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ---- page header ---- */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---- tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.875rem;
}

thead {
  background: var(--bg);
}

th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafaf9;
}

/* tabular numerals for price/number cells */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.num-col {
  text-align: right;
}

td a {
  color: var(--accent);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

/* ---- cards / panels ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ---- section divider ---- */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* ---- order summary block (detail page) ---- */
.order-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kv-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
}

.kv-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.kv-value.long { color: var(--ok); }
.kv-value.short { color: var(--danger); }

/* ---- direction pills ---- */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pill-long { background: #dcfce7; color: #166534; }
.pill-short { background: #fee2e2; color: #991b1b; }
.pill-pending { background: #fef9c3; color: #713f12; }
.pill-approved { background: #dcfce7; color: #166534; }
.pill-rejected { background: #fee2e2; color: #991b1b; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-fail { background: #fee2e2; color: #991b1b; }
.pill-info { background: #dbeafe; color: #1e40af; }
.pill-warn { background: #fef3c7; color: #92400e; }
.pill-critical { background: #fee2e2; color: #991b1b; }

/* intelligence tiers (LLM models page) */
.tier-fast { background: #e0f2fe; color: #075985; }
.tier-balanced { background: #ede9fe; color: #5b21b6; }
.tier-deep { background: #fae8ff; color: #86198f; }

/* ============================ animations ============================ */
@keyframes ta-spin { to { transform: rotate(360deg); } }
@keyframes ta-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}
@keyframes ta-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ta-blink { 0%, 20% { opacity: 0.2; } 50% { opacity: 1; } 100% { opacity: 0.2; } }

/* page content entrance */
.fade-in > * { animation: ta-fade-up 0.34s ease both; }

/* live "system on" dot next to the PAPER badge */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); display: inline-block;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.55);
  animation: ta-pulse 1.6s ease-in-out infinite;
}

/* htmx in-flight spinner (alerts refresh, etc.) */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  display: inline-block; vertical-align: middle;
  animation: ta-spin 0.7s linear infinite;
}

/* "Running agents" overlay shown while a run is in flight */
.agents-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(28,28,26,0.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: ta-fade-up 0.2s ease both;
}
.agents-overlay.hidden { display: none; }
.agents-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.75rem 2rem; max-width: 460px; width: calc(100% - 2rem);
  text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.agents-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  margin: 0 auto 1rem; animation: ta-spin 0.8s linear infinite;
}
.agents-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.agents-title .agents-symbol { color: var(--accent); }
.agents-title .dots span { animation: ta-blink 1.4s infinite both; }
.agents-title .dots span:nth-child(2) { animation-delay: 0.2s; }
.agents-title .dots span:nth-child(3) { animation-delay: 0.4s; }

/* stepper — each pipeline stage lights up in sequence as the agents "work" */
.agent-steps { list-style: none; text-align: left; margin: 1.1rem auto 0.5rem; max-width: 320px; }
.agent-step {
  display: flex; align-items: center; gap: 0.6rem; padding: 5px 0;
  font-size: 0.85rem; color: var(--text-muted); opacity: 0.5;
  transition: opacity 0.25s, color 0.25s;
}
.agent-step.active, .agent-step.done { opacity: 1; color: var(--text); }
.agent-step .step-ic {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--border); box-sizing: border-box; position: relative;
}
.agent-step.active .step-ic {
  border-color: var(--border); border-top-color: var(--accent);
  animation: ta-spin 0.7s linear infinite;
}
.agent-step.done .step-ic {
  border-color: var(--ok); background: var(--ok); animation: none;
}
.agent-step.done .step-ic::after {
  content: "✓"; position: absolute; inset: 0; color: #fff;
  font-size: 0.62rem; line-height: 12px; text-align: center; font-weight: 700;
}
.agents-progress { position: relative; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 0.9rem; }
.agents-progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.agents-sub { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.75rem; }

/* copyable identifier (Order ID etc.) */
.copyable {
  font-family: var(--font-mono); font-size: 0.78rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 7px;
  cursor: pointer; white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.copyable:hover { background: #eff6ff; border-color: var(--accent); }
.copyable::after { content: " ⧉"; color: var(--text-muted); font-size: 0.72rem; }
.copyable.copied::after { content: " ✓ copied"; color: var(--ok); }

/* portfolio metric tiles */
.metric-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem; margin-bottom: 1.5rem;
}
.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem 1rem;
}
.metric-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 4px;
}
.metric-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 1.25rem; font-weight: 700;
}
.metric.hero { grid-column: span 2; background: linear-gradient(135deg, #f8fafc, var(--surface)); }
.metric.hero .metric-value { font-size: 1.75rem; }

/* symbol quick-pick chips (runs / strategy) */
.sym-picks { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }
.sym-pick {
  font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.sym-pick:hover { background: #eff6ff; border-color: var(--accent); color: var(--accent); }
.sym-pick:active { transform: scale(0.96); }

/* Respect users who prefer reduced motion — disable all the above. */
@media (prefers-reduced-motion: reduce) {
  .fade-in > *, .live-dot, .spinner, .agents-spinner,
  .agents-overlay, .agent-step.active .step-ic, .agents-title .dots span {
    animation: none !important;
  }
}

/* ============================ live agent swarm ============================ */
.run-progress {
  position: relative; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden; margin-bottom: 0.4rem;
}
.run-progress > i {
  display: block; height: 100%; width: 4%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 2px; transition: width 0.5s ease;
}

.swarm-layout {
  display: grid; grid-template-columns: 1fr 320px; gap: 1rem; align-items: start;
}
.swarm-stage { padding: 0.75rem; }
#swarm { width: 100%; height: auto; display: block; }

.swarm-legend {
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
  font-size: 0.72rem; color: var(--text-muted); padding-top: 0.5rem;
  border-top: 1px solid var(--border); margin-top: 0.25rem;
}
.swarm-legend .lg { width: 9px; height: 9px; border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 3px; }
.lg-idle { background: #e2e2e0; }
.lg-active { background: var(--accent); }
.lg-done { background: var(--ok); }
.lg-error { background: var(--danger); }

/* --- graph nodes (SVG) --- */
.gnode .nbox { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; transition: stroke 0.2s, fill 0.2s; }
.gnode .ntitle { font: 700 12.5px var(--font-body); fill: var(--text); }
.gnode .nsub   { font: 600 8.5px var(--font-body); fill: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.gnode .nval   { font: 700 11px var(--font-mono); fill: var(--text-muted); }

.gnode.idle   .nbox { fill: #fafaf9; stroke: #e2e2e0; }
.gnode.idle   .nval { fill: #a3a3a0; }

.gnode.active .nbox { stroke: var(--accent); stroke-width: 2.5; animation: gpulse 1s ease-in-out infinite; }
.gnode.active .nval { fill: var(--accent); }

.gnode.done   .nbox { stroke: var(--ok); fill: #f0fdf4; }
.gnode.done   .nval { fill: #166534; }

.gnode.error  .nbox { stroke: var(--danger); fill: #fef2f2; }
.gnode.error  .nval { fill: var(--danger); }

@keyframes gpulse {
  0%, 100% { stroke-opacity: 1; }
  50% { stroke-opacity: 0.35; }
}

/* --- graph edges (SVG) --- */
.edge { fill: none; stroke: #dededb; stroke-width: 1.5; }
.edge.flow {
  stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 6;
  animation: edgeflow 0.6s linear infinite;
}
@keyframes edgeflow { to { stroke-dashoffset: -22; } }

/* --- reasoning stream --- */
.swarm-feed { max-height: 540px; display: flex; flex-direction: column; }
.swarm-log {
  list-style: none; overflow-y: auto; flex: 1; margin: 0;
  font-family: var(--font-mono); font-size: 0.76rem; line-height: 1.5;
}
.swarm-line {
  padding: 4px 2px; border-bottom: 1px dotted var(--border);
  color: var(--text); animation: ta-fade-up 0.25s ease both;
}
.swarm-line.key { color: var(--accent); font-weight: 700; }
.swarm-line.err { color: var(--danger); }

/* --- result banner --- */
.result-banner {
  border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-bottom: 1rem;
  font-size: 0.9rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  animation: ta-fade-up 0.3s ease both;
}
.result-banner.ok   { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.result-banner.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.result-banner.err  { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.result-banner .btn { margin-left: auto; }

@media (max-width: 860px) {
  .swarm-layout { grid-template-columns: 1fr; }
  .swarm-feed { max-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .gnode.active .nbox, .edge.flow, .swarm-line { animation: none !important; }
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover { background: var(--bg); }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* ---- forms ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 160px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.5rem;
}

/* ---- action bar (bottom of detail) ---- */
.action-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.action-bar h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.action-section {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* ---- kill switch page ---- */
.killswitch-card {
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 480px;
  background: var(--kill-bg);
}

.killswitch-card h2 {
  color: var(--danger);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* ---- alerts ---- */
.alert-list {
  list-style: none;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.alert-item:last-child { border-bottom: none; }

.empty-state {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 2rem;
  text-align: center;
}

/* ---- checks table ---- */
.check-pass { color: var(--ok); }
.check-fail { color: var(--danger); }

/* ---- conviction bar ---- */
.conviction-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.conviction-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 120px;
}

.conviction-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

/* ---- misc ---- */
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.notice {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--ok);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ---- user guide ---- */
.guide-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
}

.guide-sidebar {
  position: sticky;
  top: 68px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.guide-sidebar-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem 0.5rem;
}

.guide-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.guide-nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 0.825rem;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.3;
}

.guide-nav-link:hover { background: var(--bg); color: var(--text); }

.guide-nav-link.active {
  background: #eff6ff;
  color: var(--accent);
  font-weight: 600;
}

.guide-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  min-width: 0;
  max-width: 820px;
}

/* ---- rendered markdown typography ---- */
.markdown-body { font-size: 0.925rem; line-height: 1.65; color: var(--text); }

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  scroll-margin-top: 64px;
}

.markdown-body h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.markdown-body h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}
.markdown-body h3 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.markdown-body h4 { font-size: 0.9rem; margin: 1.25rem 0 0.5rem; color: var(--text-muted); }

.markdown-body p { margin: 0 0 0.9rem; }

.markdown-body ul,
.markdown-body ol { margin: 0 0 0.9rem; padding-left: 1.4rem; }
.markdown-body li { margin-bottom: 0.35rem; }
.markdown-body li > ul,
.markdown-body li > ol { margin: 0.35rem 0 0; }

.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.markdown-body pre {
  background: #1c1c1a;
  color: #f5f5f4;
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  margin: 0 0 0.9rem;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
}

.markdown-body blockquote p:last-child { margin-bottom: 0; }

.markdown-body table { margin: 0 0 1rem; font-size: 0.85rem; }

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

@media (max-width: 720px) {
  .guide-layout { grid-template-columns: 1fr; }
  .guide-sidebar { position: static; }
}

/* ---- strategy page ---- */
.strat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  max-width: 800px;
}
.strat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.strat-tile-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.strat-tile-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* Universe stock cards */
.universe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 0.6rem;
}
.stock-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stock-card-sym {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.stock-card-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
  flex: 1;
}
.stock-card-price {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.sector-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  align-self: flex-start;
  margin-top: 4px;
}

/* Sector distribution bar */
.seg-bar {
  display: flex;
  height: 26px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 0.4rem;
}
.seg-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.03em;
  min-width: 0;
}

/* Capacity dots grid */
.cap-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-slot {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
}

/* Strategy two-col layout */
.strat-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 800px;
  margin-bottom: 1rem;
}
@media (max-width: 560px) {
  .strat-charts { grid-template-columns: 1fr; }
}
