/* The Analysis tab's styles: its tracking list, the breakdown of one
   symbol's reading, and the tape. Loaded by both pages — the desktop's
   index.html and the phone's mobile.html, which renders the same breakdown
   (js/tabs/investments/analysis-read.js).

   Moved out of styles.css on 2026-09-26, unchanged, when the phone page
   began showing the breakdown. It reads the colour and type-scale tokens
   each page defines on :root. */

/* --- Investments > Analysis ------------------------------------------------
   The tracking list, and the breakdown beside the chart. Data is JetBrains
   Mono and rows stripe at 0.07, the same as every other table here. */
.analysis-add { display: flex; gap: 6px; padding: 0 0 8px; }
.analysis-add input {
  flex: 1; min-width: 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 8px; font-size: var(--font-body);
}
.analysis-add button {
  background: var(--amber); color: #14100A; border: none; border-radius: 4px;
  padding: 5px 12px; font-weight: 600; font-size: var(--font-body); cursor: pointer;
}
.analysis-add button.analysis-add-all {
  background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500;
}
.analysis-add button.analysis-add-all:disabled { opacity: 0.5; cursor: default; }
/* A pass under way: queued rows sit back until they are read, a read one
   gets a tick, a failed one says so (the hover says why). */
.analysis-row.queued .mono, .analysis-row.queued .analysis-trend { opacity: 0.5; }
.analysis-done { color: var(--gain); font-size: 12px; }
.analysis-failed { color: var(--loss); cursor: help; }
/* Something meaningful changed since the symbol was last looked at (the
   hover says what). Coloured like the light; off once the row is picked. */
/* A ticker kept off the tape (the row's right-click menu): quiet, it is a
   setting and not news. */
.analysis-notape {
  margin-left: 6px; vertical-align: 1px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  padding: 0 4px; border-radius: 3px; border: 1px solid var(--border);
  color: var(--muted); text-decoration: line-through; cursor: help;
}
/* A ticker filtering the tape its own way, rather than off it altogether. */
.analysis-tapeset {
  margin-left: 6px; vertical-align: 1px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  padding: 0 4px; border-radius: 3px; border: 1px solid var(--border);
  color: var(--muted); cursor: help;
}
.analysis-alert { margin-left: 4px; padding: 2px 4px; font-size: 13px; color: rgb(227, 162, 60); cursor: help; }
.analysis-alert.green { color: var(--gain); }
.analysis-alert.red { color: var(--loss); }
.analysis-changed { color: rgb(227, 162, 60); }
/* When a Today flag first came up, and whether it is new since the symbol
   was last looked at. */
.analysis-since {
  display: inline-block; min-width: 40px; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--muted);
}
/* Amber whatever the flag's own colour, so new stands out on a red or green
   line alike. */
.analysis-new {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  padding: 0 4px; border-radius: 3px; border: 1px solid var(--amber);
  color: var(--amber); background: rgba(227, 162, 60, 0.15);
}
/* The Tracking box scrolls its rows only (2026-10-04): the add bar and the
   tabs stay at the top, and the column headings stick above the rows. The
   panel stops being the scroller; the rows' own wrapper is. */
.analysis-tracking-panel { display: flex; flex-direction: column; overflow: hidden; }
.analysis-tracking-panel .analysis-add { flex: none; }
.analysis-list { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.analysis-list > .analysis-tabs { flex: none; }
.analysis-list > .analysis-rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
/* A collapsed border does not travel with a sticky cell: the rule under the
   headings is drawn as a shadow instead. */
.analysis-list .analysis-rows thead th {
  position: sticky; top: 0; z-index: 2; background: var(--panel);
  border-bottom: none; box-shadow: inset 0 -1px 0 var(--border);
}
.analysis-table { width: 100%; border-collapse: collapse; }
.analysis-table th {
  text-align: left; font-size: var(--font-head); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); font-weight: 600;
  padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.analysis-table td { font-size: var(--font-data); padding: 4px 8px; white-space: nowrap; }
.analysis-table .mono { font-family: 'JetBrains Mono', monospace; }
.analysis-section td {
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--font-head); padding-top: 12px;
}
.analysis-row { cursor: pointer; }
.analysis-row.dragging { opacity: 0.4; }
/* Where a dragged row will land: a line above or below the row under it. */
.analysis-table tr.drop-before td { box-shadow: inset 0 2px 0 rgb(227, 162, 60); }
.analysis-table tr.drop-after td { box-shadow: inset 0 -2px 0 rgb(227, 162, 60); }
.analysis-row:nth-child(even) { background: rgba(255,255,255,0.07); }
.analysis-row:hover { background: rgba(255,255,255,0.12); }
.analysis-row.selected { background: rgba(227,162,60,0.16); }
.analysis-symbol { font-weight: 700; }
/* The strongest of the symbol's flags (backend/signals.py): green or red for
   an "act" flag leaning one way, amber for anything in progress, grey for
   nothing worth the light. The flags themselves are the hover. */
.analysis-light {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 8px; background: var(--border); vertical-align: middle;
  position: relative; cursor: help;
}
/* A wider hover target than the dot: five pixels all round, which stops
   short of the next light so each keeps its own tooltip. */
.analysis-light::after { content: ''; position: absolute; inset: -5px; }
.analysis-light.green { background: var(--gain); }
.analysis-light.red { background: var(--loss); }
.analysis-light.amber { background: rgb(227, 162, 60); }
/* The Today light: the same colours, for flags the live price raised today
   that the last close did not. Square so it reads apart from the close's
   round light; an empty outline when nothing is new today. */
.analysis-light.today { border-radius: 2px; margin-left: 3px; }
.analysis-light.today.none { background: transparent; box-shadow: inset 0 0 0 1px var(--muted); opacity: 0.6; }
.analysis-trend { white-space: nowrap; }
.analysis-trend.uptrend { color: var(--gain); }
.analysis-trend.downtrend { color: var(--loss); }
/* A trend forming or stalled on the trend lines: not yet confirmed either way. */
.analysis-trend.forming { color: var(--amber); }
.analysis-signals {
  display: flex; flex-direction: column; gap: 3px;
  font-size: var(--font-body); padding: 2px 0 8px;
}
.analysis-flags { list-style: none; margin: 4px 0 0; padding: 0; }
.analysis-flag { padding: 2px 0; }
.analysis-flag.bull { color: var(--gain); }
.analysis-flag.bear { color: var(--loss); }
.analysis-flag.info { color: var(--muted); }
.analysis-sev {
  display: inline-block; min-width: 42px; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; text-transform: uppercase; color: var(--muted);
}
.analysis-support { color: var(--gain); }
.analysis-resistance { color: var(--loss); }
.analysis-muted { color: var(--muted); }
/* The day's change beside a row's price; it takes the price cell's colour. */
.analysis-day { margin-left: 8px; font-size: var(--font-note); }
.analysis-actions { text-align: right; }
.analysis-mini {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 7px; font-size: var(--font-note); cursor: pointer; margin-left: 4px;
}
.analysis-mini:hover { color: var(--text); border-color: var(--muted); }
.analysis-empty { color: var(--muted); font-size: var(--font-body); padding: 8px 2px; }
.analysis-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-bottom: 6px;
}
.analysis-head .analysis-symbol { font-size: 17px; margin-right: 8px; }
.analysis-head .mono { font-family: 'JetBrains Mono', monospace; margin-right: 8px; }
/* The breakdown's story: one line per thing that is true of the chart,
   most important first, labels aligned so the eye can skip to one. */
.analysis-story {
  display: flex; flex-direction: column; gap: 3px;
  font-size: var(--font-body); padding: 2px 0 8px;
}
.analysis-story .mono { font-family: 'JetBrains Mono', monospace; }
.analysis-story .analysis-label {
  display: inline-block; min-width: 72px; color: var(--muted);
  font-size: var(--font-head); text-transform: uppercase; letter-spacing: 0.06em;
}
/* The story's lines recede and what matters in them is lit: bright for a
   fact, green or red for a side, amber for something in progress. Colour
   classes follow .hl so they win at equal specificity. */
.analysis-story > div { color: var(--muted); }
.analysis-story .hl { color: var(--text); }
.analysis-story .hl-strong { font-weight: 600; }
.analysis-story .hl-bull { color: var(--gain); }
.analysis-story .hl-bear { color: var(--loss); }
.analysis-story .hl-warn { color: var(--amber); }
.analysis-levels td { border-top: 1px solid rgba(255,255,255,0.05); }
.analysis-levels tbody tr:nth-child(even) { background: rgba(255,255,255,0.07); }
/* Scoped to the cell: a bare .analysis-why loses to .analysis-table td,
   which is how the reasons came out at the data size. */
.analysis-table td.analysis-why { color: var(--muted); font-size: var(--font-note); white-space: normal; }
.analysis-mas { margin: 8px 0 0; padding-left: 16px; color: var(--muted); font-size: var(--font-body); }
/* The live tape: the day's intraday events, newest first. */
.analysis-tape-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--font-note); color: var(--muted); padding-bottom: 4px;
}
.analysis-tape-head input { vertical-align: middle; margin: 0 4px 0 0; accent-color: var(--amber); }
.analysis-tape-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.analysis-tape-filters select {
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font-size: var(--font-note); cursor: pointer;
}
.analysis-tape-menu { position: relative; }
.analysis-tape-menu summary {
  list-style: none; cursor: pointer; white-space: nowrap; color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 8px;
}
.analysis-tape-menu summary::-webkit-details-marker { display: none; }
.analysis-tape-menu summary::after { content: ' \25BE'; color: var(--muted); }
.analysis-tape-menu-body {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 140px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 9px; box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.analysis-tape-menu-body label { color: var(--text); white-space: nowrap; cursor: pointer; }
/* What a topic or a severity takes in, under its name (2026-09-27): the
   filters are two questions and the menu says which. */
.analysis-tape-menu-body { min-width: 260px; }
.analysis-tape-note {
  display: block; margin-left: 20px; max-width: 300px; white-space: normal;
  color: var(--muted); font-size: var(--font-note);
}
/* A tracking row's right-click menu (analysis.js initRowMenu). */
.analysis-row-menu {
  position: fixed; z-index: 1100; min-width: 110px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.analysis-row-menu[hidden] { display: none; }
.analysis-row-menu-title {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--muted);
  font-size: var(--font-note);
}
.analysis-row-menu label { color: var(--text); white-space: nowrap; cursor: pointer; }
.analysis-row-menu input { vertical-align: middle; margin: 0 6px 0 0; accent-color: var(--amber); }
/* A ticker's own tape settings: the label above the picker, both full width,
   so the menu reads down the way the tape's own filter menu does. */
.analysis-row-menu-field { display: flex; flex-direction: column; gap: 2px; }
.analysis-row-menu-field span {
  color: var(--muted); font-size: var(--font-note); text-transform: uppercase; letter-spacing: 0.06em;
}
.analysis-row-menu-field select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 4px; font-size: var(--font-note);
}
/* The menu's last row: Remove here, Remove all (2026-10-09). */
.analysis-row-menu-remove {
  display: flex; gap: 6px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border);
}
.analysis-row-menu-remove button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 7px; font-size: var(--font-note); cursor: pointer; white-space: nowrap;
}
.analysis-row-menu-remove button:hover { color: var(--text); border-color: var(--muted); }
.analysis-tape-menu-label {
  color: var(--muted); font-size: var(--font-note); text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 2px;
}
.analysis-tape-table td { padding: 2px 6px; font-size: var(--font-body); white-space: nowrap; }
.analysis-tape-table td:last-child { white-space: normal; width: 100%; }
.analysis-tape-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.07); }
/* Where the tape was when you stepped away: everything above a line came in
   while you were not looking. Solid for leaving the tab, dashed for the
   window losing focus, which is the kind that goes with the page. */
.analysis-tape-mark td {
  padding: 0; border-top: 1px solid var(--amber); line-height: 0;
  text-align: right; white-space: nowrap;
}
.analysis-tape-mark.glance td { border-top-style: dashed; }
.analysis-tape-mark button {
  display: inline-block; transform: translateY(-1px);
  background: var(--panel); border: none; padding: 0 4px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  color: var(--amber);
}
.analysis-tape-clear {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--amber); font: inherit;
}
.analysis-tape-table tbody tr.analysis-tape-row.selected { background: rgba(227,162,60,0.16); }
.analysis-tape-symbol {
  background: none; border: none; padding: 0; color: var(--text); cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: var(--font-body);
}
.analysis-tape-symbol:hover { color: var(--amber); }
.analysis-mas .mono { font-family: 'JetBrains Mono', monospace; color: var(--text); }

/* Same +1px bump the rest of the Investments page gets (see below). */
#tab-inv-watchlists .box-handle { font-size: 13px; }

/* Everything below bumps font-size +1px for widgets on the Investments
   page specifically — several of the classes it overrides (.edge-table,
   .box-handle, .candle-chart-hint, .chart-legend/.chart-ohlc/
   .chart-ind-values) are shared with the Trades tab's identical-looking
   widgets, so the override is scoped to #tab-inv-home rather than edited
   in place, which would've bumped the Trades tab too. */
#tab-inv-home .box-handle { font-size: 13px; }
#tab-inv-home .edge-table th { font-size: 13px; }
#tab-inv-home .edge-table td { font-size: 16px; }

/* The trade plan (2026-10-02, backend/plan.py): the verdict word as a badge
   in the list and at the top of the breakdown, the confidence as a number
   coloured by grade, and the plan's block under the read line. */
.analysis-badge {
  display: inline-block; padding: 0 6px; border-radius: 3px; margin-right: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; line-height: 16px;
  color: var(--muted); border: 1px solid var(--border); vertical-align: 1px;
}
.analysis-badge.bull { color: var(--gain); border-color: rgba(76, 175, 80, 0.5); background: rgba(76, 175, 80, 0.10); }
.analysis-badge.bear { color: var(--loss); border-color: rgba(239, 83, 80, 0.5); background: rgba(239, 83, 80, 0.10); }
.analysis-badge.warn { color: var(--amber); border-color: rgba(227, 162, 60, 0.5); background: rgba(227, 162, 60, 0.10); }
.analysis-conf {
  display: inline-block; min-width: 26px; text-align: center; padding: 0 4px; border-radius: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: var(--font-note); font-weight: 700;
  color: var(--muted); border: 1px solid var(--border);
}
.analysis-conf.high { color: var(--gain); border-color: var(--gain); }
.analysis-conf.moderate { color: var(--amber); border-color: var(--amber); }
.analysis-conf.low { color: var(--muted); }
.analysis-plan-cell { white-space: nowrap; }
/* A trade the plan does not rate (plan.standing: low odds, thin reward, no
   new long): its entry, stop and target stay in the row, dimmed — what it
   would be if taken — and its badge is the plain grey one. */
.analysis-table td.analysis-unrated, td.analysis-unrated { opacity: 0.45; }
.analysis-plan-setup { color: var(--muted); font-size: var(--font-note); }
/* Earnings inside a month, beside the ticker; amber inside a week. */
.analysis-earn {
  margin-left: 6px; vertical-align: 1px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  padding: 0 4px; border-radius: 3px; border: 1px solid var(--border); color: var(--muted); cursor: help;
}
.analysis-earn.soon { color: var(--amber); border-color: var(--amber); }
.analysis-risk {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 6px; font-size: var(--font-note); cursor: pointer;
}
.analysis-story .analysis-plan {
  display: flex; flex-direction: column; gap: 3px;
  padding: 4px 8px 6px; margin: 2px 0 4px; border-left: 2px solid var(--amber);
  background: rgba(227, 162, 60, 0.05); border-radius: 0 4px 4px 0;
}
.analysis-story .analysis-plan > div { color: var(--muted); }
.analysis-story .analysis-plan-head .hl { font-weight: 500; }
/* What a book holds of this symbol and the rule it holds it by, under the
   symbol's own plan and in blue rather than the plan's amber: the two are
   answers to different questions and a glance has to tell them apart
   (Spencer, 2026-10-07). One line a book. */
.analysis-story .analysis-book-plan {
  padding: 4px 8px 5px; margin: 0 0 4px; border-left: 2px solid #5B8DEF;
  background: rgba(91, 141, 239, 0.06); border-radius: 0 4px 4px 0;
  color: var(--text); font-size: var(--font-body);
}
.analysis-story .analysis-book-plan .analysis-label { color: #5B8DEF; }
.analysis-story .analysis-book-rule { color: var(--muted); font-size: var(--font-note); margin-top: 1px; }
.analysis-plan-adjust { padding-left: 72px; font-size: var(--font-note); }
/* Which rows of the levels table the plan stands on. */
.analysis-plan-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase;
  padding: 0 4px; border-radius: 3px; border: 1px solid var(--border); color: var(--muted);
}
.analysis-plan-tag.stop { color: var(--loss); border-color: var(--loss); }
.analysis-plan-tag.target { color: var(--gain); border-color: var(--gain); }
.analysis-plan-tag.entry { color: var(--amber); border-color: var(--amber); }

/* The breakdown by horizon (2026-09-27): a line on top saying what kind of
   ticker this is and the verdict that matters for it (backend/playbook.py),
   then Today, the short term and the long term, each under a quiet rule. */
.analysis-story .analysis-read {
  color: var(--text); font-size: var(--font-body);
  padding: 2px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 2px;
}
.analysis-story .analysis-horizon {
  color: var(--muted); font-size: var(--font-note); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 8px; padding-top: 4px; border-top: 1px dashed rgba(255,255,255,0.08);
}

/* The tracking list's tabs: one section on show, the rest a click or a drag
   away. Same amber-underline idiom as the page's other sub-tabs. */
.analysis-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.analysis-tab {
  display: inline-flex; align-items: center; gap: 5px; flex: none; cursor: pointer;
  color: var(--muted); padding: 4px 10px 5px; font-size: 14px; font-weight: 600; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; user-select: none;
}
.analysis-tab:hover { color: var(--text); }
.analysis-tab.active { color: var(--text); border-bottom-color: var(--amber); }
.analysis-tab.drop-tab { background: rgba(227, 162, 60, 0.18); color: var(--text); }
.analysis-tab-count { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.analysis-tab-tools { display: inline-flex; gap: 2px; margin-left: 2px; }
.analysis-tab-tools button {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 0 3px; line-height: 1;
}
.analysis-tab-tools button:hover { color: var(--text); }
.analysis-tab-input {
  width: 110px; font: inherit; font-size: 13px; padding: 1px 4px;
  background: var(--panel); color: var(--text); border: 1px solid var(--amber); border-radius: 3px;
}
.analysis-tab-add {
  flex: none; background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 16px; padding: 2px 8px;
}
.analysis-tab-add:hover { color: var(--text); }
/* Where a dragged tab will land: a line on the near side of the tab under it. */
.analysis-tab.drop-before { box-shadow: inset 2px 0 0 rgb(227, 162, 60); }
.analysis-tab.drop-after { box-shadow: inset -2px 0 0 rgb(227, 162, 60); }


/* --- The algo book (js/tabs/investments/algo.js) ---------------------------
   Its lights first: lit, and pulsing, while it has orders staged and waiting
   to be sent; steady blue while sent ones are working. On the header, the
   Investments and Analysis buttons and the box's handle. */
.algo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 0 3px rgba(227, 162, 60, 0.25);
  animation: stream-dot-pulse 1.6s ease-in-out infinite;
}
.algo-dot:not([hidden]) { display: inline-block; vertical-align: middle; margin-left: 8px; }
.algo-dot.working, .algo-light-pill.working { animation: none; }
.algo-dot.working { background: #5B9BD5; box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.25); }
/* Red while a holding is trading under its stop: the one thing the light says that is about risk, not a to-do. */
.algo-dot.alert { background: var(--loss); box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.25); }
.algo-light-pill.alert { color: var(--loss); background: rgba(239, 83, 80, 0.12); border-color: rgba(239, 83, 80, 0.6); }
.algo-watch .algo-order-why { color: var(--text); }
.algo-light-pill {
  font-family: 'JetBrains Mono', monospace; font-size: var(--font-note); font-weight: 700;
  padding: 3px 10px; border-radius: 10px; cursor: pointer; margin-right: 12px;
  /* It says what it is lit for in words now; a long one is cut, and the whole of it is on hover. */
  max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
  color: var(--amber); background: rgba(227, 162, 60, 0.12); border: 1px solid rgba(227, 162, 60, 0.6);
  animation: stream-dot-pulse 1.6s ease-in-out infinite;
}
.algo-light-pill.working { color: #5B9BD5; background: rgba(91, 155, 213, 0.12); border-color: rgba(91, 155, 213, 0.6); }
@media (prefers-reduced-motion: reduce) { .algo-dot, .algo-light-pill { animation: none; } }
/* The trades queued at the close: steady, a fact rather than a to-do. A problem in any account: bright and flashing
   (Spencer, 2026-10-13: "a bright flashing pill in the dashboard header"). */
.queued-pill { animation: none; color: #5B9BD5; background: rgba(91, 155, 213, 0.12); border-color: rgba(91, 155, 213, 0.6); }
.problems-pill { color: #fff; background: var(--loss); border-color: #ff8a80; animation: problems-flash 0.9s steps(2, jump-none) infinite; }
@keyframes problems-flash { 50% { background: rgba(239, 83, 80, 0.25); color: var(--loss); } }

/* The tabs, the account row and the head stay at the top; the body under
   them is what scrolls (2026-10-04, and a standing rule:
   docs/notes/feedback_frontend_visual_conventions.md). */
.algo-panel { display: flex; flex-direction: column; overflow: hidden; font-size: var(--font-body); }
.algo-panel > .algo-tabs, .algo-panel > .algo-accounts, .algo-panel > .algo-head { flex: none; }
.algo-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: auto; }
/* Column headings stick above their rows inside it. */
.algo-scroll thead th {
  position: sticky; top: 0; z-index: 2; background: var(--panel);
  border-bottom: none; box-shadow: inset 0 -1px 0 var(--border);
}
.algo-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.algo-account { font-weight: 600; }
.algo-actions { margin-left: auto; display: flex; gap: 6px; }
.algo-actions button, .algo-setup button, .algo-order button, .algo-list-head button {
  font-size: var(--font-note); padding: 2px 8px; border-radius: 3px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
}
.algo-actions button:hover, .algo-setup button:hover, .algo-order button:hover, .algo-list-head button:hover { color: var(--text); border-color: var(--muted); }
.algo-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-bottom: 8px; }
.algo-stats > div { display: flex; flex-direction: column; }
.algo-stats .mono { font-family: 'JetBrains Mono', monospace; font-size: var(--font-data); }
.algo-k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.algo-pct { font-size: var(--font-note); }
.algo-panel .up { color: var(--gain); }
.algo-panel .down { color: var(--loss); }
.algo-spark { margin-left: auto; }
.algo-setup { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.algo-setup select, .algo-setup input {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 3px;
  padding: 3px 6px; font-size: var(--font-body);
}
.algo-setup input { width: 120px; font-family: 'JetBrains Mono', monospace; }
.algo-note { color: var(--muted); font-size: var(--font-note); line-height: 1.45; margin: 6px 0; }
/* The Books tab (js/tabs/investments/books.js): the holdings, the orders and the record, each a striped table under
   a small head; and in a person's widget two tiers of tabs, the accounts and the books, a sparkline at the end of
   each row. */
.magnum-section { margin: 10px 0 4px; font-size: var(--font-head); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.books-tier { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.books-tier .algo-accounts { margin: 0; }
.books-tier .algo-spark { margin-left: auto; flex: none; }
/* The person card's curve, top right beside the two tiers, and the strategy card (2026-10-13; lib/mini-curve.js). */
.books-tiers { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 4px; }
/* Above the curve where a narrow widget's tabs run under it, so they take their clicks (2026-11-03: NJG on the laptop). */
.books-tiers-left { flex: 1 1 auto; min-width: 0; position: relative; z-index: 1; }
.books-curve { flex: none; width: 300px; }
.books-curve-read { font-size: var(--font-note); text-align: right; margin-bottom: 2px; white-space: nowrap; }
.mini-curve { display: block; overflow: visible; }
.books-curve-ranges { margin: 6px 0 4px; flex-wrap: wrap; row-gap: 3px; }
.books-curve-readout { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 2px; flex-wrap: wrap; }
.books-curve-big { font-size: 20px; font-weight: 600; }
.books-curve-chart { margin: 4px 0; cursor: crosshair; }
.books-curve-switches { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }
.books-curve-switches button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 3px; cursor: pointer;
  font: inherit; font-size: var(--font-note); font-weight: 600; padding: 2px 9px;
}
.books-curve-switches button:hover:not(:disabled) { color: var(--text); }
.books-curve-switches button.on { color: var(--text); border-color: var(--amber); }
.books-curve-switches button:disabled { opacity: 0.35; cursor: default; }
.books-missing { color: var(--amber); font-size: var(--font-note); margin: 6px 0; }
/* An account's split between its two books, in its All tab's title: a click edits it in place. */
.books-target-show { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.books-target-show:hover { text-decoration: underline dotted; }
.books-target { display: inline; margin: 0; }
.books-target-input { width: 3.5em; font: inherit; padding: 0 2px; }
.books-target-now { font-weight: 400; }
.books-options { flex-basis: 100%; order: 1; }        /* an account's options, a line under its split and rule 3 */
/* The record's orders under a row opened: the book's name as wide as it is, the order after it. */
.books-record td.books-note { width: 1%; white-space: nowrap; padding-right: 16px; }
/* An add or a withdrawal read back under the box, waiting on Confirm. */
.books-preview { margin: 6px 0 10px; padding: 2px 8px 8px; border: 1px solid rgba(227, 162, 60, 0.6); border-radius: 4px; }
.books-preview .magnum-section { margin-top: 4px; }
.books-preview-head { font-weight: 600; margin: 2px 0 4px; }
.books-preview-rule3 { margin: 0 0 6px; padding-left: 8px; border-left: 2px solid var(--amber, #e3a23c); }
.books-preview .inv-oe-actions { justify-content: flex-end; margin-top: 6px; }
.books-target-show.pending { color: var(--amber, #e3a23c); outline: 1px dashed var(--amber, #e3a23c); outline-offset: 1px; }
.books-settings { border-color: var(--amber, #e3a23c); background: rgba(227, 162, 60, 0.06); }
.magnum-table td.books-note { color: var(--muted); font-size: var(--font-note); white-space: nowrap; }
.magnum-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.07); }
.magnum-table th.num, .magnum-table td.num { text-align: right; }
.magnum-table td.num { font-family: 'JetBrains Mono', monospace; font-size: var(--font-data); }
.magnum-table td { padding: 2px 6px; }
.magnum-failed { color: var(--loss); }
.magnum-rule.out { color: var(--loss); }
.magnum-rule.hold { color: var(--gain); }
/* Time to add, 1 to 5: a badge beside the rule, red at 1 through green at 5. */
.magnum-gauge { margin-left: 2px; }
.magnum-gauge.l1 { color: var(--loss); border-color: rgba(239, 83, 80, 0.5); }
.magnum-gauge.l2 { color: var(--amber); border-color: rgba(227, 162, 60, 0.5); }
.magnum-gauge.l4 { color: var(--gain); border-color: rgba(76, 175, 80, 0.5); }
.magnum-gauge.l5 { color: var(--gain); border-color: rgba(76, 175, 80, 0.5); background: rgba(76, 175, 80, 0.10); }
/* A gauge whose number is not the one last clicked (2026-10-13): it glows until clicked. */
.magnum-gauge.changed { cursor: pointer; animation: gauge-changed 1.6s ease-in-out infinite; }
@keyframes gauge-changed { 50% { box-shadow: 0 0 0 2px rgba(227, 162, 60, 0.55), 0 0 10px rgba(227, 162, 60, 0.45); } }
.magnum-rule.switch { color: var(--accent, var(--gain)); font-weight: 600; }
/* The Rules tab's breakdown (2026-10-10): the book's live rules, a section at a time. */
.algo-rules { margin: 2px 0 8px; }
.algo-rules li { line-height: 1.45; }
.algo-error { color: var(--loss); font-size: var(--font-note); margin-bottom: 6px; }
.algo-section {
  font-size: var(--font-head); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  margin: 10px 0 4px; padding-top: 6px; border-top: 1px solid var(--border);
}
.algo-section.lit { color: var(--amber); }
.algo-section .analysis-muted { text-transform: none; letter-spacing: 0; font-size: var(--font-note); }
.algo-order { display: flex; align-items: baseline; gap: 8px; padding: 3px 4px; border-radius: 3px; }
.algo-order:nth-child(even) { background: rgba(255, 255, 255, 0.07); }
.algo-order.reviewing { outline: 1px solid var(--amber); }
.algo-order .mono { font-family: 'JetBrains Mono', monospace; font-size: var(--font-data); }
.algo-order-sym { min-width: 56px; }
.algo-order-size { min-width: 76px; color: var(--muted); }
.algo-order-share { min-width: 48px; color: var(--text); cursor: help; }
/* What he sold by instruction and the book is leaving alone, under the command box. */
.algo-kept { font-size: var(--font-note); margin: -2px 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.algo-kept button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: pointer;
  font: inherit; font-size: var(--font-note); padding: 0 8px; margin-right: 6px;
}
.algo-kept button:hover { color: var(--text); }
.algo-order-why { flex: 1; color: var(--muted); font-size: var(--font-note); }
.algo-order-actions { display: flex; gap: 6px; white-space: nowrap; }
.algo-order .algo-review, .algo-list-head .algo-review { color: var(--amber); border-color: rgba(227, 162, 60, 0.6); }
/* A rated entry the book has no room for: the flag. Its buttons wrap under
   it on a narrow box rather than squeezing the line. */
.algo-order.algo-waiting { flex-wrap: wrap; }
.algo-order .analysis-conf { margin-left: 6px; }
.algo-order-why .hl { color: var(--text); }
.algo-swap {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 3px;
  font-family: 'JetBrains Mono', monospace; font-size: var(--font-note); padding: 1px 4px;
}
.algo-review-evidence { color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 2px; }
.algo-review-sign { cursor: help; }
.algo-table { width: 100%; }
.algo-why { list-style: none; color: var(--text); font-size: var(--font-note); line-height: 1.5; }
.algo-why li { padding: 1px 0; }
.algo-ranking { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.algo-rank {
  font-family: 'JetBrains Mono', monospace; font-size: var(--font-note); padding: 1px 6px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--muted);
}
.algo-rank.top { color: var(--text); }
/* The command box, and the list it makes: a tick a line, and one Execute. */
.algo-command { margin: 2px 0 6px; }
.algo-command .inv-cmd-input { flex: 1; width: auto; min-width: 0; }
.algo-list-head { display: flex; align-items: baseline; gap: 10px; }
.algo-list-head > span:first-child { flex: 1; }
.algo-tick { accent-color: var(--amber); cursor: pointer; margin: 0; align-self: center; }
.algo-order.off { opacity: 0.45; }
.algo-order.off .algo-order-why { text-decoration: line-through; }
/* What he left out of the list (algo.js leftOutHtml): dimmed, with Put back. */
.algo-order.algo-left .algo-order-why, .algo-order.algo-left .algo-order-sym { opacity: 0.55; }
.algo-line { font-size: var(--font-note); color: var(--muted); white-space: normal; max-width: 340px; text-align: right; }
.algo-line.up { color: var(--gain); }
.algo-line.down { color: var(--loss); }
.algo-line.warn { color: var(--amber); }
.algo-exec-said { font-size: var(--font-note); padding: 3px 4px; color: var(--muted); }
.algo-exec-said.up { color: var(--gain); }
.algo-exec-said.down { color: var(--loss); }
.algo-exec-said.warn { color: var(--amber); }
/* The widget's tabs: Portfolio and History; and under Portfolio, the accounts, a book each. */
.algo-tabs { margin: -2px 0 8px; border-bottom: 1px solid var(--border); }
.algo-accounts { display: flex; margin: 0 0 8px; }
.algo-accounts[hidden] { display: none; }
.algo-accounts button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: pointer;
  font: inherit; font-size: var(--font-note); font-weight: 600; padding: 3px 12px;
}
.algo-accounts button:hover { color: var(--text); }
.algo-acct-bal { font-family: 'JetBrains Mono', monospace; font-weight: 400; color: var(--muted); margin-left: 4px; }
.algo-confirm { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); font-size: var(--font-note); }
.algo-actions .algo-danger { color: var(--loss); border-color: rgba(239, 83, 80, 0.6); }
.algo-correct { flex-wrap: wrap; }
.algo-correct input { width: 92px; }
.algo-correct .algo-c-sym { width: 80px; text-transform: uppercase; }
.algo-setup .algo-c-note { flex: 1; min-width: 200px; font-family: inherit; }
.algo-seg { display: inline-flex; }
.algo-seg button { border-radius: 0; margin-left: -1px; }
.algo-seg button:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.algo-seg button:last-child { border-radius: 0 3px 3px 0; }
.algo-seg button.on { color: var(--text); border-color: var(--amber); position: relative; }
/* History: a row a day and account, opening onto what happened. */
.algo-hsummary { margin: 4px 0 10px; }
.algo-hrows { margin-top: 4px; }
.algo-hrow {
  display: flex; align-items: baseline; gap: 8px; padding: 4px 4px; border-radius: 3px; cursor: pointer; user-select: none;
}
.algo-hrow:nth-child(even) { background: rgba(255, 255, 255, 0.07); }
.algo-hrow:hover, .algo-hrow.open { background: rgba(227, 162, 60, 0.10); }
.algo-hrow .mono { font-family: 'JetBrains Mono', monospace; font-size: var(--font-data); }
.algo-hrow.before { opacity: 0.6; }
.algo-hrow.chapter { border-top: 1px solid var(--gain); margin-top: 4px; }
.algo-caret { color: var(--muted); width: 10px; flex: none; }
.algo-hday { color: var(--muted); flex: none; }
.algo-hsum { flex: 1; }
.algo-hbody { padding: 4px 8px 10px 22px; border-left: 2px solid rgba(227, 162, 60, 0.35); margin: 0 0 6px 8px; }
.algo-hbody .algo-stats { margin-bottom: 4px; }
.algo-htrades td { vertical-align: baseline; }
.algo-hwhy { color: var(--muted); font-size: var(--font-note); line-height: 1.4; max-width: 420px; }
.algo-hitem { font-size: var(--font-note); padding: 1px 0; }
.algo-hnote { color: var(--text); font-size: var(--font-note); margin-bottom: 6px; }
.algo-rank.held { border-color: var(--gain); }


/* A swap's shortfall: add it, make room for it, or leave it out. */
.algo-swap-rest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 6px; font-size: var(--font-note); }
.algo-swap-rest button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: pointer;
  font: inherit; font-size: var(--font-note); padding: 1px 8px;
}
.algo-swap-rest button.on { color: var(--text); border-color: var(--amber); }

/* A book's holding opens on the tab's chart and breakdown. */
.algo-table tr[data-hold-symbol] { cursor: pointer; }

/* An entry's amount: what the book recommends, and the box he can change it in. */
.algo-entry-amount { display: inline-flex; align-items: center; gap: 4px; font-size: var(--font-note); color: var(--muted); }
.algo-entry-amount input {
  width: 84px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-size: var(--font-note); text-align: right;
}

/* A ticket (algo.js ticketRow): one line on To Send, opening into its steps. */
.algo-ticket.open { border-left: 2px solid var(--amber); }
.algo-ticket[data-ticket-row] { cursor: pointer; }
.algo-ticket-mine { margin-left: 6px; font-size: var(--font-note); color: var(--amber); }
.algo-ticket-steps { margin: 0 0 8px 26px; padding: 4px 0 6px 10px; border-left: 1px solid var(--border); font-size: var(--font-note); }
/* An open ticket's preview (algo.js wouldHtml): what the list would be with it applied. */
.algo-ticket-would { padding: 4px 0 2px; font-size: var(--font-note); line-height: 1.45; }
.algo-ticket-would:empty { display: none; }
.algo-would-k { color: var(--amber); }
.algo-would-err { color: var(--loss); }
.algo-ticket-step { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; }
.algo-ticket-n {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--muted); font-size: 10px;
}
.algo-ticket-step button, .algo-ticket-foot button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); cursor: pointer;
  font: inherit; font-size: var(--font-note); padding: 1px 8px;
}
.algo-ticket-step button.on { color: var(--text); border-color: var(--amber); }
.algo-ticket-step input {
  width: 96px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-size: var(--font-note); text-align: right;
}
.algo-ticket-step select { max-width: 260px; }
.algo-ticket-foot { display: flex; gap: 6px; padding-top: 4px; }
.algo-ticket-foot button.algo-review { color: var(--text); border-color: var(--amber); }

/* The money line's suggestions (algo.js moneySteps), and a sale's Now line (2026-10-09). */
.algo-ticket-steps select.algo-swap { max-width: 280px; }
.algo-ticket-now { color: var(--loss); font-size: var(--font-note); }
.algo-title .algo-light-pill { margin: 0 0 0 10px; cursor: default; }

/* A trade queued at the close on the Books widget (2026-10-14), as the phone's Breakdown shows it: an amber box at the
   top from that close to the next day's, the reading before the trade under it in grey, a dot on the book's tab. */
.books-queued-dot { color: #E3A23C; font-size: 9px; vertical-align: middle; }
.books-queued-box { margin: 8px 0 10px; padding: 6px 10px 8px; border: 1px solid #E3A23C; border-radius: 6px; background: rgba(227, 162, 60, 0.08); }
.books-queued-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #E3A23C; margin: 2px 0 4px; }
.books-queued-trade { margin: 4px 0; line-height: 1.45; }
.books-queued-name { font-weight: 700; margin-right: 6px; }
.books-queued-cond { color: #E3A23C; }
.books-settled { opacity: 0.5; filter: grayscale(1); }
.books-settled-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 10px; }

/* The Orders line's Retry all (2026-10-15): pinned to the right edge of the box's view, the line's text running on
   under it; the line stays put while the box scrolls sideways. */
.books-orders-head { position: sticky; left: 0; display: flex; align-items: center; min-height: 20px; white-space: nowrap;
  overflow: hidden; z-index: 1; }
.books-retry-all { position: absolute; right: 0; top: 50%; transform: translateY(-50%); background: #fff; color: #0b0e13;
  border: 1px solid #fff; border-radius: 4px; padding: 1px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: none; cursor: pointer; box-shadow: -10px 0 8px var(--panel); }
.books-retry-all:hover { background: #e7ebf3; }
.books-retry-all:disabled { opacity: 0.6; cursor: default; }
/* A book held by a refused order (2026-10-23): the line says so, and Go on without it, as Retry all, at its end. */
.books-hold { position: sticky; left: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-transform: none; }
.books-hold button { background: #fff; color: #0b0e13; border: 1px solid #fff; border-radius: 4px; padding: 1px 10px;
  font-size: 11px; font-weight: 700; cursor: pointer; }
.books-hold button:hover { background: #e7ebf3; }
.books-hold button:disabled { opacity: 0.6; cursor: default; }

/* The books' pills (js/lib/light-pills.js, 2026-10-21): a pill a kind, and on hover a panel by person, then account,
   a person's line a link to their widget. The dots on a person's tab and each account's tab say the same. */
.book-pills { display: contents; }
.book-pill { animation: none; }
.pill-panel {
  position: fixed; z-index: 10001; min-width: 160px; max-width: 360px; padding: 6px 0;
  font-family: 'JetBrains Mono', monospace; font-size: var(--font-note);
  background: var(--panel, #14171c); border: 1px solid var(--border, #2a2f37); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.pill-panel[hidden] { display: none; }
.pill-panel-person { padding: 3px 12px; font-weight: 700; color: var(--text); cursor: pointer; }
.pill-panel-person:hover { background: rgba(255, 255, 255, 0.06); color: var(--amber); }
.pill-panel-account { padding: 1px 12px 1px 26px; color: var(--muted, #8a93a0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-panel-line { padding: 3px 12px; color: var(--text); }
.pill-panel-how { margin-top: 4px; padding: 4px 12px 0; border-top: 1px solid var(--border, #2a2f37); color: var(--muted, #8a93a0); font-size: 11px; }
.algo-dot.who-dot:not([hidden]) { margin-left: 6px; width: 7px; height: 7px; }
.books-tier button .algo-dot.who-dot { margin-left: 6px; }
/* A trade queued in the account picked (2026-10-26): small and steady beside the account tabs, cut to fit. */
.books-queued-pills { display: contents; }
.books-tier .books-queued-pill { flex: 0 1 auto; min-width: 0; margin: 0; padding: 2px 8px; font-weight: 600; cursor: default; }
