/* ═══════════════════════════════════════════════════════════════════════
   Orbit — app shell
   Left icon rail · watchlist ribbon · three-pane workspace · terminal parts.
   Depends on orbit.css for tokens. No colour is declared in this file.
   ═══════════════════════════════════════════════════════════════════════ */

.app {
  --rail: 236px;
  --topbar: 48px;
  --ribbon: 34px;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── left sidebar ────────────────────────────────────────────────────
   Always expanded — labels are part of the navigation, not a tooltip you
   have to hunt for. It only changes shape at the mobile breakpoint, where
   it becomes a bottom bar (still labelled). */
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 1px;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  z-index: 30;
  overflow-y: auto; overscroll-behavior: contain;
}
.rail-brand { --logo-h: 38px; margin: 2px 8px 22px; }
.rail-group {
  margin: 18px 0 6px; padding: 0 10px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.rail-group:first-of-type { margin-top: 0; }
.rail-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 500; text-align: left;
  transition: background .14s ease, color .14s ease;
}
.rail-item svg { width: 17px; height: 17px; flex: none; }
.rail-item:hover { background: var(--fg-soft); color: var(--fg); }
.rail-item[aria-current='page'] {
  background: var(--accent-soft); color: var(--accent); font-weight: 550;
}
.rail-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-spacer { flex: 1; min-height: 24px; }
.rail-user {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 11px 10px 2px;
  border-top: 1px solid var(--border);
}
.rail-avatar {
  width: 28px; height: 28px; flex: none; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--fg);
}
.rail-user-meta { display: flex; flex-direction: column; line-height: 1.28; min-width: 0; }
.rail-user-meta strong { font-size: 13px; font-weight: 550; }
.rail-user-meta .micro { font-size: 10.5px; }

/* ─── top bar ─────────────────────────────────────────────────────────── */
.appmain { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 25;
  display: flex; align-items: center; gap: 14px;
  min-height: var(--topbar); padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--fg); }
.crumb .sep { color: var(--border); }
.crumb strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.balance { display: inline-flex; align-items: baseline; gap: 7px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.balance .micro { font-size: 10px; }
.balance .num { font-size: 13px; font-weight: 550; }

/* watchlist ribbon */
.ribbon {
  display: flex; align-items: center; gap: 0;
  min-height: var(--ribbon); padding: 0 18px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  overflow-x: auto; scrollbar-width: none;
}
.ribbon::-webkit-scrollbar { display: none; }
.ribbon-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 16px; height: var(--ribbon); white-space: nowrap;
  border-right: 1px solid var(--border); font-size: 12.5px;
}
.ribbon-item:first-child { flex: 0 0 auto; padding-left: 0; }
.ribbon-item:not(:first-child) {
  flex: 1 1 0; min-width: 0; justify-content: space-between;
}
.ribbon-item .name { color: var(--muted); }
.ribbon-item .num { font-size: 12.5px; font-weight: 550; }

/* ─── workspace ───────────────────────────────────────────────────────── */
.work { width: 100%; padding: 20px 18px 44px; min-width: 0; }
.work-wide { width: 100%; max-width: none; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--gap-md); flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { font-size: 25px; letter-spacing: -0.02em; line-height: 1.2; }
.pagehead .lead { font-size: 14px; margin-top: 4px; }

.panes { display: grid; gap: 14px; align-items: start; }
.panes-2-1 { grid-template-columns: minmax(0, 1fr) clamp(380px, 24vw, 460px); gap: 16px; }
.panes-1-2 { grid-template-columns: clamp(320px, 22vw, 420px) minmax(0, 1fr); gap: 16px; }
.panes-3   { grid-template-columns: clamp(260px, 18vw, 340px) minmax(0, 1fr) clamp(320px, 22vw, 420px); gap: 16px; }
@media (max-width: 1280px) {
  .panes-3 { grid-template-columns: minmax(0, 1fr) 320px; }
  .panes-3 > .pane-first { grid-column: 1 / -1; }
}
@media (max-width: 1020px) {
  .panes-2-1, .panes-1-2, .panes-3 { grid-template-columns: minmax(0, 1fr); }
}

.work[data-od-id='settings'] {
  max-width: none !important;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 14px;
  align-items: start;
}
.work[data-od-id='settings'] .pagehead,
.work[data-od-id='settings'] [data-od-id='venue-connections'] {
  grid-column: 1 / -1;
}
.work[data-od-id='settings'] [data-od-id='notifications'],
.work[data-od-id='settings'] [data-od-id='preferences'] {
  margin-top: 0;
}
@media (max-width: 1120px) {
  .work[data-od-id='settings'] { grid-template-columns: minmax(0, 1fr); }
  .work[data-od-id='settings'] .pagehead,
  .work[data-od-id='settings'] [data-od-id='venue-connections'] {
    grid-column: auto;
  }
}

/* ─── panels ──────────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }
.panel-body-flush { padding: 0; }
.panel-foot { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.panel + .panel { margin-top: 14px; }

/* stat tile row */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 15px 16px; }
.tile .micro { display: block; margin-bottom: 8px; }
.tile .tile-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 550; letter-spacing: -0.03em; line-height: 1.05; }
.tile .tile-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }

/* ─── AI briefing / prompt bar ────────────────────────────────────────── */
.brief p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.62; }
.brief p:last-child { margin-bottom: 0; }
.brief mark { background: var(--accent-soft); color: inherit; padding: 0 3px; border-radius: 3px; }

.promptbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.promptbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.promptbar input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: 14.5px; padding: 6px 0;
}
.promptbar input:focus { outline: none; }
.promptbar input::placeholder { color: var(--muted); }
.prompt-send { width: 34px; height: 34px; min-height: 34px; border-radius: 999px; padding: 0; }
.prompt-send svg { width: 15px; height: 15px; }
.prompt-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.prompt-chips button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 6px 13px; min-height: 32px; font-size: 12.5px;
  transition: color .15s ease, border-color .15s ease;
}
.prompt-chips button:hover { color: var(--fg); border-color: color-mix(in oklch, var(--fg) 30%, transparent); }

/* ─── market row / card ───────────────────────────────────────────────── */
.mkt-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border);
  align-items: center; transition: background .12s ease;
}
.mkt-row:last-child { border-bottom: 0; }
.mkt-row:hover { background: var(--fg-soft); }
.mkt-row .title { font-size: 14px; font-weight: 500; line-height: 1.35; margin-bottom: 5px; }
.mkt-row .sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mkt-prices { display: flex; gap: 6px; }
.px {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 56px; padding: 6px 9px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  transition: border-color .14s ease, background .14s ease;
}
.px .px-side { font-size: 9.5px; letter-spacing: 0.08em; color: var(--muted); }
.px .px-val { font-size: 14px; font-weight: 550; }
.px-yes .px-val { color: var(--yes); }
.px-no  .px-val { color: var(--no); }
button.px:hover { background: var(--surface); border-color: color-mix(in oklch, var(--fg) 30%, transparent); }

/* probability bar */
.probbar { height: 4px; border-radius: 999px; background: var(--fg-soft); overflow: hidden; }
.probbar span { display: block; height: 100%; background: var(--yes); border-radius: 999px; }

/* sparkline */
.spark { width: 84px; height: 26px; color: var(--muted); flex: none; }
.spark.is-up   { color: var(--yes); }
.spark.is-down { color: var(--no); }

/* ─── tape (whale activity / logs) ────────────────────────────────────── */
.tape { font-family: var(--font-mono); font-size: 12px; }
.tape-row {
  display: grid; grid-template-columns: 52px 1fr auto;
  gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border); align-items: baseline;
}
.tape-row:last-child { border-bottom: 0; }
.tape-row .t { color: var(--muted); font-size: 11px; }
.tape-row .m { font-family: var(--font-body); font-size: 13px; line-height: 1.4; min-width: 0; }
.tape-row .v { font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }

/* ─── news card ───────────────────────────────────────────────────────── */
.news-row { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.news-row:last-child { border-bottom: 0; }
.news-row .src { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.news-row h4 { margin: 0 0 5px; font-size: 13.5px; font-weight: 550; line-height: 1.4; }
.news-row p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.news-row .link-mkt { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.news-row .link-mkt:hover { color: var(--fg); }

/* ─── order book ──────────────────────────────────────────────────────── */
.book { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.book-head, .book-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 6px; padding: 3.5px 14px; position: relative;
}
.book-head { color: var(--muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; padding-block: 8px; border-bottom: 1px solid var(--border); }
.book-row > * { position: relative; z-index: 1; text-align: right; }
.book-row > *:first-child { text-align: left; }
.book-row .depth { position: absolute; inset: 0 0 0 auto; z-index: 0; opacity: .16; }
.book-ask .p { color: var(--no); }
.book-ask .depth { background: var(--no); }
.book-bid .p { color: var(--yes); }
.book-bid .depth { background: var(--yes); }
.book-spread {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; margin-block: 4px;
  border-block: 1px solid var(--border); background: var(--surface-2);
  font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
}

/* ─── order ticket ────────────────────────────────────────────────────── */
.ticket { display: flex; flex-direction: column; gap: 12px; }
.side-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-btn {
  padding: 11px; min-height: 46px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: var(--font-mono); transition: all .15s ease;
}
.side-btn .s { font-size: 10.5px; letter-spacing: 0.08em; }
.side-btn .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.side-btn[aria-pressed='true'].side-yes { border-color: var(--yes); background: var(--yes-soft); color: var(--yes); }
.side-btn[aria-pressed='true'].side-no  { border-color: var(--no);  background: var(--no-soft);  color: var(--no); }
.amount-row { display: flex; gap: 8px; }
.amount-row .input { font-family: var(--font-mono); font-size: 17px; font-weight: 550; text-align: right; }
.quick-add { display: flex; gap: 6px; }
.quick-add button { flex: 1; }
.ticket-summary { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 7px; }
.ticket-summary .line { display: flex; justify-content: space-between; font-size: 12.5px; }
.ticket-summary .line span:last-child { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ticket-summary .line.total { font-weight: 600; font-size: 14px; padding-top: 7px; border-top: 1px solid var(--border); }
/* the execute button carries direction colour, never the accent —
   green/red must own YES/NO on a trading surface */
.btn-side { min-height: 46px; font-size: 15px; font-weight: 560; color: var(--on-accent); }
.btn-side.is-yes { background: var(--yes); border-color: var(--yes); }
.btn-side.is-no  { background: var(--no);  border-color: var(--no); }
.btn-side:hover { filter: brightness(0.94); }

/* ─── chart ───────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; padding: 14px 16px 8px; }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 16px 14px; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; }
.chart-legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tf-pills { display: inline-flex; gap: 2px; }
.tf-pills button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 9px; min-height: 28px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px;
}
.tf-pills button:hover { background: var(--fg-soft); color: var(--fg); }
.tf-pills button[aria-selected='true'] { background: var(--fg-soft); color: var(--fg); }

/* ─── tabs ────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; color: var(--muted); white-space: nowrap;
  padding: 11px 14px; min-height: 40px; font-size: 13.5px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected='true'] { color: var(--fg); border-bottom-color: var(--accent); }

/* ─── filter bar ──────────────────────────────────────────────────────── */
.filterbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filterbar .search { flex: 1; min-width: 200px; position: relative; }
.filterbar .search .input { padding-left: 34px; }
.filterbar .search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 15px; height: 15px; color: var(--muted); }
.filterbar .select { width: auto; min-width: 128px; font-size: 13px; }
.chipset { display: flex; gap: 6px; flex-wrap: wrap; }
.chipset button {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; min-height: 30px; font-size: 12.5px;
  transition: all .14s ease;
}
.chipset button:hover { color: var(--fg); }
.chipset button[aria-pressed='true'] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.result-count { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; }

/* ─── agent builder canvas ────────────────────────────────────────────── */
.canvas {
  position: relative; padding: 26px 20px 34px;
  background-image: radial-gradient(circle at 1px 1px, var(--border) 1.1px, transparent 0);
  background-size: 16px 16px;
  min-height: 420px;
}
/* .stage-pill / .st-* live in orbit.css — shared with the landing page */
.pipeline { max-width: 620px; margin-inline: auto; display: flex; flex-direction: column; }
.pipeline .stage-pill { align-self: flex-start; }
/* inside the canvas, an accent chip means "this value is editable" */
.canvas .chip { color: var(--accent); background: var(--surface); }

.stage-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-top: 10px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.stage-card:hover { border-color: color-mix(in oklch, var(--fg) 22%, transparent); }
.stage-card.is-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stage-card > .sc-head { display: flex; align-items: center; gap: 11px; width: 100%; background: transparent; border: 0; padding: 0; text-align: left; }
.sc-mark { width: 30px; height: 30px; flex: none; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--fg); }
.sc-mark svg { width: 15px; height: 15px; }
.sc-head h3 { font-size: 15px; font-weight: 600; }
.sc-head .caret { margin-inline-start: auto; color: var(--muted); transition: transform .18s ease; }
.stage-card.is-open .sc-head .caret { transform: rotate(180deg); }
.sc-rows { margin-top: 12px; display: grid; gap: 8px; }
.sc-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 13.5px; }
.sc-row > .k { color: var(--fg); }
.sc-row > .v { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sc-editor { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--border); display: grid; gap: 9px; }
.sc-editor .erow { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 7px; align-items: center; }
.sc-editor .erow .select, .sc-editor .erow .input { font-size: 13px; min-height: 36px; padding-block: 7px; }
@media (max-width: 620px) { .sc-editor .erow { grid-template-columns: 1fr 1fr; } }
.connector { width: 1px; height: 22px; margin-inline-start: 30px; border-left: 1.5px dashed var(--border); }

/* execution log */
.exec-row { padding: 11px 16px; border-bottom: 1px solid var(--border); }
.exec-row:last-child { border-bottom: 0; }
.exec-row .top { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.exec-row .body { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

/* ─── settings ────────────────────────────────────────────────────────── */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 15px 16px; border-bottom: 1px solid var(--border); align-items: center; }
.set-row:last-child { border-bottom: 0; }
.set-row h4 { margin: 0 0 3px; font-size: 14px; font-weight: 550; }
.set-row p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 62ch; }
.set-row .ctl { display: flex; align-items: center; gap: 10px; }
.connection-details { width: 100%; }
.connection-details summary { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); font-size: 12.5px; font-weight: 550; cursor: pointer; list-style: none; }
.connection-details summary::-webkit-details-marker { display: none; }
.connection-details summary::after { content: '\203A'; margin-left: 9px; color: var(--muted); transform: rotate(90deg); transition: transform 160ms ease; }
.connection-details[open] summary::after { transform: rotate(-90deg); }
.connection-form { gap: 12px; margin-top: 14px; }
@media (max-width: 620px) { .set-row { grid-template-columns: 1fr; gap: 12px; } .set-row .ctl { justify-content: flex-start; } }

.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.matrix th, .matrix td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.matrix th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.matrix td.c, .matrix th.c { text-align: center; width: 96px; }

/* ─── toast ───────────────────────────────────────────────────────────── */
.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: var(--radius);
  background: var(--fg); color: var(--bg);
  font-size: 13.5px; box-shadow: var(--shadow-pop);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1);
  max-width: min(380px, calc(100vw - 36px));
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ─── empty state ─────────────────────────────────────────────────────── */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .num { font-size: 26px; display: block; margin-bottom: 8px; opacity: .5; }

/* ─── responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1180px) { .app { --rail: 208px; } }

/* the sidebar becomes a labelled bottom bar — never an icon-only strip */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto;
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    overflow: visible;
  }
  .rail-brand, .rail-spacer, .rail-group, .rail-user, .rail-hide-sm { display: none; }
  .rail-item {
    flex-direction: column; justify-content: center; gap: 3px;
    width: auto; flex: 1 1 0; min-width: 0; min-height: 48px;
    padding: 5px 2px; font-size: 10px;
  }
  .rail-item svg { width: 19px; height: 19px; }
  .rail-label { font-size: 10px; letter-spacing: -0.005em; max-width: 100%; }
  .appmain { padding-bottom: 76px; }
  .work { padding: 16px 16px 30px; }
  .topbar { padding-inline: 16px; }
  .ribbon { padding-inline: 16px; }
  .ribbon-item:not(:first-child) { flex: 0 0 auto; min-width: max-content; justify-content: flex-start; }
  .pagehead h1 { font-size: 22px; }
}
@media (max-width: 560px) {
  .topbar .balance { display: none; }
  .work { padding-inline: 14px; }
  .panel-body { padding: 14px; }
  .mkt-row { grid-template-columns: minmax(0, 1fr); }
  .mkt-prices { justify-content: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════════════
   AI chat — the dashboard spine
   The chat is not a widget on the dashboard; it IS the dashboard. Its
   output is a Strategy object rendered inline, so the path from a sentence
   to a deployed, shareable strategy never leaves this column.
   ═══════════════════════════════════════════════════════════════════════ */
.chat {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar) - var(--ribbon) - 92px);
  min-height: 520px;
}
.chat-scroll {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 20px;
}
.chat-foot { border-top: 1px solid var(--border); padding: 14px 16px; background: var(--surface); }

.msg { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; }
.msg-avatar {
  width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg);
}
.msg-avatar.is-ai { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.msg-body { min-width: 0; }
.msg-body > p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.62; }
.msg-body > p:last-child { margin-bottom: 0; }
.msg-body mark { background: var(--accent-soft); color: inherit; padding: 0 3px; border-radius: 3px; }
.msg-user .msg-body > p { color: var(--fg); font-weight: 500; }
/* assistant turns carry strategy cards, so they get the wider measure */
.msg-ai .msg-body { max-width: 72ch; }
.msg-ai .msg-body > .strat, .msg-ai .msg-body > .panel { max-width: none; }
.msg-name { font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* the assistant thinking line, replaced by the real answer */
.msg-thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 13.5px; }
.msg-thinking i { width: 4px; height: 4px; border-radius: 999px; background: currentColor; animation: think 1.1s infinite; }
.msg-thinking i:nth-child(2) { animation-delay: .15s; }
.msg-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes think { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ─── the strategy object ─────────────────────────────────────────────
   Same component whether it appears inline in chat, in your library, or
   in the community feed — one object, three surfaces. */
.strat {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-2); overflow: hidden;
}
.strat-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.strat-head h4 { margin: 0; font-size: 14.5px; font-weight: 600; }
.strat-head .spacer { flex: 1; }
.strat-body { padding: 14px 15px; }
.strat-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 15px; border-top: 1px solid var(--border); background: var(--surface);
}
.strat-foot .spacer { flex: 1; }

/* the module chain — what the strategy actually does, in order */
.chain { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chain .lk {
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--fg); white-space: nowrap;
}
.chain .lk-arr { color: var(--border); font-family: var(--font-mono); font-size: 11px; }
.chain .lk-edit { cursor: pointer; }
.chain .lk-edit:hover { border-color: var(--accent); color: var(--accent); }

/* key-value grid inside a strategy */
.strat-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 12px; margin-top: 13px; }
.strat-kv > div > .micro { display: block; margin-bottom: 4px; }
.strat-kv .v { font-family: var(--font-mono); font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; }

/* ─── strategy list rows (library + community) ───────────────────────── */
.strat-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px; padding: 15px 16px; border-bottom: 1px solid var(--border); align-items: center;
}
.strat-row:last-child { border-bottom: 0; }
.strat-row:hover { background: var(--fg-soft); }
.strat-row .name { font-size: 14.5px; font-weight: 550; margin-bottom: 5px; display: block; }
.strat-row p { margin: 0 0 8px; font-size: 13px; color: var(--muted); max-width: 68ch; }
.strat-row .meta-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.strat-row .ctl { display: flex; align-items: center; gap: 8px; }
@media (max-width: 720px) { .strat-row { grid-template-columns: 1fr; } }

.author { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.author .av {
  width: 20px; height: 20px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; color: var(--fg);
}
.forks { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.forks svg { width: 13px; height: 13px; }

/* .ver lives in orbit.css — both the app and the landing use it */

/* honest performance: it is the author's own run, not a promise */
.perf { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.perf .n { font-family: var(--font-mono); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.perf .l { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 1020px) {
  .chat { height: auto; min-height: 0; }
  .chat-scroll { max-height: 60vh; }
}
