:root {
  --bg: #0e1116;
  --panel: #161a22;
  --border: #232a36;
  --text: #d6d9e0;
  --muted: #7c8493;
  --accent: #4cc9f0;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}
nuro-app {
  display: grid; height: 100vh;
  grid-template-rows: 44px 1fr;
}
.topnav {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topnav .brand {
  display: inline-flex; align-items: baseline; gap: 6px;
  margin-right: 16px;
}
.topnav .brand-mark {
  font-family: "Times New Roman", Georgia, serif;
  font-style: italic;
  font-size: 22px; line-height: 1;
  color: var(--accent);
  font-weight: 400;
}
.topnav .brand-word {
  font-weight: 700; letter-spacing: 1px;
  color: var(--text);
  font-size: 13px;
}
.topnav .navtab {
  background: transparent; color: var(--muted);
  border: none; padding: 6px 14px;
  font-size: 12px; cursor: pointer;
  border-radius: 4px;
  text-transform: lowercase; font-family: inherit;
}
.topnav .navtab:hover { color: var(--text); }
.topnav .navtab.active {
  color: var(--text); background: var(--bg);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.viewroot { min-height: 0; }
.viewroot > * { display: block; height: 100%; }
.split-2 {
  display: grid; height: 100%;
  grid-template-columns: 380px 1fr;
}
.split-3 {
  display: grid; height: 100%;
  grid-template-columns: 200px 320px 1fr;
}
.split-mini {
  display: grid; height: 100%;
  grid-template-columns: 150px 1fr;
}
.single-chart {
  display: grid; height: 100%;
  grid-template-columns: 1fr;
}
.mini-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}
.mini-list-head {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev, #161a22);
  position: sticky; top: 0; z-index: 1;
}
.mini-wl-picker {
  flex: 1; background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 6px; font-size: 11px; font-family: inherit;
  min-width: 0;
}
.mini-wl-picker:focus { border-color: var(--accent); outline: none; }
.mini-auto-tag { margin-left: 0; font-size: 9px; padding: 1px 4px; }

.mini-list-row {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  cursor: pointer;
  color: var(--text);
  transition: background 0.08s ease, border-left-color 0.08s ease;
  font-variant-numeric: tabular-nums;
}
.mini-list-row:hover { background: var(--panel); }
.mini-list-row.selected {
  background: var(--panel);
  border-left-color: var(--accent);
}
.mini-row-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 6px;
}
.mini-row-bot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px; min-height: 12px;
}
.mini-list-row .msym {
  font-weight: 600; font-size: 12px; letter-spacing: 0.3px;
}
.mini-list-row .mpct {
  font-size: 11px; font-weight: 500;
}
.mini-list-row .mpct.up   { color: var(--green); }
.mini-list-row .mpct.down { color: var(--red); }
.mini-list-row .mini-rs {
  font-size: 10px; color: #a78bfa;
  background: rgba(167,139,250,0.08); padding: 0 4px; border-radius: 2px;
}
.mini-list-row .mini-spec {
  font-size: 11px; line-height: 1; margin-left: auto;
}
.mini-list-row .mini-spec.spec-long  { color: var(--green); }
.mini-list-row .mini-spec.spec-short { color: var(--red); }

.wl-list-row.draggable { cursor: grab; }
.wl-list-row.draggable:active { cursor: grabbing; }
.wl-list-row {
  padding: 4px 10px; border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; align-items: center;
  transition: background 0.08s ease;
}
.wl-list-row:hover { background: var(--panel); }
.wl-list-row.selected {
  background: var(--panel);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.wl-list-row .row-main { min-width: 0; }
.wl-list-row .symbol {
  font-weight: 600; font-size: 12px; letter-spacing: 0.2px;
  color: var(--text);
}
.wl-list-row .row-sub {
  color: var(--muted); font-size: 10px; margin-top: 0;
}
.wl-list-row .row-perf {
  text-align: right; font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; gap: 0; line-height: 1.1;
}
.wl-list-row .row-perf .pct {
  font-weight: 600; font-size: 12px;
}
.wl-list-row .row-perf .pct.up   { color: var(--green); }
.wl-list-row .row-perf .pct.down { color: var(--red); }
.wl-list-row .row-perf .rs {
  color: #a78bfa; font-size: 10px;
}

/* Ad-hoc watchlist banner — shows above the normal header when the
   panel is in transient mode (regime-tab cohort/bin drill-in). × on
   the right clears + returns to the previously-picked watchlist. */
.wl-adhoc-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; font-size: 11px;
  background: rgba(76, 201, 240, 0.08);
  border-bottom: 1px solid var(--accent);
  color: var(--text);
}
.wl-adhoc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  flex-shrink: 0;
}
.wl-adhoc-label { flex: 1; font-weight: 500; }
.wl-adhoc-clear {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 3px;
  padding: 0 6px; cursor: pointer; font-size: 12px; line-height: 1.4;
  font-family: inherit;
}
.wl-adhoc-clear:hover { color: var(--red); border-color: var(--red); }

/* Entries header — clickable button that toggles the dropdown of
   available watchlists. Designed so the user can switch lists even
   when the W (watchlists picker) panel is collapsed (Sven's
   2026-05-15 directive). */
.wl-entries-header {
  position: relative;
  cursor: pointer;
  transition: background 0.08s ease;
}
.wl-entries-header:hover { background: var(--panel); }
.wl-header-trigger {
  color: var(--text); font: inherit;
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.wl-header-caret { color: var(--muted); font-size: 9px; }
.wl-header-dropdown {
  position: absolute; left: 6px; top: 100%; margin-top: 2px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-width: 180px; max-height: 50vh; overflow-y: auto;
  z-index: 10;
  padding: 4px 0;
}
.wl-dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; box-sizing: border-box;
  padding: 6px 10px;
  background: transparent; border: none;
  color: var(--text); font: inherit; font-size: 12px;
  cursor: pointer; text-align: left;
}
.wl-dropdown-item:hover { background: var(--panel); }
.wl-dropdown-item.selected {
  background: var(--panel); color: var(--accent);
  border-left: 2px solid var(--accent); padding-left: 8px;
}
.wl-dropdown-name { flex: 1; }

/* Trash drop-zone — mounted at the left edge of the entries panel,
   visible only while a row is being dragged. Drop a row here to remove
   it from the current watchlist. The X button it replaced was visually
   noisy on every row; gating delete behind a deliberate drag is
   harder to fat-finger by accident too. */
/* Entries panel layout: header stays put at the top, only the list
   scrolls. Without this the header (with the watchlist-name dropdown)
   scrolled out of view on long lists. The trash drop-zone is absolute
   on .wl-entries, which stays in the panel-cell's stable frame, so it
   keeps showing during a drag regardless of scroll position. */
watchlist-entries {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}
.wl-entries {
  position: relative;
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  overflow: hidden;
}
.wl-entries .list {
  flex: 1; min-height: 0; overflow-y: auto;
}
.wl-trash-zone {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 80px;
  background: rgba(248, 113, 113, 0.10);
  border-right: 2px dashed rgba(248, 113, 113, 0.55);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; color: var(--red);
  font-size: 10px; letter-spacing: 0.3px;
  text-transform: uppercase;
  pointer-events: auto; z-index: 5;
  transition: background 0.1s ease;
}
.wl-trash-zone.active {
  background: rgba(248, 113, 113, 0.28);
  border-right-color: var(--red);
}
.wl-trash-icon { font-size: 28px; line-height: 1; }
.wl-trash-label { text-align: center; }

.sig-badge {
  display: inline-block; margin-left: 6px;
  background: #1e3a8a; color: #dbeafe;
  padding: 1px 6px; border-radius: 3px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  vertical-align: middle;
}
.sig-badge.mini {
  margin-left: 4px; padding: 0 4px;
  font-size: 8px;
}

.ca-badge {
  display: inline-block; margin-left: 4px;
  padding: 1px 5px; border-radius: 3px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  vertical-align: middle;
}
.ca-badge.target   { background: #7f1d1d; color: #fee2e2; }
.ca-badge.acquirer { background: #1e3a8a; color: #dbeafe; }
.ca-badge.div      { background: #14532d; color: #d1fae5; }
/* Strategy warning badges on watchlist entries — operator-facing
   discretion flags ("Low RS!", "Price below $10"). Same scale as the
   corp-action badges; warm amber so they read as "watch out" without
   being alarmist. NEVER used as a filter — pure information. */
.warn-badge {
  display: inline-block; margin-left: 4px;
  padding: 1px 5px; border-radius: 3px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  vertical-align: middle;
  background: rgba(180, 83, 9, 0.85); color: #fef3c7;
}

/* PanelGrid — vertical icon bar + accordion of toggleable panels.
   Generic surface used by SymbolView (the chart tab). Each
   visible panel takes flex weight; chart usually has weight=3 vs
   sidebars at weight=1.

   The custom element <panel-grid> needs its OWN flex rules — without
   them it defaults to inline and the inner .panel-grid div has no
   parent height to flex into. Caught after the chart collapsed to
   half-height when News was hidden: news panel's tall card stack was
   the only thing forcing the row to a real height; without it the
   row sized to nothing and chart along with it. */
panel-grid {
  display: flex; flex: 1; min-height: 0; min-width: 0;
}
.panel-grid {
  display: flex; flex: 1; min-height: 0; min-width: 0;
}
.panel-iconbar {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 4px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  width: 36px; flex-shrink: 0;
}
.panel-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
}
.panel-icon:hover { color: var(--accent); border-color: var(--border); }
.panel-icon.on    { color: var(--accent); border-color: var(--accent); background: rgba(86, 180, 233, 0.08); }
.panel-icon.sticky { color: var(--text); cursor: default; opacity: 0.6; }
.panel-icon[disabled] { cursor: default; }
/* Suppress the mouse-click focus ring — visually conflicts with the
   .on state (both render an accent border) and stays after a click,
   making the icon look "active" even when its panel is closed.
   Click handler also explicitly blur()s. Keyboard focus (Tab nav)
   keeps a visible ring via :focus-visible so accessibility isn't
   broken. Sven flagged 2026-05-16. */
.panel-icon:focus { outline: none; }
.panel-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.panel-row {
  display: flex; flex: 1; min-height: 0; min-width: 0;
  background: var(--border);
}
/* Drag handle between adjacent visible panels. 4px wide hitbox; styled
   border line down the middle. Pointer cursor signals draggable. */
.panel-resizer {
  width: 4px; flex: 0 0 4px;
  cursor: col-resize;
  background: var(--border);
  position: relative;
}
.panel-resizer:hover { background: var(--accent); }
.panel-resizer:active { background: var(--accent); }
/* Watchlists-view list panel: lists picker on top, entries list below.
   Stacks vertically inside a single PanelGrid cell. Both sub-sections
   scroll independently if their content overflows. */
.wl-list-container {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
  font-size: 12px;
}
.wl-list-container .wl-lists-row {
  max-height: 240px; overflow-y: auto;
  border-bottom: 1px solid var(--border);
}
/* WatchlistsPicker (standalone panel — not the same as .wl-list-container
   above which is the per-symbol-context variant). The picker is mounted
   inside panel-body { overflow: hidden }, so the inner list needs its
   own flex layout + scroll or rows past the panel height get clipped
   silently (caught 2026-05-23 — Sven couldn't see watchlists at the
   bottom of the list). Header stays pinned, list scrolls. */
.wl-picker {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
}
.wl-picker > .list-header { flex: 0 0 auto; }
.wl-picker > .wl-lists-row {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
}
.wl-list-container .list { flex: 1; overflow-y: auto; }
.panel-cell {
  display: flex; flex-direction: column;
  min-width: 200px; min-height: 0;
  background: var(--bg);
  overflow: hidden;
}
.panel-body {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  /* overflow:hidden so the chart's autoSize / canvas measurements
     don't get a scrollable container that miscounts available
     height. Individual panel CONTENTS manage their own scroll
     (news-panel, trades panel, earnings panel all set overflow-y
     internally where needed). */
  overflow: hidden;
}
/* Make the direct child of panel-body also flex-fill so symbol-main /
   earnings-panel / etc. claim the full height even though they're
   custom elements (otherwise they default to inline-block and the
   chart collapses to its intrinsic minimum). */
.panel-body > * {
  flex: 1; min-height: 0; min-width: 0;
}
.panel-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; padding: 32px;
}

/* Earnings panel — next event header on top, history list below.
   Color cues: green for positive post-day return, red for negative,
   muted for zero/missing. */
.earnings-panel {
  display: flex; flex-direction: column;
  font-size: 12px; color: var(--text);
  padding: 12px; gap: 12px;
  overflow-y: auto; /* full mode is long; condensed scrolls past-events list */
  /* overflow-x:hidden + min-width:0 prevents wide inner content
     (fund-profile description, revenue-chart canvas) from pushing
     the panel-cell wider than its flex allocation — without this
     the chart panel-cell beside it gets shoved off-screen since
     .panel-cell uses flex-shrink:0. Sven /sys 2026-05-19. */
  overflow-x: hidden;
  min-width: 0;
  height: 100%;
}
/* Direct children of .earnings-panel are nested flex/grid containers
   (fund-profile, accounting-signals, charts). Force min-width:0 on
   each so the inner content can wrap/shrink instead of forcing the
   parent wider. */
.earnings-panel > * { min-width: 0; max-width: 100%; }
/* Mode toggle (condensed | full) sits at the top of the earnings
   panel. In full mode an annual/quarter sub-toggle appears next to it. */
.earn-mode-toggle {
  display: flex; align-items: center;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
/* Condensed mode — tight profile + latest-period values stacked. The
   "tight" variants of profile + description trim padding so the panel
   reads in a narrow column without horizontal squeeze. */
.fund-profile-tight { padding: 0; gap: 4px; }
.fund-profile-tight .fund-profile-name { font-size: 14px; font-weight: 600; }
.fund-profile-desc-tight {
  font-size: 11px; color: var(--muted); line-height: 1.4;
  margin: 4px 0 0 0;
  /* Trim long descriptions to ~5 lines; full mode shows the rest. */
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
}
.earn-latest-block { display: flex; flex-direction: column; gap: 4px; }
.earn-latest-grid {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.earn-latest-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-soft, #1a1f2a);
}
.earn-latest-label { color: var(--muted); }
.earn-latest-val { font-weight: 600; color: var(--text); }
.earn-latest-val.up { color: var(--green); }
.earn-latest-val.down { color: var(--red); }
.earn-next-head, .earn-history-head {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 4px;
}
.earn-next-date {
  font-size: 16px; font-weight: 600; color: var(--accent);
  margin-bottom: 4px;
}
.earn-next-meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--muted);
  margin-bottom: 16px;
}
.earn-time {
  display: inline-block; padding: 1px 4px; border-radius: 2px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.earn-time.bmo { background: rgba(30,64,175,0.6); color: #dbeafe; }
.earn-time.bmo.mini { font-size: 8px; padding: 0 3px; }
.earn-history-head { margin-top: 8px; }
.earn-history { display: flex; flex-direction: column; gap: 2px; }
.earn-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-soft, #1a1f2a);
}
.earn-row:hover { background: var(--surface-hover, rgba(255,255,255,0.04)); }
.earn-row-date { color: var(--muted); font-variant-numeric: tabular-nums; flex: 1; }
.earn-row-pct { font-variant-numeric: tabular-nums; font-weight: 600; }
.earn-row-pct.up { color: var(--green); }
.earn-row-pct.down { color: var(--red); }

/* News panel — stack of clickable story cards. Re-uses .news-* classes
   from the symbol-main news section so styles stay consistent. */
.news-panel {
  display: flex; flex-direction: column; gap: 0;
  padding: 6px 0;
  overflow-y: auto; /* feed scrolls inside the panel, not the page */
  height: 100%;
}
.news-panel .news-item {
  display: block; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.news-panel .news-item:hover { background: var(--surface-hover, rgba(255,255,255,0.04)); }

/* Per-symbol trades panel: spec at top, past closed trades below.
   Sven's "right panel" content per the layout spec. */
.sym-trades-panel {
  padding: 12px; font-size: 12px;
  overflow-y: auto; height: 100%;
}
.sym-trades-section { margin-bottom: 16px; }
.sym-spec-summary {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px;
  background: var(--surface, var(--panel));
  border: 1px solid var(--border); border-radius: 4px;
}
.sym-spec-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sym-spec-row.sym-spec-meta { font-size: 11px; color: var(--muted); }
.sym-spec-side { font-weight: 600; }
.sym-spec-side.up { color: var(--green); }
.sym-spec-side.down { color: var(--red); }
.sym-spec-notes { color: var(--muted); font-size: 11px; font-style: italic; }
.sym-trade-row {
  display: flex; gap: 8px; align-items: center;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-soft, #1a1f2a);
  font-variant-numeric: tabular-nums;
}
.sym-trade-row:hover { background: var(--surface-hover, rgba(255,255,255,0.04)); }
.sym-trade-date { color: var(--muted); flex: 1; }
.sym-trade-tag { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.sym-trade-r { font-weight: 600; }
.sym-trade-r.up { color: var(--green); }
.sym-trade-r.down { color: var(--red); }

/* Symbol sidebar — sits next to the chart, holds notes + multi-list toggles. */
.chart-with-sidebar {
  display: grid; grid-template-columns: 1fr 240px;
  flex: 1; min-height: 0;
}
.chart-with-sidebar > chart-pane { min-width: 0; min-height: 0; }
symbol-sidebar {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--panel);
  padding: 12px; gap: 16px;
  overflow-y: auto; min-height: 0;
}
.sidebar-section {
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px;
  color: var(--muted); text-transform: uppercase;
}
.sidebar-empty {
  font-size: 11px; color: var(--muted); font-style: italic;
}
.notes-input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 8px; font: 12px/1.45 inherit;
  min-height: 100px; resize: vertical;
}
.notes-input:focus { border-color: var(--accent); outline: none; }
.notes-save {
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 4px;
  padding: 6px 10px; font: 600 11px inherit;
  cursor: pointer; align-self: flex-start;
}
.notes-save:disabled {
  background: var(--border); color: var(--muted); cursor: not-allowed;
}
.note-entry {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px;
}
.note-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; color: var(--muted);
  margin-bottom: 4px;
}
.note-del {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0 4px;
}
.note-del:hover { color: var(--red); }
.note-text {
  font-size: 12px; line-height: 1.45;
  word-wrap: break-word;
}
/* Markdown rendering rules — same loose-list defense as
   .market-entry-text + .agent-reply-body. Tightened block-element
   margins so paragraphs read densely; <p> inside <li> zero-margin
   so loose-source bullets don't blow up the gap. */
.note-text > :first-child { margin-top: 0; }
.note-text > :last-child  { margin-bottom: 0; }
.note-text p,
.note-text pre,
.note-text blockquote { margin: 6px 0; }
.note-text ul,
.note-text ol { margin: 6px 0; padding-left: 22px; }
.note-text h1,
.note-text h2,
.note-text h3,
.note-text h4 { margin: 8px 0 4px; line-height: 1.25; font-size: 12px; }
.note-text li { margin: 2px 0; }
.note-text li > p { margin: 0; }
.note-text li > p + p { margin-top: 4px; }
.note-text li > ul,
.note-text li > ol { margin: 2px 0; }
.note-text code {
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  font-size: 11px;
}
.note-text pre {
  background: rgba(255,255,255,0.04);
  padding: 6px 8px; border-radius: 4px;
  overflow-x: auto; white-space: pre;
}
.note-text pre code { background: transparent; padding: 0; }
.note-badge {
  display: inline-block; margin-left: 8px;
  background: #14532d; color: #d1fae5;
  padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  vertical-align: middle;
}

/* Live-market dot — pulsing green when US RTH is in session, signalling
   that the chart's most-recent bar is intraday/incomplete rather than EOD. */
.live-dot {
  display: inline-block; margin-left: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  vertical-align: middle;
  animation: live-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 4px rgba(74, 222, 128, 0.3); }
  50%      { opacity: 1.0; box-shadow: 0 0 10px rgba(74, 222, 128, 0.8); }
}
.list-toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 12px; cursor: pointer;
}
.list-toggle input { cursor: pointer; }
.wl-select {
  margin-left: auto;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font: 12px inherit;
  cursor: pointer;
}
.wl-select:focus { border-color: var(--accent); outline: none; }
.panel-mode-toggle { margin-left: auto; }
.single-pane {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0; min-width: 0;
}
/* Symbol-context panel: chart-with-sidebar takes the top 65% of the viewport,
   then profile + past trades stack below and scroll with the page so the
   operator can see everything-on-this-symbol in one place. */
/* Symbol-context fills its parent fully — fundamentals/profile/news/
   past-trades all moved INTO symbol-main, so we no longer need a
   reserved height for sections below the chart. The chart slot can
   take the entire viewport now. */
.symbol-context { overflow: hidden; }
.symbol-section {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.symbol-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 0 0 10px 0;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 18px;
  font-size: 12px;
}
.profile-row { display: flex; align-items: baseline; gap: 8px; }
.profile-label { color: var(--muted); min-width: 80px; }
.profile-row a { color: #4cc9f0; text-decoration: none; }
.profile-row a:hover { text-decoration: underline; }
.profile-desc {
  margin: 12px 0 0 0; color: var(--text); font-size: 12px; line-height: 1.6;
  max-width: 1100px;
}
.symbol-trades-tbl {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.symbol-trades-tbl th, .symbol-trades-tbl td {
  padding: 6px 10px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.symbol-trades-tbl th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 600;
}
.symbol-trades-tbl td.pos { color: var(--green); font-weight: 600; }
.symbol-trades-tbl td.neg { color: var(--red); }
.symbol-trades-tbl .reason { color: var(--muted); font-size: 11px; }
/* Symbol-input autocomplete dropdown — type-ahead via FMP /v3/search,
   200ms debounced. Mousedown (not click) on hits so blur-then-click
   doesn't fire blur first and close the dropdown before selection. */
.symbol-search-wrap { position: relative; display: inline-block; }
.symbol-search-dropdown {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--panel);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 4px 4px;
  z-index: 30;
  max-height: 320px; overflow-y: auto;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}
.symbol-search-hit {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px; align-items: center;
  padding: 6px 10px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.symbol-search-hit:last-child { border-bottom: none; }
.symbol-search-hit:hover { background: rgba(76, 201, 240, 0.08); }
.symbol-search-sym {
  font-family: ui-monospace, monospace; font-weight: 600;
  color: #4cc9f0;
}
.symbol-search-name {
  color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.symbol-search-ex {
  font-size: 10px; color: var(--muted);
}

/* /warn banner — pinned above the symbol-main tab strip so it's
   visible across every view (chart, fundamentals, news, past-trades).
   Files as a per-symbol journal note with [WARN] prefix; deleting
   the row removes the warning. */
.symbol-warn-banner {
  display: flex; flex-direction: column;
  background: rgba(248, 113, 113, 0.10);
  border-bottom: 2px solid #f87171;
}
.symbol-warn-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  font-size: 12px; color: var(--text);
  border-top: 1px solid rgba(248, 113, 113, 0.2);
}
.symbol-warn-row:first-child { border-top: none; }
.symbol-warn-icon { color: #f87171; font-size: 14px; }
.symbol-warn-text { flex: 1; font-weight: 500; }
.symbol-warn-date { font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace; }
.symbol-warn-dismiss {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 7px; font-size: 12px;
  color: var(--muted); cursor: pointer;
}
.symbol-warn-dismiss:hover { color: #f87171; border-color: #f87171; }

/* SymbolMain — chart / fundamentals / news swap with a tab strip at the
   top. Mounted inside the chart panel of SymbolView. */
symbol-main {
  display: flex; flex-direction: column;
  flex: 1; min-width: 0; min-height: 0;
}
.symbol-main {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; min-width: 0;
}
.symbol-main-tabs {
  display: flex; gap: 0;
  padding: 4px 8px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.symbol-main-tabs button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 14px; font-size: 11px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.symbol-main-tabs button:first-child { border-radius: 4px 0 0 4px; }
.symbol-main-tabs button:last-child  { border-radius: 0 4px 4px 0; border-left: none; }
.symbol-main-tabs button:not(:first-child):not(:last-child) { border-left: none; }
.symbol-main-tabs button.active {
  color: #4cc9f0; border-color: #4cc9f0;
}
.symbol-main-content {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  overflow: hidden;
}

/* News pane (when active in symbol-main). */
.news-pane {
  flex: 1; padding: 12px 18px; overflow-y: auto;
  background: var(--bg);
}
.news-pane-title { margin: 0 0 12px 0; font-size: 14px; }

/* Fundamentals panel — fills the chart-pane slot when toggled via 'f'.
   Three vertical bar groups (revenue / net income / EPS) stacked, plus
   a shared period axis at the bottom. Each group sized so the largest
   value fills the track; smaller values render proportionally. */
.fundamentals-pane {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; min-width: 0; overflow: hidden;
}
.fund-panel {
  flex: 1; display: flex; flex-direction: column;
  padding: 12px 18px; overflow-y: auto;
  background: var(--bg);
}
.fund-panel-header {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 14px;
}
.fund-panel-header h2 { margin: 0; font-size: 14px; }
.fund-period-toggle { display: inline-flex; gap: 0; }
.fund-period-toggle button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 0;
  padding: 3px 10px; font-size: 11px; cursor: pointer;
}
.fund-period-toggle button:first-child { border-radius: 3px 0 0 3px; }
.fund-period-toggle button:last-child  { border-radius: 0 3px 3px 0; border-left: none; }
.fund-period-toggle button.active {
  color: #4cc9f0; border-color: #4cc9f0;
}
.fund-hint { font-size: 10px; color: var(--muted); margin-left: auto; }
.fund-hint kbd {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; font-size: 10px;
  font-family: ui-monospace, monospace;
}
.fund-group { margin-bottom: 18px; }
.fund-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 6px;
}
.fund-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 12px;
  height: 80px;     /* tighter than before; profile now sits above */
  align-items: end;
}
.fund-charts { /* wrapper that scopes the chart-area */
  display: flex; flex-direction: column;
}

/* Accounting red-flags panel — surfaces FCF/NI divergence, AR-vs-revenue
   growth gap, inventory bloat, leverage, goodwill bloat. Sven flagged
   "spot TSLA-type fraud" in /sys 17:00. */
.fund-flags {
  margin: 0 0 16px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid #fbbf24;
  border-radius: 4px;
  background: rgba(251, 191, 36, 0.04);
}
.fund-flags-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 6px;
}
.fund-flag {
  font-size: 12px; line-height: 1.4; padding: 2px 0;
  cursor: help; /* native tooltip carries the explanation */
}
.fund-flag:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.fund-flag::before { content: "⚑ "; opacity: 0.7; }
.fund-flag-high { color: #f87171; }
.fund-flag-med  { color: #fbbf24; }
/* "no flags found" empty-state — green check, muted weight. Confirms
   we ran the analysis vs. just not rendering a section. */
.fund-flag-ok   { color: #4ade80; opacity: 0.85; }
.fund-flag-ok::before { content: "✓ " !important; opacity: 0.8; }

/* Profile-above-fundamentals (Sven 17:15: "put the profile above the
   fundamentals"). One compact bar of vitals + a description prose. */
.fund-profile {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.fund-profile-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-bottom: 8px;
}
.fund-profile-name { font-size: 14px; font-weight: 600; color: var(--text); }
.fund-profile-grid {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 11px; color: var(--text);
}
.fund-profile-label { color: var(--muted); margin-right: 4px; }
.fund-profile-grid a { color: #4cc9f0; text-decoration: none; }
.fund-profile-grid a:hover { text-decoration: underline; }
.fund-profile-desc {
  margin: 10px 0 0 0;
  font-size: 11px; line-height: 1.6; color: var(--muted);
  max-width: 1100px;
}

/* Past-trades tab (now lives inside symbol-main, not below). */
.past-trades-panel {
  flex: 1; padding: 12px 18px; overflow-y: auto;
  background: var(--bg);
}
.past-trades-title { margin: 0 0 12px 0; font-size: 14px; }
.trade-strat-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px;
}
.origin-badge {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 3px;
  font-family: ui-monospace, monospace;
}
.origin-badge.origin-backtest { background: rgba(156, 163, 175, 0.18); color: #9ca3af; }
.origin-badge.origin-paper    { background: rgba(76, 201, 240, 0.18); color: #4cc9f0; }
.origin-badge.origin-live     { background: rgba(74, 222, 128, 0.18); color: #4ade80; font-weight: 700; }
.fund-bar-col {
  display: flex; flex-direction: column; align-items: center;
  height: 100%; gap: 4px; min-width: 0;
}
.fund-bar-val {
  font-size: 10px; color: var(--text);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}
/* Per-bar period label — sits under each bar so wrapping into multiple
   rows in narrow panels keeps the label glued to its column. Was a
   shared bottom-axis row before; that broke as soon as the row wrapped. */
.fund-bar-period {
  font-size: 9px; color: var(--muted);
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  margin-top: 2px;
}
.fund-bar-track {
  flex: 1; width: 38px; max-width: 60%;
  display: flex; align-items: flex-end;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px 2px 0 0;
}
.fund-bar-fill {
  width: 100%; min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: opacity 0.15s;
}
.fund-bar-fill:hover { opacity: 0.75; }
.fund-axis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.fund-axis-label {
  font-size: 10px; color: var(--muted);
  text-align: center; line-height: 1.2;
  font-family: ui-monospace, monospace;
}

/* (chart/fundamentals swap moved to .symbol-main-tabs above) */

/* News section. */
.news-list { display: flex; flex-direction: column; gap: 8px; max-width: 1100px; }
.news-item {
  display: block;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}
.news-item:hover { border-color: #4cc9f0; }
.news-meta {
  display: flex; gap: 10px; font-size: 10px; color: var(--muted);
  margin-bottom: 4px;
}
.news-site { font-weight: 600; }
.news-title { font-size: 13px; line-height: 1.4; margin-bottom: 4px; }
.news-snippet { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* Clickable symbol cells across the app — drill-in to the symbol-context
   panel via the open-symbol event. Underlined-on-hover links rather than
   buttons so they read as inline navigation, not actions. */
.sym-link {
  cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.15s, color 0.15s;
}
.sym-link:hover {
  color: #4cc9f0;
  border-bottom-color: #4cc9f0;
}

.mcap-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px; color: var(--muted);
  font-family: ui-monospace, monospace;
}
trades-view, symbol-view, journal-view, mail-view, strategies-view {
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}

/* Strategies tab — compact table; lifecycle dropdown styled per stage so the
   field doubles as a status badge. */
/* 2026-05-22 master-detail layout: sidebar list (left) + tabbed pane
   (right). Replaces the old table-with-expanded-row design. */
.strat-layout {
  flex-direction: row !important;
  height: 100%; min-height: 0;
}
.strat-sidebar {
  width: 280px; min-width: 280px;
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
  display: flex; flex-direction: column;
  min-height: 0;
}
.strat-sidebar-header {
  padding: 14px 14px 8px;
  display: flex; align-items: baseline; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.strat-sidebar-header h2 {
  margin: 0; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text); font-weight: 700;
  flex: 1;
}
.strat-sidebar-header .count {
  color: var(--muted); font-size: 11px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
}
.strat-sidebar-header .count small { opacity: 0.7; }
.strat-sidebar-header .strat-new-btn {
  margin-left: auto;
  padding: 4px 10px; font-size: 11px;
}
.strat-sidebar-filter {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.strat-sidebar-filter input[type="text"] {
  width: 100%;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 8px; font-size: 12px;
  font-family: inherit;
}
.strat-sidebar-filter input[type="text"]:focus {
  outline: none; border-color: var(--accent);
}
.strat-sidebar-deprecated {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.strat-sidebar-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  list-style: none; margin: 0; padding: 0;
}
.strat-sidebar-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft, rgba(255,255,255,0.03));
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.strat-sidebar-row:hover { background: rgba(255,255,255,0.025); }
.strat-sidebar-row.selected {
  background: rgba(86, 180, 233, 0.10);
  border-left: 3px solid var(--accent);
  padding-left: 11px; /* compensate the 3px border */
}
.strat-sidebar-row-new { border-bottom-color: var(--accent); }
.strat-sidebar-row-line1 {
  display: flex; align-items: baseline; gap: 6px;
}
.strat-sidebar-row-name {
  font-weight: 600; color: var(--text); font-size: 13px;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.strat-sidebar-row-line2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.strat-sidebar-row-stage {
  display: inline-block; padding: 1px 6px;
  border: 1px solid currentColor; border-radius: 2px;
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.strat-sidebar-row-stat { color: var(--muted); }
.strat-sidebar-row-stat.pos   { color: var(--green); font-weight: 600; }
.strat-sidebar-row-stat.neg   { color: var(--red);   font-weight: 600; }
.strat-sidebar-row-stat.muted { color: var(--muted); opacity: 0.6; }
.strat-sidebar-empty {
  padding: 20px 14px;
  color: var(--muted); font-size: 12px; font-style: italic;
  text-align: center;
}

.strat-main {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.strat-main-header {
  padding: 18px 24px 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.012);
}
.strat-main-title {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.strat-main-title h2 {
  margin: 0; font-size: 18px; color: var(--text); font-weight: 700;
}
.strat-main-name {
  background: rgba(255,255,255,0.04); padding: 1px 6px; border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; color: var(--muted);
}
.strat-main-hint {
  color: var(--muted); font-size: 12px;
}
.strat-main-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.strat-main-stat {
  color: var(--text); font-variant-numeric: tabular-nums;
}
.strat-main-stat.muted { color: var(--muted); }
.strat-main-tabs {
  display: flex; gap: 4px;
  margin-bottom: -1px; /* overlap the header bottom border */
}
.strat-main-tab {
  background: transparent; border: 1px solid transparent;
  border-bottom: none;
  padding: 8px 16px; cursor: pointer;
  color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 4px 4px 0 0;
}
.strat-main-tab:hover { color: var(--text); }
.strat-main-tab.active {
  color: var(--accent);
  border-color: var(--border);
  border-bottom: 1px solid var(--bg); /* hide bottom border to merge with body */
  background: var(--bg);
}
.strat-main-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.strat-main-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.strat-main-empty-msg {
  color: var(--muted); font-size: 14px; text-align: center;
  max-width: 480px; line-height: 1.6;
}
.strat-main-empty-action {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); cursor: pointer;
  padding: 3px 10px; border-radius: 3px;
  font: inherit;
}
.strat-main-empty-action:hover { background: rgba(86,180,233,0.10); }

.strategies-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.strategies-tbl th {
  text-align: left; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  font-size: 10px; font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.strategies-tbl td {
  padding: 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.strategies-tbl td.num { text-align: right; }
.strat-name { font-weight: 600; color: var(--text); font-size: 14px; }
.strat-key { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; margin-top: 2px; }
.strat-desc { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; max-width: 360px; }
.cap-chip {
  display: inline-block; margin: 0 4px 2px 0;
  padding: 2px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  background: #1e3a8a; color: #bfdbfe;
}
.stage-select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  cursor: pointer;
}
/* Per-strategy R-distribution sparkline + green/red colored stats. */
.strategies-tbl td.num.pos { color: var(--green); font-weight: 600; }
.strategies-tbl td.num.neg { color: var(--red); }
.strategies-tbl tr { cursor: pointer; }
.strategies-tbl tr.expanded { background: rgba(76, 201, 240, 0.04); }
.strat-hist {
  display: flex; align-items: flex-end;
  gap: 1px;
  width: 130px; height: 32px;
}
.strat-hist-bar {
  flex: 1; min-height: 1px;
  border-radius: 1px 1px 0 0;
  opacity: 0.85;
}
.strat-hist-bar.neg { background: var(--red); }
.strat-hist-bar.pos { background: var(--green); }

/* Expanded detail row. */
.stage-row-detail td {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}
.strat-detail {
  display: flex; flex-direction: column; gap: 16px;
}
/* 2026-05-22 redesign — per-version × per-account section + rules
   markdown render. Both inside the existing expanded-detail row. */
.strat-detail-section {
  display: flex; flex-direction: column; gap: 8px;
}
.strat-detail-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text);
}
.strat-detail-section-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-size: 11px; margin-left: 8px;
}
.strat-detail-section-hint code {
  background: rgba(255,255,255,0.04); padding: 1px 4px;
  border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-versions-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.strat-versions-tbl th {
  text-align: left; padding: 6px 8px;
  color: var(--muted); font-weight: 600; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.strat-versions-tbl td {
  padding: 8px; vertical-align: top;
  border-bottom: 1px solid var(--border-soft, rgba(255,255,255,0.03));
}
.strat-versions-tbl .num { text-align: right; }
.strat-versions-tbl .pos { color: var(--green); }
.strat-versions-tbl .neg { color: var(--red); }
.strat-version-pill {
  display: inline-block; padding: 2px 8px;
  background: rgba(86,180,233,0.10);
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent); font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}
.strat-account-chip {
  display: inline-flex; align-items: center; gap: 5px;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text); cursor: pointer;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  max-width: 360px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.strat-account-chip:hover { border-color: var(--accent); color: var(--accent); }
.strat-account-chip-n {
  color: var(--muted); font-size: 10px;
}
/* Account-kind tint on the chip — backtest stands out as the
   common case; live/paper get green tint to signal "real money
   data" at a glance. */
.strat-account-chip-backtest { border-color: rgba(255,255,255,0.12); }
.strat-account-chip-live,
.strat-account-chip-paper { border-color: rgba(74, 222, 128, 0.35); }
.strat-account-chip-manual { border-color: rgba(251, 191, 36, 0.35); }
.strat-rules-body {
  font-size: 12px; line-height: 1.55;
  max-height: 480px; overflow-y: auto;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.strat-rules-body h1, .strat-rules-body h2, .strat-rules-body h3 {
  font-size: 13px; margin: 12px 0 4px;
}
.strat-rules-body h1:first-child { margin-top: 0; }
.strat-rules-body code {
  background: rgba(255,255,255,0.04); padding: 1px 4px;
  border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}
.strat-rules-body pre {
  background: rgba(0,0,0,0.25); padding: 8px;
  border-radius: 3px; overflow-x: auto;
}
.strat-rules-body table { font-size: 11px; }
/* Per-version inline visuals (commit 2 of the redesign) — sit in a
   secondary row beneath each version's stat row. Two compact SVGs
   side by side: cumulative-equity sparkline + mini R-distribution
   histogram. The operator gets the full-fidelity version via the
   "open in analytics" account chip; these are the at-a-glance read. */
.strat-version-viz-row td {
  padding-top: 0 !important;
  padding-bottom: 12px !important;
  border-bottom: 1px solid var(--border) !important;
}
.strat-version-viz {
  display: flex; gap: 24px; align-items: flex-end;
  padding-left: 4px;
}
.strat-version-viz-cell {
  display: flex; flex-direction: column; gap: 2px;
}
.strat-version-viz-label {
  font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.strat-version-spark, .strat-version-hist {
  width: 220px; height: 48px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 2px;
}
.strat-version-viz-empty {
  width: 220px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 2px;
}
.strat-version-delta {
  display: inline-block; margin-left: 6px;
  font-size: 10px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Promotion-readiness section (commit 3). For each strategy's current
   stage, render the next-step gate criteria + progress meters. The
   stage dropdown stays freely settable; gates are a readout. */
.strat-gate {
  border: 1px solid var(--border); border-radius: 4px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.strat-gate-ready { border-color: rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.04); }
.strat-gate-blocked { border-color: var(--border); background: rgba(255,255,255,0.02); }
.strat-gate-header {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px;
}
.strat-gate-status {
  font-weight: 700; font-size: 14px;
}
.strat-gate-ready .strat-gate-status { color: var(--green); }
.strat-gate-blocked .strat-gate-status { color: var(--muted); }
.strat-gate-label {
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-gate-criteria { color: var(--muted); font-size: 11px; }
.strat-gate-rows {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 2px;
}
.strat-gate-row {
  display: grid;
  grid-template-columns: 140px 1fr 220px;
  align-items: center; gap: 12px;
  font-size: 11px;
}
.strat-gate-row-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; }
.strat-gate-row-meter {
  height: 6px; background: rgba(255,255,255,0.04);
  border-radius: 3px; overflow: hidden;
}
.strat-gate-row-fill { height: 100%; transition: width 0.2s ease; }
.strat-gate-row-state {
  text-align: right;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.strat-gate-row-state.pos { color: var(--green); }
.strat-gate-row-state.muted { color: var(--muted); }
.strat-gate-manual-note {
  font-size: 11px; color: var(--muted); font-style: italic;
  border-top: 1px dashed var(--border); padding-top: 6px;
  margin-top: 2px;
}

/* DSL strategy authoring (WRITE-side step 3, 2026-05-22).
   Operator authors a strategy inline; CodeMirror handles the two
   expression textareas (screen + detect). [dsl] badge tags rows
   that are operator-authored; row-action buttons (edit / delete)
   appear only on those rows. Go-coded strategies show no buttons
   because they're permanent (init-time registration). */
.strat-new-btn {
  margin-left: 12px;
  background: rgba(86, 180, 233, 0.08);
  border: 1px solid var(--accent); color: var(--accent);
  border-radius: 3px; cursor: pointer;
  padding: 4px 12px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.strat-new-btn:hover { background: rgba(86, 180, 233, 0.15); }
.strat-dsl-badge {
  display: inline-block; margin-left: 8px;
  padding: 1px 6px; border-radius: 2px;
  background: rgba(86, 180, 233, 0.18);
  color: var(--accent); font-weight: 700;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  vertical-align: middle;
}
.strat-row-action {
  display: inline-block; margin-left: 8px;
  background: transparent; border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); cursor: pointer; padding: 0 6px;
  font-size: 10px; line-height: 1.6;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.strat-row-action:hover { color: var(--text); border-color: var(--muted); }
.strat-row-action-danger:hover { color: var(--red); border-color: var(--red); }
.strat-row-action-run {
  color: var(--accent);
  border-color: rgba(86, 180, 233, 0.35);
}
.strat-row-action-run:hover { color: var(--accent); border-color: var(--accent); }

.strat-author-form {
  background: rgba(86, 180, 233, 0.04);
  border: 1px solid rgba(86, 180, 233, 0.25);
  border-radius: 4px;
  padding: 16px 20px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.strat-author-section-h {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent);
  margin: 4px 0 -4px; /* tuck under the field block above */
}
.strat-author-section-h small {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--muted); margin-left: 6px;
}
.strat-author-section-h a { color: var(--muted); }
.strat-author-section-h a:hover { color: var(--text); }
.strat-author-title {
  font-size: 13px; font-weight: 600;
}
.strat-author-title code {
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-author-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.strat-author-grid label, .strat-author-expr {
  display: flex; flex-direction: column; gap: 4px;
}
/* Scope to DIRECT-CHILD span only — CodeMirror fills the editor area
   with descendant <span> elements for syntax tokens; without the `>`
   combinator they all get uppercased visually even though the
   underlying textarea content is case-correct (caught 2026-05-24,
   Sven reported uppercase rendering on the screener DSL editor). */
.strat-author-grid label > span, .strat-author-expr > span {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.strat-author-grid label > span small, .strat-author-expr > span small {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-size: 10px; margin-left: 6px;
}
.strat-author-grid label.span-2 { grid-column: span 2; }
.strat-author-grid input, .strat-author-grid select {
  background: var(--bg-elev, #161a22); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 5px 8px; font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-author-grid input:focus, .strat-author-grid select:focus {
  outline: none; border-color: var(--accent);
}
.strat-author-grid input:disabled {
  opacity: 0.5; cursor: not-allowed;
}
/* CodeMirror containers — replace the underlying textarea once
   _syncCodeMirror initializes. */
.strat-author-expr textarea {
  background: var(--bg-elev, #161a22); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 6px 8px; font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  min-height: 64px;
}
.strat-author-expr .CodeMirror {
  border: 1px solid var(--border); border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-author-expr .CodeMirror-focused .CodeMirror-cursor { border-left-color: var(--accent); }
.strat-author-err {
  padding: 8px 12px; border-radius: 3px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid var(--red);
  color: var(--red); font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
}
.strat-author-actions {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.strat-author-save {
  background: var(--accent); color: var(--bg, #0e1116);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 6px 16px; cursor: pointer; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px;
}
.strat-author-save:hover { opacity: 0.85; }
.strat-author-save:disabled { opacity: 0.5; cursor: not-allowed; }
.strat-author-cancel {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 6px 16px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px;
}
.strat-author-cancel:hover { color: var(--text); border-color: var(--muted); }
.strat-author-hint {
  color: var(--muted); font-size: 11px; flex: 1;
}
.strat-author-hint code {
  background: rgba(255,255,255,0.04); padding: 1px 4px;
  border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Run-backtest UI (WRITE-side step 4, 2026-05-22). Trigger
   replay+backtest from the strategies-tab detail; surface streaming
   progress events inline; deep-link to the resulting backtest
   account on success. */
.strat-run-btn {
  background: var(--accent); color: var(--bg, #0e1116);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 6px 16px; cursor: pointer; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px;
  align-self: flex-start;
}
.strat-run-btn:hover { opacity: 0.85; }
.strat-run-form .strat-run-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.strat-run-form .strat-run-grid label {
  display: flex; flex-direction: column; gap: 4px;
}
.strat-run-form .strat-run-grid label span {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
}
.strat-run-form .strat-run-grid label span small {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--muted); font-size: 10px; margin-left: 6px;
}
.strat-run-form .strat-run-grid input {
  background: var(--bg-elev, #161a22); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 5px 8px; font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-run-form .strat-run-grid input:focus {
  outline: none; border-color: var(--accent);
}
.strat-run-form .strat-run-grid input:disabled {
  opacity: 0.5; cursor: not-allowed;
}
.strat-run-status {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 8px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}
.strat-run-phase { font-weight: 600; color: var(--text); }
.strat-run-message { color: var(--muted); margin-top: 4px; }
/* Screener tab — results table + propagate-to-watchlist styling
   builds on the strat-* surfaces above. */
.screener-results {
  margin-top: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 12px 16px;
}
.screener-results-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text);
  margin-bottom: 8px;
}
.screener-results .strategies-tbl {
  font-size: 12px;
}
.screener-rotation {
  margin-top: 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 12px 16px;
}
.screener-rotation svg {
  width: 100%; height: auto; display: block;
}

.strat-run-progress-row {
  margin-top: 8px; display: flex; align-items: center; gap: 10px;
}
.strat-run-progress {
  flex: 1; height: 10px; background: rgba(255,255,255,0.06);
  border-radius: 5px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.strat-run-progress-fill {
  height: 100%; background: var(--accent);
  transition: width 0.3s ease;
}
.strat-run-progress-fill.indeterminate {
  background: linear-gradient(90deg,
    rgba(86,180,233,0.15) 0%,
    rgba(86,180,233,0.45) 50%,
    rgba(86,180,233,0.15) 100%);
  background-size: 200% 100%;
  animation: strat-run-shimmer 1.4s linear infinite;
}
@keyframes strat-run-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.strat-run-progress-pct {
  font-variant-numeric: tabular-nums;
  color: var(--muted); font-size: 11px; min-width: 130px; text-align: right;
}
.strat-run-success {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 3px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 12px;
  font-size: 12px;
}
.strat-run-success code {
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 2px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.strat-run-open {
  margin-left: auto;
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: var(--green); border-radius: 3px;
  padding: 4px 12px; cursor: pointer; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
}
.strat-run-open:hover { background: rgba(74, 222, 128, 0.22); }
.strat-detail-summary {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  font-size: 12px;
}
.strat-detail-label {
  color: var(--muted); margin-right: 4px;
  text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px;
}
.strat-detail-hist-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin-bottom: 8px;
}
.strat-detail-bars {
  display: grid;
  grid-template-columns: repeat(8, minmax(70px, 1fr));
  gap: 4px;
  height: 110px;
  align-items: end;
}
.strat-detail-bar-col {
  display: flex; flex-direction: column; align-items: center;
  height: 100%; gap: 3px;
}
.strat-detail-bar-val {
  font-size: 10px; color: var(--text);
  font-family: ui-monospace, monospace;
}
.strat-detail-bar-track {
  flex: 1; width: 60%;
  display: flex; align-items: flex-end;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px 2px 0 0;
}
.strat-detail-bar-fill {
  width: 100%; min-height: 2px;
  border-radius: 2px 2px 0 0;
}
.strat-detail-bar-fill.neg { background: var(--red); }
.strat-detail-bar-fill.pos { background: var(--green); }
.strat-detail-bar-label {
  font-size: 9px; color: var(--muted);
  font-family: ui-monospace, monospace;
}
.strat-detail-per-setup-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 8px 0 4px 0;
}
.per-setup-tbl {
  border-collapse: collapse; font-size: 12px;
}
.per-setup-tbl th, .per-setup-tbl td {
  padding: 4px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.per-setup-tbl th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 600;
}
.per-setup-tbl td.num { text-align: right; font-family: ui-monospace, monospace; }
.per-setup-tbl td.num.pos { color: var(--green); }
.per-setup-tbl td.num.neg { color: var(--red); }

/* Trade-handling sweep comparison (Strategies tab → run → sweep trail). */
.strat-sweep-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px;
}
.strat-sweep-table th, .strat-sweep-table td {
  padding: 4px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
.strat-sweep-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 600;
}
.strat-sweep-table tbody tr:first-child td { font-weight: 600; }

.stage-experimental { color: #9ca3af; border-color: #9ca3af; }
.stage-backtested   { color: #fbbf24; border-color: #fbbf24; }
.stage-paper        { color: #4cc9f0; border-color: #4cc9f0; }
.stage-live         { color: #4ade80; border-color: #4ade80; font-weight: 700; }
.stage-deprecated   { color: #6b7280; border-color: #6b7280; font-style: italic; }
.stage-row-deprecated { opacity: 0.5; }
chart-pane {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; min-width: 0;
}
.list-panel, .chart-panel, .lists-panel {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}
/* Trades tab — chart-pane sits immediately under the header so the
   selected trade is glanceable; the info-grid + notes + rule-checklist
   live in a scrollable area below so they can't push the chart off
   the bottom (caught after the trade-detail grid grew with shares /
   cost / net rows — Sven flagged 2026-05-21). */
.trades-chart-panel .chart-header { flex: 0 0 auto; }
.trades-chart-panel chart-pane { flex: 2 1 auto; min-height: 320px; }
.trades-chart-panel .trades-detail-scroll {
  flex: 1 1 auto; overflow-y: auto;
  min-height: 0; max-height: 45%;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.list-panel, .lists-panel {
  border-right: 1px solid var(--border);
}
.lists-panel {
  overflow-y: auto;
}
/* Per-row management actions — rename / empty / delete. Hidden until
   hover so the row's primary content (name + meta) reads cleanly.
   Only rendered on non-auto rows (handled in template). */
.wl-row { position: relative; }
.wl-row-actions {
  position: absolute; top: 6px; right: 8px;
  display: none; gap: 4px;
}
.wl-row:hover .wl-row-actions { display: flex; }
.wl-row-action {
  background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); cursor: pointer; padding: 1px 6px;
  font-size: 10px; line-height: 1.4;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.wl-row-action:hover { color: var(--text); border-color: var(--muted); }
.wl-row-action-danger:hover { color: var(--red); border-color: var(--red); }
/* shadowed re-declaration intentional — keeps the existing
   :hover/draggable rules below intact via the second selector. */
.wl-row {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: grab;
}
.wl-row:hover { background: var(--panel); }
.wl-row[draggable="true"]:active { cursor: grabbing; }
.list-header h1 .hint {
  font-size: 9px; color: var(--muted); font-weight: 400;
  text-transform: lowercase; letter-spacing: 0.4px;
  margin-left: 6px;
}
.wl-row.selected {
  background: var(--panel); border-left: 2px solid var(--accent);
  padding-left: 12px;
}
.wl-row .wl-name { font-weight: 600; font-size: 13px; }
.wl-row .wl-meta { color: var(--muted); font-size: 11px; }

.symbol-form {
  display: flex; gap: 6px; align-items: center;
}
.symbol-input {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; font-size: 13px;
  width: 180px; text-transform: uppercase; letter-spacing: 1px;
  font-family: inherit;
}
.symbol-input:focus { border-color: var(--accent); outline: none; }
.symbol-btn {
  background: var(--accent); color: var(--bg);
  border: none; border-radius: 4px; padding: 6px 14px;
  font-weight: 600; cursor: pointer; font-family: inherit;
}
.list-header {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
/* Aggregate-totals chip group on the positions tab — $ / % / R for
   the currently-filtered + priced positions. Sits next to the count
   in the list-header. */
.positions-totals {
  display: inline-flex; align-items: center; gap: 10px;
  margin-left: 12px;
  padding: 2px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.04);
  font-size: 12px; font-variant-numeric: tabular-nums;
}
/* Agent tab root — wraps optional sidebar + main pane in a flex row
   when the in-app stream is active. tg/runs streams skip the wrapper
   (no .with-sidebar class) so the single-pane fills as before. */
.agent-root { display: flex; height: 100%; min-height: 0; }
.agent-root.with-sidebar > .single-pane { flex: 1; min-width: 0; }

/* Conversations sidebar (Claude-like). Persistent narrow column on
   the left listing every conversation in the ChatStore, newest
   activity first. Sven /sys 2026-05-17 — multi-conversation +
   branching. Collapsible via the chevron in the head; collapsed
   state persists per-browser in localStorage. */
.agent-sidebar {
  flex: 0 0 240px; max-width: 240px;
  border-right: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  min-height: 0;
}
.agent-sidebar.collapsed { flex: 0 0 28px; max-width: 28px; }
.agent-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.agent-sidebar-title {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.agent-sidebar-toggle {
  background: transparent; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 0 4px;
}
.agent-sidebar.collapsed .agent-sidebar-toggle {
  width: 100%; padding: 10px 0;
}
.agent-sidebar-toggle:hover { color: var(--accent); }
.agent-sidebar-new {
  margin: 8px 10px; padding: 6px 10px;
  background: transparent; border: 1px dashed var(--border);
  color: var(--muted); border-radius: 3px; cursor: pointer;
  font-size: 12px; font-family: inherit;
  transition: all 0.15s;
}
.agent-sidebar-new:hover {
  border-color: var(--accent); color: var(--accent);
  border-style: solid;
}
.agent-sidebar-list { flex: 1; overflow-y: auto; padding: 0 6px 8px 6px; }
.agent-sidebar-group { margin-top: 10px; }
.agent-sidebar-group-label {
  font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 4px 6px;
}
.agent-sidebar-conv {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 6px 8px; cursor: pointer;
  border-radius: 3px; font-family: inherit;
  transition: background 0.1s;
}
.agent-sidebar-conv:hover { background: rgba(255,255,255,0.04); }
.agent-sidebar-conv.active { background: rgba(76,201,240,0.10); }
.agent-sidebar-conv.active .agent-sidebar-conv-title { color: var(--accent); }
.agent-sidebar-conv-title {
  color: var(--text); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-sidebar-conv-meta {
  color: var(--muted); font-size: 10px;
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.agent-sidebar-empty {
  padding: 16px 10px; color: var(--muted); font-size: 11px; font-style: italic;
}

/* Agent tab: pin the header (with the in-app/telegram/runs stream
   toggle) so it stays visible while scrolling long conversation or
   runs history. Sven flagged the scroll-to-find-the-toggle UX.
   Scoped to agent-view so other panels' list-headers stay normal.
   We zero the .single-pane's top padding (rather than using negative
   margins, which caused a layout-overlap bleed into the topnav area)
   and let the header own the natural top of the scroll container. */
agent-view .single-pane { padding-top: 0 !important; }
agent-view .list-header {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg, #0e1116);
  padding: 16px 12px 10px 12px;
  border-bottom: 1px solid var(--border);
}
/* Re-add the visual gap above the first content row that the
   removed pane padding-top would have provided. */
agent-view .single-pane > .list-header + * { margin-top: 8px; }
/* Group the segmented toggle together. .list-header is display:flex
   with justify-content:space-between — without this, on some browsers
   (Safari/iPad seen 2026-05-17) the three buttons get spread across
   the whole row instead of grouping inside the span. flex:0 0 auto
   forces the wrapper to take its content width as a single flex item.
   align-self centers it vertically with the h1 + count. */
agent-view .list-header .seg-toggle {
  display: inline-flex; flex: 0 0 auto; align-self: center;
  gap: 0;
}
agent-view .list-header .seg-toggle > button { flex: 0 0 auto; }
.list-header h1 {
  font-size: 14px; margin: 0; font-weight: 600;
}
.list-header .count { color: var(--muted); font-size: 12px; }
.toolbar {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.toolbar select, .toolbar input {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font-size: 12px;
  font-family: inherit;
}
.toolbar .symbol-search {
  text-transform: uppercase; letter-spacing: 1px;
  width: 80px;
}
.list {
  overflow-y: auto; flex: 1;
}
.list-row {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; display: grid;
  grid-template-columns: 1fr 50px 64px 40px;
  gap: 12px; align-items: center;
  transition: background 0.08s ease;
}
.list-row:hover { background: var(--panel); }
.list-row.selected { background: var(--panel); border-left: 2px solid var(--accent); padding-left: 12px; }
.list-row .symbol {
  font-weight: 600; font-size: 13px;
  letter-spacing: 0.3px; color: var(--text);
}
.list-row .date {
  color: var(--muted); font-size: 10px;
  margin-top: 2px;
}
.list-row .R {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 600; font-size: 13px;
}
.list-row .R.win { color: var(--green); }
.list-row .R.loss { color: var(--red); }
.list-row .setup {
  color: var(--muted); font-size: 11px; text-align: right;
}

.chart-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: flex; gap: 16px; align-items: center;
}
.chart-header .symbol-block {
  display: flex; flex-direction: column;
}
.chart-header .symbol {
  font-size: 18px; font-weight: 600; letter-spacing: 0.5px;
}
.chart-header .company {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 280px;
}
.chart-header .setup-tag,
.chart-header .sector-tag {
  color: var(--muted); font-size: 12px;
  border: 1px solid var(--border); padding: 2px 8px; border-radius: 3px;
}
.chart-header .sector-tag {
  max-width: 360px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-header .firstseen-tag {
  color: var(--muted); font-size: 11px;
  border: 1px dashed var(--border); padding: 2px 8px; border-radius: 3px;
  white-space: nowrap;
}
.trades-account-chip {
  color: var(--muted); font-size: 11px; font-weight: 400;
  margin-left: 6px;
}
/* Delete button next to the trades-tab account chip — only renders for
   KindBacktest accounts (server enforces the cascade-wipe gate too). */
.trades-delete-account {
  background: transparent; border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); cursor: pointer; padding: 1px 6px;
  font-size: 12px; line-height: 1; margin-left: 4px;
}
.trades-delete-account:hover { color: var(--red); border-color: var(--red); }

/* Trades-tab analytics panel — expression-driven histogram + scatter
   replacing the per-trade chart pane when viewMode="analytics". The
   chart is hand-rendered SVG; no chart-lib dep. */
.trades-analytics-panel {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
  padding: 12px 16px; overflow-y: auto;
}
.trades-analytics-panel .analytics-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.trades-analytics-panel .analytics-input-row {
  display: flex; align-items: center; gap: 8px; margin: 4px 0;
}
.trades-analytics-panel .analytics-input-row label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; min-width: 32px;
}
.trades-analytics-panel .analytics-expr-input {
  flex: 1; background: var(--bg-elev, #161a22); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.trades-analytics-panel .analytics-expr-input:focus {
  outline: none; border-color: var(--accent);
}
.trades-analytics-panel .analytics-err {
  margin: 8px 0; padding: 6px 10px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid var(--red); border-radius: 3px;
  color: var(--red); font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.trades-analytics-panel .analytics-loading {
  margin: 8px 0; color: var(--muted); font-size: 11px; font-style: italic;
}
.trades-analytics-panel .analytics-chart-wrap {
  margin: 12px 0; flex: 0 0 auto;
}
.trades-analytics-panel .analytics-svg {
  width: 100%; height: auto; display: block;
}
.trades-analytics-panel .analytics-tick {
  fill: var(--muted); font-size: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.trades-analytics-panel .analytics-stats {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin: 8px 0; padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.trades-analytics-panel .analytics-stats span {
  display: inline-flex; gap: 6px; align-items: baseline;
}
.trades-analytics-panel .analytics-stats label {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.trades-analytics-panel .analytics-empty {
  color: var(--muted); padding: 24px; text-align: center; font-size: 12px;
}
.trades-analytics-panel .analytics-hint {
  margin-top: auto; padding-top: 12px;
  color: var(--muted); font-size: 11px; line-height: 1.5;
  border-top: 1px solid var(--border);
}
.trades-analytics-panel .analytics-match-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--accent);
  background: rgba(86, 180, 233, 0.10);
  border: 1px solid rgba(86, 180, 233, 0.25);
  padding: 2px 8px; border-radius: 3px;
}
.trades-analytics-panel .analytics-match-badge-muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
}
.trades-analytics-panel .analytics-filter-input {
  /* Filter is a predicate — give it a subtle accent border so the
     operator can see at a glance that something is narrowing the
     dataset. */
  border-color: rgba(86, 180, 233, 0.35);
}
.trades-analytics-panel .analytics-filter-clear {
  background: transparent; border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); cursor: pointer; padding: 1px 6px;
  font-size: 12px; line-height: 1;
}
.trades-analytics-panel .analytics-filter-clear:hover {
  color: var(--red); border-color: var(--red);
}
.trades-analytics-panel .analytics-toggle {
  background: transparent; border: 1px solid var(--border); border-radius: 3px;
  color: var(--muted); cursor: pointer; padding: 2px 8px;
  font-size: 11px; line-height: 1; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.trades-analytics-panel .analytics-toggle:hover { color: var(--text); border-color: var(--muted); }
.trades-analytics-panel .analytics-toggle.active {
  color: var(--accent); border-color: var(--accent);
  background: rgba(86, 180, 233, 0.10);
}
.positions-ro-tag {
  display: inline-block; margin-left: 6px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 0 4px;
  vertical-align: middle;
}
.chart-header .r-badge {
  margin-left: auto; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chart-header .r-badge.pos { color: var(--green); }
.chart-header .r-badge.neg { color: var(--red); }
.info-grid {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px 18px;
  font-size: 11px;
}
.info-grid > div { display: flex; flex-direction: column; min-width: 0; }
.info-grid label {
  color: var(--muted); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.info-grid span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-grid .pos { color: var(--green); }
.info-grid .neg { color: var(--red); }
.info-grid .exit-reason {
  grid-column: span 4;
}
.info-grid .exit-reason span {
  white-space: normal;
}
#chart-wrap {
  flex: 1; position: relative; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
}
/* drawMode === "trendline" — applied via :host class binding so the
   cursor swap covers both the chart canvas and the SVG overlay. */
#chart-wrap.drawing, #chart-wrap.drawing #chart, #chart-wrap.drawing canvas {
  cursor: crosshair !important;
}
.chart-drawmode-banner {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 20;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px;
  background: rgba(14, 17, 22, 0.94);
  border: 1px solid var(--accent); border-radius: 14px;
  color: var(--text); font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase; letter-spacing: 0.06em;
  pointer-events: auto;
  backdrop-filter: blur(6px);
}
.chart-drawmode-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.chart-drawmode-cancel {
  background: transparent; border: none; color: var(--muted);
  padding: 0 4px; cursor: pointer; font-size: 14px; line-height: 1;
}
.chart-drawmode-cancel:hover { color: var(--red); }
#chart {
  flex: 1; min-height: 0; position: relative;
}
/* Oscillator sub-pane (RSI + Stochastic) — its own Lightweight
   Charts instance. Fixed height when visible; display:none kills the
   space allocation when both toggles are off. Border-top gives a
   clear visual separator from the main chart. */
#chart-osc {
  flex: 0 0 140px; position: relative;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
}
.hover-tip {
  position: absolute; display: none; z-index: 10;
  top: 12px; left: 12px;
  background: rgba(14, 17, 22, 0.94);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; font-size: 12px;
  width: 280px; pointer-events: none;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.hover-tip .hov-head {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-bottom: 10px; font-size: 13px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.hover-tip .hov-head strong { letter-spacing: 0.5px; }
.hover-tip .hov-head .ok {
  color: var(--green); font-weight: 600;
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
}
.hover-tip .hov-head .fail {
  color: var(--muted); font-weight: 500;
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
}
.hover-tip .hov-section-label {
  color: var(--muted); font-size: 9px;
  text-transform: uppercase; letter-spacing: 1px;
  margin: 8px 0 3px 0;
}
.hover-tip .hov-section-label:first-child { margin-top: 0; }
.hover-tip .hov-row {
  color: var(--text); margin-bottom: 2px; line-height: 1.5;
}
.hover-tip .hov-row .muted { color: var(--muted); }
.hover-tip .hov-gates {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px;
}
.hover-tip .g {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; line-height: 1.3;
}
.hover-tip .g.ok { color: var(--text); }
.hover-tip .g.fail { color: var(--muted); opacity: 0.55; }
.hover-tip .g .dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; flex-shrink: 0;
}
.hover-tip .g.ok .dot { background: var(--green); }
.hover-tip .g.fail .dot { background: var(--border); }
.hover-tip .rs-strong { color: var(--green); font-weight: 600; }
.hover-tip .rs-mid    { color: var(--yellow); font-weight: 600; }
.hover-tip .rs-weak   { color: var(--red); font-weight: 600; }
.hover-tip .hov-note {
  background: rgba(76, 201, 240, 0.08);
  border-left: 2px solid #4cc9f0;
  padding: 4px 8px; margin: 2px 0;
  font-size: 11px; line-height: 1.4;
  white-space: pre-wrap; word-break: break-word;
  max-width: 320px;
}
.hover-tip .hov-trade {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; line-height: 1.5;
  padding: 2px 0;
}
.hover-tip .hov-strat-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.hover-tip .hov-trade-kind {
  text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px;
  color: var(--muted); min-width: 28px;
}

/* Latest-RS badge — positioned dynamically above the last RS data point
   via priceToCoordinate / timeToCoordinate. Color matches the line. */
.rs-label {
  position: absolute; display: none;
  font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  color: #a78bfa;
  pointer-events: none;
  background: rgba(14, 17, 22, 0.85);
  padding: 1px 5px; border-radius: 2px;
  z-index: 5;
}
/* "RS gap" caveat — pinned to the upper-left of the RS lane (~72% from top
   per priceScale margins). Shown only when RS coverage doesn't fill the
   visible window (e.g. recent IPO without 1y of history). */
.rs-empty-note {
  position: absolute; display: none;
  left: 8px; top: 72%;
  font: 10px -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: #a78bfa; opacity: 0.75;
  background: rgba(14, 17, 22, 0.85);
  padding: 2px 6px; border-radius: 2px;
  border-left: 2px solid #a78bfa;
  pointer-events: none;
  z-index: 5;
}
/* MailView — left list of archived emails, right iframe rendering selected. */
.mail-row {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.mail-row:hover { background: var(--panel); }
.mail-row.active { background: var(--panel); border-left: 2px solid var(--accent, #a78bfa); padding-left: 12px; }
.mail-row-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
  margin-bottom: 2px;
}
.mail-kind {
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600; font-size: 9px;
  padding: 1px 6px; border-radius: 3px;
  background: #1f2937; color: #d6d9e0;
}
.mail-kind.daily       { background: #1e3a8a; color: #bfdbfe; }
.mail-kind.weekly      { background: #4c1d95; color: #ddd6fe; }
.mail-kind.weekly-tldr { background: #4c1d95; color: #ddd6fe; }
.mail-kind.premarket   { background: #422006; color: #fed7aa; }

/* Weekly briefing per-date stage. Distinct from .mail-stage (which
   centers a .mail-body card via flex) — here we want a plain padded
   scroll container so children stack normally instead of becoming
   flex items. Caught 2026-06-01 Sven screenshot: h1 + as-of div had
   gone side-by-side, h1 wrapping into a 1-word-per-line column. */
.weekly-stage {
  flex: 1; width: 100%; height: 100%;
  overflow-y: auto;
  padding: 24px;
  background: var(--panel);
  max-width: 780px;
}
.mail-sent { font-variant-numeric: tabular-nums; }
.mail-subject { font-size: 13px; color: var(--text); line-height: 1.3; }
.mail-iframe {
  flex: 1; width: 100%; border: 0; background: #fff;
}
/* Briefings tab — the email content is designed for a white card
   (inline styles + table layout); we keep that intact rather than
   hue-rotating into dark mode, but wrap it in a dark "stage" so the
   white block reads as a piece of paper sitting on the dark UI
   instead of a jarring color flip when switching tabs.
   Sven flagged 2026-05-21 tab audit: "the white background of the
   email breaks the visuals quite radical." */
.mail-stage {
  flex: 1; width: 100%; height: 100%;
  overflow-y: auto;
  padding: 16px 24px;
  background: var(--panel);
  display: flex; justify-content: center;
}
.mail-body {
  width: 100%; max-width: 720px;
  background: #fff; color: #0e1116;
  padding: 24px;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  /* Defensive — emails sometimes ship overly wide tables; let the
     card scroll horizontally rather than blowing out the stage. */
  overflow-x: auto;
}
.mail-body a { color: #1d4ed8; }
.mail-body a:visited { color: #6d28d9; }

/* Chart visibility toggles — strip above #chart-wrap. Lin/log was
   previously a floating overlay; consolidated here so adding new
   toggles (notes / trades / strats / vcp / future: daily-weekly,
   tooltip) lives in one place. */
.chart-controls {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
/* Indicator settings popover — anchored to the chart-controls strip
   so the absolute positioning lands at the toolbar's right edge.
   Sven /sys 2026-05-18 07:00: standard indicators + drawing tools
   via a settings panel on the chart tab. v0 = SMA + EMA toggles;
   Bollinger / RSI / Stochastic / drawing tools land in followups. */
.chart-settings-btn { font-size: 13px; padding: 1px 8px; }
.chart-settings-popover {
  position: absolute; top: 100%; right: 8px;
  margin-top: 4px; z-index: 20;
  background: var(--bg-elev, #161a22);
  border: 1px solid var(--border); border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  padding: 8px 4px 8px 8px; min-width: 180px;
  display: flex; flex-direction: column; gap: 2px;
}
.chart-settings-title {
  display: flex; align-items: center; justify-content: space-between;
  font: 600 10px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 0 4px 6px 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.chart-settings-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 0 4px;
  line-height: 1;
}
.chart-settings-close:hover { color: var(--text); }
.chart-settings-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px; cursor: pointer; font-size: 12px;
  border-radius: 3px;
}
.chart-settings-row:hover { background: rgba(255,255,255,0.04); }
.chart-settings-row input[type=checkbox] { margin: 0; }
.chart-settings-swatch {
  display: inline-block; width: 14px; height: 3px; border-radius: 2px;
}
.chart-settings-label { flex: 1; color: var(--text); }
.chart-settings-hint {
  color: var(--muted); font-size: 10px; font-style: italic;
  padding: 4px 4px 0 4px; border-top: 1px dashed var(--border);
  margin-top: 4px;
}
.chart-settings-divider {
  height: 1px; background: var(--border); margin: 4px 0;
}
.chart-settings-section-label {
  color: var(--accent); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 4px 2px 4px;
}
.chart-settings-clear {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; color: var(--muted);
  padding: 2px 8px; font-size: 10px; font-family: inherit;
  text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer;
}
.chart-settings-clear:hover { color: var(--red); border-color: var(--red); }
.chart-shapes-kind {
  display: inline-block; width: 14px;
  color: var(--muted); font-size: 10px;
  text-transform: uppercase; text-align: center;
  font-variant-numeric: tabular-nums;
}
.chart-shapes-label {
  flex: 1; color: var(--text);
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.chart-controls-spacer { flex: 1; }
.chart-control {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font: 600 10px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer;
}
.chart-control.on  { color: #4cc9f0; border-color: #4cc9f0; }
.chart-control.off { color: var(--muted); }
.chart-control:hover { background: rgba(76, 201, 240, 0.08); }

/* Per-strategy filter chips — appear only when past trades on this
   symbol come from >1 strategy. Each chip's color matches the strategy
   marker on the chart. Click toggles the include-filter; empty = all. */
.chart-strat-chips {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.chart-strat-chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 8px;
  font: 600 10px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  letter-spacing: 0.3px; text-transform: lowercase;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.chart-strat-chip .chart-strat-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--chip-color);
}
.chart-strat-chip.on {
  color: var(--chip-color);
  border-color: var(--chip-color);
}
.chart-strat-chip.off { opacity: 0.45; }
.chart-strat-chip:hover { opacity: 1; background: rgba(255, 255, 255, 0.04); }
.chart-strat-clear {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; padding: 0 6px; cursor: pointer;
  color: var(--muted); font-size: 11px; line-height: 1.5;
}
.chart-strat-clear:hover { color: var(--text); border-color: var(--text); }
/* Trade-detail notes — operator review annotations stored in
   trade_notes:{tenant}:{tradeID}. Renders below info-grid, above chart. */
.trade-notes {
  margin: 12px 0; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 4px;
}
.trade-notes label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.trade-notes .note-meta {
  font-size: 10px; color: var(--muted);
  text-transform: none; letter-spacing: 0;
}
.trade-notes textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 6px 8px; font: 13px/1.4 ui-monospace, monospace;
  resize: vertical;
}
.trade-notes button {
  margin-top: 6px; padding: 4px 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  cursor: pointer; font-size: 11px;
}
.trade-notes button:hover:not(:disabled) { border-color: #4cc9f0; color: #4cc9f0; }
.trade-notes button:disabled { opacity: 0.5; cursor: wait; }

/* Inline indicator on trade-list rows for trades that have notes. */
.note-dot {
  color: #4cc9f0; font-size: 9px; margin-left: 4px; vertical-align: middle;
}

/* Slash-command help line + post-save feedback under the trade-notes save button. */
.slash-help {
  font-size: 10px; color: var(--muted); margin-top: 6px;
}
.slash-help code {
  background: var(--bg); padding: 1px 4px; border-radius: 3px;
  border: 1px solid var(--border); margin: 0 2px;
}
.slash-feedback {
  margin-top: 8px; font-size: 11px;
  border-top: 1px dashed var(--border); padding-top: 6px;
}
.slash-ok  { color: #4ade80; margin-bottom: 2px; }
.slash-err { color: #f87171; margin-bottom: 2px; }

/* Read-only trade-note display (textarea retired in favor of agent-bar /tradenote). */
.trade-notes-readonly {
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}
.trade-notes-readonly label {
  display: flex; align-items: baseline; gap: 8px;
  color: var(--muted); margin-bottom: 4px; font-size: 11px;
}
.trade-notes-readonly .note-meta {
  color: var(--muted); font-size: 10px;
}
.trade-notes-body {
  margin: 4px 0; font-family: inherit;
  color: var(--text); font-size: 12px; word-wrap: break-word;
}
/* Markdown rendering — same shape as .note-text / .market-entry-text. */
.trade-notes-body > :first-child { margin-top: 0; }
.trade-notes-body > :last-child  { margin-bottom: 0; }
.trade-notes-body p,
.trade-notes-body pre,
.trade-notes-body blockquote { margin: 6px 0; }
.trade-notes-body ul,
.trade-notes-body ol { margin: 6px 0; padding-left: 22px; }
.trade-notes-body li { margin: 2px 0; }
.trade-notes-body li > p { margin: 0; }
.trade-notes-body li > p + p { margin-top: 4px; }
.trade-notes-body li > ul,
.trade-notes-body li > ol { margin: 2px 0; }
.trade-notes-body code {
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  font-size: 11px;
}
.trade-notes-body pre {
  background: rgba(255,255,255,0.04);
  padding: 6px 8px; border-radius: 4px;
  overflow-x: auto; white-space: pre;
}
.trade-notes-body pre code { background: transparent; padding: 0; }
.trade-notes-readonly.empty-notes {
  color: var(--muted); font-style: italic;
}
.trade-notes-readonly .note-hint {
  margin-top: 4px; font-size: 10px; color: var(--muted);
}
.trade-notes-readonly code {
  background: var(--panel); padding: 1px 4px; border-radius: 3px;
}

/* Global agent bar — sticky bottom on every screen. The input row is a
   fixed height. Feedback (slash results / errors) is a separate top-right
   toast — putting it in/above the bar covered the chart's time axis. */
.agent-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  z-index: 50;
  font-size: 12px;
}
.agent-toast {
  position: fixed;
  top: 60px; right: 12px;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 10px 28px 10px 12px;
  font-size: 12px;
  z-index: 60;
  max-height: 60vh; overflow-y: auto;
}
/* Highlight the toast itself when it carries any error so red-green
   confusion (protan) doesn't bury an error under success-shaped chrome.
   Distinguishability comes from background tint + border weight, not
   color alone. */
.agent-toast.has-error {
  background: rgba(82, 26, 26, 0.96);
  border: 2px solid #f87171;
  border-left: 6px solid #f87171;
  padding-left: 14px;
}

/* Agent free-form reply rendering inside the toast. Larger surface than
   the slash-ok one-liners + preserves newlines so model output reads
   naturally. */
.agent-reply { margin: 2px 0; }
.agent-reply-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #4cc9f0; margin-bottom: 4px;
}
.agent-reply-body {
  margin: 0; font-family: inherit; font-size: 12px; line-height: 1.5;
  word-break: break-word;
  color: var(--text);
}
/* Tame block-element margins inside the rendered markdown so paragraph
   spacing matches the agent's terse-line voice instead of the browser's
   default 1em-per-side stack. The previous <pre>+pre-wrap surface had
   the opposite problem (every blank line literal); this is the markdown
   equivalent — paragraphs and lists get a half-line gap, not a full one. */
.agent-reply-body > :first-child { margin-top: 0; }
.agent-reply-body > :last-child  { margin-bottom: 0; }
.agent-reply-body p,
.agent-reply-body pre,
.agent-reply-body blockquote { margin: 6px 0; }
.agent-reply-body ul,
.agent-reply-body ol { margin: 6px 0; padding-left: 22px; }
.agent-reply-body h1,
.agent-reply-body h2,
.agent-reply-body h3,
.agent-reply-body h4 { margin: 10px 0 4px; line-height: 1.25; }
.agent-reply-body li { margin: 2px 0; }
/* Loose-list defense — see .market-entry-text for context. */
.agent-reply-body li > p { margin: 0; }
.agent-reply-body li > p + p { margin-top: 4px; }
.agent-reply-body li > ul,
.agent-reply-body li > ol { margin: 2px 0; }
.agent-reply-body ul + ul,
.agent-reply-body ol + ol { margin-top: 2px; }
.agent-reply-body code {
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  font-size: 11px;
}
.agent-reply-body pre {
  background: rgba(255,255,255,0.04);
  padding: 6px 8px; border-radius: 4px;
  overflow-x: auto; white-space: pre;
}
.agent-reply-body pre code {
  background: transparent; padding: 0;
}
.agent-suggestions {
  margin-top: 8px; padding-top: 6px;
  border-top: 1px dashed var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.agent-suggestions-label {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.agent-suggestion {
  background: var(--bg);
  color: #4cc9f0;
  border: 1px solid #4cc9f0;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
}
.agent-suggestion:hover {
  background: rgba(76, 201, 240, 0.12);
}
.agent-toast-close {
  position: absolute; top: 4px; right: 6px;
  background: transparent; border: none; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.agent-toast-close:hover { color: var(--text); }
.agent-bar-row {
  display: flex; align-items: stretch; gap: 8px;
}
.agent-bar-context {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  min-width: 80px; max-width: 200px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-bar-input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  font: inherit;
  resize: none;
}
.agent-bar-input:focus {
  outline: none;
  border-color: #4cc9f0;
}
.agent-bar-send {
  background: var(--accent);
  color: #0e1116;
  border: none;
  border-radius: 4px;
  padding: 0 14px;
  font-size: 12px;
  cursor: pointer;
}
.agent-bar-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Reserve space for the agent bar's input row so chart time-axes / list
   bottoms aren't hidden under it. The feedback panel pops UP over content
   when it appears, so it doesn't need extra reserved space. */
.viewroot { padding-bottom: 52px; }

/* Shift-click range measurement overlay (chart-pane). */
.measure-panel {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(14, 17, 22, 0.92);
  border: 1px solid #4cc9f0;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text);
  z-index: 25;
  max-width: 360px;
  pointer-events: none;
}
.measure-panel .m-head {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #4cc9f0; margin-bottom: 2px;
}
.measure-panel .m-row { line-height: 1.4; }
.measure-panel .m-hint { color: var(--muted); margin-top: 2px; font-size: 10px; }

/* Market notes view — chronological surface for /market entries grouped
   by ISO week so the weekly review process has a home. */
.market-week { margin-bottom: 28px; }
.market-week-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 0 0 8px 0;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.market-entry {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 12px; margin-bottom: 8px;
  position: relative;
}
.market-entry-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; color: var(--muted); margin-bottom: 6px;
}
.market-entry-text {
  margin: 0; font-family: inherit;
  font-size: 12px; line-height: 1.5; color: var(--text);
  word-break: break-word;
}
/* Markdown block-element styling inside market entries — paragraphs
   and lists get a half-line gap (not the browser's default 1em-per-
   side which stacks visually thick). Mirrors .agent-reply-body. */
.market-entry-text > :first-child { margin-top: 0; }
.market-entry-text > :last-child  { margin-bottom: 0; }
.market-entry-text p,
.market-entry-text pre,
.market-entry-text blockquote { margin: 6px 0; }
.market-entry-text ul,
.market-entry-text ol { margin: 6px 0; padding-left: 22px; }
.market-entry-text h1,
.market-entry-text h2,
.market-entry-text h3,
.market-entry-text h4 { margin: 10px 0 4px; line-height: 1.25; font-size: 12px; }
/* Loose-list defense: when marked sees blank lines between bullets it
   produces <li><p>...</p></li> (loose) instead of <li>...</li> (tight).
   The inner <p> would inherit the 6px-margin rule above and blow up the
   inter-bullet gap into ~14px per bullet, plus visible vertical drift
   from baseline alignment. Forcing zero margin on <p> inside <li>
   (with a small top-only margin for subsequent paragraphs in the same
   bullet's multi-paragraph case) keeps the visual tight regardless of
   how the model formatted the source. Sven flagged 2026-05-17. */
.market-entry-text li { margin: 2px 0; }
.market-entry-text li > p { margin: 0; }
.market-entry-text li > p + p { margin-top: 4px; }
.market-entry-text li > ul,
.market-entry-text li > ol { margin: 2px 0; }
.market-entry-text ul + ul,
.market-entry-text ol + ol { margin-top: 2px; }
.market-entry-text code {
  background: rgba(255,255,255,0.06);
  padding: 1px 4px; border-radius: 3px;
  font-size: 11px;
}
.market-entry-text pre {
  background: rgba(255,255,255,0.04);
  padding: 6px 8px; border-radius: 4px;
  overflow-x: auto; white-space: pre;
}
.market-entry-text pre code { background: transparent; padding: 0; }
.market-del {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0 4px;
}
.market-del:hover { color: var(--red); }

/* Regime tab — whole-universe breadth tiles + per-sector breakdown.
   v0 styling: tile grid for the headline numbers, sortable table for
   the sector breakdown. Followups (histograms + historical charts)
   will extend this section. */
.regime-section {
  margin: 18px 0 10px 0; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.regime-section-clickable { cursor: pointer; }
.regime-section-clickable:hover { color: var(--accent); }
.regime-section-clickable.active {
  color: var(--accent); border-bottom-color: var(--accent);
}
.regime-clickable {
  cursor: pointer;
  text-decoration: underline dotted rgba(255,255,255,0.25);
  text-underline-offset: 2px;
}
.regime-clickable:hover { color: var(--accent) !important; text-decoration-color: var(--accent); }
.regime-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.regime-tile {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 10px 12px;
}
.regime-tile-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 4px;
}
.regime-tile-value {
  font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.regime-tile-hint {
  font-size: 10px; color: var(--muted); margin-top: 2px;
}
.regime-tile-delta {
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.regime-refresh {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 3px;
  padding: 2px 8px; font-size: 10px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-left: 8px;
}
.regime-refresh:hover { color: var(--accent); border-color: var(--accent); }
.regime-admin-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--bg-2, #11151c); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 0; min-width: 220px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); z-index: 30;
  display: flex; flex-direction: column;
}
.regime-admin-item {
  background: transparent; border: 0; color: var(--text);
  padding: 8px 14px; text-align: left; cursor: pointer;
  font-size: 11px; font-family: inherit;
  display: flex; flex-direction: column; gap: 2px;
}
.regime-admin-item:hover { background: rgba(255,255,255,0.04); }
.regime-admin-item:disabled { opacity: 0.4; cursor: not-allowed; }
.regime-admin-hint {
  font-size: 9px; color: var(--muted); text-transform: none;
  letter-spacing: 0; line-height: 1.3;
}
.regime-asof {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 3px;
  padding: 2px 6px; font-size: 11px; font-family: inherit;
  color-scheme: dark;
}
.regime-cohort-select {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 3px;
  padding: 2px 6px; font-size: 11px; font-family: inherit;
  color-scheme: dark; max-width: 220px;
}
.regime-sector-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  font-variant-numeric: tabular-nums;
  /* fixed layout + explicit widths on the first two columns so the
     8 data columns share the remaining width equally — guarantees the
     RS-cohort table and the sector table align column-by-column, even
     though their first-column labels differ in length. */
  table-layout: fixed;
}
.regime-sector-table th {
  text-align: left; padding: 6px 10px;
  color: var(--muted); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.regime-sector-table th.regime-sort {
  cursor: pointer; user-select: none;
}
.regime-sector-table th.regime-sort:hover { color: var(--accent); }
.regime-sector-table th.regime-sort.active {
  color: var(--accent); text-decoration: underline;
}
.regime-sector-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* First column = sector / cohort name; widest cohort label is
   "RS 70+ (top three-deciles)" ≈ 220px. Second column = n=NNN
   counter, fixed narrow. With table-layout:fixed the remaining 8
   data columns share the leftover width equally — both tables
   produce identical data-column positions. */
.regime-sector-table th:nth-child(1),
.regime-sector-table td:nth-child(1) { width: 230px; }
.regime-sector-table th:nth-child(2),
.regime-sector-table td:nth-child(2) { width: 64px; }
.regime-sector-name { font-weight: 600; color: var(--text); }
.regime-sector-n { color: var(--muted); font-size: 10px; }
.regime-rs-row { cursor: pointer; }
.regime-rs-row:hover { background: rgba(255,255,255,0.03); }
.regime-rs-row.open { background: rgba(76,201,240,0.04); }
.regime-rs-expand { color: var(--muted); text-align: right; }
.regime-rs-detail > td { padding: 0 10px; background: rgba(0,0,0,0.20); }
.regime-refresh.active { color: var(--accent); border-color: var(--accent); }
.regime-hist-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.regime-hist-chart-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 8px 10px;
}
.regime-hist-chart-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.regime-hist-chart-host {
  width: 100%; height: 110px; min-height: 0;
}
/* Per-series legend below the big-chart modes ("overlay" and
   "compare"). Each chip is a clickable on/off toggle; --chip-color
   names the series color so the swatch + active-state border match. */
.regime-legend {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.regime-legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 12px;
  padding: 3px 10px; font-size: 11px; cursor: pointer;
  font-family: inherit;
}
.regime-legend-chip .regime-legend-swatch {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; background: var(--chip-color);
  opacity: 0.45;
}
.regime-legend-chip.on {
  color: var(--text); border-color: var(--chip-color);
}
.regime-legend-chip.on .regime-legend-swatch { opacity: 1; }
.regime-legend-chip:hover { border-color: var(--chip-color); }
.regime-legend-chip.regime-legend-toggle-all {
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600; padding: 3px 12px;
}
.regime-legend-chip.regime-legend-toggle-all:hover {
  color: var(--accent); border-color: var(--accent);
}

/* Return-distribution histograms — three horizontal-bar histograms
   (daily/weekly/monthly windows). Bar length scales by max-count in
   the window so the shape is the visual signal; %-of-total label
   on each row gives the precise read. */
.regime-hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.regime-hist {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 10px 12px;
}
.regime-hist-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.regime-hist-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent);
}
.regime-hist-sub { color: var(--muted); font-size: 11px; }
.regime-hist-bins { display: flex; flex-direction: column; gap: 2px; }
.regime-hist-row {
  display: grid;
  grid-template-columns: 86px 1fr 90px;
  gap: 6px; align-items: center;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.regime-hist-label { color: var(--text); white-space: nowrap; }
.regime-hist-bar-wrap {
  position: relative; height: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 2px; overflow: hidden;
}
.regime-hist-bar {
  display: block; height: 100%;
  transition: width 0.2s ease;
}
.regime-hist-count { text-align: right; color: var(--text); }

/* Symbol-sidebar inline alert rows — same store as the global alerts
   tab but rendered in chart context. */
.sidebar-alert {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px; align-items: center;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; margin-bottom: 4px;
  font-size: 11px;
}
.sidebar-alert-triggered {
  border-left: 3px solid #fbbf24;
  background: rgba(251, 191, 36, 0.04);
}
.sidebar-alert-cond {
  font-family: ui-monospace, monospace; font-weight: 600; color: #4cc9f0;
}
.sidebar-alert-status {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
}
.sidebar-alert-triggered .sidebar-alert-status { color: #fbbf24; }
.sidebar-alert-actions {
  display: flex; gap: 2px;
}
.sidebar-alert-actions button {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; padding: 0 6px; font-size: 11px;
  cursor: pointer; color: var(--muted); line-height: 1.4;
}
.sidebar-alert-actions button:hover { color: var(--text); border-color: var(--text); }

/* Alerts management view. */
.alerts-filter {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 12px; font-size: 11px; cursor: pointer; margin-right: 6px;
}
.alerts-filter.active {
  color: #4cc9f0; border-color: #4cc9f0;
}
.alerts-list { max-width: 1100px; }
.alerts-group { margin-bottom: 18px; }
.alerts-group-sym {
  font-size: 13px; margin: 0 0 6px 0;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.alerts-row {
  display: grid;
  grid-template-columns: 32px 80px 90px 1fr auto;
  align-items: center; gap: 10px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
}
.alerts-row-triggered {
  border-left: 3px solid #fbbf24;
  background: rgba(251, 191, 36, 0.04);
}
.alerts-row-disabled { opacity: 0.5; }
.alerts-op {
  font-family: ui-monospace, monospace;
  font-size: 14px; color: #4cc9f0; text-align: center;
}
.alerts-thresh {
  font-family: ui-monospace, monospace; font-weight: 600;
}
.alerts-status {
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px;
  color: var(--muted);
}
.alerts-row-active   .alerts-status { color: #4ade80; }
.alerts-row-triggered .alerts-status { color: #fbbf24; }
.alerts-meta { color: var(--muted); font-size: 10px; }
.alerts-note { color: var(--text); font-style: italic; font-size: 11px; }
.alerts-source {
  color: var(--muted); font-size: 10px; font-family: ui-monospace, monospace;
  display: none; /* surface only on hover (future) */
}
.alerts-actions { display: flex; gap: 6px; }
.alerts-rearm, .alerts-del {
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 10px; font-size: 11px; cursor: pointer;
  color: var(--text);
}
.alerts-rearm:hover { border-color: #4cc9f0; color: #4cc9f0; }
.alerts-del:hover { border-color: var(--red); color: var(--red); }
.alerts-rearm:disabled, .alerts-del:disabled { opacity: 0.4; cursor: not-allowed; }

/* Help / cheatsheet popup, triggered by `h` or the topnav `?` button. */
.help-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 26px; height: 26px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.help-btn:hover { color: var(--text); border-color: #4cc9f0; }

.help-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.help-popup {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px 16px 24px;
  width: 760px; max-width: 95vw;
  max-height: 88vh; overflow-y: auto;
  position: relative;
  font-size: 12px;
  color: var(--text);
}
.help-popup h2 { margin: 0 0 6px 0; font-size: 16px; }
.help-popup h3 {
  margin: 14px 0 6px 0; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted);
}
.help-close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: none; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.help-close:hover { color: var(--text); }
.help-tbl { width: 100%; border-collapse: collapse; }
.help-tbl td {
  padding: 4px 8px;
  border-bottom: 1px dashed var(--border);
  vertical-align: top;
}
.help-tbl td:first-child {
  white-space: nowrap; color: var(--muted); width: 30%;
}
.help-tbl kbd {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
  font-family: ui-monospace, monospace; color: var(--text);
}
.help-tbl code {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; font-size: 11px;
}
.help-hint {
  margin: 6px 0 0 0; color: var(--muted); font-size: 11px;
}
.help-doc-buttons {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.help-doc-buttons button {
  background: transparent; border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 10px; color: var(--text);
  font-size: 11px; cursor: pointer;
}
.help-doc-buttons button:hover { border-color: #4cc9f0; color: #4cc9f0; }

/* Project-doc viewer popup. */
.doc-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 110;
}
.doc-popup {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 920px; max-width: 95vw;
  height: 88vh;
  display: flex; flex-direction: column;
  position: relative;
  font-size: 13px;
  color: var(--text);
}
.doc-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.doc-picker {
  flex: 1;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; font-size: 12px;
}
.doc-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}
.doc-close:hover { color: var(--text); }
.doc-err { color: var(--red); padding: 12px; }
.doc-body {
  flex: 1; overflow-y: auto;
  padding: 16px 24px;
  line-height: 1.55;
}
.doc-body h1 { font-size: 22px; margin-top: 0; }
.doc-body h2 { font-size: 18px; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); }
.doc-body h3 { font-size: 14px; margin-top: 18px; color: var(--text); }
.doc-body code {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; font-size: 12px;
}
.doc-body pre {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px 12px; overflow-x: auto;
}
.doc-body pre code { background: transparent; border: none; padding: 0; }
.doc-body table { border-collapse: collapse; margin: 8px 0; }
.doc-body th, .doc-body td {
  border: 1px solid var(--border); padding: 4px 8px; font-size: 12px;
}
.doc-body th { background: var(--bg); }
.doc-body blockquote {
  border-left: 3px solid var(--border); margin: 8px 0;
  padding: 4px 12px; color: var(--muted);
}
.doc-body a { color: #4cc9f0; text-decoration: none; }
.doc-body a:hover { text-decoration: underline; }
.doc-body-fallback {
  font-family: ui-monospace, monospace; font-size: 11px;
  white-space: pre-wrap;
}

/* Agent conversation tab. */
.agent-reset {
  margin-left: auto;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 10px; font-size: 11px; cursor: pointer;
}
.agent-reset:hover { color: var(--red); border-color: var(--red); }
.agent-transcript {
  max-width: 920px;
  display: flex; flex-direction: column; gap: 10px;
}
.agent-turn {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px;
  max-width: 75%;
}
/* WhatsApp-style alignment: user bubbles right, assistant bubbles left.
   Distinct backgrounds + corner cut on the bubble's "tail" side make the
   conversation flow read at a glance. */
.agent-turn-user {
  align-self: flex-end;
  background: rgba(76, 201, 240, 0.10);
  border-color: #4cc9f0;
  border-bottom-right-radius: 2px;
}
.agent-turn-assistant {
  align-self: flex-start;
  background: var(--bg);
  border-bottom-left-radius: 2px;
}
.agent-turn-meta {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 10px; margin-bottom: 6px;
}
.agent-turn-role {
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted);
}
.agent-turn-assistant .agent-turn-role { color: #4cc9f0; }
.agent-turn-time { color: var(--muted); }
.agent-flag-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 6px; cursor: pointer;
  font-size: 12px; line-height: 1; opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}
/* Branch button — pushed all the way right (margin-left:auto), with
   the flag button next to it. Hover-revealed via the .agent-turn-meta
   hover state so per-turn chrome doesn't crowd the transcript at
   rest. Click creates a new conversation seeded with turns up to
   and including this one. */
.agent-branch-btn {
  background: transparent; border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 6px; cursor: pointer;
  font-size: 12px; line-height: 1; opacity: 0;
  margin-left: auto;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}
.agent-branch-btn:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.agent-turn:hover .agent-branch-btn { opacity: 0.5; }
.agent-flag-btn:hover { opacity: 1; border-color: var(--red); }
/* Lit state — the turn has been flagged via /sys note. Persisted in
   localStorage so re-renders keep it visible. Sven /sys 2026-05-17
   17:36: "thumbs-down icon should be lit when reported". Full
   opacity + filled red tint distinguishes it from the muted unflagged
   state without changing button position/size. Re-clicking re-files
   the /sys note (intentional — sometimes the same bad pattern
   re-surfaces and Sven wants the audit trail). */
.agent-flag-btn.flagged {
  opacity: 1;
  border-color: var(--red);
  background: rgba(248,113,113,0.15);
}
.agent-turn-body {
  margin: 0; font-family: inherit; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text);
}

/* "Confabulating…" placeholder while the agent is generating. Three
   pulsing dots evoke the typing-indicator pattern from chat apps. */
.agent-turn-thinking { opacity: 0.85; }
.agent-thinking {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-style: italic;
}
.agent-thinking-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: #4cc9f0;
  animation: agent-thinking-pulse 1.2s infinite ease-in-out;
}
.agent-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.agent-thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-thinking-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1.0); opacity: 1.0; }
}

/* Review-tab action buttons in the chart-header. */
.review-actions { display: flex; gap: 6px; margin-left: auto; }
.review-actions button {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 10px; font-size: 11px; cursor: pointer;
}
.review-actions button:hover:not(:disabled) {
  border-color: #4cc9f0; color: #4cc9f0;
}
.review-actions button:disabled { opacity: 0.5; cursor: wait; }

.empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted);
}
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}

/* Spec-watch confirmation modal — pops on a Tradeable pivot-cross when
   the spec uses trigger=confirm. Embeds <chart-pane> at full RTH-
   visible size so Sven can size up the setup before accept/skip.
   Same dark backdrop as .modal but bigger inner box for the chart. */
.sw-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center; z-index: 110;
}
.sw-modal {
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 8px;
  width: min(960px, 92vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.sw-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.sw-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 600; color: var(--text);
}
.sw-icon { font-size: 18px; }
.sw-side {
  font-size: 10px; padding: 2px 7px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.sw-side.long  { background: rgba(74,222,128,0.18); color: #4ade80; }
.sw-side.short { background: rgba(248,113,113,0.18); color: #f87171; }
.sw-queue-hint {
  font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px;
}
.sw-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; padding: 0 6px;
}
.sw-close:hover { color: var(--text); }
.sw-chart-wrap {
  flex: 1; min-height: 320px; max-height: 50vh;
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--border);
}
.sw-chart-wrap > chart-pane {
  flex: 1; min-height: 0; min-width: 0; display: flex;
}
.sw-details {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 4px 18px; padding: 12px 14px;
}
.sw-row { display: flex; justify-content: space-between; font-size: 12px; }
.sw-label { color: var(--muted); text-transform: lowercase; }
.sw-muted { color: var(--muted); font-size: 11px; }
.sw-error {
  margin: 0 14px 8px;
  padding: 6px 10px;
  border: 1px solid rgba(248,113,113,0.4);
  background: rgba(248,113,113,0.08);
  color: #f87171; font-size: 12px; border-radius: 4px;
}
.sw-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--border);
}
.sw-skip, .sw-accept {
  padding: 6px 16px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; font-weight: 500;
}
.sw-skip {
  background: transparent; color: var(--muted);
}
.sw-skip:hover { color: var(--text); border-color: var(--text); }
.sw-accept {
  background: var(--accent); color: var(--bg); border-color: var(--accent);
  font-weight: 600;
}
.sw-accept:hover { filter: brightness(1.1); }
.sw-skip:disabled, .sw-accept:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-box {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px; width: 360px;
}
.modal-box h2 { margin: 0 0 12px 0; font-size: 14px; }
.modal-box p { color: var(--muted); margin: 0 0 12px 0; }
.modal-box input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}
.modal-box button {
  background: var(--accent); color: #0e1116; border: none;
  border-radius: 4px; padding: 6px 14px; font-weight: 600; cursor: pointer;
}

/* ============================================================================
   Rule checklist (per-trade discipline) + rules tab + scorecard
   ============================================================================ */

.rule-check {
  border: 1px solid var(--border); border-radius: 4px;
  margin: 8px 0; background: var(--bg-elev, #161a22);
}
.rule-check-header {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  cursor: pointer; user-select: none;
}
.rule-check-header:hover { background: rgba(76,201,240,0.05); }
.rule-check-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600;
}
.rule-check-summary { display: flex; gap: 6px; align-items: center; flex: 1; }
.rule-check-toggle { color: var(--muted); font-size: 11px; }
.rule-check-saving { color: var(--muted); font-size: 11px; font-style: italic; }
.rc-pill {
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
  background: rgba(255,255,255,0.04);
}
.rc-pill.rc-obey { color: var(--green); }
.rc-pill.rc-vio  { color: var(--red); }
.rc-pill.rc-na   { color: var(--muted); }
.rc-pct { font-size: 12px; font-weight: 600; }
.rc-pct.muted { color: var(--muted); font-weight: 400; font-style: italic; }
.rule-check-body {
  border-top: 1px solid var(--border); padding: 8px 10px;
}
.rc-section { margin-bottom: 10px; }
.rc-section:last-child { margin-bottom: 0; }
.rc-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 4px;
}
.rc-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 8px; align-items: center; padding: 3px 0;
}
.rc-id { font-family: monospace; color: var(--muted); font-size: 11px; }
.rc-text { font-size: 12px; }
.rc-buttons { display: flex; gap: 2px; }
.rc-btn {
  width: 24px; height: 22px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rc-btn:hover { border-color: var(--accent); }
.rc-btn-obey.on { background: var(--green); color: #0e1116; border-color: var(--green); }
.rc-btn-vio.on  { background: var(--red);   color: #0e1116; border-color: var(--red); }
.rc-btn-na.on   { background: var(--muted); color: #0e1116; border-color: var(--muted); }
.rc-note {
  grid-column: 1 / -1; margin-top: 2px;
  background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 6px; font-size: 12px; font-family: inherit;
}
.rc-note:focus { border-color: var(--red); outline: none; }
.rule-check-empty, .rule-check-err {
  padding: 8px 10px; font-size: 12px; color: var(--muted);
}
.rule-check-err { color: var(--red); }

/* Ghost row = auto-suggested rule the operator hasn't accepted yet. The
   buttons render in the suggested state but with reduced opacity so it's
   clear it isn't manually confirmed — clicking promotes to manual. */
.rc-row-ghost .rc-btn.on { opacity: 0.55; border-style: dashed; }
.rc-row-ghost .rc-text { opacity: 0.85; }
.rc-auto-note {
  display: block; font-size: 10px; color: var(--accent);
  font-style: italic; margin-top: 1px; opacity: 0.75;
}
.rc-accept-all {
  font-size: 11px; padding: 2px 8px; border-radius: 3px;
  background: var(--accent); color: #0e1116; border: none;
  cursor: pointer; font-weight: 600;
}
.rc-accept-all:hover { filter: brightness(1.1); }
.rc-origin-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: rgba(255,255,255,0.04); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  font-style: italic;
}

/* Tradeable trade-spec marker on watchlist rows. No border, no
   background, no slot/mode badge inline — keeps the row compact and
   prevents the chip from wrapping into a multi-line bordered box on
   tight row widths. Full spec details live in the title tooltip. */
.spec-chip {
  display: inline; font-size: 11px; font-family: ui-monospace, monospace;
  margin-left: 6px; white-space: nowrap; cursor: help;
}
.spec-chip.spec-long  { color: var(--green); }
.spec-chip.spec-short { color: var(--red); }
.spec-mode {
  font-size: 9px; padding: 0 4px; border-radius: 2px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.spec-mode.spec-live { background: var(--accent); color: #0e1116; }
.spec-mode.spec-sim  { background: var(--border); color: var(--muted); }
.spec-btn {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); cursor: pointer;
}
.spec-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Positions tab: per-row mode badge (manual / simulated / live). Same
   visual scale as .spec-mode but standalone so the table cell has its
   own component. */
.mode-badge {
  display: inline-block;
  font-size: 9px; padding: 1px 5px; border-radius: 2px;
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--border); color: var(--muted);
}
.mode-badge.mode-live { background: var(--accent); color: #0e1116; }
.mode-badge.mode-simulated { background: rgba(74,222,128,0.2); color: var(--green); }
.mode-badge.mode-manual { background: rgba(255,200,80,0.18); color: #f3c84d; }
.positions-table th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.positions-table tbody tr:hover { background: var(--surface-hover); }

/* Chart-header acquisition badge: M&A target = warm-red (warning-ish),
   acquirer = blue (informational). Matches the M&A pill rendered in
   the email upcoming-earnings table for visual consistency. */
.acq-badge {
  display: inline-block;
  font-size: 10px; padding: 1px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  margin-left: 6px;
}
.acq-badge.acq-target   { background: rgba(127,29,29,0.85); color: #fee2e2; }
.acq-badge.acq-acquirer { background: rgba(30,58,138,0.85); color: #dbeafe; }

/* Forensic-accounting glance icon — sits in the chart-header next to
   the ticker so the operator sees a flagged name BEFORE clicking in.
   Replaced the earnings panel's "✓ no flags" empty state per Sven
   /sys 2026-05-15. Hover reveals the full flag list. Only renders
   when flags.length > 0. */
.forensic-flag-icon {
  display: inline-block; margin-left: 8px;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 3px;
  cursor: help;
}
.forensic-flag-icon.high { background: rgba(127,29,29,0.85); color: #fef2f2; }
.forensic-flag-icon.med  { background: rgba(146,64,14,0.85); color: #fef3c7; }

/* Header watchlist-membership chips — clickable, jump to that
   watchlist (force-watchlist event). Sven /sys 2026-05-15: "list all
   watchlists the currently stock is on in the titlebar". */
.header-lists {
  display: inline-flex; flex-wrap: wrap;
  gap: 4px; margin-left: 8px; align-items: center;
}
.header-list-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 1px 7px; border-radius: 3px;
  font-size: 10px; font-family: inherit;
  cursor: pointer;
  text-transform: lowercase;
}
.header-list-chip:hover { color: var(--accent); border-color: var(--accent); }

.spec-form {
  background: var(--bg-elev, #161a22);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 12px; margin: 4px 8px 12px;
  font-size: 12px;
}
.spec-form-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); margin-bottom: 10px;
}
.spec-form-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px;
  margin-bottom: 8px;
}
.spec-form-row { margin-bottom: 8px; }
.spec-form label {
  display: block; font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px;
}
.spec-form label.full-width { grid-column: 1 / -1; }
.spec-form input, .spec-form select {
  width: 100%; box-sizing: border-box;
  background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 6px; font-size: 12px; font-family: inherit;
}
.spec-form input:focus, .spec-form select:focus {
  border-color: var(--accent); outline: none;
}
.spec-form-actions { display: flex; gap: 8px; margin-top: 8px; }
.spec-save {
  background: var(--accent); color: #0e1116; border: none;
  border-radius: 3px; padding: 4px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.spec-save:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
.spec-clear {
  background: transparent; color: var(--red);
  border: 1px solid var(--red); border-radius: 3px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.spec-cancel {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.spec-form-err {
  margin-top: 8px; padding: 6px 10px;
  background: rgba(248,113,113,0.1); color: var(--red);
  border: 1px solid rgba(248,113,113,0.3); border-radius: 3px;
  font-size: 12px;
}
.spec-form-hint {
  display: inline-block; margin-left: 6px;
  font-size: 10px; color: var(--muted); font-style: italic;
}
.wl-row-remove {
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 3px;
  width: 22px; height: 22px;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.wl-row-remove:hover { color: var(--red); border-color: rgba(248,113,113,0.4); }
/* Inline "review due" indicator on the symbol-main tab strip — small
   chip pinned to the right so it doesn't steal chart real estate. */
.review-due-tag {
  margin-left: auto; padding: 2px 8px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(76,201,240,0.12); color: var(--accent);
  border: 1px solid rgba(76,201,240,0.3); border-radius: 3px;
  align-self: center;
}
.review-due-tag.past {
  background: rgba(248,113,113,0.15); color: var(--red);
  border-color: rgba(248,113,113,0.4);
  animation: review-pulse 1.6s ease-in-out infinite;
}
@keyframes review-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
/* Portable spec editor mounted in symbol-main — thin one-line bar with
   chip + edit button; expands an inline form below when editing. */
.spec-editor { margin: 4px 0; }
.spec-editor-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-elev, #161a22);
}
.spec-editor-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 600;
}
.spec-editor-empty { color: var(--muted); font-style: italic; font-size: 11px; }
.spec-editor-edit { margin-left: auto; }

/* .seg-toggle: shared segmented-toggle pattern. Use anywhere a control
   picks one of N short labels (period, stream, panel mode, etc.).
   Replaces the per-feature one-off styles (agent-stream, fund-period,
   chart period, panel-toggle cycle) with one visual language. */
.seg-toggle { display: inline-flex; gap: 0; }
.seg-toggle button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 12px; font-size: 12px; cursor: pointer;
  text-transform: lowercase;
  font-family: inherit;
}
.seg-toggle button + button { border-left: none; }
.seg-toggle button:first-child { border-radius: 3px 0 0 3px; }
.seg-toggle button:last-child  { border-radius: 0 3px 3px 0; }
.seg-toggle button:only-child  { border-radius: 3px; }
.seg-toggle button:hover { color: var(--text); }
/* Active state: same pattern as .topnav .navtab.active — full-strength
   text on the panel bg with an accent-colored underline. The previous
   filled-cyan-bg + dark-text version was hard to read (Sven flagged
   2026-05-15). Bold weight + accent underline together make the
   active choice unambiguous without needing the heavy fill. */
.seg-toggle button.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}
/* Back-compat alias for the existing agent-stream uses; same styling. */
.agent-stream-toggle { display: inline-flex; gap: 0; margin-left: 12px; }
.agent-stream-toggle button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px; font-size: 11px; cursor: pointer; text-transform: lowercase;
}
.agent-stream-toggle button:first-child { border-radius: 3px 0 0 3px; }
.agent-stream-toggle button:last-child  { border-radius: 0 3px 3px 0; border-left: none; }
.agent-stream-toggle button.active { background: var(--accent); color: #0e1116; border-color: var(--accent); }

/* .view-toolbar: shared layout for the controls strip above any
   list-view (trades / alerts / watchlists / strategies). Anchors the
   eye in the same place across tabs. Contents (filters, search,
   actions) vary; the WRAPPER doesn't. */
.view-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev, #161a22);
}
.view-toolbar > .toolbar-spacer { flex: 1; }
.view-toolbar input[type="text"], .view-toolbar input[type="search"] {
  background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 8px; font-size: 12px; font-family: inherit;
  min-width: 100px;
}
.view-toolbar input:focus { border-color: var(--accent); outline: none; }
.view-toolbar label.tb-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
}
.view-toolbar select {
  background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 6px; font-size: 12px; font-family: inherit;
}
.view-toolbar select:focus { border-color: var(--accent); outline: none; }

/* Top-of-chart inline OHLC strip — TradingView-style. Always-on
   replacement for the floating popup which is now opt-in (press 'p').
   Floats absolutely over the top of the chart canvas (which is also
   absolute:inset:0); pointer-events:none so chart hover/click pass
   through. Without the absolute positioning, #chart's inset:0
   completely covered the strip and Sven saw a blank top-of-chart
   despite the values being rendered (caught 2026-05-15). */
.hov-strip {
  display: none; /* set to flex by _renderHovStrip once data lands */
  position: absolute; top: 6px; left: 8px; z-index: 5;
  pointer-events: none;
  align-items: center; gap: 8px;
  padding: 4px 10px;
  font: 11px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  background: rgba(14, 17, 22, 0.92);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}
.hs-date  { color: var(--accent); font-weight: 600; }
.hs-sep   { color: var(--border); }
.hs-k     { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.hs-v     { color: #d6d9e0; font-weight: 500; }
.hs-pct   { font-weight: 600; padding: 0 4px; }
.hs-pct-sm{ color: var(--muted); font-size: 10px; font-weight: 500; }
.hs-fire  { color: #fbbf24; font-weight: 600; text-transform: uppercase; font-size: 10px; }

/* "polished" tag on a note that was AI-cleaned at save time. Hover
   shows the original body so the operator can verify intent didn't
   drift. */
.note-polished {
  font-size: 9px; color: var(--accent); margin-left: 6px;
  background: rgba(76,201,240,0.08); padding: 1px 4px; border-radius: 2px;
  cursor: help;
}

/* Image attachments — chips in the agent bar before submit, full-width
   inline thumbnails in the journal. Both render via hydrateAttachment-
   Images() since <img> can't carry an Authorization header. */
.agent-bar-attachments {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 14px 0;
}
.att-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-elev, #161a22);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 4px 3px 3px;
}
.att-chip img {
  height: 28px; width: 40px; object-fit: cover; border-radius: 2px;
}
.att-chip button {
  background: transparent; color: var(--muted);
  border: none; cursor: pointer; padding: 0 4px;
  font-size: 14px; line-height: 1;
}
.att-chip button:hover { color: var(--red); }
.att-uploading { color: var(--muted); font-style: italic; padding: 4px 8px; }

.note-attachments {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}
.note-att {
  max-width: 100%; max-height: 160px; border-radius: 3px;
  border: 1px solid var(--border); cursor: pointer;
  transition: filter 0.1s ease;
}
.note-att:hover { filter: brightness(1.15); }

/* Agent transcript audit trail — tool calls collapsed under each
   assistant turn so the conversation stays readable but the operator
   can drill into reasoning when needed (per /sys 19:04). */
.agent-tool-calls {
  margin-top: 6px; font-size: 11px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 8px;
}
.agent-tool-calls summary {
  cursor: pointer; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px;
}
.agent-tool-calls summary:hover { color: var(--accent); }
.agent-tool-call {
  margin: 6px 0; padding: 4px 6px;
  border-left: 2px solid var(--accent); background: rgba(76,201,240,0.04);
}
.agent-tool-call.err { border-left-color: var(--red); background: rgba(248,113,113,0.06); }
.agent-tool-head { display: flex; gap: 8px; align-items: center; }
.agent-tool-name { font-weight: 600; color: var(--accent); font-family: monospace; }
.agent-tool-err  { font-size: 10px; color: var(--red); text-transform: uppercase; }
.agent-tool-io {
  font-size: 10px; font-family: monospace; color: var(--muted);
  white-space: pre-wrap; word-break: break-word;
  margin: 2px 0; max-height: 200px; overflow-y: auto;
}
.agent-tool-idx { color: var(--muted); font-size: 10px; min-width: 18px; }

/* Agent-runs stream — each card is one queue-driven specialist
   invocation (process-curator, weekly-market-overview, etc.).
   Click the head to expand the full workflow (system prompt,
   tool calls, final reply). Polls live while runs are in-flight. */
.agent-runs { display: flex; flex-direction: column; gap: 8px; }
.agent-run {
  border: 1px solid var(--border); border-radius: 4px;
  background: rgba(255,255,255,0.02);
}
.agent-run-running { border-left: 3px solid var(--accent); }
.agent-run-error   { border-left: 3px solid var(--red); }
.agent-run-done    { border-left: 3px solid var(--green, #4ade80); }
.agent-run-head {
  display: grid;
  grid-template-columns: 90px 1fr auto auto auto 18px;
  gap: 10px; align-items: center;
  padding: 8px 12px; cursor: pointer;
  font-size: 12px;
}
.agent-run-head:hover { background: rgba(255,255,255,0.03); }
.agent-run-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; padding: 2px 6px; border-radius: 3px;
  display: inline-block; text-align: center;
}
.agent-run-status-running {
  background: rgba(76,201,240,0.15); color: var(--accent);
  animation: pulse-soft 1.5s ease-in-out infinite;
}
@keyframes pulse-soft { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.agent-run-status-done    { background: rgba(74,222,128,0.12); color: var(--green, #4ade80); }
.agent-run-status-error   { background: rgba(248,113,113,0.12); color: var(--red); }
.agent-run-target { font-weight: 600; font-family: monospace; }
.agent-run-time   { color: var(--muted); font-size: 11px; }
.agent-run-dur    { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.agent-run-calls  { color: var(--muted); font-size: 11px; }
.agent-run-toggle { color: var(--muted); }
.agent-run-summary {
  padding: 0 12px 8px 112px; /* align with target column */
  color: var(--muted); font-size: 11px;
  border-top: 1px dashed rgba(255,255,255,0.04);
}
.agent-run-detail {
  padding: 8px 12px 12px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.agent-run-error {
  padding: 6px 10px; margin-bottom: 8px;
  border-left: 3px solid var(--red); background: rgba(248,113,113,0.08);
  color: var(--red); font-size: 12px; font-family: monospace;
}
.agent-run-section { margin: 6px 0; }
.agent-run-section summary {
  cursor: pointer; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px;
  padding: 2px 0;
}
.agent-run-section summary:hover { color: var(--accent); }
.agent-run-pre {
  font-size: 11px; font-family: monospace; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  margin: 4px 0; padding: 8px 10px;
  background: rgba(0,0,0,0.2); border-radius: 3px;
  max-height: 320px; overflow-y: auto;
}
/* agent-run-md is the markdown-rendered counterpart of agent-run-pre.
   Same container chrome (dark, scrollable, padded), but content is
   prose-rendered via .md-body rather than monospace. Used for the
   system prompt, the user message, and tool outputs. */
.agent-run-md {
  margin: 4px 0; padding: 8px 10px;
  background: rgba(0,0,0,0.2); border-radius: 3px;
  max-height: 320px; overflow-y: auto;
}
.agent-tool-io-label {
  font-size: 10px; color: var(--muted); margin-top: 4px;
}
.agent-tool-io-md {
  font-size: 11px; padding: 6px 8px;
  background: rgba(0,0,0,0.15); border-radius: 3px;
  margin: 2px 0; max-height: 240px; overflow-y: auto;
}
.agent-run-reply {
  margin-top: 4px; padding: 8px 10px;
  background: rgba(0,0,0,0.2); border-radius: 3px;
}

/* Markdown body — minimal styling so agent replies render like prose
   instead of plaintext. Agent self-flagged via /sys 20:49. */
/* Markdown body — selectors target the bare elements marked.js emits
   (no custom classes), so the same rules apply whether the markdown
   came from the agent transcript or anywhere else that uses .md-body. */
.md-body { font: 13px/1.5 inherit; color: var(--text); }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }
.md-body h1, .md-body h2, .md-body h3 {
  margin: 12px 0 4px 0; font-weight: 700; color: var(--text);
}
.md-body h1 { font-size: 16px; }
.md-body h2 { font-size: 14px; color: var(--accent); }
.md-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.md-body p { margin: 6px 0; }
/* Drop empty paragraphs entirely. If a stray `\n\n\n+` slips past
   the renderMarkdown normalizer marked produces <p></p>, which
   browsers render as a 6px-tall visible gap. Sven flagged this as
   the recurring "multiple consecutive empty lines" regression
   (2026-05-15 + 2026-05-17). Fix it at the CSS layer so every
   .md-body surface inherits the defense automatically — past patches
   only addressed individual surfaces (.market-entry-text +
   .agent-reply-body) and got bypassed by every new surface added
   (.md-body in the runs inspector, etc.). */
.md-body p:empty { display: none; }
/* Loose-list defense: when marked sees `- a\n\n- b` it produces
   <li><p>a</p></li><li><p>b</p></li>; the inner <p> inherits the
   6px paragraph margin and stacks with the <li> margin into a
   14px+ gap that LOOKS like a blank line. Force zero margin on
   <p> inside <li>, with a small top-only margin for the
   multi-paragraph case. Mirrors the .market-entry-text +
   .agent-reply-body rules but applied to the SHARED base class so
   every downstream surface inherits. */
.md-body li { margin: 2px 0; }
.md-body li > p { margin: 0; }
.md-body li > p + p { margin-top: 4px; }
.md-body li > ul,
.md-body li > ol { margin: 2px 0; }
.md-body ul + ul,
.md-body ol + ol { margin-top: 2px; }
.md-body strong { color: var(--text); font-weight: 700; }
.md-body em     { color: inherit; font-style: italic; }
.md-body code {
  background: rgba(255,255,255,0.06); padding: 1px 5px;
  border-radius: 3px; font-size: 12px; font-family: monospace;
}
.md-body pre {
  background: var(--bg-elev, #161a22); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px 12px; margin: 6px 0;
  font: 12px/1.4 monospace; overflow-x: auto;
}
.md-body pre code { background: transparent; padding: 0; font-size: inherit; }
.md-body ul, .md-body ol { margin: 4px 0 6px 0; padding-left: 22px; }
.md-body li { margin: 2px 0; }
.md-body a  { color: var(--accent); text-decoration: underline; }
.md-body a:hover { filter: brightness(1.2); }
.md-body table {
  border-collapse: collapse; margin: 8px 0;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.md-body table th,
.md-body table td {
  border: 1px solid var(--border); padding: 4px 8px;
  text-align: left; vertical-align: top;
}
.md-body table th {
  background: var(--bg-elev, #161a22);
  color: var(--accent); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px;
}
.md-body table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* Click-candle annotate panel — alt+click on a bar opens this floating
   form. Lives inside chart-wrap so positioning hugs the chart. */
.annotate-panel {
  position: absolute; left: 12px; top: 40px;
  background: var(--bg-elev, #161a22);
  border: 1px solid var(--accent); border-radius: 4px;
  padding: 10px; z-index: 6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-width: 280px;
}
.annotate-panel .m-head {
  font-size: 11px; color: var(--accent); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.annotate-panel textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg, #0e1116); color: inherit;
  border: 1px solid var(--border); border-radius: 3px;
  padding: 6px; font: 12px/1.4 inherit; resize: vertical;
}
.annotate-panel textarea:focus { border-color: var(--accent); outline: none; }
.annotate-panel .m-actions { display: flex; gap: 8px; margin-top: 8px; }
.annotate-panel button {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 4px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.annotate-panel button#annotate-save {
  background: var(--accent); color: #0e1116; border-color: var(--accent); font-weight: 600;
}
.annotate-panel button:hover { filter: brightness(1.1); }
.wl-auto-tag {
  display: inline-block; margin-left: 6px;
  font-size: 9px; padding: 1px 5px; border-radius: 2px;
  background: rgba(255,255,255,0.05); color: var(--muted);
  letter-spacing: 0.06em; font-weight: 600; vertical-align: middle;
}

/* Rules tab — markdown body left, scorecard right */
.rules-view { display: grid; grid-template-columns: minmax(360px, 1fr) 1fr; gap: 16px; padding: 16px; }
.rules-md {
  background: var(--bg-elev, #161a22); border: 1px solid var(--border);
  border-radius: 4px; padding: 12px 16px;
  font-size: 13px; line-height: 1.5;
  max-height: calc(100vh - 130px); overflow-y: auto;
}
.rules-md h1 { font-size: 16px; margin: 0 0 8px 0; }
.rules-md h2 { font-size: 13px; margin: 14px 0 6px 0; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.rules-md p { color: var(--muted); margin: 6px 0; }
.rules-md .rule-line {
  display: grid; grid-template-columns: 36px 1fr; gap: 8px;
  padding: 2px 0;
}
.rules-md .rule-line .rid { font-family: monospace; color: var(--muted); }
.rules-md .rule-line.retired { text-decoration: line-through; color: var(--muted); }
.rules-md .edit-hint {
  font-size: 11px; color: var(--muted); font-style: italic;
  margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border);
}

.scorecard {
  background: var(--bg-elev, #161a22); border: 1px solid var(--border);
  border-radius: 4px; padding: 12px 16px;
  max-height: calc(100vh - 130px); overflow-y: auto;
}
.scorecard h2 { font-size: 14px; margin: 0 0 10px 0; }
.scorecard-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.sc-row {
  display: grid; grid-template-columns: 36px 1fr 60px 80px;
  gap: 8px; align-items: center; padding: 6px 0;
  border-top: 1px solid var(--border);
}
.sc-row:first-of-type { border-top: none; }
.sc-id { font-family: monospace; color: var(--muted); font-size: 11px; }
.sc-text { font-size: 12px; }
.sc-text.retired { text-decoration: line-through; color: var(--muted); }
.sc-counts { font-size: 11px; color: var(--muted); text-align: right; font-family: monospace; }
.sc-bar {
  position: relative; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.sc-bar > .fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--green); transition: width 0.2s;
}
.sc-bar.bad > .fill { background: var(--red); }
.sc-bar.warn > .fill { background: #f59e0b; }
.sc-pct {
  display: block; font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px;
}
.sc-violations {
  grid-column: 1 / -1; margin: 4px 0 0 36px;
  font-size: 11px; color: var(--muted);
}
.sc-violations .v-row {
  display: flex; gap: 8px; padding: 2px 0;
  border-top: 1px dotted var(--border);
}
.sc-violations .v-row .v-trade { color: var(--accent); cursor: pointer; }
.sc-violations .v-row .v-trade:hover { text-decoration: underline; }
.sc-violations .v-row .v-note { font-style: italic; }
.sc-empty { color: var(--muted); font-style: italic; padding: 12px 0; }

/* social — build-in-public draft queue */
.social-pane { padding: 12px 16px; max-width: 900px; margin: 0 auto; overflow-y: auto; height: 100%; }
.social-compose { border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin: 12px 0; background: var(--panel); }
.social-compose .compose-row { display: flex; gap: 8px; margin-bottom: 6px; }
.social-compose select, .social-compose input, .social-compose textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 8px; font: inherit; font-size: 13px;
}
.social-compose .compose-row input { flex: 1; }
.social-compose textarea { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit; }
.social-compose button { background: var(--accent); color: var(--bg); border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: 600; }
.social-compose button:disabled { opacity: 0.5; cursor: not-allowed; }
.social-list { display: flex; flex-direction: column; gap: 12px; }
.social-card { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; background: var(--panel); }
.social-card.status-shipped { opacity: 0.6; }
.social-card.status-discarded { opacity: 0.4; }
.social-card-meta { display: flex; gap: 12px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.social-card-meta .social-kind { background: var(--bg); padding: 1px 6px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.social-card-meta .social-status { color: var(--accent); }
.social-summary { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-style: italic; }
.social-variant { border-top: 1px solid var(--border); padding: 8px 0; }
.social-variant .variant-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.social-variant .variant-body { white-space: pre-wrap; font-size: 13px; line-height: 1.45; }
.social-variant .variant-actions { display: flex; gap: 6px; margin-top: 6px; }
.social-variant .variant-actions button, .social-variant .variant-actions .btn-link {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 3px; font-size: 11px; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.social-variant .variant-actions button:hover, .social-variant .variant-actions .btn-link:hover { border-color: var(--accent); color: var(--accent); }
.social-card-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.social-card-actions button { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 4px 10px; border-radius: 3px; font-size: 11px; cursor: pointer; }
.social-card-actions button:hover { border-color: var(--accent); }
.social-card-actions button.danger:hover { border-color: var(--red); color: var(--red); }
.empty { color: var(--muted); font-style: italic; padding: 20px; text-align: center; }
.err-banner { background: rgba(239,68,68,0.1); color: var(--red); padding: 6px 10px; border-radius: 4px; margin: 6px 0; font-size: 12px; }

/* System Builder tab */
.sb-pane { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: 100%; overflow: hidden; }
.sb-side { border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; background: var(--panel); }
.sb-side-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sb-side-h h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.sb-side-h button { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 2px 8px; border-radius: 3px; font-size: 12px; cursor: pointer; }
.sb-run { padding: 8px 10px; border-radius: 4px; cursor: pointer; margin-bottom: 4px; font-size: 12px; border: 1px solid transparent; }
.sb-run:hover { border-color: var(--border); }
.sb-run.active { background: var(--bg); border-color: var(--accent); }
.sb-run-name { font-weight: 600; }
.sb-run-meta { color: var(--muted); font-size: 10px; margin-top: 2px; }
.sb-main { padding: 16px; overflow-y: auto; height: 100%; }
.sb-cells-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.sb-cells-h h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.sb-cells-h .hint { color: var(--muted); font-size: 11px; }
.sb-grid { width: 100%; border-collapse: collapse; font-size: 12px; }
.sb-grid th, .sb-grid td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.sb-grid th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.sb-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sb-grid td.pos { color: var(--green); }
.sb-grid td.neg { color: var(--red); }
.sb-grid tbody tr:hover { background: rgba(76,201,240,0.05); cursor: pointer; }
.sb-grid tbody tr.active { background: rgba(76,201,240,0.10); }
.sb-grid .sb-spec { font-family: monospace; font-size: 11px; }
.sb-grid .sqn-cell { font-weight: 700; }
.sb-detail { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.sb-detail h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 12px 0; }
.sb-detail h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0 0 8px 0; }
.sb-detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; }
.r-hist { display: flex; flex-direction: column; gap: 4px; }
.r-row { display: grid; grid-template-columns: 60px 1fr 32px; gap: 8px; align-items: center; font-size: 11px; }
.r-label { color: var(--muted); text-align: right; }
.r-bar-track { background: var(--bg); border-radius: 2px; height: 14px; overflow: hidden; }
.r-bar { height: 100%; min-width: 1px; }
.r-bar.pos { background: var(--green); }
.r-bar.neg { background: var(--red); }
.r-count { text-align: left; font-variant-numeric: tabular-nums; color: var(--muted); }
.sb-trades { width: 100%; border-collapse: collapse; font-size: 11px; }
.sb-trades th, .sb-trades td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.sb-trade-row { cursor: pointer; }
.sb-trade-row:hover { background: rgba(76,201,240,0.06); }
.sb-trade-row:hover .sb-trade-sym { color: var(--accent); }
.sb-trade-row.active { background: rgba(76,201,240,0.15); }
.sb-trade-row.active .sb-trade-sym { color: var(--accent); font-weight: 700; }
.sb-inline-chart { margin-top: 16px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); padding: 10px 12px; }
.sb-inline-chart-h { display: flex; align-items: baseline; gap: 12px; font-size: 12px; margin-bottom: 8px; }
.sb-inline-chart-h .hint { color: var(--muted); font-size: 11px; margin-left: auto; }
.sb-inline-chart-h .num.pos { color: var(--green); }
.sb-inline-chart-h .num.neg { color: var(--red); }
.sb-inline-chart chart-pane { display: block; height: 420px; }
.sb-trades th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px; }
.sb-trades td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sb-trades td.pos { color: var(--green); }
.sb-trades td.neg { color: var(--red); }

/* System Builder — rules panel above the cell grid */
.sb-rules { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 12px 14px; margin-bottom: 16px; }
.sb-rules-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.sb-rules-h h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.sb-rules-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.sb-tag { background: var(--bg); color: var(--text); padding: 2px 8px; border-radius: 3px; font-size: 11px; border: 1px solid var(--border); }
.sb-rules-list { display: flex; flex-direction: column; gap: 8px; }
.sb-rule-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sb-rule-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; min-width: 110px; }
.sb-rule-ol { margin: 0; padding-left: 18px; flex: 1; min-width: 0; }
.sb-rule-ol li { margin-bottom: 5px; font-size: 13px; line-height: 1.45; }
.sb-rule-desc { color: var(--text); font-size: 13px; }
.sb-gate-name { font-family: monospace; color: var(--muted); font-size: 10px; margin-left: 8px; opacity: 0.55; }
.sb-swept-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; background: rgba(76,201,240,0.20); color: var(--accent); padding: 1px 5px; border-radius: 2px; margin-left: 6px; font-weight: 600; }

/* Docs tab — full-page markdown reader with sidebar catalog */
.docs-pane { display: grid; grid-template-columns: 240px 1fr; gap: 0; height: 100%; overflow: hidden; }
.docs-side { border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; background: var(--panel); }
.docs-side-h { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 12px 0 6px 0; padding-left: 6px; }
.docs-side-h:first-child { margin-top: 0; }
.docs-link { padding: 5px 8px; border-radius: 3px; cursor: pointer; font-size: 12px; margin-bottom: 1px; color: var(--text); }
.docs-link:hover { background: var(--bg); }
.docs-link.active { background: var(--bg); border-left: 2px solid var(--accent); padding-left: 6px; font-weight: 600; }
.docs-main { padding: 24px 32px; overflow-y: auto; height: 100%; }
.docs-body { max-width: 880px; line-height: 1.55; font-size: 14px; }
.docs-body h1 { font-size: 22px; margin-top: 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.docs-body h2 { font-size: 18px; margin-top: 28px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.docs-body h3 { font-size: 15px; margin-top: 20px; }
.docs-body code { background: var(--panel); padding: 1px 5px; border-radius: 3px; font-size: 12px; color: var(--accent); }
.docs-body pre { background: var(--panel); padding: 12px; border-radius: 4px; overflow-x: auto; border: 1px solid var(--border); }
.docs-body pre code { background: transparent; padding: 0; color: var(--text); }
.docs-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.docs-body table th, .docs-body table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.docs-body table th { background: var(--panel); font-weight: 600; }
.docs-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--muted); margin: 12px 0; }
.docs-body a { color: var(--accent); text-decoration: none; }
.docs-body a:hover { text-decoration: underline; }
.docs-body ul, .docs-body ol { padding-left: 24px; }
.docs-body li { margin-bottom: 3px; }
.docs-body-fallback { white-space: pre-wrap; font-family: monospace; }

/* System Builder — scatter plot (correlation discovery) */
.sb-scatter-panel { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.sb-scatter-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; }
.sb-scatter-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12px; }
.sb-scatter-controls label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.sb-scatter-controls select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 3px; padding: 2px 6px; font: inherit; font-size: 11px; }
.sb-pearson { margin-left: 8px; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
.sb-pearson b { color: var(--accent); }
.sb-pearson-strength { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 2px; }
.sb-scatter-n { color: var(--muted); font-size: 11px; margin-left: auto; }
.sb-scatter-svg { display: block; background: var(--bg); border-radius: 3px; margin-top: 4px; }
.sb-scatter-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.sb-scatter-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.sb-scatter-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

/* Quick-jump button to the Tradeable watchlist (per /sys 2026-05-11 23:42). */
.wl-jump-tradeable {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 10px; font-size: 11px; cursor: pointer;
  font-family: inherit;
}
.wl-jump-tradeable:hover { border-color: var(--accent); color: var(--accent); }
.wl-jump-tradeable.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
