/* TrueVest's stylesheet, built by scripts/build_css.py from the files in
   output/static/css/, joined in name order. Edit those, not this file;
   each one starts below at its name. */

/* ===== css/01-base.css ===== */

/* ---------- Base: colour tokens for both themes, page defaults, gain and loss ---------- */

/* The display face (--font-display). Relative to style.css, which is
   served from /static. "swap": the system face shows until it arrives. */
@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/libre-franklin-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url("fonts/libre-franklin-latin-700-normal.woff2") format("woff2");
}

:root {
  /* Semantic accent colors, as fills (bars, dots, pie slices, tints):
     unchanged between themes. */
  --color-gain: #2ecc71;
  --color-loss: #e74c3c;
  /* The same three as TEXT. The fills are too light to read as text on
     white -- 2.1:1, 3.8:1 and 2.25:1, where WCAG AA asks 4.5:1 -- so light
     mode writes them in deeper shades that pass on white and on their own
     tinted pills (5.9, 6.5 and 6.0 on white). Dark mode reads the fills
     themselves, which pass on navy; only the red is lifted a little there. */
  --color-gain-text: #16733a;
  --color-loss-text: #b91c1c;
  --color-highlight-text: #7d5f12;
  --color-neutral: #95a5a6;
  /* A chart bar that is neither a gain nor a loss (ChartKit.SECTOR_BAR). */
  --color-bar: #3498db;
  /* Warm gold accent (inspired by fund-fact-sheet dashboards like
     VanEck's) — replaces the previous blue. Content sitting ON a
     highlight-filled background (button text, active-item text) uses
     --color-on-highlight, a dark tone, rather than white: gold is light
     enough that white text on it reads poorly, the same reason the
     reference site sets dark text on its gold "Buy Now" button. */
  --color-highlight: #c9a961;
  --color-on-highlight: #1a1a2e;

  /* Table header banner (VanEck-style): same navy as --color-on-highlight,
     but named for its own role. Fixed in :root, not overridden by the
     dark-theme block below, so it reads as a constant branded banner
     regardless of light/dark mode — matching the reference site, whose
     table header doesn't change with a site-wide theme toggle. */
  --color-table-header-bg: #1a1a2e;
  --color-table-header-text: #f5f5fa;

  /* Light theme (default) */
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-border: #ddd;
  --color-text: #2c2c2c;
  --color-text-muted: #6b7280;
  --color-error-bg: #fdecea;
  /* A selected item filled solid. Its own pair, not the table header's:
     that navy is the same in both themes, and on a dark card (#141a3d)
     it was 1.01:1, so nothing looked selected. */
  --color-selected-bg: #1a1a2e;
  --color-selected-text: #f5f5fa;
  /* Gold (--color-highlight) means one thing: the reader's own -- a move,
     a limit they wrote, a target they set -- plus the one primary action.
     Everything that only says "this one", "here" or "you're pointing at
     it" uses these instead. */
  --color-focus: #1a1a2e;
  --color-fill-neutral: #566078;
  --color-hover-bg: rgba(26, 26, 46, 0.06);
  /* What the browser draws itself: a date field's calendar, a select's
     list, checkboxes, scrollbars. */
  color-scheme: light;

  /* Native OS UI font first on each platform (crisper/more refined than
     always falling back to Segoe UI, including on Windows itself once a
     Variable build is available), proportional-sans fallbacks after. */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  /* Monospace is for codes and keys only (a recovery code, a pasted
     list). Windows has no Monaco, and its Courier New is about a pixel
     wide at 14px, so money set in it read pale and took a third more
     width. */
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, Monaco, monospace;
  /* Totals and headings only: Libre Franklin, the open version of the
     face on American financial forms, served from /static/fonts (the
     content policy allows only our own files). Everything else keeps
     the system face above. */
  --font-display: "Libre Franklin", var(--font-body);

  /* Type scale, in px so a rem default in one browser can't move it.
     Seven sizes and two weights (400 and 600; 700 only for the total).
     A size between these is a size this app doesn't use. */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 48px;

  /* Two radii: controls (buttons, fields, chips) and containers
     (cards, dialogs). A pill or a circle is a shape, not a third. */
  --radius-control: 4px;
  --radius-dialog: 8px;

  /* Spacing steps. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

/* Dark theme: system preference by default (unless the user picked "light"
   explicitly), or an explicit choice via the toggle (persisted to
   localStorage, applied as data-theme by an inline script in <head> before
   first paint so there's no flash of the wrong theme). Deep navy rather
   than neutral gray, to pair with the gold accent above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0d1128;
    --color-surface: #141a3d;
    --color-border: #2a3163;
    --color-text: #e8e8f0;
    --color-text-muted: #8b90b8;
    --color-error-bg: rgba(231, 76, 60, 0.15);
    --color-gain-text: #2ecc71;
    --color-loss-text: #f0675a;
    --color-highlight-text: #c9a961;
    --color-selected-bg: #e8e8f0;
    --color-selected-text: #141a3d;
    --color-focus: #e8e8f0;
    --color-fill-neutral: #8b90b8;
    --color-hover-bg: rgba(232, 232, 240, 0.08);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --color-bg: #0d1128;
  --color-surface: #141a3d;
  --color-border: #2a3163;
  --color-text: #e8e8f0;
  --color-text-muted: #8b90b8;
  --color-error-bg: rgba(231, 76, 60, 0.15);
  --color-gain-text: #2ecc71;
  --color-loss-text: #f0675a;
  --color-highlight-text: #c9a961;
  --color-selected-bg: #e8e8f0;
  --color-selected-text: #141a3d;
  --color-focus: #e8e8f0;
  --color-fill-neutral: #8b90b8;
  --color-hover-bg: rgba(232, 232, 240, 0.08);
  color-scheme: dark;
}

/* Paper is white whatever the theme (three :root beat the dark theme's
   selectors, as 55-research-page.css's print colours do). */
@media print {
  :root:root:root {
    color-scheme: light;
  }
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute's built-in `display: none` comes from the
   browser's user-agent stylesheet — the lowest-specificity layer, so it
   silently loses to ANY author rule that sets `display` on the same
   element (e.g. `.research-list-item { display: flex; }`). That's a real
   bug class, not a hypothetical one: it's exactly what let a "Show Top 5"
   toggle flip its state and label while every row stayed visibly on
   screen. One global override beats every future instance of it, rather
   than requiring a per-class `[hidden]` patch each time (a few of those
   already existed — modal/loading-overlay/account-field-group — and
   still missed this one). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
}

h1 {
  font-size: var(--text-2xl);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
  margin: 0 0 0.75rem;
}

/* Figures: the body face with every digit the same width, so a column
   of dollars lines up without a typewriter face. The class keeps its old
   name because 200-odd templates and scripts use it. */
.mono {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
}

/* A code or key to read character by character. */
.code,
code,
kbd {
  font-family: var(--font-mono);
}

/* On the scale, not the browser's 13px or 0.83em. */
code,
kbd {
  font-size: var(--text-sm);
}

small {
  font-size: var(--text-xs);
}

/* Controls don't inherit the page's font by default, so buttons and
   fields drew in Arial beside Segoe UI text. */
button,
input,
select,
textarea {
  font-family: inherit;
}

/* A button with no size of its own drew at the browser's 13.33px. */
button {
  font-size: var(--text-sm);
}

/* Figures in tables and inputs line up. */
table,
input {
  font-variant-numeric: tabular-nums;
}

.gain {
  color: var(--color-gain-text);
}

.loss {
  color: var(--color-loss-text);
}

/* Small directional marker so gain/loss doesn't rely on color alone to
   read at a glance — the same idea as the up/down triangle next to a
   fund's NAV on a fact-sheet page. No white-space: nowrap here — a
   header stat like Daily Change has a parenthetical percentage after a
   space ("+47.60 (+0.13%)") that needs to be free to wrap onto a second
   line inside its tile rather than overflow past its border. */
.gain::before {
  content: "\25B2 ";
  font-size: 0.75em;
}

.loss::before {
  content: "\25BC ";
  font-size: 0.75em;
}

.hint {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* All Portfolios' read-only note: one slim line above the holdings, not
   a box. A second box under it, the delayed-prices disclaimer, moved into
   the header beside "Data as of" (.price-disclaimer). */
.combined-view-hint {
  margin: 0 0 0.75rem;
  font-size: var(--text-xs);
}

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

.exposure-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.75rem;
}

.exposure-search-input {
  flex: 1 1 260px;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.exposure-search-input:focus {
  outline: none;
  border-color: var(--color-highlight);
}

/* ===== css/02-layout.css ===== */

/* ---------- Split-view layout: portfolio sidebar + main content ---------- */

.app-layout {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* Off-canvas drawer controls only exist below the 720px breakpoint --
   hidden here so desktop/tablet layout is untouched. */
.sidebar-toggle-btn,
.sidebar-close-btn,
.sidebar-backdrop {
  display: none;
}

/* Phone navigation (app-shell.js) -- shown only below 720px. */
.bottom-nav,
.quick-add-btn,
.switcher-name,
.switcher-caret {
  display: none;
}

.action-sheet h2 {
  margin: 0 0 0.75rem;
}

.action-sheet-list {
  display: grid;
  gap: 0.4rem;
}

.action-sheet-item {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  min-height: 52px;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.action-sheet-item span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.action-sheet-danger strong {
  color: var(--color-loss-text);
}

/* Mobile-only tab dropdown -- desktop/tablet keeps the .tab-btn strip. */
.tab-select {
  display: none;
}

/* Groups .tab-select + the 7 .tab-btns apart from Add Holding/Export
   HTML so the two button groups can wrap onto separate mobile rows
   independently (see the 720px override below) -- `contents` makes the
   wrapper invisible to desktop's flex layout, so .tab-nav's children
   lay out exactly as if it weren't there. */
.tab-scroll {
  display: contents;
}

/* ===== css/03-sidebar.css ===== */

/* ---------- The sidebar: net worth, accounts, groups, Recent, its footer ---------- */

/* A column of three: .sidebar-top (search, All Portfolios, Net Worth)
   and .sidebar-bottom (the footer) stay put, and only .sidebar-scroll,
   the account list, scrolls. The whole sidebar used to scroll as one:
   with 27 accounts it was 2,898px tall in an 800px window, and Net
   Worth, the Add buttons and the footer sat 2,500px down. */
.portfolio-sidebar {
  width: 230px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  padding: 1.25rem 0.75rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.sidebar-top,
.sidebar-bottom {
  flex-shrink: 0;
}

.sidebar-bottom {
  padding-bottom: 1rem;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -0.75rem;
  padding: 0.25rem 0.75rem 0.5rem;
  border-top: 1px solid var(--color-border);
  /* Theme-matched rather than the browser's bulky native scrollbar (with
     its up/down arrow buttons on Windows). */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-control);
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.sidebar-head .sidebar-title {
  flex: 1;
  margin: 0;
}

.sidebar-filter {
  position: relative;
  margin-bottom: 0.6rem;
}

.sidebar-filter-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.sidebar-filter-input:focus {
  outline: none;
  border-color: var(--color-focus);
}

/* The gold border alone was too faint to read as focus from the keyboard. */
.sidebar-filter-input:focus-visible {
  box-shadow: 0 0 0 1px var(--color-focus);
}

/* The "/" that jumps to the search (sidebar.js), shown in the box until
   it's used: on a keyboard's screen only, and gone once the box has focus
   or text. Nobody found the shortcut from the guide alone. */
.sidebar-filter-key {
  display: none;
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  min-width: 1.1rem;
  padding: 0 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .sidebar-filter-key {
    display: block;
  }

  .sidebar-filter-input:focus + .sidebar-filter-key,
  .sidebar-filter-input:not(:placeholder-shown) + .sidebar-filter-key {
    display: none;
  }
}

.sidebar-title {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}

.portfolio-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.portfolio-sidebar .portfolio-list-pinned {
  margin-bottom: 0.4rem;
}

/* All Portfolios heads the list it adds up: bold like a portfolio, its
   total in the same column as theirs. */
.sidebar-all .portfolio-item {
  font-weight: 600;
}

.portfolio-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.15rem;
}

.portfolio-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.portfolio-item {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-control);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
  /* Truncate rather than wrap: a long name wrapping to several lines
     visually "stretches" the row (and pushes the whole list taller,
     which is what was triggering the scrollbar in the first place) far
     worse than a one-line ellipsis does. The full name is still
     available via the title attribute (native hover tooltip). */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portfolio-item:hover {
  background: var(--color-bg);
}

.portfolio-item.active {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
  font-weight: 600;
}

/* Marks the seeded "Sample Portfolio" (item 6) in the sidebar list --
   same gold "notice" accent as .risk-badge-fair/.welcome-card's top
   border, not a new color, so it reads as "heads up" rather than an
   error. */
.sample-tag {
  align-self: flex-start;
  margin: 0.1rem 0 0 0.6rem;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-control);
  background: var(--color-hover-bg);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* One line per account: name (truncated, full name in the tooltip) and
   value. The tax type is in the text for search and the tooltip, not on
   screen. Scoped to the sidebar: Manage Portfolios lists .portfolio-row
   too. */
.portfolio-sidebar .portfolio-row,
.portfolio-sidebar .manual-account-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 0 0.05rem;
}

.portfolio-sidebar .portfolio-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  font-size: var(--text-sm);
}

.row-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-type {
  display: none;
}

.row-value {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.row-value.liability {
  color: var(--color-loss-text);
}

.portfolio-item.active .row-value {
  color: inherit;
}

/* ⋯ per row: Edit and Delete, which used to sit on every row as two
   icons. With a mouse it appears over the value on hover or focus, so a
   long name keeps the value's width; on touch it's always there. */
.row-menu {
  flex-shrink: 0;
  position: relative;
}

/* Above the rows after it -- each row is positioned, so without this the
   next ones painted over the open menu's Edit and Delete. */
.row-menu[open] {
  z-index: 30;
}

.row-menu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-control);
  color: var(--color-text-muted);
  font-size: var(--text-md);
  cursor: pointer;
}

.row-menu > summary::-webkit-details-marker,
.sidebar-add-menu > summary::-webkit-details-marker {
  display: none;
}

.row-menu > summary:hover,
.row-menu[open] > summary {
  background: var(--color-bg);
  color: var(--color-text);
}

@media (hover: hover) {
  .portfolio-sidebar .row-menu {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
  }

  .portfolio-sidebar .portfolio-row:hover .row-menu,
  .portfolio-sidebar .manual-account-row:hover .row-menu,
  .portfolio-sidebar .row-menu:focus-within,
  .portfolio-sidebar .row-menu[open] {
    opacity: 1;
  }

  .portfolio-sidebar .portfolio-row:hover .row-value,
  .portfolio-sidebar .manual-account-row:hover .row-value,
  .portfolio-sidebar .portfolio-row:focus-within .row-value,
  .portfolio-sidebar .manual-account-row:focus-within .row-value {
    visibility: hidden;
  }
}

.sidebar-add-menu {
  position: relative;
}

.sidebar-add-btn {
  list-style: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.sidebar-add-btn:hover,
.sidebar-add-menu[open] > .sidebar-add-btn {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* + Add's three choices, each with what it adds under its name, so the
   menu is wider and its lines wrap: it stays inside the sidebar, which
   clips what overflows it. */
.sidebar-add-menu .sidebar-menu {
  width: 12.5rem;
}

.sidebar-add-menu .sidebar-menu .sidebar-menu-item {
  white-space: normal;
}

.menu-item-title {
  display: block;
  font-weight: 600;
}

.menu-item-hint {
  display: block;
  margin-top: 0.1rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* The popover both menus open: under its button, right-aligned. */
.sidebar-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  display: grid;
  min-width: 150px;
  padding: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

/* Near the bottom of the list the menu opens upwards instead, rather
   than running out of sight below the scroll area (sidebar.js). */
.sidebar-menu.opens-up {
  top: auto;
  bottom: calc(100% + 4px);
}

.sidebar-menu .sidebar-menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: var(--radius-control);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.sidebar-menu .sidebar-menu-item:hover,
.sidebar-menu .sidebar-menu-item:focus-visible {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-menu .account-delete-btn:hover,
.sidebar-menu .manual-account-delete-btn:hover {
  background: var(--color-error-bg);
  color: var(--color-loss-text);
}

.portfolio-edit-btn,
.manual-account-edit-btn,
.account-edit-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.portfolio-edit-btn:hover,
.manual-account-edit-btn:hover,
.account-edit-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.portfolio-delete-btn,
.manual-account-delete-btn,
.account-delete-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-md);
  line-height: 1;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-control);
  cursor: pointer;
  /* On top of the row's own 4px flex gap from the edit button next to it --
     a destructive tap sitting nearly flush against a benign one is a
     documented mobile mis-tap risk, so it gets its own extra buffer
     rather than sharing the row's general spacing. */
  margin-left: 0.5rem;
}

.portfolio-delete-btn:hover,
.manual-account-delete-btn:hover,
.account-delete-btn:hover {
  background: var(--color-error-bg);
  color: var(--color-loss-text);
}

.sidebar-title-secondary {
  margin-top: 0.5rem;
}

/* One group per portfolio (dashboard.py's _sidebar_groups), plus one for
   manual accounts. The chevron shows or hides the group (remembered, see
   sidebar.js); the name opens the whole portfolio. One line since v2.12.0:
   the name truncates before the total does, and the total ends where an
   account's value does (the same 0.5rem in from the edge), so the figures
   read down one column. They stacked, a second grey line per portfolio
   with its total under the name and the accounts' to the right. */
.sidebar-group {
  margin-top: 0.35rem;
}

.sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 2rem;
  padding: 0.2rem 0.5rem 0.2rem 0;
  box-sizing: border-box;
  border-radius: var(--radius-control);
}

.sidebar-group-header:not(.is-current):hover {
  background: var(--color-hover-bg);
}

/* The whole portfolio is the view: filled, as an account is when it is. */
.sidebar-group-header.is-current {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.sidebar-group-header.is-current .sidebar-group-link,
.sidebar-group-header.is-current .sidebar-group-meta,
.sidebar-group-header.is-current .sidebar-group-toggle {
  color: inherit;
}

.sidebar-group-header.is-current .sidebar-group-toggle:hover {
  background: none;
}

.sidebar-group-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-control);
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.sidebar-group-toggle:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.sidebar-group-toggle .chevron {
  font-size: var(--text-xs);
  transition: transform 0.15s ease;
}

.sidebar-group.is-collapsed .chevron {
  transform: rotate(-90deg);
}

/* A long name wraps rather than being cut: the line holds the total too,
   and a portfolio's name is how you tell two apart. */
.sidebar-group-link {
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.3;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

a.sidebar-group-link:hover,
.sidebar-group-name-toggle:hover {
  color: var(--color-text);
}

/* The whole portfolio is in view. */
.sidebar-group-link.is-current {
  cursor: default;
}

.sidebar-group-meta {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 0.5rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sidebar-group-meta.liability {
  color: var(--color-loss-text);
}

.sidebar-group-header .sample-tag {
  align-self: center;
  flex-shrink: 0;
  margin: 0 0 0 0.3rem;
}

.sidebar-group.is-collapsed .sidebar-group-list {
  display: none;
}

/* A search opens every group, so a match inside a collapsed one shows. */
.portfolio-sidebar.filtering .sidebar-group.is-collapsed .sidebar-group-list {
  display: block;
}

.portfolio-sidebar .sidebar-group-list {
  margin: 0.1rem 0 0 0.9rem;
}

.sidebar-group-empty {
  padding: 0.2rem 0.5rem 0.3rem;
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-text-muted);
}

/* Recent (sidebar.js's wireRecent) is for the phone's account sheet; on a
   desktop the whole list is on screen already. */
.sidebar-recent {
  display: none;
}

.sidebar-recent-title {
  margin: 0.5rem 0 0.2rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

/* The portfolio a Recent account is in, where the list shows a value. */
.row-note {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Both Manage lists, side by side under the list they change. */
.sidebar-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0.75rem 0 0.25rem;
}

.sidebar-manage[hidden] {
  display: none;
}

.sidebar-manage-link {
  display: block;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-control);
  border: none;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.sidebar-manage-link:hover {
  color: var(--color-text);
  background: var(--color-hover-bg);
}

/* Manage Accounts: Manage Portfolios' rows, grouped under portfolio
   headings, with each account's type and value on a second line. */
.manage-accounts-group {
  margin: 1rem 0 0.3rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.manage-accounts-list {
  margin-bottom: 0.25rem;
}

.manage-accounts-meta {
  padding: 0 0.6rem 0.3rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.manual-account-empty {
  padding: 0.4rem 0.6rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Whole-household net worth, one line (Say It Once S2, v2.1.0):
   deliberately outside the per-type group list above it (net worth spans
   every portfolio and manual account), as a small standalone card rather
   than another .sidebar-group. Its assets, liabilities and leverage are on
   Home's Net worth view, which it opens; they were here too, as a second
   row beside the same figures in the top card. */
.sidebar-networth {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-bg-secondary, transparent);
  color: var(--color-text);
  font: inherit;
  text-align: left;
}

.sidebar-networth.is-link {
  cursor: pointer;
}

.sidebar-networth.is-link:hover {
  border-color: var(--color-text-muted);
}

.sidebar-networth-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.sidebar-networth-value {
  margin-left: auto;
  font-size: var(--text-md);
  font-weight: 700;
}

.sidebar-networth-more {
  color: var(--color-text-muted);
}

/* Settings & help on its own line (it opens the More sheet), then the
   version and Log Out. It held seven controls in 230px: emoji squeezed
   into ovals, the first cut off at the edge, Log Out on two lines. */
.sidebar-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sidebar-settings-btn {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.sidebar-settings-btn:hover {
  border-color: var(--color-text-muted);
}

.sidebar-settings-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Was a plain <span> -- now links to the in-app Release Notes page
   (output/routes/releases.py). Explicit color since .sidebar-footer's
   inherited color would otherwise lose to the browser's default link
   blue/underline. */
.sidebar-version-link {
  color: inherit;
  text-decoration: none;
}

.sidebar-version-link:hover {
  color: var(--color-text);
  text-decoration: underline;
}

.logout-form {
  margin: 0;
}

.logout-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.logout-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.app-main {
  flex: 1;
  min-width: 0;
}

.error-banner {
  background: var(--color-error-bg);
  border: 1px solid var(--color-loss);
  color: var(--color-loss-text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
}

/* ===== css/04-states.css ===== */

/* ---------- Load errors, the error page, the welcome card, empty tabs, the sample banner ---------- */

/* Something that didn't load (a tab, one of Home's charts): what, and a
   way to try again (tabs.js failedHtml, dashboard.js). */
/* A dialog takes focus itself when it has no field to start in
   (Ui.wireDialogFocus); its own box needs no ring for that. */
.modal[tabindex="-1"]:focus,
.modal-overlay[tabindex="-1"]:focus {
  outline: none;
}

.load-failed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.load-failed p {
  margin: 0;
  flex: 1 1 14rem;
  color: var(--color-text);
}

.load-failed-compact {
  padding: 0.75rem 0.9rem;
  margin-top: 0.5rem;
}

/* Not found and server errors (error.html), on the sign-in page's card. */
.error-title {
  margin: 0.25rem 0 0.5rem;
  font-size: var(--text-xl);
}

.error-message {
  margin: 0 0 1.25rem;
  color: var(--color-text-muted);
}

.error-home {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* First-time-user empty state (dashboard.py's load_error is only ever
   raised for "this user has zero portfolios" -- see
   _resolve_portfolio's docstring -- so this is a welcome message, not a
   real error, and gets its own friendly styling instead of
   .error-banner's red treatment. Same card convention as .chart-card/
   .stat-tile (surface + border + gold top accent), not a new pattern. */
/* Phase 4's second color moment: seen exactly once, by a brand-new
   account with nothing to compare it against, so it can afford to be
   a little more pronounced than .hero-card's daily-use version --
   centered and wider rather than corner-anchored. Same rationale and
   the same theme-invariant --color-highlight, see .hero-card above. */
.welcome-card {
  background: radial-gradient(70% 140% at 50% 0%, var(--color-hover-bg), var(--color-surface) 70%);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1.25rem 1.5rem;
}

.welcome-card h2 {
  margin: 0 0 0.6rem;
  font-size: var(--text-lg);
}

.welcome-card p {
  margin: 0 0 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  max-width: 62ch;
}

/* What TrueVest is for, ahead of the first steps: full-strength text, so
   it reads as the lead rather than one more muted instruction. */
.welcome-card .welcome-purpose {
  color: var(--color-text);
}

/* The tour hint under the welcome card's buttons. */
.welcome-card .welcome-tour-hint {
  margin: 0.9rem 0 0;
  font-size: var(--text-sm);
}

/* Words that differ between a desktop and a phone (the 720px block swaps
   them). */
.only-phone {
  display: none;
}

/* A tab, or Holdings, with nothing to show yet (_no_portfolio_tab.html,
   holdings.html): what it will show, and the way to start. */
.tab-empty-state,
.holdings-empty {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 0;
}

.tab-empty-lead {
  margin: 0;
  max-width: 62ch;
  font-size: var(--text-md);
  color: var(--color-text);
}

.tab-empty-state .hint,
.holdings-empty .hint {
  margin: 0;
  max-width: 62ch;
}

.welcome-card-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Persistent while any is_sample portfolio exists (item 6) -- same gold
   "notice" accent as .welcome-card's top border, not the red
   .error-banner treatment, since this isn't an error. */
.sample-data-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--color-hover-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.sample-data-exit-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-control);
  padding: 0.3rem 0.85rem;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sample-data-exit-btn:hover {
  background: var(--color-hover-bg);
  color: var(--color-text);
}

/* Try a move and Exit sample mode stay together when the banner wraps. */
.sample-data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== css/05-share.css ===== */

/* ---------- Sharing a portfolio to view (share.js) ---------- */

/* The owner's Share button, at the far end of the header's top row. Phones
   reach it from the More sheet instead (720px block). */
.share-btn {
  margin-left: auto;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.share-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* Someone else's portfolio, open to view: same shape as the sample-data
   banner, in the neutral border colour so it reads as information. */
.shared-view-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.65rem 1rem;
  margin: 0.75rem 0;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.shared-view-back {
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-highlight-text);
}

/* The owner's name where an account row shows its value. */
.row-owner {
  font-family: var(--font-body);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-add {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.share-add .form-row {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.share-add .btn-primary {
  flex: 0 0 auto;
}

#share-error {
  margin-top: 0.6rem;
}

.share-list-title {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 1.1rem 0 0.4rem;
}

.share-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--color-border);
}

.share-who {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.share-email {
  overflow-wrap: anywhere;
}

.share-pending,
.share-empty {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.share-empty {
  padding: 0.4rem 0;
}

.share-remove {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0.3rem 0;
  color: var(--color-loss-text);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.share-remove:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 720px) {
  .share-btn {
    display: none;
  }
}

/* ===== css/06-stats.css ===== */

/* ---------- Stat tiles, the ⓘ icon, Risk badges ---------- */

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}

.stat-tile,
.stat-row .stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.9rem 1rem;
  min-width: 170px;
  max-width: 100%;
  flex: 1 1 170px;
  overflow: hidden;
  box-sizing: border-box;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 0.3rem;
}

.info-icon {
  display: inline-block;
  /* pointer, not help -- clicking one pins a fuller explanation open
     (see Tooltip.showAndPinInfo), the same click-for-more affordance
     .ticker-symbol already signals with this same cursor. */
  cursor: pointer;
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95em;
}

.info-icon:hover {
  color: var(--color-text);
}

.stat-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.stat-value.stat-na {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: var(--text-md);
}

/* A line under a tile's figure: Tax Location's dividends by tax group.
   The same small muted type as the Retirement tiles' own
   (23-retirement.css), with its figure in the tile's numerals. */
.stat-tile .stat-sub {
  display: block;
  margin-top: 0.3rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.stat-tile .stat-sub .mono {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.stat-pill .stat-label {
  margin-bottom: 0.15rem;
}

.stat-pill .stat-value {
  font-size: var(--text-md);
  font-weight: 600;
}

.dividend-table .mono {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Risk tab traffic-light badges (core.scoring) -- same pill shape as
   .research-result .sentiment, reusing the same green/red accents plus
   the gold "notice" accent (--color-highlight, see .import-skipped-summary)
   for the middle "fair" tier rather than introducing a new color. */
.risk-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.35rem;
  border-radius: var(--radius-control);
  padding: 0.1rem 0.45rem;
  font-size: var(--text-xs);
  font-weight: 600;
}

.risk-badge-good {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-gain-text);
}

.risk-badge-fair {
  background: rgba(201, 169, 97, 0.18);
  color: var(--color-highlight-text);
}

.risk-badge-poor {
  background: rgba(231, 76, 60, 0.15);
  color: var(--color-loss-text);
}

/* ===== css/07-risk.css ===== */

/* ---------- Risk tab: Portfolio Score + detailed parameter list ----------
   Replaces what used to be 8 large .stat-tile cards with a compact score
   summary up top and a collapsed-by-default list further down (see
   #risk-detail-toggle-btn in analysis-tabs.js) -- the tile grid read as
   cluttered with this many metrics on one tab. */

/* One grid for all five cards, so every card in a row shares its height
   and its top edge. It used to be a flex row of the overall card beside a
   second flex-wrap row of pillars at `align-items: flex-start`: pillars
   were only as tall as their own content (60px bare, 133px with a note),
   the overall card centred its contents vertically so its label sat
   lower than the pillars', and whether it sat beside the pillars or
   wrapped above them depended on how long a note happened to be.
   .score-pillars is display:contents so the pillars join this grid.
   Columns widen in steps rather than auto-fitting, which would leave a
   lone fourth pillar on a row of three. The 1460px and 1205px steps are
   measured: a pillar needs ~177px before its label wraps (148px of text
   + padding), and the sidebar and gutters take ~369px. */
.score-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

@media (max-width: 1459px) {
  .score-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .score-overall {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1204px) {
  .score-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Same padding as a pillar, less the extra 1px of its gold top border,
   so the overall label lines up exactly with the four pillar labels.
   align-content keeps both lines at the top of a stretched card instead
   of spreading them down it. */
.score-overall {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: calc(0.75rem - 1px) 1rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 0.35rem 0.6rem;
}

/* Same type as .score-pillar-name, so the five labels share a baseline. */
.score-overall-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-basis: 100%;
}

.score-overall-stars {
  font-size: var(--text-xl);
  line-height: 1;
  color: var(--color-highlight-text);
  letter-spacing: 0.05em;
}

.score-overall-word {
  font-size: var(--text-md);
  font-weight: 700;
}

.score-pillars {
  display: contents;
}

.score-pillar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.75rem 1rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.score-pillar-name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.score-pillar-stars {
  font-size: var(--text-md);
  color: var(--color-highlight-text);
  letter-spacing: 0.05em;
}

/* "What moves this?" / "Where do I start?" on every score card: the card
   itself stays name-and-stars, and this native <details> holds what the
   score means and what moves it. margin-top:auto keeps the toggles on
   one line along the bottom of a row of equal-height cards; flex-basis
   puts it on its own line in the overall card's wrapping row. */
.score-pillar-more {
  margin-top: auto;
  flex-basis: 100%;
}

.score-pillar-more > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.score-pillar-more > summary::-webkit-details-marker {
  display: none;
}

.score-pillar-more > summary::after {
  content: "\25BE";
  transition: transform 0.15s ease;
}

.score-pillar-more[open] > summary::after {
  transform: rotate(180deg);
}

.score-pillar-more > summary:hover,
.score-pillar-more[open] > summary {
  color: var(--color-text);
}

/* The whole tile toggles it (analysis-tabs.js), so it reads as one
   button: pointer, and the gold hover border the header's clickable
   Annual Dividend Income tile uses -- only where there's a real hover. A
   touch screen keeps :hover on the last thing tapped, which left a tile
   just closed outlined in gold as if it were still open. */
.score-overall,
.score-pillar {
  cursor: pointer;
}

@media (hover: hover) {
  .score-overall:hover,
  .score-pillar:hover {
    border-color: var(--color-text-muted);
  }
}

/* While a card is open the rows stop stretching: otherwise opening one
   card pads every other card in its row with the same empty height --
   the look this replaced. Closed cards all have the same content, so
   they stay level either way. */
.score-summary:has(.score-pillar-more[open]) {
  align-items: start;
}

/* What the score means, then (in body colour, since it's the part to act
   on) what usually moves it. Same small dashed-pill "reveals more,
   elsewhere" link language as .tt-view-full-holdings. */
.score-pillar-note {
  margin: 0.3rem 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.35;
}

.score-pillar-action {
  color: var(--color-text);
}

.score-pillar-link {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-control);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.score-pillar-link:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.score-overall-stars.stat-na,
.score-pillar-stars.stat-na {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  letter-spacing: normal;
}

/* Compact list view for the detailed parameters, shown/hidden via
   #risk-detail-toggle-btn -- one line per metric instead of a
   .stat-tile card each, so all 11 fit without the page feeling like a
   wall of tiles. */
.metric-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.25rem 1rem;
  margin-bottom: 1.25rem;
}

.metric-group {
  padding: 0.6rem 0;
}

.metric-group + .metric-group {
  border-top: 1px solid var(--color-border);
}

.metric-group-title {
  margin: 0 0 0.3rem;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.metric-group-subtitle {
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-text-muted);
  font-weight: 400;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.metric-row + .metric-row {
  border-top: 1px dashed var(--color-border);
}

.metric-name {
  flex: 1 1 auto;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.metric-value {
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

/* A quieter second line under a metric's name -- which sector a Sector
   Tilt is in. Beside the number it didn't fit on a phone: "Communication
   Services +12.1 pts" plus its badge ran 80px past a 375px screen. */
.metric-name-detail {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.metric-group-hint {
  margin: 0.5rem 0 0;
  font-size: var(--text-xs);
}

/* ===== css/08-rebalance.css ===== */

/* ---------- Rebalance tab: dimension switcher, drift table, Set Targets editor ----------
   Reuses .mode-toggle-btn for the switcher, .data-table for the drift
   table, .risk-badge for per-row status, and .modal/.form-* for the
   editor; only the editor's own row grid and live total are new. */

.rebalance-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.rebalance-dimension-toggle {
  margin: 0;
}

.rebalance-dimension-toggle .mode-toggle-btn {
  flex: 0 0 auto;
}

.stat-of {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.target-editor-row {
  display: grid;
  grid-template-columns: 1fr auto 110px auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

.target-editor-row label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.target-editor-actual {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.target-editor-row input,
.target-editor-add input {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.target-editor-row input {
  text-align: right;
}

.target-editor-row input:focus,
.target-editor-add input:focus {
  outline: none;
  border-color: var(--color-focus);
}

.target-editor-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* display:flex would otherwise beat the UA's [hidden] rule -- same
   reason .modal-overlay[hidden] exists. */
.target-editor-add[hidden] {
  display: none;
}

.target-editor-add input {
  flex: 1;
}

.target-editor-total {
  margin: 0.75rem 0 0.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.target-editor-total.is-valid {
  color: var(--color-gain-text);
}

.target-editor-total.is-invalid {
  color: var(--color-loss-text);
}

/* ===== css/09-tabs.css ===== */

/* ---------- Tabs ---------- */

/* Pinned to the top as the page scrolls, as on a phone, and tabs.js
   brings a picked tab's content up under it: the header above was 690px
   of a 1000px window, so every analysis tab opened below the fold (The
   Round Trip, U1). Under the shared info panel (1000) and dialogs. */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 2rem;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  /* 2400px since v2.6.0: at 1600 a wide screen kept a band of empty
     page either side of everything. */
  max-width: 2400px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--color-bg);
}


.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--color-text-muted);
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-text);
  border-bottom-color: var(--color-selected-bg);
  font-weight: 600;
}

/* Try a move, Your rules and Reconcile sit together at the far end. They
   share a wrapper so a row too narrow for them all wraps them as
   a group, still right-aligned, rather than stranding one on its own. */
.tab-nav-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

/* `color` is set here because a <button> doesn't inherit it: without it
   both buttons were the browser's black, on navy in dark mode. */
.export-btn,
.reconcile-btn {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.export-btn:hover,
.reconcile-btn:hover:not(:disabled) {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.reconcile-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Try a move is the one brass button beside the tabs (v1.188.0): seeing a
   move before making it is what the app is for. */
.reconcile-btn.move-try-btn {
  background: var(--color-highlight);
  border-color: var(--color-highlight);
  color: var(--color-on-highlight);
}

.reconcile-btn.move-try-btn:hover:not(:disabled) {
  border-color: var(--color-highlight);
  color: var(--color-on-highlight);
  opacity: 0.9;
}

/* Icon-only, in the sidebar footer next to the version number — a
   global display preference, not a page action, so it lives in the
   app's persistent chrome rather than the tab-navigation row alongside
   Add Holding/Export HTML. */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
}

.sidebar-help-link {
  font-weight: 700;
  text-decoration: none;
}

.theme-toggle-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.add-holding-btn {
  background: var(--color-highlight);
  color: var(--color-on-highlight);
  border: none;
  border-radius: var(--radius-control);
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}

.add-holding-btn:hover {
  opacity: 0.9;
}

/* Once a portfolio has holdings, adding one is no longer the job: an
   outline like the buttons beside it. */
.add-holding-btn.is-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-weight: 600;
}

.add-holding-btn.is-secondary:hover:not(:disabled) {
  border-color: var(--color-text-muted);
  opacity: 1;
}

.add-holding-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.tab-content-container {
  padding: 1.5rem 2rem 3rem;
  /* 2400px since v2.6.0: at 1600 a wide screen kept a band of empty
     page either side of everything. */
  max-width: 2400px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-panel.loading::after {
  content: "Loading…";
  display: block;
  color: var(--color-text-muted);
  padding: 2rem 0;
}

/* ===== css/10-tables.css ===== */

/* ---------- Tables ---------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Wraps #holdings-table and #holdings-exposure-table. overflow-x:auto
   applies at every width, not just mobile: a wide enough table can
   exceed even a wide desktop container (previously silently clipped by
   .data-table's own overflow:hidden, invisibly losing whatever columns
   didn't fit -- arguably worse). Kept scrollable rather than clipped
   either way; the mobile media query below adds the rest of the
   compact/sticky-column treatment (.holdings-compact-table) on top. */
.holdings-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The same for any other table that can outgrow its column: Performance's
   By Account and Tax Location's misplaced holdings. Their uppercase,
   unwrapping headers need ~590-610px, so between the phone card layout
   (<=720px) and a wide desktop -- a phone held sideways, a small tablet,
   where the sidebar leaves ~500px -- they pushed the whole page sideways.
   Now the table scrolls in its own box instead. Deliberately not
   .holdings-table-scroll: that class carries Holdings-only phone rules. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Direct vs. Indirect Exposure: a frozen header row, at every width.
   Fund look-through can make this table hundreds of rows long, and
   scrolling it lost which column was which. A sticky <th> needs a
   vertical scroll container to stick within -- the wrapper already
   scrolls sideways, which makes it the sticky container anyway -- so the
   box gets a height cap, and the frame (border, radius, spacing) moves
   from the table onto it so the header freezes inside a bordered box.
   The table then needs three things undone for sticky to work: its own
   overflow:hidden would make the TABLE the sticky container instead,
   and border-collapse:collapse breaks sticky cells (the Holdings table
   hit the same thing, v1.90.0). Collapsed to its top 5 rows it's short
   enough that the cap never applies. */
#holdings-exposure-scroll {
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  margin-bottom: 1.5rem;
}

#holdings-exposure-table {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  overflow: visible;
  border-collapse: separate;
  border-spacing: 0;
}

#holdings-exposure-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-table-header-bg);
}

/* On a phone the first column is pinned sideways too, so this cell is
   frozen both ways and must sit above both the header row and the
   pinned body cells -- at an equal z-index, the header cells scrolling
   in beneath it would paint over it, being later in the DOM. */
#holdings-exposure-table thead th:first-child {
  z-index: 3;
}

/* While a holding's Undo toast is pending, every other row/cell/button in
   this table is addressed by the same position-based `index` the pending
   delete already shifted server-side -- freezing the table for those few
   seconds is simpler and safer than re-indexing every open handler to
   match, and the table unfreezes itself on the reload that always follows
   (either branch of the Undo toast triggers one). */
.table-locked {
  opacity: 0.6;
  pointer-events: none;
}

/* A pill with a dashed border and a gold hover, the same family as the
   score cards' "See in…" links and every tab/nav highlight, rather than
   the neutral grey .btn-secondary hover used for dismissive actions like
   modal Cancel buttons.

   Sits above its table (see each template), not below — collapsing a
   table that's been expanded to dozens of rows would otherwise mean
   scrolling all the way past every row just to reach the button again;
   anchored above the table, it's reachable either way without scrolling. */
.holdings-toggle-btn {
  display: block;
  margin: 0.75rem auto;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.5rem 1.5rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.holdings-toggle-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* Disabled for the few seconds a delete's Undo toast is pending -- see
   .table-locked's own comment for why. */
.holdings-toggle-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.holdings-toggle-btn:disabled:hover {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.data-table th,
.data-table td {
  text-align: left;
  /* Tight enough that Holdings' 10-column table (Ticker through Weight)
     fits within its container at normal desktop widths without pushing
     the page into a horizontal scroll — no scroll wrapper needed at all
     when the table simply fits. */
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

/* Numeric columns already carry .mono consistently (every data-table
   across the app) — reuse that existing hook to right-align them,
   VanEck-style, with no per-template changes needed. */
.data-table th.mono,
.data-table td.mono {
  text-align: right;
}

/* Bold row labels, matching the reference table's left column. */
.data-table td:first-child {
  font-weight: 600;
}

.data-table th {
  background: var(--color-table-header-bg);
  color: var(--color-table-header-text);
  font-weight: 700;
  font-size: var(--text-xs);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--color-text);
}

/* A sortable header's label is a button (Ui.wireSortableTable), so the
   keyboard can sort. It looks like the header text it holds; a ring shows
   where Tab has reached. */
.data-table th .sort-btn {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: inherit;
  white-space: inherit;
  cursor: pointer;
}

/* The label's trailing space ends inside the button, where it collapses,
   so the button keeps the gap before an ⓘ. On the button, not the ⓘ,
   whose margin makes its bigger tap area on a touch screen. */
.data-table th .sort-btn:has(+ .info-icon) {
  margin-right: 0.3em;
}

.data-table th .sort-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}

/* Permanent sort affordance on every sortable header, dim until active —
   VanEck's headers always show a chevron rather than only on hover. */
.data-table th[data-sort]::after {
  content: "\2195";
  display: inline-block;
  margin-left: 0.4em;
  font-size: 0.85em;
  opacity: 0.5;
}

.data-table th.sorted-asc::after {
  content: "\25B2";
  opacity: 1;
  color: var(--color-text);
}

.data-table th.sorted-desc::after {
  content: "\25BC";
  opacity: 1;
  color: var(--color-text);
}

.data-table td[data-editable] {
  cursor: text;
}

.data-table td[data-editable]:hover {
  outline: 1px dashed var(--color-focus);
  outline-offset: -3px;
}

.cell-edit-input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: var(--text-sm);
  padding: 2px 4px;
  border: 1px solid var(--color-focus);
  border-radius: var(--radius-control);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.holding-row {
  cursor: pointer;
}

.holding-row:hover {
  background: var(--color-bg);
}

.drill-down-row td {
  background: var(--color-bg);
}

.drill-down-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 0.25rem 0;
  font-size: var(--text-sm);
}

/* One ▲/▼ per mover, on its percent; the dollars just take the colour,
   or carry the arrow where the span gives no percent (since a look). */
.mover-pct + .mover-dollar.gain::before,
.mover-pct + .mover-dollar.loss::before {
  content: none;
}

/* ===== css/11-rebalance-bars.css ===== */

/* ---------- Rebalance: the mix and target bars ---------- */

.rebalance-empty-lead {
  margin: 0.5rem 0 0.75rem;
  color: var(--color-text-muted);
}

.rebalance-mix-card {
  margin-top: 1rem;
}

.rebalance-mix-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.rebalance-mix-value {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.mix-bar {
  display: flex;
  height: 1.1rem;
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--color-border);
}

.mix-seg {
  display: block;
  height: 100%;
}

.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.mix-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mix-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: var(--radius-control);
}

/* Capped, so on a wide screen the figures stay near their bars. */
.target-bars {
  display: grid;
  gap: 0.55rem;
  max-width: 56rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.target-bar-row {
  display: grid;
  grid-template-columns: minmax(6rem, 12rem) 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-sm);
}

.target-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-bar-track {
  position: relative;
  height: 0.9rem;
}

.target-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-control);
  background: var(--color-neutral);
}

.target-bar-good {
  background: var(--color-gain);
}

.target-bar-poor {
  background: var(--color-loss);
}

/* The target, across the bar. Brass: it's the reader's own number, as a
   rule's line is. The text shade, which keeps 3:1 against the page in
   both themes where the fill's gold doesn't on white. */
.target-bar-tick {
  position: absolute;
  top: -0.25rem;
  bottom: -0.25rem;
  width: 3px;
  margin-left: -1.5px;
  border-radius: var(--radius-control);
  background: var(--color-highlight-text);
}

.target-bar-figures {
  white-space: nowrap;
}

.target-bar-target {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* ===== css/12-positions.css ===== */

/* ---------- Positions and their lots (holdings.html) ---------- */

/* "2 lots" beside a ticker bought more than once. */
.lot-count {
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  vertical-align: middle;
}

/* The lots inside a position's details: a quiet sub-table, not a second
   banner-headed table to scan. Scoped under .holdings-compact-table so it
   outranks that table's own cell rules (the pinned first column on a
   phone included), which reach it as a descendant. */
.lot-table-scroll {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.holdings-compact-table .lot-table {
  display: table;
  width: auto;
  min-width: 32rem;
  border-collapse: collapse;
  border: none;
  margin: 0;
}

.holdings-compact-table .lot-table th,
.holdings-compact-table .lot-table td {
  position: static;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  box-shadow: none;
}

.holdings-compact-table .lot-table th {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: default;
}

.holdings-compact-table .lot-table th:hover {
  background: transparent;
}

.holdings-compact-table .lot-table td:first-child {
  font-weight: 500;
  white-space: nowrap;
}

.holdings-compact-table .lot-table tbody tr:last-child td {
  border-bottom: none;
}

.btn-delete.btn-delete-lot {
  margin-left: 0;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
}

.lot-hint {
  margin: 0.5rem 0 0;
}

/* Lots a sale took, under the open ones (holdings.html): history, so
   quieter than what's held, with the sale's date under when it was
   bought. Gains keep their colour. */
.holdings-compact-table .lot-table .lot-sold-heading th {
  padding-top: 0.75rem;
  text-align: left;
}

.holdings-compact-table .lot-table .lot-sold-row td:not(.gain, .loss) {
  color: var(--color-text-muted);
}

.lot-sold-on {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
}

.holdings-compact-table .lot-table .lot-sold-more td {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

/* Neutral at rest, red only on hover -- the same "quiet until you engage
   with it" language as the sidebar's icon-only delete buttons
   (.account-delete-btn and friends), so delete reads as one consistent
   idea across the app instead of this row's own separate treatment. */
.btn-delete {
  margin-left: auto;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: var(--radius-control);
  padding: 0.35rem 0.9rem;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.btn-delete:hover {
  background: var(--color-error-bg);
  border-color: var(--color-loss);
  color: var(--color-loss-text);
}

.btn-delete:disabled {
  opacity: 0.5;
  cursor: default;
}

.ticker-symbol {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px dotted var(--color-text-muted);
}

.ticker-symbol:hover {
  color: var(--color-text);
}

/* ===== css/13-charts.css ===== */

/* ---------- Charts ---------- */

.chart-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem;
  flex: 1 1 320px;
  min-width: 280px;
}

.chart-card-wide {
  flex-basis: 100%;
}

.chart-canvas {
  max-height: 280px;
}

/* Ranked bars (ChartKit.rankedBarsHtml): name, bar, share, in one colour.
   The list scrolls within its card rather than growing with every holding,
   so the top card stays the height it was; a part-row at the bottom edge
   shows there are more. */
.ranked-bars {
  --ranked-name: 5.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 23.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.ranked-bars--long {
  --ranked-name: 11rem;
}

.ranked-bars--tall {
  max-height: 27rem;
}

/* All of them, and capped as the target bars are, so on a wide screen the
   figures stay near their bars. */
.ranked-bars--all {
  max-height: none;
  max-width: 56rem;
}

.ranked-bar {
  display: grid;
  grid-template-columns: var(--ranked-name) minmax(2rem, 1fr) 3.5rem;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 0.1rem 0.4rem;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.25;
  text-align: left;
}

button.ranked-bar {
  cursor: pointer;
}

.ranked-bar.active {
  background: var(--color-bg);
}

/* Inset, so the list's scroll box doesn't cut it off. */
.ranked-bar:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.ranked-bar-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ranked-bar-track {
  display: block;
  height: 0.75rem;
}

.ranked-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: var(--radius-control);
  background: var(--color-bar);
  print-color-adjust: exact;
}

.ranked-bar-fill.is-negative {
  background: transparent;
  border: 2px solid var(--color-bar);
}

.ranked-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Below the width where the top card's two halves sit side by side there
   is no height beside it to fill. */
@media (max-width: 1100px) {
  .hero-chart-card .ranked-bars:not(.ranked-bars--all) {
    max-height: 17.5rem;
  }
}

/* The two lines between a chart card's title and its chart
   (ChartKit.chartReadoutHtml): a headline, then the selected row's details,
   at fixed sizes across the card's full width. Above the chart rather than
   under it: on a phone, tapping a holding opens its ticker panel as a
   bottom sheet, which covered a readout below. Each line fits a phone's
   width, so selecting a row doesn't move the chart under the finger. */
.chart-readout {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 0 0.75rem;
  line-height: 1.35;
}

.chart-readout-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
}

.chart-readout-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

/* "+$187 today" already carries its sign; no arrow before it. */
.chart-readout .gain::before,
.chart-readout .loss::before {
  content: none;
}

/* Horizontal bar charts (Sector Exposure, Direct vs. Indirect Exposure):
   charts.js sets the box's height from the row count, and the canvas
   fills it. */
.hbar-wrap {
  position: relative;
  width: 100%;
}

.hbar-wrap .chart-canvas {
  max-height: none;
}

/* What Sector Exposure's bar and tick stand for. */
.hbar-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0.6rem 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.hbar-key-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hbar-key-swatch {
  width: 0.75rem;
  height: 0.6rem;
  border-radius: var(--radius-control);
  background: #3498db;
}

.hbar-key-tick {
  width: 2.5px;
  height: 0.9rem;
  border-radius: var(--radius-control);
  background: var(--color-text);
}

.table-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.table-row > div {
  flex: 1 1 280px;
  min-width: 240px;
}

/* ===== css/14-research.css ===== */

/* ---------- Research tab ---------- */

/* Every row shares the list's columns (subgrid), so the buttons line up
   from row to row whatever the ticker or the button's label ("Open deep
   dive" is wider than "Deep dive"); each row laid itself out on its own
   until v1.152.0, and the Research buttons zigzagged. */
.research-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  column-gap: 0.75rem;
}

.research-list-item {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

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

.research-list .empty-state {
  grid-column: 1 / -1;
}

/* A ticker column of its own width, so the accounts start in line too.
   The ticker keeps its own width inside it, so its dotted underline (the
   hover-for-details cue) stays under the letters. */
.research-holding {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: baseline;
  column-gap: 1rem;
  min-width: 0;
}

.research-holding .ticker-symbol {
  justify-self: start;
}

.research-account {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  min-width: 0;
}

.research-list-item .research-btn {
  justify-self: stretch;
  text-align: center;
  white-space: nowrap;
}

/* Research's own Search: a solid button, as the action the box is for.
   It borrowed "Show more"'s dashed outline and read as disabled. */
.research-search-btn {
  flex: 0 0 auto;
}

.research-note {
  margin: 0.75rem 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.research-btn {
  background: var(--color-highlight);
  color: var(--color-on-highlight);
  border: none;
  border-radius: var(--radius-control);
  padding: 0.4rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.research-btn:hover {
  opacity: 0.9;
}

.research-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.research-result {
  font-size: var(--text-sm);
}

/* The tone of recent news (research-tab.js), a short sentence rather than
   a one-word call, so it isn't set in capitals. */
.research-result .sentiment {
  display: inline-block;
  border-radius: var(--radius-control);
  padding: 0.1rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
}

.sentiment-positive {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-gain-text);
}

.sentiment-negative {
  background: rgba(231, 76, 60, 0.15);
  color: var(--color-loss-text);
}

.sentiment-mixed {
  background: rgba(149, 165, 166, 0.2);
  color: var(--color-neutral);
}

.research-tokens {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  margin-top: 0.75rem;
}

/* ===== css/15-tooltip.css ===== */

/* ---------- Tooltip panel ---------- */

.tooltip-panel {
  position: fixed;
  z-index: 1000;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 12px;
  font-size: var(--text-xs);
  max-width: 300px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.tooltip-panel.visible {
  opacity: 1;
  pointer-events: auto;
}

.tooltip-panel .tt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.tooltip-panel .tt-close {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  line-height: 1;
  color: var(--color-text-muted);
}

.tooltip-panel.pinned .tt-close {
  display: block;
}

.tooltip-panel .tt-name {
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.tooltip-panel .tt-simple {
  color: var(--color-text);
  line-height: 1.45;
}

.tooltip-panel .tt-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-top: 1px solid var(--color-border);
}

.tooltip-panel .tt-row:first-of-type {
  border-top: none;
}

/* The chart-specific number(s) that used to live in a second, overlapping
   tooltip — bold + accent-colored so it still reads as "why you're
   looking at this" at a glance, ahead of the general asset fields below. */
.tooltip-panel .tt-context-row {
  font-weight: 600;
}

.tooltip-panel .tt-context-row span:last-child {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.tooltip-panel .tt-context-row:last-of-type {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
  margin-bottom: 2px;
}

.tooltip-panel .tt-holdings {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: var(--text-xs);
}

/* Same "important computed number" treatment as .tt-context-row's value
   (bold, accent-coloured, even-width digits) rather than blending into the muted
   list above it — a summary total reads as a footnote at that size/color,
   not the headline figure it actually is. The border-top plus extra
   top padding is the standard "table footer" separator convention,
   visually closing off the list it's summarizing. */
.tooltip-panel .tt-holdings-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* Only ever rendered on the lighter hover view (see render()'s
   includeHoldings) — points at what clicking reveals (the fund's Top
   Holdings breakdown and/or the external link below), so it never
   appears once the panel is already pinned open. */
.tooltip-panel .tt-hint {
  margin-top: 8px;
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-text-muted);
}

.tooltip-panel .tt-link {
  display: none;
  margin-top: 8px;
  font-size: var(--text-xs);
}

.tooltip-panel.pinned .tt-link {
  display: block;
}

.tooltip-panel .tt-link a {
  color: var(--color-highlight-text);
  text-decoration: underline;
}

/* Opens the Full Holdings modal (SEC EDGAR N-PORT) -- same dashed-pill
   "reveals more data" language as .holdings-toggle-btn, scaled down to
   fit this compact panel. Always rendered alongside Top Holdings (see
   tooltip.js's render()); a fund SEC doesn't have full holdings for
   yet just shows a message inside the modal on click, not a disabled
   button here. */
.tooltip-panel .tt-view-full-holdings {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-control);
  padding: 5px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.tooltip-panel .tt-view-full-holdings:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

/* Full Holdings modal's "As of <date> · Source: ..." line, below its
   <h2> title -- same small-muted-caption treatment as .login-hint. */
.tt-holdings-caption {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0.25rem 0 1rem;
}

.tt-holdings-caption a {
  color: var(--color-highlight-text);
}

/* ---------- Research tab: search-any-ticker ---------- */

.research-search-panel {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* Reuses Tooltip's .tooltip-panel/.tt-* markup and styling (see the
   "Tooltip panel" rules above) for the search result card, but this one
   sits in normal page flow instead of floating at the cursor -- so its
   positioning/visibility rules are overridden here. The extra class
   beats .tooltip-panel's own single-class rule on specificity regardless
   of source order. Rendered with the "pinned" class too (see
   research-tab.js), which is what makes .tt-close and .tt-link visible
   at all -- both are display:none on a bare .tooltip-panel. */
.research-ticker-card.tooltip-panel {
  position: static;
  max-width: 480px;
  opacity: 1;
  pointer-events: auto;
  margin: 1rem 0 0;
}

.research-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.85rem 0 0;
}

.research-exposure-result {
  margin-top: 0.6rem;
}

.research-exposure-result .error-banner {
  margin: 0;
}

/* The ⓘ icons and ticker symbols are buttons from the keyboard
   (Ui.wireInfoTooltips): a ring shows where Tab has reached, and on the
   pinned panel once it has the focus. */
.info-icon:focus-visible,
.ticker-symbol:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-control);
  color: var(--color-text);
}

.tooltip-panel:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ===== css/16-modals.css ===== */

/* ---------- Modals (research + add-holding) ---------- */

/* A dialog that lists things and opens other dialogs from its rows
   (Manage Accounts, Manage Portfolios): one level below every other
   dialog, so what it opens -- Edit, the delete confirmation -- shows on
   top of it. At the same level, a dialog earlier in the page opened
   hidden behind it: Edit from Manage Portfolios did, before v1.103.0.
   Still above the phone's account sheet (1050) and bottom bar (1030). */
.modal-overlay.modal-list {
  z-index: 1090;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-dialog);
  padding: 1.5rem;
  width: min(480px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-wide {
  width: min(640px, 92vw);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: var(--text-xl);
  cursor: pointer;
  color: var(--color-text-muted);
}

/* ===== css/17-onboarding.css ===== */

/* ---------- Onboarding tour ---------- */

.onboarding-steps {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.onboarding-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

.onboarding-step-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.onboarding-step-body strong {
  display: block;
  font-size: var(--text-sm);
}

.onboarding-step-body p {
  margin: 0.25rem 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.onboarding-step-cta {
  margin-top: 0.5rem;
  background: var(--color-highlight);
  color: var(--color-on-highlight);
  border: none;
  border-radius: var(--radius-control);
  padding: 0.35rem 0.9rem;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.onboarding-step-cta:hover {
  opacity: 0.9;
}

.onboarding-step-done {
  opacity: 0.75;
}

.onboarding-step-done .onboarding-step-icon {
  background: var(--color-gain);
  border-color: var(--color-gain);
  color: #fff;
}

.onboarding-step-current {
  border-color: var(--color-selected-bg);
}

.onboarding-step-current .onboarding-step-icon {
  border-color: var(--color-selected-bg);
  color: var(--color-text);
}

.onboarding-step-locked {
  opacity: 0.5;
}

.onboarding-step-loading {
  list-style: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* A finished step folded down to its title row. The markup these rules
   style is only generated on a phone (see onboarding.js's open), so
   there's no media query here -- JS decides when, this decides how. */
.onboarding-step-collapsible {
  flex-direction: column;
  gap: 0;
}

.onboarding-step-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* .onboarding-step-body strong doesn't reach this one -- the title moves
   into the toggle so the whole row, not just the text, is the tap target. */
.onboarding-step-toggle strong {
  flex: 1 1 auto;
  font-size: var(--text-sm);
}

.onboarding-step-chevron {
  flex: 0 0 auto;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.onboarding-step-toggle[aria-expanded="false"] .onboarding-step-chevron {
  transform: rotate(-90deg);
}

.onboarding-step-toggle[aria-expanded="false"] + .onboarding-step-body {
  display: none;
}

.onboarding-step-collapsible .onboarding-step-body {
  margin-top: 0.5rem;
}

.mode-toggle {
  display: flex;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}

.mode-toggle-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.45rem 0.6rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
}

.mode-toggle-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.mode-toggle-btn.active {
  background: var(--color-selected-bg);
  border-color: var(--color-selected-bg);
  color: var(--color-selected-text);
  font-weight: 700;
}

.import-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}

/* ===== css/18-import.css ===== */

/* ---------- Importing a portfolio: skipped rows, column mapping, preview ---------- */

/* Partial-success checkpoint after an import: the portfolio was already
   created (so this isn't a .form-error), but some rows were dropped and
   the user needs to actually read why before moving on — a gold left
   border reads as "notice", not "failure" (--color-loss red) or
   "all clear" (--color-gain green). */
.import-skipped-summary {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--color-border);
  background: var(--color-bg);
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
}

.import-skipped-summary p {
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.import-skipped-list {
  margin: 0;
  padding-left: 1.2rem;
  max-height: 180px;
  overflow-y: auto;
  color: var(--color-text-muted);
}

.import-skipped-list li {
  margin-bottom: 0.2rem;
}

.import-mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 1rem;
  margin-bottom: 0.85rem;
}

.import-mapping-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.import-mapping-row label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.ai-suggested-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--color-hover-bg);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: none;
  vertical-align: middle;
}

.import-mapping-row select {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.import-preview-table-wrap {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  margin-bottom: 0.75rem;
}

.import-preview-table-wrap .data-table {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
}

.import-preview-table-wrap .data-table th,
.import-preview-table-wrap .data-table td {
  white-space: nowrap;
  font-size: var(--text-xs);
  padding: 0.4rem 0.6rem;
  cursor: default;
}

/* ===== css/19-forms.css ===== */

/* ---------- Form rows, errors and notices ---------- */

.spinner {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.85rem;
}

.form-row label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.form-row input,
.form-row select {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--color-focus);
}

.form-row input.field-invalid {
  border-color: var(--color-loss);
}

.form-row input:disabled,
.form-row select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--color-bg-alt, var(--color-bg));
}

.form-error {
  color: var(--color-loss-text);
  font-size: var(--text-sm);
  margin: 0 0 0.75rem;
}

/* Advisory, not a rejection -- e.g. the Add Holding form's Cost Basis
   sanity check. Gold "notice" reads distinctly from .form-error's red
   (a blocker) or .form-success's green (all clear); same color role as
   .import-skipped-summary's left border. */
/* A one-line heads-up inside a tab (e.g. Tax Location's untyped
   accounts): the sample-data banner's gold tint, without its button row. */
.notice-banner {
  background: var(--color-hover-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.6rem 0.9rem;
  font-size: var(--text-sm);
  margin: 0.75rem 0;
}

/* The one thing to do about a notice or a failed load, inline in its
   sentence: "Set account types", "Try again". */
.notice-action {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--color-highlight-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.notice-action:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}

.form-warning {
  color: var(--color-highlight-text);
  font-size: var(--text-xs);
  margin: 0.35rem 0 0;
}

.form-success {
  color: var(--color-gain-text);
  font-size: var(--text-sm);
  margin: 0 0 0.75rem;
}

/* ===== css/20-login.css ===== */

/* ---------- Login page ---------- */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--color-bg);
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 2rem;
  width: min(380px, 100%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.login-title {
  margin: 0 0 0.25rem;
  font-size: var(--text-xl);
  color: var(--color-text);
}

.login-subtitle {
  margin: 0 0 1.25rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.login-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.login-hint {
  margin: 1.25rem 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

/* No anchor styling exists anywhere else in this stylesheet -- without
   this, a bare <a> here would render browser-default blue/underlined,
   which reads badly against the dark theme. Reuses the same gold accent
   .btn-primary already uses, rather than inventing a new color. */
.login-hint a {
  color: var(--color-highlight-text);
}

.login-hint a:hover {
  opacity: 0.85;
}

/* ===== css/21-reconcile.css ===== */

/* ---------- Reconcile with a broker file (reconcile.js) ---------- */

.reconcile-results {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.reconcile-summary {
  margin: 0;
  font-weight: 600;
}

.reconcile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  max-height: 22rem;
  overflow-y: auto;
}

.reconcile-item + .reconcile-item {
  border-top: 1px solid var(--color-border);
}

/* Checkbox, ticker and share counts on the first line; the change under
   them, lined up with the ticker. */
.reconcile-item label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.15rem 0.6rem;
  align-items: baseline;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}

.reconcile-item input {
  grid-row: span 2;
  align-self: center;
}

.reconcile-ticker {
  font-weight: 600;
}

.reconcile-counts {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: right;
}

.reconcile-change {
  grid-column: 2 / 4;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reconcile-gone .reconcile-change,
.reconcile-fewer .reconcile-change {
  color: var(--color-loss-text);
}

.reconcile-new .reconcile-change,
.reconcile-more .reconcile-change {
  color: var(--color-gain-text);
}

.reconcile-skipped {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.reconcile-skipped ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

/* ===== css/22-fee-projection.css ===== */

/* ---------- Fee projection (risk.html, Cost Efficiency's panel) ---------- */

.fee-projection {
  margin-top: 0.6rem;
}

.fee-projection-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.35rem 0 0.25rem;
  /* The card's own scale (.score-pillar-note is 0.72rem). */
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.fee-projection-table th,
.fee-projection-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
}

.fee-projection-table th:first-child {
  text-align: left;
}

.fee-projection-table tbody th {
  font-weight: 500;
}

.fee-projection-table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ===== css/23-retirement.css ===== */

/* ---------- Retirement tab (retirement.html) ---------- */

.retirement-result,
.retirement-plan,
.retirement-how {
  margin-bottom: 1.25rem;
}

.retirement-headline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.retirement-chance {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.retirement-chance-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.retirement-chance-text strong {
  font-size: var(--text-md);
}

.retirement-outlook {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.12rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
}

.retirement-good {
  color: var(--color-gain-text);
}

.retirement-fair {
  color: var(--color-highlight-text);
}

.retirement-low {
  color: var(--color-loss-text);
}

.retirement-verdict,
.retirement-intro,
.retirement-how p {
  max-width: 75ch;
  line-height: 1.5;
}

.retirement-verdict {
  margin: 0.8rem 0 1rem;
}

.retirement-intro {
  margin: 0 0 0.5rem;
}

.retirement-result .stat-sub {
  display: block;
  margin-top: 0.3rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.retirement-result h3 {
  margin-bottom: 0.25rem;
}

/* The chart is drawn with maintainAspectRatio:false (charts.js), so this
   box sets its height. */
.retirement-chart-wrap {
  position: relative;
  height: 300px;
}

.retirement-chart-wrap .chart-canvas {
  max-height: none;
}

/* Bottom-aligned so the inputs line up when a long label wraps. */
.retirement-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  align-items: end;
  gap: 0 1rem;
}

.retirement-form-hint {
  margin: 0 0 0.5rem;
}

.retirement-actions {
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.retirement-how > summary {
  cursor: pointer;
  font-weight: 600;
}

.retirement-how p {
  font-size: var(--text-sm);
}

.retirement-assumptions {
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: 0.5rem 0;
}

.retirement-assumptions th,
.retirement-assumptions td {
  text-align: left;
  vertical-align: top;
  padding: 0.35rem 1rem 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
}

.retirement-assumptions th {
  font-weight: 500;
  color: var(--color-text-muted);
}

.retirement-assumption-note {
  font-family: var(--font-body);
  font-size: 0.85em;
  color: var(--color-text-muted);
}

.retirement-disclaimer {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 720px) {
  .retirement-chance {
    font-size: var(--text-2xl);
  }

  .retirement-chart-wrap {
    height: 240px;
  }
}

/* ===== css/24-two-step.css ===== */

/* ---------- Two-step sign-in (two_step*.html) ---------- */

/* A little wider than the sign-in card: the setup page holds a QR code
   and numbered steps. */
.two-step-card {
  width: min(440px, 100%);
}

.two-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: var(--text-sm);
  margin-bottom: 1.25rem;
}

.two-step-body p {
  margin: 0;
}

.two-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.two-step-actions a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.two-step-steps {
  margin: 0 0 0.5rem;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: var(--text-sm);
}

/* White behind the code on either theme: scanners need dark on light. */
.two-step-qr {
  background: #ffffff;
  border-radius: var(--radius-dialog);
  padding: 0.5rem;
  width: fit-content;
  margin: 0.6rem 0;
  line-height: 0;
}

.two-step-qr svg {
  display: block;
  width: min(210px, 100%);
  height: auto;
}

.two-step-key {
  margin: 0.25rem 0 0;
  padding: 0.5rem 0.65rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  font-size: var(--text-sm);
  letter-spacing: 0.06em;
  user-select: all;
}

/* A group of four never breaks across lines: it wrapped as "BH" and "5K",
   the one place where a slip means starting over. */
.two-step-key-group {
  white-space: nowrap;
}

.two-step-copy {
  margin-top: 0.4rem;
}

.two-step-form {
  margin-top: 0.6rem;
}

.two-step-code-input {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  letter-spacing: 0.2em;
}

.two-step-codes {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  font-size: var(--text-md);
  user-select: all;
}

.two-step-continue {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 1rem;
}

.two-step-section {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  margin-top: 1.25rem;
}

.two-step-section h2 {
  font-size: var(--text-md);
  margin: 0 0 0.35rem;
}

/* With .btn-secondary, which comes later in the cascade and would
   otherwise set its own color and border. */
.btn-secondary.two-step-danger {
  color: var(--color-loss-text);
  border-color: var(--color-loss);
}

/* A plain-text link that's a button (it changes the form, not the page). */
.two-step-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-highlight-text);
  cursor: pointer;
}

/* The sidebar's 🔒 carries a dot while two-step sign-in is off. */
.sidebar-security-link {
  position: relative;
  text-decoration: none;
}

.sidebar-security-link.is-off::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-loss);
  border: 2px solid var(--color-surface);
}

.admin-two-step summary {
  cursor: pointer;
}

.admin-two-step form {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ===== css/25-admin.css ===== */

/* ---------- Admin: users and invites (admin_users.html) ---------- */

/* Minimal admin user-list page (output/routes/admin.py) -- reuses the
   .login-page/.login-card shell every other standalone page already
   uses, just wider (a table, not a narrow form) and left-aligned. */
/* 1320px since v1.173.0: at 1120 Users' table and the Costs chart
   wrapped on a desktop. */
.admin-page .login-card {
  width: min(1320px, 100%);
}

/* Wide enough since the research plan column (v1.149.0): at 900px the
   table ran past the card's right edge. A plan's select fits its cell. */
.admin-plan-form select {
  max-width: 100%;
}

.admin-page .data-table a {
  color: var(--color-highlight-text);
}

/* Users | What the AI costs (v1.167.1): the dashboard's tab strip, under
   the Back link, with a rule beneath like the dashboard's. */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
  margin: 0 0 1.25rem;
}

.admin-nav .tab-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.admin-back-link {
  text-align: left;
  margin: 0 0 1rem;
}

/* The in-page "invite a colleague" form -- same .chart-card/.stat-tile
   surface+border+gold-top-accent convention as the dashboard's own
   welcome card, so this reads as part of the same visual system. */
.admin-invite-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-invite-title {
  margin: 0 0 0.75rem;
  font-size: var(--text-md);
}

.admin-invite-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.admin-invite-form .form-row {
  flex: 1 1 220px;
  margin: 0;
}

.admin-invite-link {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  word-break: break-all;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.6rem 0.75rem;
  margin: 0 0 1rem;
}

/* Asks for a bigger plan (v1.151.0): one row each, with Grant and
   Decline side by side. */
.admin-ask-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-ask + .admin-ask {
  border-top: 1px solid var(--color-border);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.admin-ask p {
  margin: 0 0 0.35rem;
}

.admin-ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.admin-ask-actions form {
  margin: 0;
}

/* Sidebar entry point to the admin page -- shown only for
   current_user.is_admin (see dashboard.html), same muted-link treatment
   as .login-hint's own links, sized to fit the sidebar footer area. */
.sidebar-admin-link {
  display: block;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.5rem 0;
}

/* Access (v1.163.0): Suspend or restore access, and Delete account,
   behind a disclosure per row like Two-Step's reset, so nothing
   destructive sits one tap away. */
.admin-access summary {
  cursor: pointer;
}

.admin-access-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  min-width: 15rem;
}

.admin-access-body form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
}

.admin-access-body p {
  margin: 0;
}

.admin-delete-form {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
}

.admin-keep-copy {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.admin-suspended td {
  color: var(--color-text-muted);
}

.admin-archives {
  margin-top: 1.5rem;
}

/* Costs (v1.172.0): four figures across the top, wrapping on a phone,
   then a bar per day drawn in the table (one colour; a day over the
   daily limit is marked in the loss colour). */
.cost-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.cost-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.9rem 1rem;
  text-align: left;
}

.cost-tile-label,
.cost-tile-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.cost-tile-value {
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
}

.cost-source {
  text-align: left;
  margin: 0 0 1.5rem;
}

.cost-days td {
  font-variant-numeric: tabular-nums;
}

.cost-bar-cell {
  width: 50%;
}

.cost-bar {
  display: block;
  height: 0.6rem;
  border-radius: var(--radius-control);
  background: var(--color-fill-neutral);
}

.cost-over .cost-bar {
  background: var(--color-loss);
}

.cost-limits {
  margin-top: 1.5rem;
}

/* ===== css/26-release-notes.css ===== */

/* ---------- Release Notes (releases.html) ---------- */

/* Release Notes page (output/routes/releases.py) -- reuses the
   .login-page/.login-card shell like .admin-page, just wider (prose,
   not a narrow form) and left-aligned. */
.releases-page .login-card {
  width: min(680px, 100%);
}

.release-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 1.25rem;
  cursor: pointer;
}

.release-entry {
  padding: 0.9rem 0;
  border-top: 1px solid var(--color-border);
}

.release-entry:first-child {
  border-top: none;
  padding-top: 0;
}

.release-entry-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.release-entry-version {
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--text-sm);
}

.release-entry-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.release-entry-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.1rem 0.4rem;
}

/* "New" marks what's arrived since your last visit (releases.html); it
   reads as an alert, "Feature" as a label. */
.release-entry-badge.is-new {
  color: var(--color-selected-text);
  background: var(--color-selected-bg);
  border-color: var(--color-selected-bg);
}

/* The current month open, earlier months folded under their name. */
.release-month {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.release-month > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 0.6rem;
}

.release-month-count {
  font-weight: 400;
  color: var(--color-text-muted);
}

.release-intro {
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
}

.release-entry-body ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: var(--text-sm);
  line-height: 1.55;
}

.release-entry-body li {
  margin-bottom: 0.45rem;
}

.release-entry-body li:last-child {
  margin-bottom: 0;
}

.release-entry-body ul.sub {
  margin-top: 0.4rem;
  padding-left: 1.1rem;
}

.release-entry-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 0.05rem 0.3rem;
}

.release-entry-body a {
  color: var(--color-highlight-text);
}

.sidebar-admin-link:hover {
  color: var(--color-text);
}

/* ===== css/27-account-dialog.css ===== */

/* ---------- Add and Edit Account (manual-accounts.js) ---------- */

/* Dynamic Add/Edit Account modal: field groups swap in/out per Account
   Type instead of routing to separate pages/modals per type. */
.account-field-group[hidden] {
  display: none;
}

.form-row-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.form-row-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.form-row-grid > div,
.form-row-grid-2 > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-row-grid label,
.form-row-grid-2 label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.form-row-grid input,
.form-row-grid select,
.form-row-grid-2 input,
.form-row-grid-2 select {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.form-row-inline {
  display: flex;
  align-items: center;
  margin-bottom: 0.85rem;
}

.form-row-inline label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}

.form-row-inline select {
  margin-right: 0.5rem;
}

.account-net-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: var(--text-md);
  margin: 0.5rem 0 0.85rem;
}

.account-net-value.liability,
.manage-accounts-meta .liability {
  color: var(--color-loss-text);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ===== css/28-add-holding-steps.css ===== */

/* ---------- Add Holding's steps ---------- */

/* Add Holding's step indicator -- "Step N of 3" plus a slim 3-segment
   progress track. Same done/current color language as the onboarding
   checklist's step icons (.onboarding-step-done/.onboarding-step-current)
   reused here in a compact horizontal form instead of a vertical list. */
.add-holding-step-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.add-holding-step-count {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.add-holding-step-track {
  display: flex;
  flex: 1 1 auto;
  gap: 0.35rem;
}

.add-holding-step-segment {
  flex: 1 1 0;
  height: 4px;
  border-radius: 999px;
  background: var(--color-border);
}

.add-holding-step-segment.done {
  background: var(--color-gain);
}

.add-holding-step-segment.current {
  background: var(--color-selected-bg);
}

/* ===== css/29-buttons-toasts.css ===== */

/* ---------- Buttons, the loading overlay, toasts ---------- */

/* Four kinds of button, and only four:
   - primary: the one action a screen is for. Brass, so it is never
     confused with a selection (navy) or a figure.
   - secondary: every other action. An outline.
   - quiet: an action inside a sentence or a list. Text only.
   - segmented: a choice of views (.segmented around buttons); the chosen
     one is filled navy, as every selection is.
   All sentence case, one radius, one size. */
.btn-primary,
.btn-secondary,
.btn-quiet {
  border-radius: var(--radius-control);
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-highlight);
  color: var(--color-on-highlight);
  border: 1px solid var(--color-highlight);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-quiet:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-secondary {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: var(--color-text-muted);
}

.btn-quiet {
  background: none;
  border: 1px solid transparent;
  padding-left: 0;
  padding-right: 0;
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-quiet:hover {
  text-decoration-thickness: 2px;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.segmented > button {
  border: none;
  border-radius: 0;
  background: none;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
}

.segmented > button + button {
  border-left: 1px solid var(--color-border);
}

.segmented > button.is-on,
.segmented > button[aria-pressed="true"] {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-quiet:focus-visible,
.segmented > button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* A link that looks like a button (Download my data, Restore your
   TrueVest data) isn't underlined, and is as tall as a <button>, which
   doesn't inherit the page's line height. Only those: some set their own
   display in earlier parts, which this more specific rule would beat. */
a.btn-primary,
a.btn-secondary {
  text-decoration: none;
  line-height: normal;
}

.nav-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 2000;
  color: #fff;
}

.nav-loading-overlay[hidden] {
  display: none;
}

.nav-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nav-loading-spin 0.8s linear infinite;
}

@keyframes nav-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.nav-loading-overlay p {
  font-size: var(--text-sm);
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: calc(100vw - 3rem);
  background: var(--color-loss);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-dialog);
  font-size: var(--text-sm);
  z-index: 1200;
}

/* A toast paired with an action (e.g. "Undo") rather than a plain error --
   neutral surface chrome instead of .toast's loss-red, since it reports
   something that already succeeded, not a failure. */
.toast-action {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-dialog);
  font-size: var(--text-sm);
  z-index: 1200;
}

.toast-action-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-highlight-text);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  white-space: nowrap;
}

.toast-success {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-gain);
}

/* ===== css/30-alerts.css ===== */

/* ---------- Alerts (alerts-form.js, push.js) ---------- */

/* Email alerts dialog (alerts-form.js). */
.alerts-master {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-weight: 700;
}

.alerts-fields {
  display: grid;
  gap: 0.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  border: none;
}

/* While alerts are off, the controls dim and the words stay readable:
   that's when someone is deciding whether to turn alerts on. The whole
   set used to fade to half strength. */
.alerts-fields:disabled input,
.alerts-fields:disabled button {
  opacity: 0.5;
}

/* How delivery has gone (alerts-form.js statusLines). Outside the
   fieldset, so it stays readable while alerts are off. */
.alerts-status {
  margin: 0 0 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.alerts-status-error {
  color: var(--color-loss-text);
}

.alerts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  min-height: 44px;
  padding: 0.25rem 0;
  border-top: 1px solid var(--color-border);
}

.alerts-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 500;
}

.alerts-input {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text-muted);
}

.alerts-input input {
  width: 4.5rem;
  text-align: right;
  /* The form fields' own look: unstyled, they were white boxes in dark
     mode. */
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.alerts-input input:focus {
  outline: none;
  border-color: var(--color-focus);
}

/* How alerts are sent: email, and notifications on this device (push.js). */
.alerts-channels {
  margin-top: 0.6rem;
}

.alerts-channels-title {
  margin: 0 0 0.15rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.push-device {
  padding: 0.5rem 0 0.25rem;
  border-top: 1px solid var(--color-border);
}

.push-status {
  margin: 0 0 0.5rem;
  font-size: var(--text-sm);
  line-height: 1.45;
}

.push-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.push-test {
  background: none;
  border: none;
  padding: 0.4rem 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-highlight-text);
  cursor: pointer;
}

.push-note {
  margin: 0.5rem 0 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.toast-action-btn:hover {
  text-decoration: underline;
}

/* ===== css/31-add-holding.css ===== */

/* ---------- Add Holding: ticker suggestions, cost mode ---------- */

.ticker-options {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.ticker-option {
  display: grid;
  gap: 0.05rem;
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  border: none;
  border-top: 1px solid var(--color-border);
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ticker-options li:first-child .ticker-option {
  border-top: none;
}

.ticker-option:hover,
.ticker-option:focus-visible {
  background: var(--color-hover-bg);
}

.ticker-option-symbol {
  font-weight: 700;
}

.ticker-option-name {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* A file field you can click or drop a file on (Ui.wireFileDrops). The
   input stays the one the page reads, hidden but focusable inside its
   label; the label shows focus for it. */
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1rem;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-bg);
  text-align: center;
  cursor: pointer;
  font-weight: 400;
}

.file-drop:hover,
.file-drop.is-dragover {
  border-color: var(--color-text-muted);
}

.file-drop:focus-within {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.file-drop .file-drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  opacity: 0;
}

.file-drop-text {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.file-drop-text strong {
  color: var(--color-highlight-text);
}

.file-drop-name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.file-drop.has-file .file-drop-name {
  color: var(--color-text);
  font-weight: 600;
}

.file-drop.is-wrong-type .file-drop-name {
  color: var(--color-loss-text);
}

/* ===== css/32-account-type.css ===== */

/* ---------- Manage Accounts: an account still typed "Other" ---------- */

/* Manage Accounts: an account still typed "Other", and its one-tap fix,
   on a line of their own under the type and balance. */
.type-unset-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  /* The same inset as .manage-accounts-meta above it. */
  padding: 0 0.6rem 0.4rem;
  font-size: var(--text-xs);
}

.type-unset {
  color: var(--color-highlight-text);
  font-weight: 600;
}

.type-suggest-btn {
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.type-suggest-btn:hover {
  background: var(--color-hover-bg);
  color: var(--color-text);
}

/* ===== css/33-retirement-answer.css ===== */

/* ---------- Retirement: the plan's answer (retirement-tab.js) ---------- */

/* Retirement: the plan's answer beside the form (retirement-tab.js). */
.retirement-plan-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.75rem;
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.retirement-plan-summary-outlook {
  font-size: var(--text-xs);
}

/* While a change is being worked out, or the form holds numbers it hasn't
   been worked out for (a refused entry): the old answer, dimmed. */
.is-recalculating .retirement-result,
.is-recalculating .retirement-plan-summary,
.is-stale .retirement-result,
.is-stale .retirement-plan-summary {
  opacity: 0.55;
  transition: opacity 0.2s;
}

/* ===== css/34-field-notes.css ===== */

/* ---------- Notes beside a field's label, small segmented choices ---------- */

.label-note {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mini-seg {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 2px;
  font-size: var(--text-xs);
}

.mini-seg label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-control);
  cursor: pointer;
  color: var(--color-text-muted);
  font-weight: 600;
}

.mini-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mini-seg label:has(input:checked) {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.mini-seg label:has(input:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

/* ===== css/35-holdings-list.css ===== */

/* ---------- Phone holdings list (holdings-list.js) ----------
   Only shown below 720px (see the Responsive block); desktop keeps the
   table. */

.holdings-list-wrap {
  display: none;
}

.hl-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
}

.hl-chips::-webkit-scrollbar {
  display: none;
}

.hl-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.hl-chip.is-on {
  border-color: var(--color-selected-bg);
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.hl-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.hl-link-btn {
  background: none;
  border: none;
  padding: 0.5rem 0;
  min-height: 44px;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-highlight-text);
  cursor: pointer;
}

.holdings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

/* Three columns: ticker, weight, value. With two, the value sat hard
   right and ~48% of every row was empty between them; the middle column
   now shows each holding's share of the portfolio in that space. */
.hl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem auto;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--color-border);
}

.hl-row:first-child {
  border-top: none;
}

.hl-main {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  gap: 0.1rem;
  justify-items: start;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hl-ticker {
  font-weight: 700;
  font-size: var(--text-md);
}

.hl-sub {
  max-width: 100%;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Placed explicitly: a holding with no price has no weight cell, and
   auto-placement would then slide its value into the middle column. */
.hl-weight {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.hl-weight-bar {
  flex: 1 1 auto;
  height: 6px;
  border-radius: var(--radius-control);
  background: var(--color-bg);
  overflow: hidden;
}

.hl-weight-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-control);
  background: var(--color-fill-neutral);
}

.hl-weight-pct {
  flex: 0 0 auto;
  min-width: 2.8em;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.hl-value {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  font-weight: 600;
  font-size: var(--text-md);
}

.hl-pill-btn {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  padding: 0.15rem 0;
  background: none;
  border: none;
  cursor: pointer;
}

.hl-pill {
  display: none;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-control);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.hl-pill.gain {
  background: rgba(46, 204, 113, 0.14);
  color: var(--color-gain-text);
}

.hl-pill.loss {
  background: rgba(231, 76, 60, 0.14);
  color: var(--color-loss-text);
}

/* The ▲/▼ markers .gain/.loss add elsewhere: a pill's own colour and
   sign already say it. */
.hl-pill.gain::before,
.hl-pill.loss::before {
  content: none;
}

.holdings-list[data-metric="today"] .hl-pill[data-metric="today"],
.holdings-list[data-metric="today-dollar"] .hl-pill[data-metric="today-dollar"],
.holdings-list[data-metric="return"] .hl-pill[data-metric="return"] {
  display: inline-block;
}

.hl-view-toggle {
  display: block;
  margin: 0.25rem auto 1rem;
}

/* ===== css/36-position-sheet.css ===== */

/* ---------- Position sheet (position-sheet.js) ---------- */

.position-sheet {
  display: grid;
  gap: 0.75rem;
}

.ps-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-right: 3rem;
}

.ps-head h2 {
  margin: 0;
  font-size: var(--text-xl);
}

.ps-name {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.ps-price {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
}

.ps-chart-wrap {
  min-height: 150px;
}

.ps-chart-status {
  margin: 0;
}

/* Range chips under a chart (_range_chips.html, the position sheet). */
.range-chips {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  margin: 0.25rem 0 0.5rem;
}

.range-chip {
  flex: 1;
  min-height: 36px;
  border: none;
  border-radius: var(--radius-dialog);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
}

.range-chip.is-on {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

/* A range the data doesn't reach back to yet (the Net worth view's). */
.range-chip:disabled {
  opacity: 0.4;
  cursor: default;
}

.hero-seg-btn.is-on {
  background: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.hero-breakdown dd.loss::before {
  content: none;
}

.hero-readout.gain {
  color: var(--color-gain-text);
}

.hero-readout.loss {
  color: var(--color-loss-text);
}

.ps-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-bg);
}

.ps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
}

.ps-cell {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.ps-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.ps-value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ps-value.ps-text {
  font-family: var(--font-body);
}

.ps-value.gain::before,
.ps-value.loss::before {
  content: none;
}

.ps-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.ps-small {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.ps-strong {
  font-weight: 700;
}

.ps-bar {
  height: 6px;
  border-radius: var(--radius-control);
  background: var(--color-text-muted);
  overflow: hidden;
}

.ps-bar i {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
}

/* While a change is brought in place (page-refresh.js): the figures about
   to change dim for the moment it takes, rather than the whole page
   going away behind a loading screen. */
.is-updating :is(#dashboard-hero, #dashboard-secondary-stats, .tab-panel.active, [data-live]) {
  opacity: 0.55;
  transition: opacity 0.15s;
}

/* When the position was last edited (holding-edit.js lastChangedText). */
.ps-changed {
  margin: 0.25rem 0 0.75rem;
}

/* ===== css/37-edit-holding.css ===== */

/* ---------- Edit a position (_edit_holding_dialog.html) ----------
   One box per lot, its fields side by side where they fit; a position
   bought once has just the fields. */
.edit-lot {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  margin: 0 0 0.85rem;
  padding: 0.6rem 0.85rem 0;
  min-width: 0;
}

.edit-lot-only {
  border: 0;
  padding: 0;
}

.edit-lot legend {
  padding: 0 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.edit-lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  column-gap: 0.75rem;
}

.ps-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.ps-actions button {
  min-height: 44px;
}

/* ===== css/38-watchlist.css ===== */

/* ---------- Research: watchlist ---------- */

.watchlist-panel {
  margin: 1.25rem 0;
}

.watchlist {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.watchlist:empty {
  display: none;
}

.watchlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 44px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.85rem;
  border-top: 1px solid var(--color-border);
}

.watchlist-row:first-child {
  border-top: none;
}

.watchlist-open {
  display: grid;
  justify-items: start;
  gap: 0.1rem;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.watchlist-price {
  font-weight: 600;
}

.watchlist .hl-pill {
  display: inline-block;
}

.watchlist-remove {
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
}

/* ===== css/39-rebalance-new-cash.css ===== */

/* ---------- Rebalance: Invest new cash, starter mixes ---------- */

.invest-cash,
.starter-mixes {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.invest-cash h3 {
  margin: 0;
}

.invest-cash-form,
.invest-cash-result {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-width: 0;
}

.invest-cash-form .hint,
.invest-cash-result .hint {
  margin: 0;
}

/* The amount beside its split, rather than a list stretched across the
   width of the page. */
@media (min-width: 900px) {
  .invest-cash {
    grid-template-columns: minmax(260px, 360px) minmax(0, 540px);
    gap: 0.5rem 2.5rem;
  }
}

.invest-cash-summary {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
}

.invest-cash-label {
  font-weight: 600;
  font-size: var(--text-sm);
}

/* The app's field look (.form-row input); it isn't in a .form-row. 16px
   text, because iOS zooms the page into any smaller field it focuses. */
.invest-cash-input {
  max-width: 220px;
  font: inherit;
  font-size: var(--text-md);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.invest-cash-input:focus {
  outline: none;
  border-color: var(--color-focus);
}

.invest-cash-input:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.invest-cash-plan {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.invest-cash-plan li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 0.75rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--color-border);
}

.invest-cash-plan li:first-child {
  border-top: none;
}

.invest-cash-bucket {
  font-weight: 600;
}

.invest-cash-amount {
  font-weight: 700;
}

.invest-cash-after {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.starter-mixes p {
  margin: 0;
}

.starter-mix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.privacy-slash {
  display: none;
}

.hide-balances .privacy-slash {
  display: inline;
}

/* The shared now line (Pure.nowAfterLine, styled in part 53) under each
   bucket of the split: now, after this cash, and the reader's target. */
.invest-cash-plan .mp-line {
  grid-column: 1 / -1;
  max-width: 20rem;
}

/* ===== css/40-privacy.css ===== */

/* ---------- Hide balances (privacy.js) ---------- */

/* Kept invisible until privacy.js has masked the page (see base.html),
   so a saved "hide" never flashes real amounts on load. */
.hide-balances:not(.privacy-ready) .app-layout {
  visibility: hidden;
}

/* What text masking can't reach: share counts (value divided by price
   gives the balance back) and charts, whose axes and centre totals are
   drawn on canvas. */
.hide-balances td[data-key="shares"],
.hide-balances .hl-shares,
.hide-balances .tn-shares,
.hide-balances .chart-canvas {
  filter: blur(8px);
}

/* ===== css/41-help.css ===== */

/* ---------- User guide (help.html) ----------
   A reading page: one column near 70 characters, five parts, tables that
   scroll in place on a phone, a search box and an index at the back, and
   print rules that turn it into a clean handout. */

.help-body {
  background: var(--color-bg);
}

.help-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  color: var(--color-text);
  line-height: 1.6;
}

.help-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.help-header h1 {
  margin: 0;
  font-size: var(--text-2xl);
  line-height: 1.15;
}

.help-back,
.help-lede {
  margin: 0;
  color: var(--color-text-muted);
}

.help-page a {
  color: var(--color-highlight-text);
}

.help-toc a,
.help-back a,
.help-ix a,
.help-ix-letters a,
.help-top a {
  text-decoration: none;
}

.help-toc a:hover,
.help-back a:hover,
.help-ix a:hover,
.help-top a:hover {
  text-decoration: underline;
}

/* ---- Search ---- */

.help-search {
  display: grid;
  gap: 0.35rem;
}

.help-search[hidden],
.help-search-results[hidden] {
  display: none;
}

.help-search label {
  font-size: var(--text-sm);
  font-weight: 700;
}

/* 16px so an iPhone doesn't zoom the page when the box is tapped. */
.help-search input {
  width: 100%;
  font: inherit;
  font-size: var(--text-md);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
  color: var(--color-text);
}

.help-search input:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  border-color: var(--color-focus);
}

.help-search-status {
  margin: 0;
  min-height: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.help-search-status:empty {
  display: none;
}

.help-search-results {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-result {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.help-result > a,
.help-result-index {
  display: grid;
  gap: 0.1rem;
  padding: 0.5rem 0.75rem;
  color: var(--color-text);
  text-decoration: none;
}

.help-result > a:hover .help-result-title,
.help-result > a:focus-visible .help-result-title {
  text-decoration: underline;
}

.help-result-title {
  font-weight: 700;
  color: var(--color-text);
}

.help-result-part {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.help-result-snippet,
.help-result-links {
  font-size: var(--text-sm);
  line-height: 1.45;
}

.help-result mark {
  background: rgba(201, 169, 97, 0.32);
  color: inherit;
  border-radius: var(--radius-control);
}

/* ---- Contents ---- */

.help-toc {
  padding: 0.75rem 0;
  border-block: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.help-toc summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
}

.help-toc summary::-webkit-details-marker {
  display: none;
}

.help-toc summary::before {
  content: "▸";
  color: var(--color-text-muted);
}

.help-toc details[open] > summary::before {
  content: "▾";
}

.help-toc-title {
  display: inline;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Columns rather than a grid, so the parts flow into balanced columns
   instead of leaving a gap under a short one. */
.help-toc-parts {
  columns: 3 220px;
  column-gap: 1.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: help-part;
}

.help-toc-parts > li {
  break-inside: avoid;
  margin-bottom: 0.75rem;
  counter-increment: help-part;
}

.help-toc-part {
  font-weight: 700;
}

.help-toc-part::before {
  content: counter(help-part) ". ";
}

.help-toc-parts ul {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  list-style: none;
  line-height: 1.45;
}

.help-toc-parts ul li {
  margin-bottom: 0.15rem;
}

.help-print {
  justify-self: start;
}

.help-note {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

/* ---- Parts and topics ---- */

.help-page {
  counter-reset: help-part-heading;
}

.help-part {
  counter-increment: help-part-heading;
  scroll-margin-top: 1rem;
}

.help-part-title {
  margin: 2.5rem 0 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xl);
  line-height: 1.2;
  scroll-margin-top: 1rem;
}

.help-part-title::before {
  content: "Part " counter(help-part-heading);
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.help-section,
.help-subtopic {
  scroll-margin-top: 1rem;
}

.help-section {
  padding-top: 0.25rem;
}

.help-section h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: var(--text-xl);
  line-height: 1.25;
}

.help-section h4 {
  margin: 1.2rem 0 0.35rem;
  font-size: var(--text-md);
  scroll-margin-top: 1rem;
}

.help-section p,
.help-section li {
  max-width: 72ch;
}

.help-section ul,
.help-section ol {
  padding-left: 1.25rem;
}

.help-section li {
  margin-bottom: 0.35rem;
}

.help-section li > ul {
  margin-top: 0.35rem;
}

/* "I want to...": goals in the reader's words, each a link to the topic
   whose steps do it. Four groups across on a desktop, one on a phone. */
.help-goals {
  margin: 1rem 0;
  padding: 0.9rem 1rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.help-goals-title {
  margin: 0 0 0.6rem;
  font-size: var(--text-md);
}

.help-goals-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.5rem 1.5rem;
}

.help-goals-group h3 {
  margin: 0 0 0.25rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.help-goals-group ul {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.help-goals-group li a {
  display: block;
  padding: 0.3rem 0;
}

@media (pointer: coarse) {
  .help-goals-group li a {
    padding: 0.7rem 0;
  }
}

@media print {
  .help-goals {
    display: none;
  }
}

/* Where a task is done, on a computer and on a phone. */
.help-where {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-control);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

/* Numbered steps: one action each, the number in a circle. */
.help-steps {
  list-style: none;
  counter-reset: help-step;
  padding-left: 0;
}

.help-section .help-steps {
  padding-left: 0;
}

.help-steps > li {
  position: relative;
  padding-left: 2.1rem;
  counter-increment: help-step;
}

.help-steps > li::before {
  content: counter(help-step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--color-fill-neutral);
  color: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
}

.help-steps > li > ul {
  padding-left: 1.1rem;
  list-style: disc;
}

.help-top {
  margin: 1.25rem 0 0;
  font-size: var(--text-sm);
}

/* Where a search result or a link landed: marked for a moment. */
.help-flash {
  animation: help-flash 2s ease-out;
}

@keyframes help-flash {
  from {
    background: rgba(201, 169, 97, 0.35);
  }

  to {
    background: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-flash {
    animation: none;
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
  }
}

.help-question {
  margin: 0 0 0.4rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.help-example {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-control);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.help-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  font-size: var(--text-sm);
}

.help-table-wrap {
  overflow-x: auto;
  margin: 0.4rem 0 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.help-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.help-table th,
.help-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.help-table tbody tr:last-child > * {
  border-bottom: none;
}

.help-table thead th {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.help-table tbody th {
  white-space: nowrap;
}

/* A deep-dive figure's dimension, under its name. */
.help-table tbody th small {
  display: block;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Two short columns (Limits): fits a phone as it is, labels wrapping. */
.help-table.help-table-narrow {
  min-width: 0;
}

.help-table-narrow tbody th {
  white-space: normal;
}

.help-table .help-level {
  display: table;
  margin-bottom: 0.15rem;
}

.help-level {
  display: inline-block;
  margin-right: 0.25rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.help-level-good {
  background: rgba(46, 204, 113, 0.16);
  color: var(--color-gain-text);
}

.help-level-fair {
  background: rgba(201, 169, 97, 0.22);
  color: var(--color-highlight-text);
}

.help-level-poor {
  background: rgba(231, 76, 60, 0.14);
  color: var(--color-loss-text);
}

.help-level-neutral {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.help-faq dt,
.help-glossary dt {
  margin-top: 0.8rem;
  font-weight: 700;
  scroll-margin-top: 1rem;
}

.help-faq dd,
.help-glossary dd {
  margin: 0.2rem 0 0;
  max-width: 72ch;
}

.help-glossary dd p {
  margin: 0.1rem 0;
}

.help-glossary details {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.help-glossary summary {
  cursor: pointer;
  color: var(--color-text);
}

.help-glossary dt:target {
  color: var(--color-text);
}

/* ---- Index ---- */

.help-ix-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0 0.75rem;
}

.help-ix-letters a {
  display: inline-block;
  min-width: 2rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  font-weight: 700;
  text-align: center;
}

/* Two columns where there's room, as a printed index sets it. A letter's
   heading stays with its first terms, and no term splits. */
@media (min-width: 700px) {
  .help-ix-body {
    columns: 2;
    column-gap: 2rem;
  }
}

.help-section .help-ix-letter {
  break-after: avoid;
  margin: 1rem 0 0.25rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-lg);
  color: var(--color-text);
}

.help-section .help-ix {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-section .help-ix li {
  margin-bottom: 0.25rem;
  line-height: 1.45;
  break-inside: avoid;
  scroll-margin-top: 1rem;
}

/* A hanging indent, as a printed index has: a term's wrapped lines sit
   in from the term, so the next term stands out. */
.help-section .help-ix > li {
  padding-left: 1.1rem;
  text-indent: -1.1rem;
}

.help-ix-group:first-child .help-ix-letter {
  margin-top: 0;
}

.help-ix-term {
  font-weight: 700;
  margin-right: 0.35rem;
}

/* Sub-entries one step in from the term; their own wrapped lines hang
   in from them again. */
.help-section .help-ix ul {
  margin: 0.15rem 0 0.1rem;
  padding-left: 0.4rem;
  list-style: none;
}

.help-section .help-ix ul li {
  padding-left: 1.1rem;
  text-indent: -1.1rem;
}

.help-ix ul .help-ix-term {
  font-weight: 400;
  font-style: italic;
}

@media print {
  /* Compact handout type: the whole guide, glossary and index included,
     on a few pages. The glossary prints its short explanations in two
     columns, and the index in three; the fuller detail stays in the app. */
  .help-body {
    background: #fff;
  }

  .help-page {
    max-width: none;
    padding: 0;
    color: #000;
    font-size: 9.5pt;
    line-height: 1.35;
  }

  .help-page a {
    color: #000;
    text-decoration: none;
  }

  .help-back,
  .help-toc,
  .help-print,
  .help-search,
  .help-top,
  .help-ix-letters {
    display: none;
  }

  .help-header h1 {
    font-size: 16pt;
  }

  .help-part-title {
    margin: 1rem 0 0.2rem;
    padding-top: 0.4rem;
    border-top-color: #999;
    font-size: 14pt;
    break-after: avoid;
  }

  .help-part-title::before {
    color: #555;
  }

  .help-section h3 {
    margin: 0.9rem 0 0.25rem;
    font-size: 12pt;
    break-after: avoid;
  }

  .help-section h4 {
    margin: 0.6rem 0 0.15rem;
    font-size: 10.5pt;
    break-after: avoid;
  }

  .help-section p {
    margin: 0.2rem 0 0.35rem;
  }

  .help-section li {
    margin-bottom: 0.1rem;
  }

  .help-section p,
  .help-section li,
  .help-faq dd {
    max-width: none;
  }

  .help-where {
    padding: 0.15rem 0.4rem;
    border-color: #999;
    background: none;
  }

  .help-steps > li::before {
    background: none;
    border: 1px solid #000;
    color: #000;
    width: 1.2rem;
    height: 1.2rem;
    line-height: 1.2rem;
  }

  .help-table-wrap {
    overflow: visible;
    margin: 0.2rem 0 0.4rem;
    border-color: #999;
  }

  .help-table {
    min-width: 0;
    font-size: 8.5pt;
  }

  .help-table th,
  .help-table td {
    padding: 0.2rem 0.35rem;
  }

  .help-table tr {
    break-inside: avoid;
  }

  .help-faq dt {
    margin-top: 0.35rem;
  }

  .help-glossary {
    columns: 2;
    column-gap: 1.2rem;
    font-size: 8.5pt;
  }

  .help-glossary dt {
    margin-top: 0.3rem;
    break-after: avoid;
  }

  .help-glossary dd {
    break-inside: avoid;
  }

  .help-glossary details {
    display: none;
  }

  .help-ix-body {
    columns: 3;
    column-gap: 1rem;
    font-size: 8pt;
  }

  .help-section .help-ix-letter {
    margin-top: 0.4rem;
    font-size: 10pt;
    color: #000;
    break-after: avoid;
  }

  .help-section .help-ix li {
    margin-bottom: 0.05rem;
    break-inside: avoid;
  }
}

/* ===== css/42-activity.css ===== */

/* ---------- Activity tab (activity-tab.js) ---------- */

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}

.activity-income {
  margin-bottom: 0.75rem;
}

/* The one line pointing to realized gains on Taxes (v2.4.0). */
.activity-gains-link {
  margin: 0 0 1.25rem;
}

.activity-history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.activity-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.activity-list .empty-state {
  padding: 1rem;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 44px;
  grid-template-areas:
    "main side remove"
    "meta meta remove";
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  padding: 0.55rem 0.4rem 0.55rem 0.85rem;
  border-top: 1px solid var(--color-border);
}

.activity-row:first-child {
  border-top: none;
}

.ar-kind {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-align: center;
}

.ar-kind-buy {
  background: rgba(46, 204, 113, 0.15);
  color: var(--color-gain-text);
}

.ar-kind-sell {
  background: rgba(231, 76, 60, 0.13);
  color: var(--color-loss-text);
}

.ar-kind-dividend {
  background: var(--color-hover-bg);
  color: var(--color-text);
}

.ar-main {
  grid-area: main;
  min-width: 0;
}

.ar-meta {
  grid-area: meta;
  min-width: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.ar-side {
  grid-area: side;
  display: grid;
  justify-items: end;
  gap: 0.1rem;
}

.ar-gain {
  font-size: var(--text-sm);
}

.ar-delete {
  grid-area: remove;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
}

.ar-delete:hover {
  color: var(--color-loss-text);
}

.tx-kind {
  display: flex;
  margin-bottom: 0.9rem;
  font-size: var(--text-sm);
}

.tx-kind label {
  flex: 1;
  justify-content: center;
  padding: 0.45rem 0.7rem;
}

/* Year and filter chips size to their labels rather than sharing the
   row the way the chart range chips do. */
#activity-filter {
  justify-content: flex-start;
}

#activity-filter .range-chip {
  flex: 0 0 auto;
  padding: 0 0.85rem;
}

.returns-card {
  margin-bottom: 1.25rem;
}

.returns-card .stat-row {
  margin-bottom: 0.5rem;
}

/* ===== css/43-touch.css ===== */

/* ---------- Responsive ---------- */

/* ---------- Touch screens, any size (The In-Between, S2) ----------
   At least 44px to tap, whatever a control looks like. An invisible area
   centred on each (::after) takes the tap, so pills and chips keep their
   drawn size: 22px (the Holdings list's pills) to 36px (filter and range
   chips). These were phone-only (v1.125.0), so a tablet's were left at
   their drawn size; Research's buttons (28px) were missed. */
@media (pointer: coarse) {
  .hl-pill-btn,
  .tab-scroll .tab-btn,
  .range-chip,
  .hl-chip,
  .holdings-toggle-btn,
  .research-btn,
  .research-search-btn {
    position: relative;
  }

  .hl-pill-btn::after,
  .tab-scroll .tab-btn::after,
  .range-chip::after,
  .hl-chip::after,
  .holdings-toggle-btn::after,
  .research-btn::after,
  .research-search-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }

  .sidebar-filter-input,
  .exposure-search-input {
    min-height: 44px;
  }

  /* The chip and tab rows scroll sideways, and a scroller clips whatever
     extends past it -- the tap areas above included. Room inside, taken
     back outside, so nothing moves. (A desktop's .tab-scroll is
     display: contents, which has no padding to give.) */
  .hl-chips {
    padding-top: 4px;
    margin-top: -4px;
  }

  .tab-scroll {
    padding-block: 7px;
    margin-block: -7px;
  }

  /* A portfolio's name in the account list clips its own overflow (for
     the ellipsis), which would clip a tap area around it too: it grows by
     padding instead, taken back by margin. It has no background, so it
     looks the same. */
  .sidebar-group-link {
    padding-block: 0.65rem;
    margin-block: -0.65rem;
  }

  /* The total beside the name may sit inside that area; it's only text,
     so a tap there goes through to the name. */
  .sidebar-group-meta {
    pointer-events: none;
  }
}

/* ===== css/44-tablet.css ===== */

/* ---------- Tablets, phones on their side, small windows (S1) ----------
   From the phone layout's 720px up to 1100px, the 230px account list took
   a fifth of the width, the tabs wrapped to three rows, and they started
   about 1,300px down the page. Here, as on a phone, the account list is a
   drawer opened from the switcher, and the tab bar comes first and stays
   pinned: the switcher and actions on one line, the tabs in one sideways
   row under them. These mirror the phone block's drawer and bar (below),
   without its bottom bar or full-screen sheet. */
@media (min-width: 721px) and (max-width: 1100px) {
  .portfolio-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(360px, 85vw);
    height: 100vh;
    background: var(--color-surface);
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
  }

  .portfolio-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 0.85rem 0 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-md);
    font-weight: 700;
    cursor: pointer;
  }

  .sidebar-toggle-btn[aria-expanded="true"],
  .sidebar-toggle-btn:active {
    border-color: var(--color-selected-bg);
  }

  .sidebar-toggle-btn .hamburger-icon {
    flex-shrink: 0;
  }

  .switcher-name {
    display: block;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .switcher-caret {
    display: inline;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }

  .hamburger-icon,
  .hamburger-icon::before,
  .hamburger-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
  }

  .hamburger-icon {
    position: relative;
  }

  .hamburger-icon::before,
  .hamburger-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .hamburger-icon::before {
    top: -6px;
  }

  .hamburger-icon::after {
    top: 6px;
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-main {
    display: flex;
    flex-direction: column;
  }

  /* `margin: 0 auto` means shrink-to-content in a column flexbox. */
  .tab-nav,
  .tab-content-container {
    margin-inline: 0;
    width: 100%;
  }

  .tab-nav {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 1030;
    gap: 0.5rem;
    padding-block: 0.5rem;
    background: var(--color-bg);
  }

  .tab-scroll {
    display: flex;
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }

  .tab-scroll::-webkit-scrollbar {
    display: none;
  }

  .tab-nav .tab-btn {
    display: block;
    flex: 0 0 auto;
    white-space: nowrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: var(--text-sm);
  }

  .tab-nav .tab-btn.active {
    background: var(--color-selected-bg);
    color: var(--color-selected-text);
    border-color: var(--color-selected-bg);
    font-weight: 600;
  }

  /* Add Holding and the toolbar share the switcher's line, at its end. */
  .add-holding-btn {
    margin-left: auto;
  }

  .tab-nav-actions {
    margin-left: 0;
  }

  .reconcile-btn-more {
    display: none;
  }
}

/* ===== css/45-phone-frame.css ===== */

/* ---------- Phones (below 720px): the frame, drawer, account sheet, header ---------- */

@media (max-width: 720px) {
  /* The base rule's align-items:flex-start (desktop: sidebar and main
     don't force each other's height) becomes wrong once .app-layout
     switches to a column: flex-start sizes .app-main to its own
     max-content width instead of stretching it to fill the viewport,
     so anything inside with un-shrinkable content (e.g. the composition
     chart's fixed-width canvas + flex-grow legend) silently overflows
     the real device width instead of wrapping/shrinking against it.
     Pre-existing bug, not introduced by this phase -- it just never
     had a wide-enough unshrinkable child to expose it until now. */
  .app-layout {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
  }

  /* Off-canvas drawer: hidden by default (translated fully off-screen),
     slides in over the content when JS adds .is-open (see sidebar.js).
     Positioned/z-indexed below .modal-overlay (1100) and .nav-loading-overlay
     (2000) so modals and full-page-nav loading still stack correctly above
     an open drawer. */
  /* The account sheet fills the screen: at 300px, names were cut short and
     the page showed through at the side for no purpose. */
  .portfolio-sidebar {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    border-right: none;
    /* No shadow while closed: parked off the left edge, it still fell
       about 18px into view and shaded that side of every screen. */
    box-shadow: none;
    background: var(--color-surface);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
  }

  .portfolio-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
  }

  /* The header's switcher on a phone: what you're looking at, and the
     way to the account list. It was the name alone, styled as a title
     (v1.94 dropped the ☰ it replaced), and didn't read as something to
     tap. Now it's a bordered pill with the ☰ back in front of the name,
     sized to its text so it can't pass for the page heading. */
  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 0.85rem 0 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    color: var(--color-text);
    font: inherit;
    font-size: var(--text-md);
    font-weight: 700;
    cursor: pointer;
  }

  .sidebar-toggle-btn[aria-expanded="true"],
  .sidebar-toggle-btn:active {
    border-color: var(--color-selected-bg);
  }

  .sidebar-toggle-btn .hamburger-icon {
    flex-shrink: 0;
  }

  .switcher-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .switcher-caret {
    display: inline;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }

  .hamburger-icon,
  .hamburger-icon::before,
  .hamburger-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
  }

  .hamburger-icon {
    position: relative;
  }

  .hamburger-icon::before,
  .hamburger-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .hamburger-icon::before {
    top: -6px;
  }

  .hamburger-icon::after {
    top: 6px;
  }

  /* 16px: iOS zooms the page into any smaller field it focuses. */
  .sidebar-filter-input {
    font-size: var(--text-md);
  }

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

/* ===== css/46-phone-tabs.css ===== */

/* ---------- Phones: the tab bar, sections, bottom bar, tiles ---------- */

@media (max-width: 720px) {
  /* The tab bar comes first on a phone and stays pinned to the top, so
     switching tabs never means scrolling back up past the header (the
     tab bar used to start ~1,300px down a 844px screen). tabs.js scrolls
     a newly picked tab's content up to just under it. */
  .app-main {
    display: flex;
    flex-direction: column;
  }

  /* Their desktop `margin: 0 auto` (centring under a 2400px max-width)
     means something else in a column flexbox: auto side margins make an
     item shrink to its content width instead of stretching. The tab
     bar's content is ~810px of pills, so it pushed the page sideways. */
  .tab-nav,
  .tab-content-container {
    margin-inline: 0;
    width: 100%;
  }

  .tab-nav {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.5rem;
    background: var(--color-bg);
  }

  /* Which tabs the strip shows, for the destination you're on, is
     69-home.css's, as on every screen. Adding is in "+". */
  #add-holding-btn {
    display: none;
  }

  /* Home's fold of the Holdings tab is in 69-home.css, at every width
     since v2.2.0. */

  .app-header-top .refresh-info,
  .refresh-label,
  .freshness-prefix {
    display: none;
  }

  /* margin-left: auto keeps it at the right edge now that the switcher
     beside it is sized to its text instead of stretching. */
  .quick-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    margin-left: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-highlight);
    color: var(--color-on-highlight);
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
  }

  .bottom-nav-btn {
    display: grid;
    justify-items: center;
    gap: 0.05rem;
    min-height: 48px;
    padding: 0.2rem 0;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
  }

  .bottom-nav-icon {
    display: block;
  }

  .bottom-nav-btn[aria-current="page"] {
    color: var(--color-text);
  }

  /* Room at the end of the page for the fixed bottom bar. */
  .app-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* The drawer is the account switcher now; adding lives in "+", and
     settings, the tour and log out in More. */
  .portfolio-sidebar .sidebar-add-menu,
  .portfolio-sidebar .sidebar-footer,
  .portfolio-sidebar .sidebar-admin-link {
    display: none;
  }

  .portfolio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .portfolio-list li {
    flex: 1 1 100%;
  }

  .tab-nav,
  .tab-content-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* 2-column instead of a single stacked column -- same info, half the
     vertical scroll to get past the header before reaching tab content. */
  .summary-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .stat-tile {
    min-width: 0;
  }

  /* Name over its bar on a phone, figures at the end. */
  .target-bar-row {
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.75rem;
  }

  .target-bar-label {
    grid-column: 1 / -1;
  }

  .only-desktop {
    display: none;
  }

  .only-phone {
    display: inline;
  }

  /* Touch targets moved to the (pointer: coarse) block above, which
     covers every touch screen, this one included (The In-Between, S2). */

  /* The plan's answer stays in view under the pinned tab bar while the
     form below it is edited. */
  .retirement-plan-summary {
    position: sticky;
    top: var(--pin-top, 0px);
    z-index: 5;
    margin-inline: -0.25rem;
    padding: 0.5rem 0.25rem;
    background: var(--color-surface);
  }

  /* Performance's returns side by side, not three full-width tiles
     (~300px) stacked. */
  #performance-returns {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  /* The base `.stat-row .stat-tile` gives every tile 170px at least, and
     outranks the plain `.stat-tile` reset above: three of them overflowed
     the screen. */
  #performance-returns .stat-tile {
    min-width: 0;
    padding: 0.55rem 0.5rem;
  }

  #performance-returns .stat-label {
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
  }

  /* "▲+46.46%" on one line in a third of the screen. */
  #performance-returns .stat-value {
    font-size: var(--text-md);
    white-space: nowrap;
  }

  /* Tab strip becomes a horizontally-scrollable row of pills on mobile
     instead of a plain <select> -- Phase 2 of "The Polish Gap" UX
     roadmap (Finding 02): a native dropdown hid all 7 tabs behind one
     tap and read as a form control rather than navigation, the one
     thing every benchmarked competitor's mobile nav got right. The
     buttons already have full click/keyboard-shortcut wiring in
     tabs.js -- wire()/switchTo() act on every .tab-btn regardless of
     visibility -- so this is a pure CSS swap of which control shows.
     .tab-select stays in the DOM (kept in sync by switchTo() too) as
     an inert fallback rather than something to rip out. */
  .tab-scroll {
    display: flex;
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }

  .tab-scroll::-webkit-scrollbar {
    display: none;
  }

  .tab-nav .tab-btn {
    display: block;
    flex: 0 0 auto;
    white-space: nowrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: var(--text-sm);
  }

  .tab-nav .tab-btn.active {
    background: var(--color-selected-bg);
    color: var(--color-selected-text);
    border-color: var(--color-selected-bg);
    font-weight: 600;
  }

  .tab-select {
    display: none;
  }

  /* Add Holding shrinks to a round "+" at the right end of the pinned
     bar. It's hidden where it can't be used (the read-only All
     Portfolios view) rather than shown disabled at full width. Export
     HTML saves a file for a desktop browser, so a phone doesn't get it. */
  .add-holding-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: var(--text-xl);
    line-height: 1;
  }

  .add-holding-label,
  .add-holding-btn:disabled,
  .tab-nav-actions {
    display: none;
  }

  /* nowrap matters as much as the direction. A wrapping flex container
     sizes each line to its widest item's content rather than to the
     container, so a chart drawn wide -- before a rotation, say -- sized
     its card around it; Chart.js measures the card, so the canvas never
     shrank back, and the page scrolled sideways. Each row got stuck at
     its own width, leaving Portfolio vs. SPY wider than the charts above
     it. A single line is as wide as the screen, whatever it holds. */
  .chart-row,
  .table-row {
    flex-direction: column;
    flex-wrap: nowrap;
  }
}

/* ===== css/47-phone-tables.css ===== */

/* ---------- Phones: tables and charts ---------- */

@media (max-width: 720px) {
  /* A wide multi-column table is unreadable at phone width no matter how
     small the font gets -- turn each row into its own card instead, with
     the first column (Ticker/Account/Sector -- always the identifying
     field, per each template's column order) as an unlabeled headline
     and the rest as label:value rows via data-label (see holdings.html /
     performance.html). Existing .mono/.gain/.loss
     classes and data-key/data-value/data-editable attributes on the <td>s
     are untouched -- this only changes layout, not the DOM sort/edit/
     drill-down wiring in holdings-tab.js, which is all sibling/attribute
     based and doesn't care about display mode. */
  .data-table,
  .data-table thead,
  .data-table tbody,
  .data-table tr,
  .data-table th,
  .data-table td {
    display: block;
  }

  .data-table thead {
    position: absolute;
    left: -9999px;
  }

  .data-table tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-dialog);
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--color-surface);
  }

  .data-table td {
    border: none;
    padding: 0.25rem 0;
    text-align: right;
  }

  .data-table td::before {
    content: attr(data-label);
    float: left;
    /* A gain or loss cell's ::before is also its ▲/▼ marker, which sets
       0.75em: those labels came out smaller than the rest of the card. */
    font-size: 1em;
    font-weight: 600;
    color: var(--color-text-muted);
    /* A numeric cell is .mono, and the label would inherit it --
       "Dividend Yield" set like code next to "Portfolio" in the body
       face on the card above it. */
    font-family: var(--font-body);
  }

  .data-table td:first-child {
    text-align: left;
    font-size: var(--text-md);
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
  }

  .data-table td:first-child::before {
    content: none;
  }

  /* About four and a half of the 44px rows (49-phone-touch.css): enough to
     see there are more, in a card no taller than the pie it replaced. The
     selected row's details are in the readout above (.chart-readout). */
  .hero-chart-card .ranked-bars:not(.ranked-bars--all),
  .ranked-bars--tall {
    max-height: 12.5rem;
  }

  .ranked-bars {
    --ranked-name: 5rem;
  }

  .ranked-bars--long {
    --ranked-name: 7.5rem;
  }

  /* The drill-down row's single wide <td colspan> and the "empty state"
     row don't have a data-label to show -- suppress the (empty) label
     gap and let their own content (a flex row / centered text) fill the
     card-row width normally. */
  .drill-down-row td,
  .data-table td.empty-state {
    text-align: left;
  }
  .drill-down-row td::before,
  .data-table td.empty-state::before {
    content: none;
  }

  /* .holdings-compact-table gets a different mobile treatment than the
     other data-tables above: a compact, still-real table instead of
     stacked cards. A portfolio with dozens of tickers (in the main
     Holdings table, or in the Direct vs. Indirect Exposure table below
     it -- fund look-through can surface even more distinct rows there
     than the holdings themselves) turned into dozens of ~10-line cards
     -- real scroll fatigue -- and the stacked-card conversion also moves
     <thead> off-screen entirely (see .data-table thead above), so there
     was no way to tap a column header and sort on mobile at all. Scoped
     to this class (higher specificity than the .data-table class rules
     above via #holdings-table/#holdings-exposure-table's own id further
     down, since both tables also carry the plain .data-table class)
     rather than changing the shared pattern every other mobile table
     still uses -- Performance/Rebalance/Tax Location have
     far fewer rows, so stacked cards are still the better fit there. */
  .holdings-table-scroll {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-dialog);
    margin-bottom: 1.5rem;
  }

  .holdings-compact-table {
    display: table;
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    /* position:sticky on a <td>/<th> doesn't reliably work under
       border-collapse:collapse (the .data-table base rule) in most
       browsers -- needed for the pinned first column below.
       border-spacing:0 keeps the seamless look collapse otherwise gave. */
    border-collapse: separate;
    border-spacing: 0;
    /* .data-table's own overflow:hidden (for its desktop border-radius)
       would otherwise make the table itself -- not .holdings-table-scroll
       -- the sticky td's nearest scrolling ancestor, since overflow:hidden
       counts as a scroll container for that calculation even though nothing
       can actually scroll inside it. The pinned column silently stopped
       pinning until this was found by testing a minimal sticky-table-cell
       case against the real one and diffing every ancestor's overflow. */
    overflow: visible;
  }

  /* Columns size to their own content rather than being stretched to a
     fixed width. This used to be `min-width: 760px` ("wide enough for all
     11 columns to breathe"), but stretching a table past its content width
     makes the browser hand the surplus out across the columns: every one
     landed on an identical 135px, so a Ticker cell holding ~30px of text
     carried ~105px of dead space, and Sector, Price and Weight each
     carried ~85px. That is ~700px of emptiness to swipe through to reach
     the numbers -- the columns that genuinely needed room (Account, Day
     Change) were the only ones not getting it. max-content gives each
     column what it actually needs and nothing more; the table still
     scrolls sideways, just past data instead of whitespace. */
  #holdings-table {
    width: max-content;
  }

  .holdings-compact-table thead {
    display: table-header-group;
    position: static;
    left: auto;
  }

  .holdings-compact-table tbody {
    display: table-row-group;
  }

  .holdings-compact-table tr {
    display: table-row;
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    padding: 0;
    background: none;
  }

  .holdings-compact-table th,
  .holdings-compact-table td {
    display: table-cell;
    padding: 0.55rem 0.5rem;
    font-size: var(--text-xs);
    text-align: left;
  }

  .holdings-compact-table td::before {
    content: none;
  }

  /* Undoes the stacked-card treatment of this cell, which the card rules
     above still apply because both selectors have the same specificity.
     There it is a card's headline (1.05rem, bold, underlined, with the
     rest of the card beneath it); here it is just the first cell of a
     real row. `font-size: inherit` did not undo the 1.05rem -- it left
     the Ticker rendering at 16.8px against 13.6px data cells and a
     12.5px column header, which is the "first column header is smaller
     than the data" effect. The underline has to be turned off rather
     than merely left unset, for the same specificity reason, and no
     other cell in this table carries one. */
  .holdings-compact-table td:first-child {
    font-size: var(--text-xs);
    font-weight: 600;
    border-bottom: none;
    padding-bottom: 0.55rem;
    margin-bottom: 0;
  }

  .holdings-compact-table th.mono,
  .holdings-compact-table td.mono {
    text-align: right;
  }

  /* The free-text columns, capped so none of them can set the table's
     width on its own. Once columns size to their content (see
     #holdings-table above) these are the only ones that can run long: a
     real account name like "Personal Taxable Investing - Brokerage" took
     its column to 238px by itself, pushing every money column that much
     further right.

     The first column is capped too, and matters most of the three: it is
     the pinned one, so its width is subtracted from what you can see at
     every scroll position, not just at the start. In Direct vs. Indirect
     Exposure its labels ("Other - Technology") were wrapping to two
     lines, making every row twice as tall to avoid a horizontal problem.

     The numeric columns are deliberately left uncapped -- they are the
     reason for scrolling sideways, and truncating a dollar amount would
     make it wrong rather than merely shorter.

     120px keeps the widest header of the set ("Account" plus its info
     icon, ~115px with padding) on one line, so the cap never truncates a
     header. Tapping a cell to edit it still shows the full value.

     Scoped to real data rows by class, not to td:first-child generally:
     the drill-down panel and the empty-state row are single wide
     <td colspan> cells that are also first children, and clipping those
     to 120px would cut off the panel and the "No holdings found."
     message. */
  .holdings-compact-table th[data-sort="account"],
  .holdings-compact-table th[data-sort="sector"],
  .holdings-compact-table td[data-key="account"],
  .holdings-compact-table td[data-key="sector"],
  .holdings-compact-table th:first-child,
  .holdings-compact-table tr.holding-row td:first-child,
  .holdings-compact-table tr.exposure-row td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
  }

  /* The pinned column gets a tighter budget than the ones you scroll
     past, because it is subtracted from the visible width at every scroll
     position rather than only at the start. 100px keeps it as narrow as
     the two-line wrap left it (93px) while fitting on one line, so the
     shorter rows cost no horizontal room; 120px here would have widened
     it to 120px for 13% more label. Holdings is unaffected either way --
     a ticker is a handful of characters, so its column sits at 75px and
     this is only insurance against a long one. */
  .holdings-compact-table th:first-child,
  .holdings-compact-table tr.holding-row td:first-child,
  .holdings-compact-table tr.exposure-row td:first-child {
    max-width: 100px;
  }

  /* First column (Ticker) stays pinned while the rest of the row scrolls
     underneath it, so a row scrolled several columns in still reads as
     "which one is this" without scrolling back -- the whole point of
     swiping sideways instead of hunting through stacked cards. Needs its
     own opaque background: a sticky cell doesn't otherwise get one for
     free, and without it the scrolled-under columns would show through. */
  .holdings-compact-table th:first-child,
  .holdings-compact-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--color-surface);
  }

  .holdings-compact-table th:first-child {
    background: var(--color-table-header-bg);
    z-index: 2;
  }

  /* The pinned Ticker column is capped (above), so a "2 lots" badge beside
     the ticker was cut to "2 lo...": it sits under the ticker instead. */
  .holdings-compact-table .lot-count {
    display: block;
    width: fit-content;
    margin: 0.2rem 0 0;
  }

  /* Holdings: the list replaces the table unless "Table view" is on.
     By id, not .holdings-table-scroll: that class also wraps the Direct
     vs. Indirect Exposure table, which the list does not replace, and
     hiding every wrapper left the exposure section as a search box and a
     "Show All" button with nothing under either. */
  .holdings-list-wrap {
    display: block;
  }

  .tab-panel:not(.hl-table-mode) #holdings-table-scroll,
  .tab-panel:not(.hl-table-mode) #holdings-toggle-btn,
  .hl-table-mode #hl-account-chips,
  .hl-table-mode #hl-sort-chips,
  .hl-table-mode .hl-summary,
  .hl-table-mode .holdings-list {
    display: none;
  }
}

/* Research's holdings on a phone (v1.152.0): the ticker and account on a
   line of their own, then the two buttons side by side at equal widths.
   Four in a row left "Open deep dive" wrapped over three lines and
   running off the list. A row with only Research gives it the width. */
@media (max-width: 720px) {
  .research-list {
    grid-template-columns: 1fr 1fr;
  }

  .research-list-item {
    row-gap: 0.6rem;
  }

  .research-holding {
    grid-column: 1 / -1;
  }

  .research-list-item .research-btn {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .research-list-item .research-btn:only-of-type {
    grid-column: 1 / -1;
  }
}

/* ===== css/48-phone-sheets.css ===== */

/* ---------- Phones: tooltips and dialogs as bottom sheets, the account sheet ---------- */

@media (max-width: 720px) {
  /* Ticker-hover/info-icon popup becomes a fixed bottom sheet instead of
     a cursor-anchored floating box -- see position()'s mobile branch in
     tooltip.js, which skips inline left/top positioning below this same
     720px breakpoint so this rule applies untouched. !important is
     necessary because inline styles otherwise beat a plain media-query
     rule regardless of specificity. */
  .tooltip-panel {
    z-index: 1045;
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: 0.75rem !important;
    top: auto !important;
    max-width: none;
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
  }

  /* Modals become a bottom sheet on mobile -- same idea as .tooltip-panel
     above, but simpler: every modal opens by toggling its `hidden`
     attribute (see ui.js/dashboard.js/*-forms.js), never via inline JS
     positioning, so there's no !important fight to win here, just a
     plain override. One .modal rule also replaces .modal-wide's desktop
     width for free (same specificity, this rule is physically later). */
  .modal-overlay {
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-width: none;
    max-height: 85vh;
    margin: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  }

  .modal-close {
    width: 44px;
    height: 44px;
    top: 0.35rem;
    right: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* manual-account-modal is the only modal using these -- its rows are
     already flex-direction: column internally, so collapsing to one
     track is all a phone-width form needs. */
  .form-row-grid,
  .form-row-grid-2 {
    grid-template-columns: 1fr;
  }

  /* Every icon-only edit/delete button bumps to a real ~44px tap target
     on mobile (.modal-close is already sized above) -- desktop keeps its
     compact ~24px sizing, since a tight click target is fine with a
     mouse but not a thumb.

     The box is also given a visible resting surface here, which it has
     none of at any width: the 44px hit area was invisible, wrapping a
     14px pencil and a 9px times glyph with a transparent background and
     no border. Desktop reveals the button on :hover; touch has no hover,
     so on a phone these read as two ambiguous marks floating in the
     row's whitespace -- a compliant target you can't see. The glyphs get
     a modest bump for the same reason (the 9px times was the worst). */
  .portfolio-edit-btn,
  .portfolio-delete-btn,
  .manual-account-edit-btn,
  .manual-account-delete-btn,
  .account-edit-btn,
  .account-delete-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-dialog);
  }

  .portfolio-delete-btn,
  .manual-account-delete-btn,
  .account-delete-btn {
    font-size: var(--text-lg);
  }

  .sidebar-recent:not([hidden]) {
    display: block;
    margin-bottom: 0.5rem;
  }

  /* A search replaces Recent with its results. */
  .portfolio-sidebar.filtering .sidebar-recent {
    display: none;
  }

  /* The sheet is for switching view; Edit and Delete live in Manage
     Accounts (its link ends the list, and it's in More). */
  .portfolio-sidebar .row-menu {
    display: none;
  }

  .sidebar-scroll {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .sidebar-manage-link {
    min-height: 44px;
    font-size: var(--text-sm);
  }

  /* Account rows, group chevrons and the ⋯ at full tap height. */
  .portfolio-sidebar .portfolio-item {
    min-height: 44px;
    align-items: center;
    box-sizing: border-box;
  }

  .sidebar-group-toggle {
    width: 36px;
    height: 44px;
  }

  .sidebar-group-link {
    font-size: var(--text-sm);
  }

  .row-menu > summary {
    width: 44px;
    height: 44px;
  }

  /* Edit and Delete are menu items here, not the 44px bordered squares
     the rule above makes of them as standalone buttons. */
  .sidebar-menu .sidebar-menu-item {
    display: flex;
    justify-content: flex-start;
    min-height: 44px;
    border: none;
    background: none;
    font-size: var(--text-md);
  }
}

/* ===== css/49-phone-touch.css ===== */

/* ---------- Phones: tap targets, links, errors ---------- */

@media (max-width: 720px) {
  /* Broader tap-target pass: everything else measured under 44px on a
     real 375px render, found by checking getBoundingClientRect() on
     each candidate rather than trusting the CSS alone -- the .app-layout
     bug earlier this cycle was a reminder that reasoning about mobile
     layout from source is not the same as measuring it. */

  /* .theme-toggle-btn is shared by the dark-mode toggle (🌙) and the
     onboarding-tour trigger (🎯) -- both were a 26px circle. */
  .theme-toggle-btn {
    width: 44px;
    height: 44px;
  }

  /* An inline glyph inside running text ("Max Drift ⓘ") can't just grow
     -- that would shove the surrounding line apart. Padding + an equal
     negative margin extends the invisible tap area without moving
     anything else on the line; only .info-icon's own hit box grows. */
  .info-icon {
    padding: 16px;
    margin: -16px;
  }

  /* The pinned tooltip's own close button was a bare 14px glyph with no
     padding at all -- the only way to dismiss it besides tapping
     outside. */
  .tooltip-panel .tt-close {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  /* Rebalance's dimension pills and Add Portfolio's Start Empty/Import
     toggle were full-width already; only their height (~31px) was
     short. */
  .mode-toggle-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* A ranked bar's row: tap to select it and open its ticker panel. */
  button.ranked-bar {
    min-height: 44px;
  }

  /* The score cards' "What moves this?" toggle: a full-height tap target,
     like the links it opens onto, sitting to the right of the stars
     rather than on a 44px line of its own -- that line made every closed
     card 124px on a phone, taller than the bare cards it replaced. Out of
     flow, it stays put when its card opens; the text opens below. top
     centres it on the stars row (12px padding + 18px label + gap). */
  .score-overall,
  .score-pillar {
    position: relative;
  }

  .score-pillar-more > summary {
    position: absolute;
    top: 1.7rem;
    right: 1rem;
    min-height: 44px;
  }

  /* Risk tab's "See in Rebalance →" / "Look up in Research →" links
     were full-width but only ~22px tall -- the shortest of this batch. */
  .score-pillar-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Risk scores stack on a phone: two pillars across would be ~170px
     each, below the ~177px their labels need without wrapping. */
  .score-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  /* A fixed bottom-right box sized for a short error string reads as
     cramped once it also carries an Undo button -- stretch it to the
     screen width instead, same reasoning as the modal-to-bottom-sheet
     change above. */
  .toast-action {
    left: 1rem;
    right: 1rem;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  /* Above the bottom bar rather than on top of it. */
  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .toast-action-btn {
    min-height: 44px;
    padding-inline: 0.5rem;
  }

  /* 16px: iOS zooms the page into any smaller field it focuses. Every
     form's fields were 0.9rem (14.4px), so signing in, adding a holding
     or recording a trade zoomed the page on an iPhone. */
  .form-row input,
  .form-row select,
  .form-row textarea {
    font-size: var(--text-md);
  }
}

/* ===== css/50-holdings-widths.css ===== */

/* ---------- Holdings table between phone and wide desktop (S1) ----------
   The table needs about 1,055px. Rather than scroll it sideways, the
   least-needed columns go first as the width shrinks; each is still in
   the position sheet a row opens. Phones have their own list. */
@media (min-width: 721px) and (max-width: 1366px) {
  #holdings-table > thead th[data-sort="sector"],
  #holdings-table tr.holding-row > td[data-key="sector"] {
    display: none;
  }
}

@media (min-width: 721px) and (max-width: 1280px) {
  #holdings-table > thead th[data-sort="cost_basis"],
  #holdings-table tr.holding-row > td[data-key="cost_basis"] {
    display: none;
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  #holdings-table > thead th[data-sort="shares"],
  #holdings-table tr.holding-row > td[data-key="shares"] {
    display: none;
  }
}

@media (min-width: 721px) and (max-width: 860px) {
  #holdings-table > thead th[data-sort="current_price"],
  #holdings-table tr.holding-row > td[data-key="current_price"] {
    display: none;
  }
}

@media (min-width: 721px) and (max-width: 760px) {
  #holdings-table > thead th[data-sort="weight"],
  #holdings-table tr.holding-row > td[data-key="weight"] {
    display: none;
  }
}

/* ===== css/51-phone-exposure.css ===== */

/* ---------- The phone's exposure by holding, as cards (S3) ----------
   As a sideways-scrolling table, names were cut to "Other · T…" and
   Indirect, Total and the share sat off the right edge with nothing to
   show they were there. Each holding is now two lines: its name and
   sector, then Direct, Indirect, Total and its share under small labels.
   The rows come largest first; sorting by column stays on a desktop. */
@media (max-width: 720px) {
  #holdings-exposure-table,
  #holdings-exposure-table tbody {
    display: block;
    width: 100%;
  }

  #holdings-exposure-table thead {
    display: none;
  }

  #holdings-exposure-table tr.exposure-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.2rem 0.6rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
  }

  #holdings-exposure-table tr.exposure-row:last-child {
    border-bottom: none;
  }

  #holdings-exposure-table tr.exposure-row td {
    display: block;
    position: static;
    max-width: none;
    padding: 0;
    border: none;
    background: none;
    white-space: normal;
    overflow: visible;
    text-align: left;
    min-width: 0;
  }

  #holdings-exposure-table tr.exposure-row td[data-key="ticker"] {
    grid-column: 1 / 3;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  #holdings-exposure-table tr.exposure-row td[data-key="sector"] {
    grid-column: 3 / 5;
    text-align: right;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }

  #holdings-exposure-table tr.exposure-row td.mono::before {
    content: attr(data-label);
    display: block;
    /* The phone's table cards float their labels left, and a short value
       ("$0") then sat beside its label instead of under it. */
    float: none;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
  }

  #holdings-exposure-table tr.exposure-row td[data-key="pct_of_portfolio"]::before {
    content: "Share";
  }
}

/* ===== css/52-top-card.css ===== */

/* ---------- The top of the dashboard ----------
   The header line (market status, data freshness, Hide balances,
   Refresh), the top card with its composition chart, the tiles, today's
   movers, and the one-line summary other tabs fold it to, with their
   responsive overrides. Last in the cascade: it was moved out of the
   rest in source order (The Round Trip, M1), and a rule shared with
   other parts of the page keeps those there and gives this file a copy
   of the top-card selectors. */

/* ---------- Header ---------- */

.app-header {
  padding: 1.5rem 2rem 1rem;
  /* 2400px since v2.6.0: at 1600 a wide screen kept a band of empty
     page either side of everything. */
  max-width: 2400px;
  margin: 0 auto;
}

.app-header-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* Live/pre-market/after-hours/closed read from wall-clock time alone
   (core.market_hours) -- a colored dot rather than text-only color so it
   still reads at a glance for a colorblind viewer, same reasoning as the
   gain/loss ▲/▼ markers. */
/* Next to the Refresh button -- makes the price cache's freshness (up to
   5 min stale by design, see market/price_fetcher.py) visible instead of
   silently showing a number with no indication of how old it is. Empty
   text renders as nothing until dashboard.js fills it in, so there's no
   flash of unstyled content. */
.data-freshness {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* What "Data as of" means for the numbers below it, in the same quiet
   type. On a narrower desktop it wraps to its own line under the rest. */
.price-disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.price-disclaimer strong {
  font-weight: 600;
}

.market-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.market-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-neutral);
  flex: 0 0 auto;
}

.market-status-open {
  color: var(--color-gain-text);
}

.market-status-open .market-status-dot {
  background: var(--color-gain);
}

.market-status-pre-market,
.market-status-after-hours {
  color: var(--color-highlight-text);
}

.market-status-pre-market .market-status-dot,
.market-status-after-hours .market-status-dot {
  background: var(--color-highlight);
}

/* ---------- Dashboard header: hero number + composition chart ----------
   Phase 1 of "The Polish Gap" UX roadmap. Previously all 9 header stats
   rendered as equal-weight .stat-tile cards with the page's one chart
   buried below the holdings table -- the same problem .score-summary
   below already solved once for the Risk tab. Total Value now leads at
   its own scale, paired with the composition chart it used to be
   scrolled past; the remaining 7 stats demote into a denser secondary
   row instead of matching Total Value's old size. */
.hero-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: stretch;
  margin-top: 0.75rem;
}

/* Phase 4 of "The Polish Gap": a single, deliberate color moment
   instead of drifting there by default. A soft gold glow from the
   card's top-left corner, fading into the normal surface color by
   60% -- the same near/far gradient idea ChartKit.gradientStops()
   already uses for the composition donut and the gain waterfall
   (v1.81.0), just as a CSS radial-gradient instead of a canvas fill.
   --color-highlight is the same theme-invariant gold in both themes,
   so one rgba() value reads correctly against a white surface and a
   navy one alike -- no separate dark-mode override needed. */
.hero-card {
  background: radial-gradient(120% 140% at 15% 10%, var(--color-hover-bg), var(--color-surface) 60%);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1.25rem 1.5rem;
  /* One width for both views (the Investments one), so switching to Net
     worth changes what's inside, not the row: sized by its content, the
     card went from about 500px to 310px and the row shifted. */
  flex: 0 1 31rem;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
}

.hero-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.hero-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.hero-delta {
  font-size: var(--text-md);
  font-weight: 600;
  margin-top: 0.3rem;
}

.hero-delta-caption {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 0.35rem;
}

/* The all-time line under today's: same colour coding, less weight. */
.hero-delta-secondary {
  font-size: var(--text-sm);
  margin-top: 0.1rem;
}

/* .chart-card already supplies surface/border/padding; this only sets
   how it shares the row with .hero-card instead of wrapping full-width
   the way .chart-card-wide does in a .chart-row. */
.hero-chart-card {
  flex: 1 1 380px;
}

.hero-chart-card h3 {
  margin: 0 0 0.6rem;
  font-size: var(--text-md);
}

/* Under the Net worth composition: what's subtracted from the bars. */
.networth-mix-debts {
  margin: 0.5rem 0 0;
  font-size: var(--text-sm);
  color: var(--color-loss-text);
}

.stat-row-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.stat-pill {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.5rem 0.9rem;
  flex: 1 1 150px;
  min-width: 140px;
}

/* Annual Dividend Income, when there's a breakdown behind it
   (dashboard.html). A real <button>, so the browser's button styling
   comes off to match its sibling pills; the hover/focus state and the
   chevron are what say it opens something. */
.stat-pill-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.stat-pill-button:hover {
  border-color: var(--color-text-muted);
}

.stat-pill-button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.stat-pill-more {
  color: var(--color-text);
  font-weight: 700;
}

/* The breakdown dialog's table: its own class rather than .data-table,
   which turns into stacked cards on a phone -- four short columns fit as
   a table even inside the phone's bottom sheet. */
.dividend-table {
  width: 100%;
  margin-top: 0.75rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.dividend-table th,
.dividend-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.dividend-table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.dividend-table tbody th {
  font-weight: 600;
}

.dividend-table tfoot th,
.dividend-table tfoot td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid var(--color-border);
}

/* Drawn from stored prices while fresh ones are fetched (dashboard.js
   bringInFreshPrices; The Round Trip, P2). */
.data-freshness.is-updating-prices::after {
  content: " · updating";
}

/* ---------- The top card folded to one line (The Round Trip, U1) ----------
   Anywhere but Home, wider than a phone, the top card and the tiles fold
   away and this line says the total and today's change, so the
   destination's content starts near the top. They filled the first 690px
   of a 1000px window on every tab. app-shell.js keeps `data-section` on
   <body> (v1.189.0; it was the tab, when Home and Holdings were one).
   Collapsed rather than display:none, like the phone's sections: a chart
   in a display:none box is drawn at no size and stays that way, while a
   collapsed box keeps its width. */
.hero-summary {
  display: none;
}


@media (min-width: 721px) {
  body[data-section]:not([data-section="home"]) .hero-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.75rem;
    margin: 0.25rem 0 0.5rem;
  }

  body[data-section]:not([data-section="home"]) :is(#dashboard-hero, #dashboard-secondary-stats) {
    height: 0;
    min-height: 0;
    margin-block: 0;
    padding-block: 0;
    border-block-width: 0;
    overflow: hidden;
    visibility: hidden;
    position: relative;
  }
}

.hero-summary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.hero-summary-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}

.hero-summary-delta {
  font-size: var(--text-md);
}

.hero-summary-when {
  color: var(--color-text-muted);
  font-family: var(--font-body);
}

/* Header's Refresh button reuses .holdings-toggle-btn's exact pill/dashed-
   border/gold-hover look (same "small secondary action" language as the
   Risk tab's "See detailed parameters" toggle) -- just overriding the
   block-centered layout that button style assumes when it sits above a
   table, since this one sits inline next to the Market Status badge. */
.refresh-prices-btn {
  display: inline-block;
  margin: 0;
  padding: 0.4rem 1rem;
  white-space: nowrap;
}

.refresh-prices-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.refresh-prices-btn:disabled:hover {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

/* ---------- A mover (What changed, 66-stay-current.css) ---------- */

.mover {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.mover:hover,
.mover:focus-visible {
  border-color: var(--color-text-muted);
}

.mover-ticker {
  font-weight: 700;
}

.mover-pct,
.mover-dollar {
  font-variant-numeric: tabular-nums;
}

.mover-dollar {
  font-size: var(--text-xs);
}

/* Home hero: Investments / Net worth switch and the net-worth view. */
.hero-seg {
  display: inline-flex;
  align-self: flex-start;
  margin-bottom: 0.6rem;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
}

.hero-seg-btn {
  min-height: 32px;
  padding: 0 0.85rem;
  border: none;
  border-radius: var(--radius-control);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.hero-view {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hero-view[hidden] {
  display: none;
}

.hero-breakdown {
  display: grid;
  gap: 0.3rem;
  margin: 0.6rem 0 0;
  font-size: var(--text-sm);
}

.hero-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.hero-breakdown dt {
  color: var(--color-text-muted);
}

.hero-breakdown dd {
  margin: 0;
  font-weight: 600;
}

.hero-breakdown-total {
  padding-top: 0.35rem;
  border-top: 1px solid var(--color-border);
}

/* Home hero: a small value chart and its caption under the deltas. */
.hero-chart {
  margin-top: 0.6rem;
}

.hero-chart-canvas {
  position: relative;
  height: 72px;
}

.hero-readout {
  margin: 0.35rem 0 0;
  min-height: 1.3em;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ---------- Hide balances (privacy.js) ---------- */

.privacy-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: pointer;
}

.privacy-toggle-btn:hover,
.privacy-toggle-btn[aria-pressed="true"] {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}


@media (pointer: coarse) {

  .hero-seg-btn,
  .mover {
    position: relative;
  }

  .hero-seg-btn::after,
  .mover::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}


@media (min-width: 721px) and (max-width: 1100px) {

  .app-header {
    margin-inline: 0;
    width: 100%;
  }

  /* With no sidebar beside it, the top card is often alone on its line
     (the composition wraps under it below about 900px): it fills the
     line rather than leave 40% of it empty. Still one width for both
     views. */
  .hero-card {
    flex-grow: 1;
  }
}


@media (max-width: 720px) {

  .app-header {
    margin-inline: 0;
    width: 100%;
  }

  body[data-section]:not([data-section="home"]) #dashboard-hero,
  body[data-section]:not([data-section="home"]) #dashboard-secondary-stats {
    height: 0;
    min-height: 0;
    margin-block: 0;
    padding-block: 0;
    border-block-width: 0;
    overflow: hidden;
    visibility: hidden;
    /* overflow only clips absolutely positioned descendants whose
       containing block it is. Without this, every row's visually-hidden
       label escaped and Home ended in ~440px of empty scroll. */
    position: relative;
  }

  /* The header is one line: market status, when the prices are from, and
     the Hide balances and Refresh buttons, with the delayed-prices
     disclaimer under it. It was three lines (~130px) before every
     section -- the TrueVest title, the eye, the market status, a Refresh
     button with its own ⓘ, then "Data as of" -- above content the pinned
     bar already names. Insights and Research also no longer stack Home's
     hero above every tab (the collapse rule above). */
  .app-header {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .app-header-top {
    gap: 0.25rem 0.6rem;
  }

  .app-header-top h1,
  .market-word {
    display: none;
  }

  .app-header-top .market-status {
    order: 1;
  }

  /* Takes the room that's left, and never pushes the buttons onto a
     second line: a zero basis, cut with an ellipsis if it must be. */
  .app-header-top .data-freshness {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-header-top .privacy-toggle-btn {
    order: 3;
  }

  .app-header-top .refresh-prices-btn {
    order: 4;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.7rem;
  }

  .app-header-top .price-disclaimer {
    order: 5;
    flex-basis: 100%;
    font-size: var(--text-xs);
    line-height: 1.4;
  }

  .app-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Hero card stacks above the composition chart instead of sitting
     side by side -- at this width the two would otherwise squeeze each
     other below a usable size. Secondary stats keep the same 2-column
     treatment .summary-stats already uses elsewhere. */
  /* One line, not wrapping: a wrapping column stretches each card to its
     line, and a line is as wide as its widest card's content -- the value
     chart's canvas starts at the browser's default 300px, so both cards
     came out 7px wider than everything below them on a 375px phone. */
  .hero-row {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .hero-card,
  .hero-chart-card {
    min-width: 0;
    flex-basis: auto;
  }

  .hero-value {
    font-size: var(--text-2xl);
  }

  .stat-row-secondary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .stat-pill {
    min-width: 0;
  }

  /* Three pills since v2.1.0: the odd one out takes the row. */
  .stat-pill:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .privacy-toggle-btn {
    width: 44px;
    height: 44px;
  }
}

/* ===== css/53-move-preview.css ===== */

/* What would this move do? (move-preview.js): the panel in the trade
   dialog, and the "Made it?" notice above the tabs for a move tried and
   not yet recorded. Each line is a label and its figures before -> after,
   in the text's own colours: they're facts about the move, not a verdict
   on it. Gains alone take the usual gain/loss colours, as everywhere. */
.move-preview {
  border-top: 1px solid var(--color-border);
  margin: 0.25rem 0 0.75rem;
  padding-top: 0.6rem;
}

/* Working the move out again after a change: the old figures stay, dimmed,
   rather than the panel jumping to empty and back. */
.move-preview[data-state="loading"] {
  opacity: 0.55;
}

.mp-title {
  font-size: var(--text-md);
  margin: 0 0 0.35rem;
}

.mp-heading {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0.75rem 0 0.2rem;
}

.mp-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Label left, figures right; a long pair wraps the figures under the
   label, still right-aligned, rather than squeezing either. */
.mp-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.1rem 0.75rem;
  padding: 0.25rem 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
}

.mp-row:last-child {
  border-bottom: none;
}

.mp-value {
  margin-left: auto;
  text-align: right;
}

.mp-words {
  font-family: var(--font-body);
}

.mp-target {
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-xs);
}

.move-preview .hint {
  margin: 0.35rem 0 0;
}

.move-preview .form-error {
  margin: 0;
}

.pending-move {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
}

.pending-move-actions {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

/* A finger-sized target for each, without making the banner taller than
   its sentence on a desktop. */
@media (pointer: coarse) {
  .pending-move .notice-action {
    min-height: 44px;
  }
}

/* Trying a move on a desktop: the figures sit beside the form rather than
   below it, so they're in view while the move is typed in. A tablet or a
   phone keeps one column, the figures under the form. Recording a trade
   already made ('record' mode) stays narrow too: its figures appear only
   once the trade is complete, and the dialog widening mid-typing would
   move the field being typed in. */
@media (min-width: 900px) {
  /* Taller too: a sale's lots and the tax year make the figures the
     longer column. */
  .modal.modal-move {
    width: min(920px, 94vw);
    max-height: 92vh;
  }

  .modal-move #transaction-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    align-items: start;
  }

  .modal-move .tx-fields {
    grid-column: 1;
    grid-row: 1;
    padding-right: 1.5rem;
  }

  .modal-move .move-preview {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0 0 0 1.5rem;
    border-top: none;
    border-left: 1px solid var(--color-border);
    min-height: 100%;
  }

  .modal-move #transaction-effect {
    grid-column: 1 / -1;
  }

  /* The figures are in view beside the form, so the pinned answer would
     only say them twice. */
  .move-answer {
    display: none;
  }
}

/* Which shares a sale takes (v1.180.0): the three ways above the sale's
   figures, and in Choose lots a tick box on each lot the account holds. */
.mp-lot-method {
  margin: 0.2rem 0 0.35rem;
  flex-wrap: wrap;
}

.mp-lot-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.mp-lot-label input {
  width: auto;
  margin: 0;
}

.mp-lot-pick {
  margin-bottom: 0.35rem;
}

.move-preview .mp-lot-error {
  margin: 0 0 0.35rem;
}

/* The 30-day window: a sentence of fact, set apart by a rule in the text's
   own colours, never a warning colour (it isn't a verdict). */
.mp-window {
  border-left: 3px solid var(--color-border);
  padding-left: 0.6rem;
}

.mp-window p {
  margin: 0;
  font-size: var(--text-sm);
}

@media (pointer: coarse) {
  .mp-lot-label {
    min-height: 44px;
  }
}

/* ---------- Lead with the move (v1.188.0) ---------- */

/* Now, after and the reader's own mark on one scale, under a figure's
   row: slate for now, navy for after, a brass tick for a target or a
   rule's limit. The figures beside it say the same, in words. */
.mp-line {
  position: relative;
  display: block;
  flex-basis: 100%;
  height: 8px;
  margin: 0.15rem 0 0.1rem;
}

.mp-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--color-border);
}

.mp-line-now,
.mp-line-after,
.mp-line-mark {
  position: absolute;
  left: 0;
}

.mp-line-now {
  top: 0;
  height: 8px;
  border-radius: 2px;
  background: var(--color-fill-neutral);
  opacity: 0.45;
}

.mp-line-after {
  top: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--color-selected-bg);
}

.mp-line-mark {
  top: -3px;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: var(--color-highlight);
}

.mp-rules .mp-line {
  margin-top: 0.3rem;
}

.mp-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  margin: 0 0 0.35rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.mp-key {
  display: inline-block;
  width: 14px;
  height: 8px;
  border-radius: 2px;
}

.mp-key + .mp-key,
.mp-legend .mp-key:not(:first-child) {
  margin-left: 0.5rem;
}

.mp-key-now {
  background: var(--color-fill-neutral);
  opacity: 0.45;
}

.mp-key-after {
  height: 4px;
  background: var(--color-selected-bg);
}

.mp-key-mark {
  width: 2px;
  height: 12px;
  background: var(--color-highlight);
}

/* The buttons, pinned to the foot of the dialog however long the figures
   run, and while a move is tried on a phone or tablet, its answer in
   three lines beside them. Down over the dialog's 1.5rem of padding, or
   the figures show below them (as Reconcile's do). */
.tx-dock {
  position: sticky;
  bottom: -1.5rem;
  z-index: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1rem -1.5rem -1.5rem;
  padding: 0.6rem 1.5rem 1.5rem;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.tx-dock-buttons {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.tx-dock .form-error {
  flex-basis: 100%;
  margin: 0;
}

.move-answer {
  flex: 1 1 14rem;
  min-width: 0;
}

.move-answer[hidden] {
  display: none;
}

.move-answer[data-state="loading"] {
  opacity: 0.55;
}

.move-answer .mp-row {
  padding: 0.1rem 0;
  border-bottom: none;
}

.move-answer .form-error {
  margin: 0;
}

.move-answer-words {
  display: block;
  padding-left: 0.5rem;
  border-left: 3px solid var(--color-border);
}

.move-answer-words.is-past {
  border-left-color: var(--color-highlight);
}

/* Date, fees and note: folded when trying a move, where today, no fees
   and no note are what most moves are. Recording a trade already made
   keeps them open, with no toggle. */
.tx-more > summary {
  cursor: pointer;
  padding: 0.35rem 0;
  margin-bottom: 0.35rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.modal:not(.modal-move) .tx-more > summary {
  display: none;
}

.tx-fields .move-add-step {
  margin-top: 0.25rem;
}

@media (pointer: coarse) {
  .tx-more > summary,
  .tx-dock-buttons button {
    min-height: 44px;
  }
}

/* ===== css/54-deep-dive.css ===== */

/* ---------- Research reports (deep-dive.js, v1.149.0) ----------
   A report with a front page (v1.153.0): a masthead, key data in a box
   beside the story, and every figure on a strip of its five bands. The
   strips are one hue, light to dark, with a gold mark (v1.154.0): a level
   says how high a figure is, never whether that's good, so nothing here
   is green or red. The page around a report is 55-research-page.css. */

/* The five bands: navy, a step darker per band, in both themes. */
:root {
  --dd-band1: #eceef6;
  --dd-band2: #dfe2ef;
  --dd-band3: #d0d4e7;
  --dd-band4: #bfc4dd;
  --dd-band5: #aab0d0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --dd-band1: #1f2757;
    --dd-band2: #283166;
    --dd-band3: #323c76;
    --dd-band4: #3e4887;
    --dd-band5: #4b5699;
  }
}

:root[data-theme="dark"] {
  --dd-band1: #1f2757;
  --dd-band2: #283166;
  --dd-band3: #323c76;
  --dd-band4: #3e4887;
  --dd-band5: #4b5699;
}

/* The allowance panel at the top of Research (v1.152.0): what's left
   this month and today as big numbers, each with a bar of what's used.
   It was one line of small grey text that people didn't notice. Same
   surface and gold top edge as the dashboard's stat tiles. */
.dd-allowance {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.dd-allowance-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dd-allowance-title {
  margin: 0;
  font-size: var(--text-md);
}

.dd-plan-badge {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

.dd-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 220px));
  gap: 0.75rem 2rem;
}

.dd-count {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.5rem;
}

.dd-count-num {
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.dd-count-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

.dd-count-bar {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  margin: 0.4rem 0 0.3rem;
  border-radius: var(--radius-control);
  background: var(--color-border);
  overflow: hidden;
}

.dd-count-bar i {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
}

.dd-count-used {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.dd-allowance-note {
  margin: 0.75rem 0 0;
}

/* Asking for a bigger plan, at the foot of the panel: the button sits in
   the sentence's flow (after its space, so no margin of its own) and
   wraps under it, flush left, on a phone. */
.dd-allowance .deep-dive-ask {
  margin: 0.6rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--color-border);
}

.deep-dive-ask:empty {
  display: none;
}

/* Your deep dives (v1.166.0; chips since v1.167.1): this month's as
   ticker chips that wrap, so a long month stays a few lines on a phone
   and on a desktop; earlier months folded under one disclosure. A chip is
   44px tall, the touch size. An earlier month's can't be opened, so it's
   plain, with no fill or pointer. */
.dd-mine {
  margin-bottom: 1.5rem;
}

.dd-mine-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.dd-mine-head h3 {
  margin: 0;
}

.dd-mine-head .hint,
.dd-mine-empty {
  margin: 0;
}

.dd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dd-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 4.5rem;
  justify-content: center;
  padding: 0 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.dd-chip:hover,
.dd-chip:focus-visible {
  background: var(--color-hover-bg);
}

.dd-chip.is-past {
  border-color: var(--color-border);
  color: var(--color-text-muted);
  cursor: default;
}

.dd-chip.is-past:hover {
  background: var(--color-surface);
}

#dd-mine-toggle {
  margin-top: 0.6rem;
}

.dd-mine-earlier {
  margin-top: 0.85rem;
}

.dd-mine-earlier summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  list-style: none;
}

/* A flex summary loses the browser's own triangle, so it draws one. */
.dd-mine-earlier summary::-webkit-details-marker {
  display: none;
}

.dd-mine-earlier summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin: 0 0.6rem 0 0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.dd-mine-earlier[open] summary::before {
  transform: rotate(45deg);
}

.dd-mine-month h4 {
  margin: 0.6rem 0 0.4rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}

.deep-dive-ask .deep-dive-ask-btn {
  vertical-align: baseline;
}

.rp-report h3 {
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-md);
}

.rp-report h4 {
  margin: 1rem 0 0.35rem;
  font-size: var(--text-md);
}

/* The masthead: name and identity on the left, the price it was written
   at on the right, then what its figures run to. */
.dd-mast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 1.5rem;
  padding: 0 0 0.9rem;
  border-bottom: 2px solid var(--color-text);
}

.dd-kicker {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.dd-mast h2 {
  margin: 0.15rem 0 0.2rem;
  font-size: var(--text-2xl);
  line-height: 1.2;
}

.dd-ident {
  margin: 0;
  color: var(--color-text-muted);
}

.dd-ident b {
  color: var(--color-text);
}

.dd-mast-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: right;
}

.dd-price {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
}

.dd-change,
.dd-price-when {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.dd-mast-meta,
.dd-stale {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dd-mast-meta b {
  color: var(--color-text);
  font-weight: 600;
}

/* Said in words, not colour: it's a fact about the report's age. */
.dd-stale {
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}

/* The story, with the key data beside it on a wide screen. The rail
   comes first in the page, so on a phone it sits under the masthead. */
.dd-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.dd-body.has-rail {
  grid-template-columns: minmax(0, 1fr) 16rem;
}

.dd-body.has-rail .dd-rail {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.dd-body.has-rail .dd-main {
  grid-column: 1;
  grid-row: 1;
}

.dd-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.dd-overview {
  margin: 0;
  line-height: 1.55;
}

.dd-rail {
  min-width: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-dialog);
  background: var(--color-bg);
  font-size: var(--text-sm);
}

.dd-rail h3 {
  font-size: var(--text-sm);
}

.dd-rail h4 {
  margin: 0.75rem 0 0.2rem;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.dd-rail h4 small {
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-muted);
  font-weight: 400;
}

.dd-kv {
  margin: 0;
}

.dd-kv div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.12rem 0;
}

.dd-kv dt {
  color: var(--color-text-muted);
}

.dd-kv dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Every figure on a strip: label, figure with its period, the five bands
   with the mark where it falls, and its level in words. */
.dd-dim h4 {
  margin: 0.9rem 0 0.15rem;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.dd-dim:first-of-type h4 {
  margin-top: 0.4rem;
}

.dd-note,
.dd-dim-fact {
  margin: 0 0 0.3rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text-muted);
}

.dd-dim-fact {
  color: var(--color-text);
}

/* What's behind a dimension's figures (v1.157.0): the deep dive's words,
   from a page its search found, set off from TrueVest's figures by a rule
   in the bands' hue. */
.dd-behind {
  margin: 0.2rem 0 0.45rem;
  padding-left: 0.65rem;
  border-left: 3px solid var(--dd-band4);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text);
}

.dd-row {
  display: grid;
  grid-template-columns: 10.5rem 8.5rem minmax(0, 1fr) 5rem;
  gap: 0.75rem;
  align-items: center;
  min-height: 2.2rem;
}

.dd-row-label {
  font-size: var(--text-sm);
}

.dd-row-value {
  white-space: nowrap;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.dd-period {
  margin-left: 0.3rem;
  padding: 0 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: help;
  vertical-align: 1px;
}

.dd-row-level {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dd-strip {
  position: relative;
  display: block;
  height: 2.05rem;
}

.dd-bands {
  position: absolute;
  inset: 0.3rem 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  height: 0.6rem;
}

.dd-strip.is-none {
  height: auto;
}

.dd-strip.is-plain .dd-bands {
  grid-template-columns: 1fr;
}

/* One hue, a step darker per band: the order of the levels, not good and
   bad. */
.dd-bands i {
  border-radius: var(--radius-control);
  background: var(--dd-band1);
}

.dd-bands i:nth-child(2) { background: var(--dd-band2); }
.dd-bands i:nth-child(3) { background: var(--dd-band3); }
.dd-bands i:nth-child(4) { background: var(--dd-band4); }
.dd-bands i:nth-child(5) { background: var(--dd-band5); }
.dd-strip.is-plain .dd-bands i { background: var(--dd-band2); }

.dd-edge {
  position: absolute;
  top: 0.95rem;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  line-height: 1.1;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.dd-edge.is-start {
  left: 0;
  transform: none;
}

.dd-edge.is-end {
  right: 0;
  transform: none;
}

.dd-mark {
  position: absolute;
  top: 0.05rem;
  width: 4px;
  height: 1.1rem;
  margin-left: -2px;
  border-radius: var(--radius-control);
  background: var(--color-fill-neutral);
  box-shadow: 0 0 0 2px var(--color-surface);
}

/* A figure's own range over the years its filings cover (v1.155.0): an
   outline from its low to its high around the bands, under the mark, in
   the text colour. Where it has been, beside where it is. */
.dd-range {
  position: absolute;
  top: 0.2rem;
  height: 0.8rem;
  box-sizing: border-box;
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius-control);
  opacity: 0.55;
  pointer-events: none;
}

.dd-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.3rem 0 0;
}

.dd-legend-mark,
.dd-legend-range {
  display: inline-block;
  margin-right: 0.35rem;
}

.dd-legend-mark {
  width: 4px;
  height: 0.9rem;
  border-radius: var(--radius-control);
  background: var(--color-fill-neutral);
}

.dd-legend-range {
  width: 1.4rem;
  height: 0.7rem;
  margin-left: 0.75rem;
  box-sizing: border-box;
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius-control);
  opacity: 0.55;
}

/* What a fund holds (v1.164.0): bars in the one neutral hue, each as wide as
   its share of the widest, with the figure beside it. A calendar year's
   change grows from a middle line, down to the left and up to the right,
   in the same colour: a level, never good or bad. */
.dd-subsection {
  margin-top: 1rem;
}

.dd-subsection h4 {
  margin: 0 0 0.4rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dd-bars {
  display: grid;
  gap: 0.3rem;
}

.dd-bar-row {
  display: grid;
  grid-template-columns: minmax(8rem, 15rem) minmax(0, 1fr) 4rem;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-sm);
}

.dd-bar-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dd-bar-value {
  text-align: right;
}

.dd-bar-track {
  display: block;
  height: 0.75rem;
  background: var(--dd-band1);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.dd-bar-track i {
  display: block;
  height: 100%;
  background: var(--dd-band5);
}

.dd-bar-both {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.dd-bar-both b {
  display: flex;
  min-width: 0;
}

.dd-bar-both b:first-child {
  justify-content: flex-end;
  border-right: 1px solid var(--color-text-muted);
}

.dd-bar-both b i {
  height: 100%;
}

@media (max-width: 720px) {
  .dd-bar-row {
    grid-template-columns: minmax(0, 1fr) 3.5rem;
    row-gap: 0.15rem;
  }

  .dd-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Ten years from the filings (v1.155.0): sales and net income as bars,
   then the table, the 12 months set apart in the last column. On a phone
   the table scrolls sideways with each row's name kept in view. */
.dd-history-chart {
  position: relative;
  height: 13rem;
  margin-bottom: 0.9rem;
}

.dd-years-wrap {
  overflow-x: auto;
  border-top: 2px solid var(--color-text);
}

/* Small enough that ten years and the 12 months fit beside the key data
   at a desktop's width. */
.dd-years {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.dd-years th,
.dd-years td {
  padding: 0.3rem 0.32rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
  white-space: nowrap;
}

.dd-years thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.dd-years th[scope="row"],
.dd-years thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--color-surface);
}

.dd-years th[scope="row"] {
  font-weight: normal;
}

.dd-years-group th {
  padding-top: 0.75rem;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

/* A group's heading stays in view as the table scrolls sideways, like the
   row names under it. */
.dd-years-group span {
  position: sticky;
  left: 0.32rem;
}

.dd-years .is-twelve {
  border-left: 1px solid var(--color-border);
  background: var(--color-bg);
}

/* A column part under the row names as the table scrolls, hidden until
   it's clear of them (research-page.js). */
.dd-years .is-under {
  visibility: hidden;
}

.dd-years-note {
  margin: 0.4rem 0 0;
}

.dd-years-note a {
  color: var(--color-highlight-text);
}

.dd-glossary {
  margin-top: 0.75rem;
  font-size: var(--text-sm);
}

.dd-glossary summary {
  cursor: pointer;
  color: var(--color-highlight-text);
}

.dd-glossary dl {
  margin: 0.5rem 0 0;
}

.dd-glossary div {
  padding: 0.35rem 0;
  border-top: 1px solid var(--color-border);
}

.dd-glossary dt {
  font-weight: 600;
}

.dd-glossary dd {
  margin: 0.1rem 0 0;
  color: var(--color-text-muted);
  line-height: 1.45;
}

.dd-date-note {
  color: var(--color-text-muted);
}

/* What the report is made from, at its foot. */
.dd-about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem 1.5rem;
  padding-top: 0.8rem;
  border-top: 2px solid var(--color-text);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text-muted);
}

.dd-about b {
  display: block;
  margin-bottom: 0.15rem;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.dd-about a {
  color: var(--color-highlight-text);
}

.dd-list {
  margin: 0;
  padding-left: 1.1rem;
}

.dd-list li {
  margin: 0.3rem 0;
  line-height: 1.45;
}

.dd-list small {
  color: var(--color-text-muted);
}

.dd-date {
  display: inline-block;
  min-width: 7.5rem;
  margin-right: 0.4rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.dd-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.dd-sources a {
  color: var(--color-highlight-text);
}

/* Citations (v1.156.0): the numbers of the pages that back a line, and
   the numbered sources they match. */
.dd-cites {
  margin-left: 0.15rem;
  font-size: var(--text-xs);
  line-height: 0;
  white-space: nowrap;
}

.dd-cite {
  color: var(--color-highlight-text);
  text-decoration: none;
}

.dd-cite:hover,
.dd-cite:focus-visible {
  text-decoration: underline;
}

/* A finger needs more than the 13px a number is: padding on an inline
   link widens where it can be tapped without moving the text. */
@media (pointer: coarse) {
  .dd-cite {
    padding: 0.4rem 0.2rem;
  }
}

.dd-source-n {
  color: var(--color-text-muted);
}

.dd-suggestions {
  display: block;
  width: 100%;
  /* Google's strip is one row of chips, about 48px tall. */
  height: 3.75rem;
  margin-top: 0.75rem;
  border: 0;
}

/* A year of prices: the box has its own height, and the chart fills it. */
.dd-chart-box {
  position: relative;
  height: 15rem;
}

.dd-chart-box[hidden] {
  display: none;
}

.dd-chart-note,
.dd-summary-note {
  margin: 0.4rem 0 0;
}

/* A Snapshot's offer of the deep dive: set apart by a gold edge, as the
   allowance panel is. */
.dd-offer {
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
}

.dd-offer p {
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

.dd-offer p:last-child {
  margin-bottom: 0;
}

.dd-offer-act .hint {
  margin-left: 0.4rem;
}

.dd-stale .dd-rewrite-btn {
  margin-left: 0.4rem;
}

/* A phone: the date sits in front of its item, not on a line of its own. */
@media (max-width: 719px) {
  .dd-date {
    min-width: 0;
    font-size: var(--text-xs);
  }
}

/* Too narrow for the key data beside the story: it goes above it, two
   columns of figures while there's room. */
@media (max-width: 960px) {
  .dd-body.has-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .dd-body.has-rail .dd-rail,
  .dd-body.has-rail .dd-main {
    grid-column: 1;
    grid-row: auto;
  }

  .dd-rail {
    columns: 2 14rem;
    column-gap: 1.5rem;
  }

  .dd-rail h3 {
    column-span: all;
  }

  .dd-kv-group {
    break-inside: avoid;
  }

  .dd-kv-group:first-of-type h4 {
    margin-top: 0.25rem;
  }
}

/* A phone: the price goes under the name, and each figure's label, value
   and level sit on one line above its strip. Shorter than v1.153.0's 5,255
   pixels at 375 wide: key data two to a row, sections closer together. */
@media (max-width: 720px) {
  .dd-mast {
    grid-template-columns: minmax(0, 1fr);
  }

  .dd-mast h2 {
    font-size: var(--text-xl);
  }

  .dd-mast-price {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.6rem;
    text-align: left;
  }

  .dd-price {
    font-size: var(--text-xl);
  }

  .dd-main {
    gap: 1.1rem;
  }

  /* Every figure row shares one set of columns (subgrid), so values and
     levels line up down the page whatever their width, and every strip
     spans the row under them. Headings, notes and the list span it all. */
  .dd-figures {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 0.6rem;
  }

  .dd-figures > *,
  .dd-dim > * {
    grid-column: 1 / -1;
  }

  .dd-dim {
    display: contents;
  }

  .dd-row {
    grid-template-columns: subgrid;
    gap: 0 0.6rem;
    min-height: 0;
    padding: 0.25rem 0 0;
  }

  .dd-row-label { grid-area: 1 / 1; }
  .dd-row-value { grid-area: 1 / 2; justify-self: end; }
  .dd-row-level { grid-area: 1 / 3; justify-self: end; }

  /* Just tall enough for the bands and their edges under them. */
  .dd-strip {
    grid-area: 2 / 1 / 3 / -1;
    height: 1.8rem;
  }

  /* Lists without bullets: the dates already start each item, and every
     line is the wider for it. */
  .dd-list {
    padding-left: 0;
    list-style: none;
  }

  .dd-list li {
    margin: 0.45rem 0;
  }

  /* The key data two to a row, each label over its figure. */
  .dd-rail {
    columns: auto;
    padding: 0.75rem 0.85rem;
  }

  .dd-kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.75rem;
  }

  .dd-kv div {
    display: block;
    padding: 0;
  }

  .dd-kv dt {
    font-size: var(--text-xs);
  }

  .dd-kv dd {
    text-align: left;
  }

  .dd-kv-group:first-of-type h4 {
    margin-top: 0.25rem;
  }

  .dd-chart-box {
    height: 11rem;
  }

  .dd-history-chart {
    height: 11rem;
  }

  /* The table scrolls a whole column at a time, each stopping just clear
     of the row names, so no figure sits half under them: a negative
     figure's minus is on its left, and would be the part hidden. */
  .dd-years-wrap {
    scroll-snap-type: x mandatory;
    scroll-padding-left: 8.5rem;
  }

  .dd-years th[scope="row"],
  .dd-years thead th:first-child {
    box-sizing: border-box;
    width: 8.5rem;
    min-width: 8.5rem;
    max-width: 8.5rem;
    white-space: normal;
    box-shadow: 1px 0 0 var(--color-border);
  }

  .dd-years td,
  .dd-years thead th:not(:first-child) {
    scroll-snap-align: start;
  }

  .dd-about {
    gap: 0.6rem;
  }
}

/* The allowance on a phone: the month and the day side by side. */
@media (max-width: 720px) {
  .dd-allowance {
    padding: 0.9rem 1rem;
  }

  .dd-counts {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
  }

  .dd-count-num {
    font-size: var(--text-2xl);
  }
}

/* ---------- Progress while a deep dive is written (v1.159.0) ---------- */

.dd-progress {
  max-width: 34rem;
  margin: 0.5rem 0 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.dd-progress-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.dd-progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dd-progress-step {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.6rem;
  color: var(--color-text-muted);
}

.dd-progress-step::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.55rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  box-sizing: border-box;
}

.dd-progress-step.is-done::before {
  content: "✓";
  border: none;
  top: 0.3rem;
  width: auto;
  height: auto;
  color: var(--color-gain-text);
  font-weight: 700;
}

.dd-progress-step.is-now {
  color: var(--color-text);
  font-weight: 600;
}

.dd-progress-step.is-now::before {
  border-color: var(--color-focus);
  border-top-color: transparent;
  animation: dd-progress-spin 0.9s linear infinite;
}

.dd-progress-note {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text);
}

.dd-progress-bar {
  height: 4px;
  margin: 0.75rem 0 0.4rem;
  border-radius: var(--radius-control);
  background: var(--color-border);
  overflow: hidden;
}

.dd-progress-bar span {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
  transition: width 0.4s linear;
}

.dd-progress-time {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

@keyframes dd-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dd-progress-step.is-now::before {
    animation: none;
    border-top-color: var(--color-focus);
  }

  .dd-progress-bar span {
    transition: none;
  }
}

/* ===== css/55-research-page.css ===== */

/* ---------- A research page (research-page.js, v1.154.0) ----------
   A ticker's page over the dashboard, at its own address: a bar with Back
   and Print, the report on a sheet (54-deep-dive.css), and under it the
   reader's own position, set apart because it isn't part of the report.
   Full screen on a phone. Below every dialog (1100), so Try a move opens
   over it, and above the phone's sheets (1045-1050) and bottom bar. */

.modal-overlay.research-page {
  display: block;
  z-index: 1080;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg);
}

.modal-overlay.research-page[hidden] {
  display: none;
}

/* The dashboard under the page stays where it was, and doesn't scroll. */
body.research-page-open {
  overflow: hidden;
}

.rp-frame {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.rp-frame:focus {
  outline: none;
}

/* Back and Print, in view however far down the report is read. */
.rp-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.rp-back {
  min-height: 44px;
  padding: 0.4rem 0.9rem 0.4rem 0.1rem;
  border: none;
  background: none;
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.rp-back:hover,
.rp-back:focus-visible {
  color: var(--color-text);
}

.rp-report {
  margin-top: 1rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

/* The reader's own position: a dashed gold edge, so it reads as theirs
   and apart from the report everyone gets. */
.rp-mine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1.5px dashed var(--color-highlight);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.rp-mine[hidden] {
  display: none;
}

.rp-mine-what {
  flex: 1 1 20rem;
  min-width: 0;
}

.rp-mine h3 {
  margin: 0 0 0.25rem;
  font-size: var(--text-md);
}

.rp-mine-holds {
  margin: 0 0 0.3rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.rp-mine .hint {
  margin: 0;
}

@media (max-width: 720px) {
  .rp-frame {
    padding: 0 0.75rem 2rem;
  }

  .rp-report {
    margin-top: 0.75rem;
    padding: 1rem 0.8rem;
    border-radius: var(--radius-dialog);
  }

  .rp-mine {
    padding: 0.9rem 1rem;
  }

  .rp-try-btn {
    width: 100%;
  }
}

/* Printed (Print, or the browser's own): the report alone, on white, its
   bands and mark printed as on screen. The page holds nothing else, and
   the reader's position isn't part of the report. */
@media print {
  /* Light colours whatever the theme: three :root beat the dark theme's
     own selectors. */
  :root:root:root {
    --color-bg: #fff;
    --color-surface: #fff;
    --color-border: #ccc;
    --color-text: #1a1a1a;
    --color-text-muted: #555;
    --color-highlight-text: #7d5f12;
    --dd-band1: #eceef6;
    --dd-band2: #dfe2ef;
    --dd-band3: #d0d4e7;
    --dd-band4: #bfc4dd;
    --dd-band5: #aab0d0;
  }

  body.research-page-open {
    overflow: visible;
    background: #fff;
  }

  body.research-page-open > :not(#research-page) {
    display: none !important;
  }

  .modal-overlay.research-page {
    position: static;
    overflow: visible;
    background: none;
  }

  .rp-frame {
    max-width: none;
    padding: 0;
  }

  .rp-bar,
  .rp-mine,
  .dd-offer,
  .dd-rewrite-btn,
  .dd-suggestions,
  .dd-glossary {
    display: none !important;
  }

  .rp-report {
    margin: 0;
    padding: 0;
    border: none;
  }

  .dd-bands i,
  .dd-mark {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* The ten years on paper: every column, nothing scrolled out of view. */
  .dd-years-wrap {
    overflow: visible;
  }

  .dd-years {
    font-size: var(--text-xs);
  }

  .dd-years th,
  .dd-years td {
    padding: 0.2rem 0.3rem;
  }

  .dd-section,
  .dd-row,
  .dd-kv-group {
    break-inside: avoid;
  }
}

/* ===== css/56-back-link.css ===== */

/* ---------- Back (every page that leads back to another) ---------- */

/* One look for every Back: a chevron and a label in a pill at least 44px
   tall (WCAG 2.5.8 asks for 24, Apple and Google for 44 and 48), with a
   visible hover and focus state. It was a 14px "<-" in a line of text.
   `a.back-link` and `button.back-link` are one class and one element
   specific, to beat `.help-page a`, `.login-hint a` and `.help-back a`
   without !important; this part comes after them. */
a.back-link,
button.back-link,
.rp-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  padding: 0.5rem 1rem 0.5rem 0.6rem;
  margin-left: -0.6rem;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, color 0.12s ease;
}

a.back-link:hover,
button.back-link:hover,
.rp-back:hover,
a.back-link:focus-visible,
button.back-link:focus-visible,
.rp-back:focus-visible {
  background: var(--color-surface);
  color: var(--color-highlight-text);
  text-decoration: none;
}

a.back-link:focus-visible,
button.back-link:focus-visible,
.rp-back:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

a.back-link:active,
button.back-link:active,
.rp-back:active {
  background: var(--color-border);
}

.back-link-icon {
  flex: none;
}

/* The link in the middle of a centred card keeps its place. */
.login-hint .back-link {
  margin-left: 0;
}

/* The Back links that sit by themselves at the top of a page. */
.admin-back-link,
.help-back {
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  a.back-link,
  button.back-link,
  .rp-back {
    transition: none;
  }
}

/* ---------- Appearance: System / Light / Dark (More sheet) ---------- */

.appearance-group {
  display: grid;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
}

.appearance-group strong {
  display: block;
}

.appearance-group > span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.appearance-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: var(--radius-dialog);
  background: var(--color-bg);
}

.appearance-option {
  min-height: 44px;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-dialog);
  background: none;
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.appearance-option:hover {
  background: var(--color-surface);
}

.appearance-option.is-selected {
  border-color: var(--color-selected-bg);
  background: var(--color-surface);
  color: var(--color-text);
}

.appearance-option:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

/* Add Holding's Back is a button in the dialog's footer row. */
.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===== css/57-xray.css ===== */

/* ---------- The public X-ray (/xray, xray.html) ---------- */

/* A standalone page like the sign-in page, wider: a paste box, then the
   answer in panels. Colours are the app's tokens, so dark mode follows. */

.xr-page {
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

.xr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.xr-brand {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.xr-top-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
}

.xr-top-link:hover,
.xr-top-link:focus-visible {
  background: var(--color-border);
}

.xr-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
  box-sizing: border-box;
}

.xr-title {
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin: 0.5rem 0 0.75rem;
}

.xr-intro {
  max-width: 62ch;
  margin: 0 0 1.25rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

.xr-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem;
}

.xr-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.xr-form textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  line-height: 1.5;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
  resize: vertical;
}

.xr-hint,
.xr-fine,
.xr-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.xr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.xr-actions button,
.xr-invite button,
.xr-next .btn-primary {
  min-height: 44px;
}

.xr-status {
  min-height: 1.2em;
  margin: 0.6rem 0 0;
  font-size: var(--text-sm);
}

.xr-result {
  margin-top: 1.5rem;
}

.xr-headline {
  font-size: var(--text-xl);
  line-height: 1.4;
  font-weight: 600;
  margin: 0 0 0.35rem;
  outline: none;
}

.xr-summary {
  margin: 0 0 1rem;
  color: var(--color-text-muted);
}

.xr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.xr-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.xr-grid .xr-panel {
  margin-bottom: 0;
}

.xr-companies,
.xr-coverage,
.xr-left-out {
  margin-top: 1rem;
}

.xr-panel h3 {
  font-size: var(--text-md);
  margin: 0 0 0.6rem;
}

.xr-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.xr-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.xr-list li:first-child {
  border-top: none;
}

.xr-coverage .xr-list li,
.xr-left-out .xr-list li {
  display: block;
}

.xr-shared-figures {
  color: var(--color-text-muted);
}

.xr-ticker,
.xr-sector {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 0.85em;
  margin-left: 0.35rem;
}

.xr-sector {
  display: block;
  margin-left: 0;
}

.xr-bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.xr-bar {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr 3.5rem;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: var(--text-sm);
}

.xr-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xr-bar-track {
  height: 0.6rem;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

/* One neutral colour: a mix is described, never rated. */
.xr-bar-fill {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
}

.xr-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.xr-table-wrap {
  overflow-x: auto;
}

.xr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.xr-table th,
.xr-table td {
  padding: 0.45rem 0.5rem;
  border-top: 1px solid var(--color-border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.xr-table thead th {
  border-top: none;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: var(--text-xs);
}

.xr-table th[scope="row"],
.xr-table thead th:first-child {
  text-align: left;
}

.xr-table th[scope="row"] {
  font-weight: 600;
}

.xr-other th[scope="row"] {
  font-weight: 400;
  color: var(--color-text-muted);
}

.xr-show-all {
  margin-top: 0.75rem;
  min-height: 44px;
}

.xr-next {
  margin-top: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem;
}

.xr-next h2 {
  font-size: var(--text-lg);
  margin: 0 0 0.5rem;
}

.xr-next p {
  line-height: 1.55;
}

.xr-invite {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.xr-invite input {
  flex: 1 1 14rem;
  min-height: 44px;
  padding: 0 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

.xr-footer {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  box-sizing: border-box;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.xr-footer p {
  margin: 0 0 0.4rem;
}

@media (max-width: 600px) {
  .xr-title {
    font-size: var(--text-xl);
  }

  .xr-headline {
    font-size: var(--text-lg);
  }

  .xr-bar {
    grid-template-columns: minmax(5.5rem, 7rem) 1fr 3.2rem;
  }

  .xr-table th,
  .xr-table td {
    padding: 0.4rem 0.3rem;
  }
}

/* ===== css/58-latest-results.css ===== */

/* Latest results (v1.168.0): what a company reported in its newest results
   release, at the top of its research page. The figures read like the ten
   years' table; a change is plain text, never green or red, since a figure
   going up or down is a fact, not a verdict. */
.dd-results {
  padding-bottom: 0.4rem;
}

.rr-meta {
  margin: -0.2rem 0 0.7rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dd-results h4 {
  margin: 1rem 0 0.35rem;
  font-size: var(--text-sm);
}

.rr-table-wrap {
  max-width: 46rem;
  overflow-x: auto;
  border-top: 2px solid var(--color-text);
}

.rr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.rr-table th,
.rr-table td {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
  white-space: nowrap;
}

.rr-table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.rr-table th[scope="row"],
.rr-table thead th:first-child {
  text-align: left;
  font-weight: normal;
}

.rr-table .rr-cite-cell {
  text-align: left;
  width: 1%;
}

.rr-lines {
  margin: 0;
  padding-left: 1.1rem;
}

.rr-lines li {
  margin-bottom: 0.35rem;
}

/* Citations: the paragraph numbers of the release behind a line. */
.rr-cites {
  margin-left: 0.15rem;
  font-size: var(--text-xs);
  white-space: nowrap;
}

.rr-cite {
  color: var(--color-highlight-text);
  text-decoration: none;
}

.rr-cite:hover,
.rr-cite:focus-visible {
  text-decoration: underline;
}

@media (pointer: coarse) {
  .rr-cite {
    padding: 0.4rem 0.2rem;
  }
}

.rr-release {
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 0.6rem;
}

.rr-release summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.rr-paras {
  max-height: 28rem;
  overflow-y: auto;
  margin: 0.4rem 0 0;
  padding-left: 2.6rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.rr-paras li {
  margin-bottom: 0.45rem;
  overflow-wrap: anywhere;
}

.rr-paras li.is-cited {
  color: var(--color-text);
}

.rr-paras li.is-target {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.rr-note {
  margin-top: 0.8rem;
}

/* On a phone the table fits the screen: the paragraphs go under each
   figure's name instead of a column of their own. */
.rr-cite-under {
  display: none;
}

@media (max-width: 480px) {
  .rr-table {
    font-size: var(--text-xs);
  }

  .rr-table th,
  .rr-table td {
    padding: 0.35rem 0.2rem;
  }

  .rr-table .rr-cite-cell,
  .rr-table thead th:last-child {
    display: none;
  }

  .rr-cite-under {
    display: block;
  }

  .rr-cite-under .rr-cites {
    margin-left: 0;
  }
}

@media print {
  .rr-paras {
    max-height: none;
    overflow: visible;
  }
}

/* ===== css/59-screenshot-import.css ===== */

/* ---------- Reconcile from screenshots (screenshot-import.js) ---------- */

.reconcile-modes {
  display: flex;
  gap: 0.25rem;
  margin: 0.5rem 0 0.75rem;
}

.reconcile-mode {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}

.reconcile-mode.is-on {
  background: var(--color-selected-bg);
  border-color: var(--color-selected-bg);
  color: var(--color-selected-text);
}

.shots-review {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.shots-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  max-height: 24rem;
  overflow-y: auto;
}

.shots-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.3rem 0.6rem;
  padding: 0.6rem 0.75rem;
  align-items: start;
}

.shots-row + .shots-row {
  border-top: 1px solid var(--color-border);
}

.shots-tick {
  grid-column: 1;
  grid-row: 1;
  margin-top: 1.4rem;
}

/* Everything else in the row's second column, or what comes after the flags
   lands in the first and widens it. */
.shots-fields,
.shots-meta,
.shots-flags,
.shots-found {
  grid-column: 2;
}

.shots-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
}

.shots-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* The app's field look (.form-row input); these aren't in a .form-row. */
.shots-fields input,
#shots-cash {
  font: inherit;
  font-size: var(--text-sm);
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
  box-sizing: border-box;
}

.shots-fields input:focus,
#shots-cash:focus {
  outline: none;
  border-color: var(--color-focus);
}

.shots-fields input {
  width: 100%;
  min-height: 36px;
}

.shots-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.shots-find {
  background: none;
  border: none;
  padding: 0.5rem 0;
  color: var(--color-highlight-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.shots-flags {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.shots-flag {
  color: var(--color-highlight-text);
  font-size: var(--text-xs);
}

.shots-found {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: var(--text-sm);
}

.shots-pick {
  min-height: 44px;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.shots-pick span {
  color: var(--color-text-muted);
}

.shots-cash {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
}

.shots-cash #shots-cash {
  width: 8rem;
}

@media (max-width: 720px) {
  .shots-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  /* One scroll, the sheet's: a list scrolling inside it showed a row and a
     half. The buttons stay in reach, however long the list. */
  .shots-list,
  #reconcile-modal .reconcile-list {
    max-height: none;
    overflow-y: visible;
  }

  #reconcile-modal .form-actions {
    /* Down over the sheet's 1.5rem of padding, or the list shows below them. */
    position: sticky;
    bottom: -1.5rem;
    padding: 0.6rem 0 1.5rem;
    margin-bottom: -1.5rem;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
  }

  #reconcile-modal .form-actions button,
  #shots-read,
  .shots-find {
    min-height: 44px;
  }

  /* An error sits just above the buttons: not behind them. */
  #reconcile-error {
    scroll-margin-bottom: 5rem;
  }

  /* 16px text, because iOS zooms the page into any smaller field it focuses. */
  .shots-fields input,
  #shots-cash {
    font-size: var(--text-md);
    min-height: 44px;
  }

  .shots-tick,
  #shots-cash-tick,
  #reconcile-modal .reconcile-item input {
    width: 24px;
    height: 24px;
  }
}

/* ===== css/60-daily-brief.css ===== */

/* Today's brief (docs/specs/daily-brief.md): the card above the tabs on the
   first visit of the day. Plain text with one accent rule, like the
   welcome card; nothing is green or red, since an item moving is a fact and
   not a verdict, and the line under an item says what the reader holds,
   not what it does to it. */
.brief-card {
  position: relative;
  margin: 0 0 1rem;
  padding: 1rem 1.25rem 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

.brief-card[hidden] {
  display: none;
}

.db-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.db-head h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.db-close {
  flex: none;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: -0.75rem -0.9rem 0 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
}

.db-close:hover,
.db-close:focus-visible {
  color: var(--color-text);
}

.db-meta {
  margin: 0.15rem 0 0.7rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.db-age {
  margin: 0 0 0.7rem;
  font-size: var(--text-sm);
}

.brief-card h3 {
  margin: 0.9rem 0 0.35rem;
  font-size: var(--text-sm);
}

.db-items,
.db-ahead {
  margin: 0;
  padding: 0;
  list-style: none;
}

.db-items li,
.db-ahead li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--color-border);
}

.db-items li:first-child,
.db-ahead li:first-child {
  border-top: 0;
}

.db-what {
  display: block;
}

.db-exposure {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
}

.db-when {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.db-none {
  margin: 0.4rem 0;
}

.db-also,
.db-sources {
  margin-top: 0.8rem;
}

.db-also > summary,
.db-sources > summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
}

.db-cites {
  margin-left: 0.1rem;
  white-space: nowrap;
}

.db-cite {
  margin-left: 0.15rem;
  font-size: var(--text-xs);
}

.db-source-list {
  margin: 0.4rem 0;
  padding: 0;
  list-style: none;
}

.db-source-list li {
  padding: 0.15rem 0;
  scroll-margin-top: 4rem;
}

.db-source-n {
  display: inline-block;
  min-width: 1.4rem;
  color: var(--color-text-muted);
}

.db-note {
  margin: 0.9rem 0 0;
}

.db-writing {
  margin: 0.6rem 0 0.2rem;
}

/* A reader on a plan without the brief: one line and the ask. */
.brief-card.is-teaser {
  padding: 0.7rem 3rem 0.7rem 1.25rem;
}

.db-teaser {
  margin: 0;
}

.db-teaser .db-close {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  margin: 0;
}

.brief-card.is-teaser .deep-dive-ask {
  margin: 0.4rem 0 0;
}

/* Once read, the brief stays as one line that opens it again. */
.brief-card.is-bar {
  padding: 0;
}

.db-bar {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 1.25rem;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.db-bar-title {
  flex: none;
  font-weight: 600;
}

.db-bar-meta {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.db-bar-open {
  flex: none;
  font-size: var(--text-sm);
  color: var(--color-link, var(--color-highlight));
}

.db-bar:hover .db-bar-open,
.db-bar:focus-visible .db-bar-open {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .db-bar {
    flex-wrap: wrap;
    gap: 0.1rem 0.75rem;
    padding: 0.55rem 1rem;
  }

  .brief-card {
    margin: 0 0 0.75rem;
    padding: 0.85rem 1rem 0.8rem;
  }
}

@media print {
  .brief-card {
    display: none;
  }
}

/* ===== css/61-admin-redesign.css ===== */

/* ---------- Admin: Costs chart and the Users list (v1.173.0) ---------- */

/* The chart's three service colours and a grey for the rest: the first
   three slots of a colour-blind-checked categorical order, stepped for
   each theme's surface. Red stays the loss colour, used only for a day
   over the daily limit. */
:root {
  --cc-0: #2a78d6;
  --cc-1: #eb6834;
  --cc-2: #1baf7a;
  --cc-other: #9aa3ad;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cc-0: #3987e5;
    --cc-1: #d95926;
    --cc-2: #199e70;
    --cc-other: #6b7299;
  }
}

:root[data-theme="dark"] {
  --cc-0: #3987e5;
  --cc-1: #d95926;
  --cc-2: #199e70;
  --cc-other: #6b7299;
}

.admin-page .login-card {
  text-align: left;
}

/* Title on the left, the page's one control (Limits, + Invite) on the right. */
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-head .login-title,
.admin-head .login-subtitle {
  text-align: left;
}

.admin-head .login-subtitle {
  margin-bottom: 0;
}

.cost-limits,
.admin-invite {
  position: relative;
}

.cost-limits > summary,
.admin-invite > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.cost-limits > summary::-webkit-details-marker,
.admin-invite > summary::-webkit-details-marker {
  display: none;
}

.cost-limits-panel,
.admin-invite-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  width: min(30rem, calc(100vw - 2rem));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.cost-limits-panel .hint,
.admin-invite-panel .hint {
  margin: 0 0 0.75rem;
}

/* ---------- Costs ---------- */

.cost-tiles {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 1.75rem;
}

.cost-tile-note a {
  color: var(--color-highlight-text);
}

.cost-meter {
  display: block;
  height: 6px;
  border-radius: var(--radius-control);
  background: var(--color-border);
  overflow: hidden;
  margin: 0.2rem 0;
}

.cost-meter > span {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
  border-radius: var(--radius-control);
}

.cost-meter-over > span {
  background: var(--color-loss);
}

.cost-section {
  margin: 0 0 2rem;
}

.cost-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.cost-subtitle {
  font-size: var(--text-sm);
  margin: 1.25rem 0 0.5rem;
}

.cc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.cc-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cc-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-control);
  flex: none;
}

.cc-s0 { background: var(--cc-0); }
.cc-s1 { background: var(--cc-1); }
.cc-s2 { background: var(--cc-2); }

.cc-s3,
.cc-other { background: var(--cc-other); }

.cc-limit-key {
  height: 0;
  border-top: 2px dashed var(--color-loss);
  border-radius: 0;
}

.cc-chart {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0 1.5rem; /* room for the dates under the columns */
}

.cc-axis {
  position: relative;
  width: 3.25rem;
  height: 200px;
  flex: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.cc-axis span {
  position: absolute;
  right: 0;
  transform: translateY(50%);
}

.cc-plot {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 200px;
  border-bottom: 1px solid var(--color-border);
}

.cc-grid,
.cc-limit {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--color-border);
  pointer-events: none;
}

.cc-grid {
  opacity: 0.6;
}

.cc-limit {
  border-top: 2px dashed var(--color-loss);
  z-index: 2;
}

.cc-cols {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cc-col {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  outline: none;
  cursor: default;
}

.cc-col:hover,
.cc-col:focus-visible {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
}

.cc-col:focus-visible {
  box-shadow: inset 0 0 0 2px var(--color-focus);
}

/* One column a day: its services stacked from the baseline, the 2px
   surface gap between them, the top rounded. */
.cc-stack {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: 100%;
  max-width: 28px;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.cc-seg {
  display: block;
  min-height: 1px;
}

/* Over the daily limit: a red cap, besides the dashed line it crosses. */
.cc-over .cc-stack {
  border-top: 3px solid var(--color-loss);
}

/* After Google's latest figures: hatched, not an empty day. */
.cc-pending .cc-stack {
  height: 100% !important;
  background: repeating-linear-gradient(135deg, transparent 0 4px,
    color-mix(in srgb, var(--color-text-muted) 25%, transparent) 4px 6px);
}

.cc-x {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* The day's figures, above the plot over its column: hover or focus. */
.cc-tip {
  display: none;
  position: absolute;
  top: -0.5rem;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 10;
  min-width: 11rem;
  padding: 0.5rem 0.65rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
}

.cc-tip-start .cc-tip {
  left: 0;
  transform: translateY(-100%);
}

.cc-tip-end .cc-tip {
  left: auto;
  right: 0;
  transform: translateY(-100%);
}

.cc-col:hover .cc-tip,
.cc-col:focus-visible .cc-tip {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cc-tip-total {
  font-variant-numeric: tabular-nums;
}

.cc-tip-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text-muted);
}

.cc-tip-row > span:last-child {
  margin-left: auto;
  padding-left: 0.75rem;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.cost-section .data-table {
  margin: 0;
}

.cost-section .data-table td {
  font-variant-numeric: tabular-nums;
}

.cost-more {
  margin-top: 0.75rem;
}

.cost-more > summary {
  cursor: pointer;
  color: var(--color-text);
  font-size: var(--text-sm);
  padding: 0.4rem 0;
}

.cost-more[open] > summary {
  margin-bottom: 0.5rem;
}

.cost-google {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 400;
}

.cost-google a {
  color: var(--color-highlight-text);
}

.cost-share-cell {
  white-space: nowrap;
  width: 30%;
}

.cost-share {
  display: inline-block;
  vertical-align: middle;
  width: calc(100% - 3rem);
  max-width: 220px;
  height: 8px;
  margin-right: 0.4rem;
  border-radius: var(--radius-control);
  background: var(--color-border);
  overflow: hidden;
}

.cost-share > span {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
  border-radius: var(--radius-control);
}

.cost-outside {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

.cost-outside li {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 9rem 2fr;
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding: 0.65rem 1rem;
}

.cost-outside li + li {
  border-top: 1px solid var(--color-border);
}

.cost-outside-price {
  font-variant-numeric: tabular-nums;
}

/* Calls left in a free allowance (RentCast, Realie). */
.cost-calls-left {
  display: block;
  margin-top: 0.15rem;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Users ---------- */

.admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.admin-summary li {
  font-size: var(--text-sm);
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.admin-summary li strong {
  color: var(--color-text);
}

.admin-summary a {
  color: var(--color-highlight-text);
}

.admin-notice {
  margin: 0 0 1rem;
}

.admin-notice p {
  margin: 0 0 0.5rem;
}

.admin-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  vertical-align: 0.1em;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.admin-badge-admin {
  border-color: var(--color-border);
  color: var(--color-text);
}

.admin-badge-suspended {
  border-color: var(--color-loss);
  color: var(--color-loss-text);
}

.admin-sub {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.admin-users td {
  vertical-align: middle;
}

.admin-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  background: var(--color-text-muted);
  opacity: 0.5;
}

.admin-dot-on {
  background: var(--color-gain);
  opacity: 1;
}

.admin-meter {
  display: block;
  width: 8rem;
  max-width: 100%;
  height: 6px;
  margin: 0.3rem 0 0.15rem;
  border-radius: var(--radius-control);
  background: var(--color-border);
  overflow: hidden;
}

.admin-meter > span {
  display: block;
  height: 100%;
  background: var(--color-fill-neutral);
}

.admin-manage-cell {
  text-align: right;
  white-space: nowrap;
}

.admin-manage-btn[aria-expanded="true"] {
  border-color: var(--color-selected-bg);
}

/* A person's Manage panel: a row of its own under theirs, across the table. */
.admin-manage-row > td {
  background: color-mix(in srgb, var(--color-selected-bg) 4%, var(--color-surface));
  padding: 1rem 1.25rem;
}

.admin-manage-row[hidden] {
  display: none;
}

.admin-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem 1.5rem;
  text-align: left;
}

.admin-manage-grid section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.admin-manage-grid h3 {
  font-size: var(--text-sm);
  margin: 0;
}

.admin-manage-grid form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
}

.admin-manage-grid p {
  margin: 0;
}

.admin-manage-grid .admin-plan-form {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.admin-manage-grid input[type="text"] {
  width: 100%;
}

.admin-archives > summary {
  cursor: pointer;
  font-weight: 600;
}

.admin-archives[open] > summary {
  margin-bottom: 0.75rem;
}

@media (max-width: 720px) {
  .cost-limits-panel,
  .admin-invite-panel {
    position: static;
    width: auto;
    margin-top: 0.5rem;
    box-shadow: none;
  }

  .admin-head > details {
    width: 100%;
  }

  /* 30 columns need about 450px: the chart scrolls sideways rather than squeeze. */
  .cc-chart {
    overflow-x: auto;
  }

  /* The card's own label says how much; a bar beside it doesn't fit. */
  .admin-meter {
    display: none;
  }

  .admin-manage-row > td {
    padding: 0.75rem;
  }

  .admin-manage-grid select {
    max-width: 100%;
  }

  .cc-plot {
    min-width: 450px;
  }

  .cost-outside li {
    grid-template-columns: 1fr auto;
  }

  .cost-outside-note {
    grid-column: 1 / -1;
  }

  .cost-share-cell {
    width: auto;
  }

  .admin-manage-cell {
    text-align: left;
  }

  .data-table .admin-manage-row > td::before {
    content: none;
  }
}

/* Requests for access (v1.177.0): the blocked domains under the list. */
.admin-blocked-title {
  margin: 1.25rem 0 0.5rem;
  font-size: var(--text-sm);
}

.admin-blocked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ===== css/62-purchase-choice.css ===== */

/* ---------- Add Holding: "Is this a new purchase?" ---------- */

.purchase-choice {
  border: 0;
  padding: 0;
  margin-inline: 0;
  min-inline-size: 0;
}

.purchase-choice legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.35rem;
}

.purchase-choice label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  cursor: pointer;
  min-height: 44px;
  box-sizing: border-box;
}

.purchase-choice label + label {
  margin-top: 0.4rem;
}

.purchase-choice input {
  margin-top: 0.2rem;
  flex: none;
}

.purchase-choice label:has(input:checked) {
  border-color: var(--color-selected-bg);
}

.purchase-choice:has(.field-invalid) label {
  border-color: var(--color-loss);
}

/* ===== css/63-brokerage-sync.css ===== */

/* ---------- Reconcile from your brokerage (brokerage-sync.js) ---------- */

#sync-mode {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#sync-mode #sync-connect,
#sync-mode #sync-connected {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

#sync-mode .sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#sync-mode [hidden] {
  display: none;
}

#sync-status:empty {
  display: none;
}

/* ===== css/64-front.css ===== */

/* ---------- The front page: what a signed-out visitor sees at / ---------- */

/* Its own page (front.html), in the app's colours and buttons. The
   tokens below are the only ones it adds: the inset behind an example
   row, the grey for notes on it (the app's muted grey was 4.32:1 there,
   under the 4.5 a small note needs; v1.190.0) and the soft gold under
   the example card. */
.front {
  --front-inset: #f1f2f5;
  --front-inset-muted: #5f6675;
  --front-glow: rgba(201, 169, 97, 0.16);
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .front {
    --front-inset: #0d1128;
    --front-inset-muted: #8b90b8;
    --front-glow: rgba(201, 169, 97, 0.1);
  }
}

:root[data-theme="dark"] .front {
  --front-inset: #0d1128;
  --front-inset-muted: #8b90b8;
  --front-glow: rgba(201, 169, 97, 0.1);
}

/* Small capitals: every label on the page. Body face with even-width
   digits; Courier New was a pixel wide at this size on Windows. */
.front-label {
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.front a.btn-primary {
  display: inline-block;
  white-space: nowrap;
}

.front a:focus-visible {
  outline: 2px solid var(--color-highlight-text);
  outline-offset: 3px;
}

/* Top bar */
.front-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
}

.front-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.front-brand img {
  border-radius: 8px;
  flex: 0 0 auto;
}

.front-brand span {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-highlight-text);
}

.front-bar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Hero: the headline beside one worked example */
.front-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 3rem;
  align-items: center;
  padding: 3rem 0 4rem;
}

.front-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--color-highlight);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  color: var(--color-highlight-text);
}

.front-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-highlight);
}

.front-hero h1 {
  margin: 1.5rem 0;
  font-size: clamp(2.7rem, 7.2vw, 5.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.front-hero h1 em {
  display: block;
  font-style: normal;
  color: var(--color-highlight-text);
}

.front-lede {
  max-width: 34rem;
  margin: 0 0 2rem;
  font-size: 1.1rem;
}

/* Request access: one field and one button, in the page's own classes. */
.front-request {
  max-width: 34rem;
}

.front-request-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-highlight-text);
}

.front-request-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.front-input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.front-input:focus-visible {
  outline: 2px solid var(--color-highlight-text);
  outline-offset: 2px;
  border-color: var(--color-highlight);
}

.front .front-cta {
  padding: 0.8rem 1.8rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* The field no person fills: off the screen, out of the tab order. */
.front-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.front-error {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--color-loss-text);
}

.front-sent {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-highlight);
  border-radius: 12px;
  background: var(--color-surface);
}

.front-under-cta a,
.front-link {
  color: var(--color-highlight-text);
}

.front-foot-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.front-link {
  font-size: 0.9rem;
}

.front-under-cta {
  max-width: 30rem;
  margin: 1.1rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* The worked example: one move, three figures, one total. */
.front-example {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 20px 60px var(--front-glow);
}

.front-example-head {
  margin: 0.15rem 0 1rem;
}

.front-move {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.front-move b {
  font-size: 1.25rem;
  font-weight: 700;
}

.front-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--front-inset);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-top: 0.6rem;
}

/* Notes on the inset take its own grey. */
.front-row,
.front-chips li {
  --color-text-muted: var(--front-inset-muted);
}

.front-row .front-label {
  display: block;
  color: var(--color-highlight-text);
}

.front-row small {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* The figure after the move. One colour for every row, never gain green
   or loss red: it's a change, not a verdict. */
.front-row .front-figure {
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  font-weight: 700;
}

.front-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0.25rem 0.15rem;
}

.front-total .front-figure {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 700;
}

/* The two promises */
.front-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.front-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.75rem;
}

.front-card h2 {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin: 0 0 1.1rem;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
}

.front-num {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-highlight-text);
}

.front-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.front-chips li {
  font-variant-numeric: tabular-nums;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  background: var(--front-inset);
}

.front-chips li.front-chip-plain {
  border: 0;
  background: none;
  padding-left: 0.2rem;
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: 0.04em;
}

.front-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* The lessons: a short explanation over the figures that show it */
.front-snippets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.front-snippet {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1.5rem;
}

.front-snippet h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  line-height: 1.25;
}

.front-snippet-lede {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
}

.front-ledger {
  margin: 0 0 1.1rem;
}

.front-ledger > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--color-border);
}

.front-ledger dt {
  font-size: 0.88rem;
}

.front-ledger dt small {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* One colour for every figure, an amount owed included: the minus sign
   says it, and nothing here is good or bad. */
.front-ledger dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.front-ledger .front-ledger-total {
  border-top: 2px solid var(--color-highlight);
}

.front-ledger-total dt {
  font-weight: 700;
}

.front-ledger-total dd {
  font-size: 1.1rem;
}

/* At the foot of the card, so the three line up whatever their length. */
.front-snippet-foot {
  margin: auto 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* How it goes */
.front-steps-title {
  margin: 4rem 0 1.25rem;
}

.front-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.front-steps li {
  border-top: 2px solid var(--color-highlight);
  padding-top: 0.9rem;
}

.front-steps .front-num {
  display: block;
  font-size: 1.5rem;
  line-height: 1.2;
}

.front-steps h3 {
  margin: 0.5rem 0 0.4rem;
  font-size: 1.05rem;
}

.front-steps p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* What it never does */
.front-never {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0;
  margin: 3.5rem 0 0;
  padding: 1.1rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  list-style: none;
}

.front-never li {
  padding-right: 1.5rem;
}

.front-never li + li {
  padding-left: 1.5rem;
  border-left: 1px solid var(--color-border);
}

.front-fine {
  max-width: 46rem;
  margin: 2rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.front-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
}

/* Tablet and phone */
@media (max-width: 900px) {
  .front-hero {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    padding: 1.5rem 0 3rem;
  }

  .front-steps {
    grid-template-columns: 1fr 1fr;
  }

  .front-snippets {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .front {
    padding: 0 1rem 2.5rem;
  }

  .front-bar-right .front-label {
    display: none;
  }

  .front-pair {
    grid-template-columns: 1fr;
  }

  .front-card {
    padding: 1.25rem;
  }

  /* A finger's height, as the app's own buttons are on a phone. */
  .front a.btn-primary {
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .front .front-cta {
    flex: 1 1 100%;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .front-row .front-figure {
    font-size: 1.2rem;
  }

  .front-never {
    display: block;
  }

  .front-never li,
  .front-never li + li {
    padding: 0.3rem 0;
    border-left: 0;
  }
}

@media (max-width: 420px) {
  .front-steps {
    grid-template-columns: 1fr;
  }
}

/* ===== css/65-taxes.css ===== */

/* The Taxes tab (v1.180.0; Tax Location before it): the reader's rates and
   realized gains by tax year side by side (every year since v2.4.0), then the 30-day window, above the
   location tiles and table (06, 10). Figures in the text's own colours;
   gains alone take the gain/loss colours, as everywhere. */
.taxes-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.taxes-card,
.taxes-window {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
  padding: 0.9rem 1rem;
}

.taxes-card h3,
.taxes-window h3 {
  margin: 0 0 0.4rem;
}

/* Year chips size to their labels, as Activity's filter does. */
.taxes-years {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.taxes-years .range-chip {
  flex: 0 0 auto;
  padding: 0 0.85rem;
}

.taxes-csv {
  display: inline-block;
  margin-top: 0.25rem;
  text-decoration: none;
}

.taxes-rates-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 0.75rem;
  align-items: end;
}

.taxes-rates-form .form-row {
  margin-bottom: 0.5rem;
}

.taxes-rates-form .form-actions,
.taxes-rates-form .form-error {
  grid-column: 1 / -1;
  margin-top: 0;
}

.taxes-window {
  margin-bottom: 1.25rem;
}

.taxes-window-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.taxes-window-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

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

.taxes-window-buys {
  color: var(--color-text-muted);
}

.taxes-location-title {
  margin: 0 0 0.5rem;
}

/* A phone: the three rates stay in a row, narrow as they are, so the
   form is one glance. */
@media (max-width: 480px) {
  .taxes-rates-form {
    gap: 0 0.5rem;
  }
}

/* ===== css/66-stay-current.css ===== */

/* Staying current (The Open Seat, Release 3; stay-current.js): the date on
   each account, and "Since you last looked" above the total. The mark on
   an account past the reader's span is the gold of every other notice
   here, not red: it says how old the figures are, not that anything is
   wrong. */

/* ---------- An account's age, in the sidebar ---------- */
.row-fresh {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-highlight-text);
}

.row-fresh:empty {
  display: none;
}

.portfolio-item.active .row-fresh {
  color: inherit;
}

@media (hover: hover) {
  /* Out of the row menu's way, like the value beside it. */
  .portfolio-sidebar .portfolio-row:hover .row-fresh,
  .portfolio-sidebar .portfolio-row:focus-within .row-fresh {
    visibility: hidden;
  }
}

/* ---------- Manage accounts ---------- */
.manage-fresh.is-stale {
  color: var(--color-highlight-text);
  font-weight: 600;
}

.check-reminder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0.75rem 0 0.35rem;
  font-size: var(--text-sm);
}

.check-reminder select {
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.manage-reconcile-btn {
  flex: none;
  min-height: 2rem;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.manage-reconcile-btn:hover,
.manage-reconcile-btn:focus-visible {
  border-color: var(--color-text-muted);
}

/* ---------- Reconcile ---------- */
.reconcile-checked {
  color: var(--color-gain-text);
}

.sync-daily {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
  font-weight: 600;
}

/* ---------- What changed (one block since v2.2.0) ---------- */
.since-block {
  position: relative;
  margin: 0.25rem 0 0.75rem;
  padding: 0.7rem 1rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

.since-block[hidden] {
  display: none;
}

.since-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.since-head h2 {
  margin: 0 0 0.3rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.since-close {
  flex: none;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin: -0.7rem -0.9rem -0.9rem 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
}

.since-close:hover,
.since-close:focus-visible {
  color: var(--color-text);
}

.since-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.since-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.12rem 0;
  font-size: var(--text-md);
}

.since-lead {
  font-size: var(--text-md);
}

.since-action {
  flex: none;
  min-height: 2rem;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.since-action:hover,
.since-action:focus-visible {
  background: var(--color-bg);
}

/* With the top card, on Home only (69-home.css, v1.189.0). */
@media (max-width: 720px) {
  .since-action {
    min-height: 2.75rem;
  }
}

/* The spans: one chip each, the open one filled. */
.since-spans {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.5rem;
}

.since-span {
  min-height: 2rem;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.since-span[aria-pressed="true"] {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-surface);
  font-weight: 600;
}

.since-span:hover:not([aria-pressed="true"]),
.since-span:focus-visible:not([aria-pressed="true"]) {
  border-color: var(--color-text-muted);
}

.since-span-label {
  margin: 0 0 0.35rem;
  font-size: var(--text-xs);
  font-weight: 600;
}

.what-changed[aria-busy="true"] .since-span-body {
  opacity: 0.55;
}

.since-movers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.35rem 0 0;
}

.since-movers-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.since-movers-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.since-movers .mover {
  padding: 0.2rem 0.55rem;
}

.since-week-title {
  margin: 0 0 0.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* What's to know of the accounts, under whichever span is open. */
.since-span-body + .since-accounts {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 720px) {
  .since-span {
    min-height: 2.75rem;
  }

  /* Ticker and dollars, two or three to a line. */
  .since-movers .mover-pct {
    display: none;
  }

  /* With the percent gone, the dollars carry the arrow (01-base.css). */
  .since-movers .mover-pct + .mover-dollar.gain::before {
    content: "\25B2 ";
  }

  .since-movers .mover-pct + .mover-dollar.loss::before {
    content: "\25BC ";
  }
}

/* ===== css/67-rules.css ===== */

/* Your rules (The Open Seat, Release 4; rules.js): the block on Home for
   rules past their line, the Your rules dialog, the rules a move touches
   in the preview, and the moves a reader is considering. A rule past its
   line takes the gold of every other notice here, not red: it's the
   reader's own line, and the app has no view on it. */

/* ---------- On Home: with "Since you last looked" ---------- */
.rules-block {
  margin: 0.25rem 0 0.75rem;
  padding: 0.7rem 1rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-highlight);
  border-radius: var(--radius-dialog);
}

.rules-block[hidden] {
  display: none;
}

.rules-block .since-head {
  align-items: center;
}

.rules-block .since-head h2 {
  margin: 0;
}

/* With the top card, on Home only (69-home.css, v1.189.0). */

/* ---------- The dialog ---------- */
.modal.rules-modal {
  width: min(620px, 94vw);
}

.rules-summary {
  margin: 0.5rem 0 0.25rem;
  font-weight: 600;
}

.rules-summary:empty {
  display: none;
}

.rules-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.rule-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0 0.45rem 0.6rem;
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid transparent;
}

.rule-row.is-past {
  border-left-color: var(--color-highlight);
}

.rule-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.rule-reading {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.rule-row.is-past .rule-reading {
  color: var(--color-highlight-text);
}

.rule-delete,
.move-step-remove {
  flex: none;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--color-text-muted);
  font-size: var(--text-md);
  cursor: pointer;
}

.rule-delete:hover,
.rule-delete:focus-visible,
.move-step-remove:hover,
.move-step-remove:focus-visible {
  color: var(--color-text);
  background: var(--color-bg);
}

.rules-add-title {
  margin: 0.75rem 0 0.4rem;
  font-size: var(--text-md);
}

.rules-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}

.rule-amount {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rule-amount input {
  flex: 1;
  min-width: 0;
}

/* ---------- In the move preview ---------- */
.mp-rules p {
  margin: 0;
  padding: 0.25rem 0 0.25rem 0.6rem;
  font-size: var(--text-sm);
  border-left: 3px solid var(--color-border);
}

.mp-rules p + p {
  margin-top: 0.25rem;
}

.mp-rules p.is-past {
  border-left-color: var(--color-highlight);
}

/* ---------- Several moves in one preview ---------- */
.move-steps {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  counter-reset: move-step;
}

.move-steps[hidden] {
  display: none;
}

.move-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  counter-increment: move-step;
}

.move-step-label {
  flex: 1;
  min-width: 0;
}

.move-step-label::before {
  content: counter(move-step) ". ";
  color: var(--color-text-muted);
}

.move-step-done,
.move-add-step {
  flex: none;
  min-height: 2rem;
  padding: 0.15rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
}

.move-step-done:hover,
.move-step-done:focus-visible,
.move-add-step:hover,
.move-add-step:focus-visible {
  border-color: var(--color-highlight);
}

.move-add-step[hidden] {
  display: none;
}

.move-add-step:disabled {
  opacity: 0.55;
  cursor: default;
}

.move-next-title {
  margin: 0 0 0.4rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}

.move-next-title[hidden] {
  display: none;
}

/* ---------- Moves you're considering, above the tabs ---------- */
.pending-move.has-several {
  display: block;
}

.pending-moves-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.pending-moves {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pending-moves li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 1.25rem;
  padding: 0.2rem 0;
}

.pending-move-note,
.ar-note {
  font-style: italic;
  color: var(--color-text-muted);
}

.ar-note {
  display: block;
}

/* What changed a kept move's position since it was tried (v1.186.5). */
.pending-move-changed {
  display: block;
  margin-top: 0.2rem;
  color: var(--color-text);
  font-size: var(--text-sm);
}

.pending-moves-more {
  margin-top: 0.25rem;
}

@media (pointer: coarse) {
  .rule-delete,
  .move-step-remove,
  .move-step-done,
  .move-add-step {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 720px) {
  .rules-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Your rules is a fourth button beside the tabs. Reconcile gives up its
   "with broker" a little sooner than it did, so the four still share the
   tabs' row on an ordinary desktop instead of wrapping under it. */
@media (max-width: 1900px) {
  .reconcile-btn-more {
    display: none;
  }
}

/* Where a rule stands against the reader's own limit (Pure.nowAfterLine,
   styled in part 53): on Home's block and in the dialog. */
.rule-line {
  flex-direction: column;
  align-items: stretch;
}

/* In a column, the line's flex-basis (100%, for a wrapping row) would
   stand in for its height. */
.rule-line .mp-line,
.rule-text .mp-line {
  flex-basis: auto;
  max-width: 20rem;
}

/* ===== css/68-for-the-forums.css ===== */

/* For the forums (The Open Seat, Release 5): Copy for a forum's dialog
   (forum-post.js), the household sheet (household.html), the bear-market
   table on Risk, and new cash by account on Rebalance. */

/* ---------- Copy for a forum ---------- */
.holdings-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.35rem;
}

/* Wide enough for the flow's full layout (see-whole.js draws it narrow
   below 560px); a phone still gets 94% of its width. */
.modal.forum-post-modal {
  width: min(44rem, 94vw);
}

.forum-post-text {
  width: 100%;
  box-sizing: border-box;
  min-height: 18rem;
  padding: 0.6rem 0.7rem;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.forum-post-status:empty {
  display: none;
}

/* The flow beside the post (v1.198.0), drawn by see-whole.js with the
   Holdings flow's own classes (73-see-whole.css). */
.forum-post-flow {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.forum-post-flow-title {
  margin: 0 0 0.25rem;
  font-size: var(--text-md);
  font-weight: 600;
}

.forum-post-flow-chart {
  margin: 0.5rem 0;
}

.forum-post-flow-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.forum-post-flow-actions .forum-post-status {
  margin: 0;
}

/* ---------- The household sheet (household.html) ---------- */
.household-body {
  background: var(--color-bg);
}

.household-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 16px 3rem;
  color: var(--color-text);
}

.household-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.household-head h1 {
  margin: 0;
  font-size: var(--text-2xl);
}

.household-who {
  margin: 0.2rem 0 0;
  color: var(--color-text-muted);
}

.household-lede {
  max-width: 44rem;
  margin: 0.75rem 0 1.25rem;
}

.household-section {
  margin: 0 0 1.5rem;
}

.household-section h2 {
  font-size: var(--text-lg);
  margin: 0 0 0.5rem;
}

.household-table {
  width: 100%;
}

.household-table td,
.household-table th {
  vertical-align: top;
}

/* Row headings read as the rows they head, not as the dark column
   header every .data-table th gets (10-tables.css). */
.data-table.household-table tfoot th,
.data-table.bear-markets-table tbody th {
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--text-sm);
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
  white-space: normal;
}

.data-table.household-table tfoot th {
  text-align: right;
  font-weight: 600;
}

.household-table tfoot td {
  font-weight: 600;
}

.household-total {
  font-size: var(--text-md);
  margin: 0 0 0.25rem;
}

.household-foot {
  margin: 0 0 2rem;
}

.household-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.6rem 0.9rem 0.3rem;
  margin: 0 0 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 0.75rem;
}

.household-fieldset legend {
  font-weight: 600;
  padding: 0 0.3rem;
}

.household-fieldset .form-row input {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .household-fieldset {
    grid-template-columns: 1fr;
  }

  /* The phone cards (47-phone-tables.css) give each row its own card; the
     total's heading needs no label beside it. */
  .data-table.household-table tfoot {
    display: block;
  }

  .data-table.household-table tfoot th {
    text-align: left;
  }
}

@media print {
  .household-body {
    background: #fff;
  }

  .household-page {
    max-width: none;
    padding: 0;
    color: #000;
  }

  .no-print {
    display: none !important;
  }

  .household-table {
    font-size: 10pt;
  }

  .household-table tr {
    break-inside: avoid;
  }
}

/* ---------- Four bear markets, on the Risk tab ---------- */
.bear-markets {
  margin-top: 1rem;
}

.bear-markets-table {
  width: 100%;
}

.bear-markets-table th[scope="row"] {
  font-weight: 600;
  text-align: left;
}

.bear-markets-dates {
  display: block;
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 720px) {
  /* The phone cards' headline is a row's first cell, here a <th>. */
  .data-table.bear-markets-table tbody th {
    font-size: var(--text-md);
    border-bottom: 1px solid var(--color-border);
    padding: 0 0 0.4rem;
    margin-bottom: 0.3rem;
  }
}

/* ---------- A blended benchmark (Edit Portfolio) ---------- */
.blend-rows {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  padding: 0.5rem 0.75rem 0.25rem;
  margin: 0 0 0.75rem;
}

.blend-rows[hidden] {
  display: none;
}

.blend-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
}

.blend-row .blend-ticker {
  flex: 1 1 auto;
  min-width: 0;
}

.blend-row .blend-pct {
  width: 4.5rem;
  flex: 0 0 auto;
}

/* The same deposits in the benchmark, under the Returns tiles. */
.returns-same-deposits {
  margin: 0.35rem 0 0;
}

/* ---------- Invest new cash, by account (Rebalance) ---------- */
.invest-cash-account {
  display: block;
  width: 100%;
  max-width: 220px;
  font: inherit;
  font-size: var(--text-md);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  color: var(--color-text);
}

.invest-cash-account:focus {
  outline: none;
  border-color: var(--color-focus);
}

.invest-cash-pick {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.3rem 0 0.1rem;
}

.invest-cash-pick-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  cursor: pointer;
}

.invest-cash-pick-option.is-disabled {
  cursor: default;
  opacity: 0.6;
}

.invest-cash-pick-none {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
}

.invest-cash-try {
  margin-top: 0.5rem;
}

.data-table.household-table tfoot th:hover,
.data-table.bear-markets-table tbody th:hover {
  color: var(--color-text);
}

/* ===== css/69-home.css ===== */

/* ---------- Home and the five destinations (v1.189.0) ----------
   Release 4 of the front-end review (findings 12 to 14). The same five
   destinations on every screen, Home, Holdings, Insights, Plan and
   Research (app-shell.js): across the top on a computer, along the bottom
   on a phone. Holdings, Insights and Plan each have a strip of their own
   tabs under the bar. Home leads with the total, the accounts it's made
   of and the look-through, then one strip of notices, one row of figures,
   and up to 25 holdings. Last in the cascade, so it decides over the parts
   it reshapes (09 tabs, 44 tablet, 46 phone tabs, 52 top card). */

/* ---------- The bar ---------- */

.tab-nav-brand {
  margin: 0 1.25rem 0 0;
  font-size: var(--text-xl);
  line-height: 1;
}

.dest-row {
  display: flex;
  gap: 0.25rem;
}

.dest-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.85rem 1rem 0.7rem;
  font: inherit;
  font-size: var(--text-md);
  color: var(--color-text-muted);
  cursor: pointer;
}

.dest-btn:hover {
  color: var(--color-text);
}

.dest-btn[aria-current="page"] {
  color: var(--color-text);
  border-bottom-color: var(--color-selected-bg);
  font-weight: 600;
}

/* The phone's More, beside "+": shown in the 720px block below. */
.more-header-btn {
  display: none;
}

/* The open destination's own tabs, a row under the bar. A tab shows only
   in its destination (data-in); Home and Research have no strip. Before
   app-shell.js names a destination, none shows. */
.tab-nav .tab-scroll {
  flex: 1 1 100%;
  order: 10;
}

.tab-nav .tab-btn {
  display: none;
}

body[data-section="holdings"] .tab-nav .tab-btn[data-in="holdings"],
body[data-section="insights"] .tab-nav .tab-btn[data-in="insights"],
body[data-section="plan"] .tab-nav .tab-btn[data-in="plan"] {
  display: block;
}

body:not([data-section="holdings"]):not([data-section="insights"]):not([data-section="plan"]) .tab-nav .tab-scroll {
  display: none;
}

@media (min-width: 1101px) {
  /* Under the bar, smaller and quieter than the destinations: a choice
     within one, not another place to go. */
  .tab-nav .tab-scroll {
    display: flex;
    gap: 0.25rem;
    padding: 0 0 0.5rem;
  }

  .tab-nav .tab-btn {
    padding: 0.3rem 0.85rem;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font-size: var(--text-sm);
  }

  .tab-nav .tab-btn.active {
    background: var(--color-selected-bg);
    border-color: var(--color-selected-bg);
    color: var(--color-selected-text);
  }

  .tab-nav .tab-btn:not(.active):hover {
    background: var(--color-hover-bg);
  }
}

/* A tablet or a small window: the switcher and actions on the first line,
   the destinations on the second, the tabs on a third. */
@media (min-width: 721px) and (max-width: 1100px) {
  .tab-nav-brand {
    display: none;
  }

  .dest-row {
    order: 5;
    flex: 1 1 100%;
  }

  .dest-btn {
    padding: 0.5rem 0.85rem 0.45rem;
  }
}

/* ---------- The header under it ---------- */

/* The bar is above it now, so it needs less room on top. */
.app-header {
  padding-top: 0.75rem;
}

/* One line on a computer: the delayed-prices note wraps within itself
   rather than pushing Share onto a line of its own. */
@media (min-width: 721px) {
  .app-header-top .price-disclaimer {
    flex: 1 1 16rem;
    min-width: 0;
  }
}

/* ---------- Home on a computer: a grid ---------- */

/* Two columns that each stack without a hole (v2.5.2). On the left, the
   total, its three figures, then what you paid and where $100 sits; on
   the right, the look-through, then the notices; Coming up under both.
   The left held only the total before, so beside a tall look-through and
   notices it was mostly empty.

   Rows are shared across a grid's columns, so each column's items span
   rows to keep it closed up: the look-through spans the total's and the
   figures' rows and one more; the learn cards span that one and the last,
   which is 1fr. An item spanning a flexible row grows only that row, so
   whichever column is taller, the other's items still sit one under the
   next and any room left over is at its foot, not between them.

   The top card's own wrapper (#dashboard-hero, which page-refresh.js
   swaps whole) steps aside so its two cards are the grid's. Only on
   Home: elsewhere the top card folds to one line (52-top-card.css). */
@media (min-width: 1101px) {
  body:is(:not([data-section]), [data-section="home"]) .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 31rem) minmax(0, 1fr);
    grid-template-areas:
      "total look"
      "stats look"
      "learn look"
      "learn notices"
      "coming coming";
    grid-template-rows: auto auto auto 1fr auto;
    column-gap: 1.5rem;
    margin-top: 0.75rem;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid > #dashboard-hero {
    display: contents;
  }

  .home-grid .hero-card {
    grid-area: total;
    align-self: start;
  }

  /* Stretched, so where the total's column is the taller (Net worth, with
     its chart) the card fills down to the notices rather than leaving a
     gap above them. */
  .home-grid .hero-chart-card {
    grid-area: look;
    align-self: stretch;
  }

  .home-grid .home-notices {
    grid-area: notices;
    align-self: start;
  }

  .home-grid .stat-row-secondary {
    grid-area: stats;
    align-self: start;
  }

  .home-grid .coming-up {
    grid-area: coming;
  }

  .home-grid .learn-row {
    grid-area: learn;
    align-self: start;
  }

  /* In the total's column the three figures are a list under it, a label
     and its value to a line, not a row of three squeezed to its width. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary {
    flex-direction: column;
    padding: 0.25rem 0;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-pill {
    display: flex;
    flex: none;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    width: 100%;
    padding: 0.45rem 0;
    text-align: left;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-pill + .stat-pill {
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-label {
    margin-bottom: 0;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-value {
    text-align: right;
  }

  /* The learn cards one above the other, at the column's width. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .learn-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Home on a wide screen: three columns (v2.6.0) ----------

   Two columns on a wide screen made cards of 1000px or more with a few
   short lines in them (the look-through's bars ran across the page, a
   milestone's line ended halfway), and a 1600px page left a band of empty
   screen either side. Past 1600px the page widens to 2400px and Home is
   three columns of a size: the total, the look-through and the notices
   side by side, then What you paid (two columns) beside Where $100, then
   Coming up across.

   The total and its three figures read as one card: the figures are its
   foot, joined under it, and stretch to the foot of the row. The
   look-through and the notices span both of their rows, so the three
   cards of the first row end level; the second row is 1fr, as in the two
   columns, so whichever is taller the total's card closes up. The notices
   stop at 34rem and scroll within (below), so they can't stretch the two
   cards beside them to twice their content. */
@media (min-width: 1600px) {
  body:is(:not([data-section]), [data-section="home"]) .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "total look notices"
      "stats look notices"
      "learn learn learn"
      "coming coming coming";
    grid-template-rows: auto 1fr auto auto;
  }

  /* No notices: the look-through takes their column too. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid:has(> .home-notices:not(:has(> :not([hidden])))) {
    grid-template-areas:
      "total look look"
      "stats look look"
      "learn learn learn"
      "coming coming coming";
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .hero-card {
    align-self: stretch;
    justify-content: flex-start;
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .hero-chart-card,
  body:is(:not([data-section]), [data-section="home"]) .home-grid .home-notices {
    align-self: stretch;
    margin: 0;
  }

  /* The notices are as tall as what they say, and a week's breakdown, the
     milestones and a lesson together ran to 900px, stretching the two
     cards beside them to that with nothing in them. Past 34rem they
     scroll within their card instead, no bar shown (as Coming up), a
     shadow at an edge saying there is more that way. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .home-notices {
    max-height: 34rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    background:
      linear-gradient(var(--color-surface) 30%, transparent) center top / 100% 2.5rem no-repeat local,
      linear-gradient(transparent, var(--color-surface) 70%) center bottom / 100% 2.5rem no-repeat local,
      radial-gradient(farthest-side at 50% 0, rgb(0 0 0 / 35%), transparent) center top / 100% 0.75rem no-repeat scroll,
      radial-gradient(farthest-side at 50% 100%, rgb(0 0 0 / 35%), transparent) center bottom / 100% 0.75rem no-repeat scroll,
      var(--color-surface);
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .home-notices::-webkit-scrollbar {
    display: none;
  }

  /* The total's chart a little taller, at the column's width. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .hero-card .hero-chart-canvas {
    height: 88px;
  }

  /* The three figures in a row under the total, in its card: a label
     over its value, as they were before they were a list in a narrower
     column. Where the row is taller than the card's content, the room
     left is at its foot, as in the cards beside it. */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary {
    align-self: stretch;
    flex-direction: row;
    align-items: flex-start;
    margin: 0;
    padding: 0.75rem 1.5rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-dialog) var(--radius-dialog);
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-pill {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: auto;
    padding: 0.1rem 1rem;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-pill:first-child {
    padding-left: 0;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-pill + .stat-pill {
    border-top: 0;
    border-left: 1px solid var(--color-border);
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid .stat-row-secondary .stat-value {
    text-align: left;
  }

  /* What you paid over two columns and Where $100 in the third, on the
     grid's own columns (subgrid), level with the cards above. One card
     alone takes the row (72-learn.css). */
  body:is(:not([data-section]), [data-section="home"]) .home-grid .learn-row {
    grid-template-columns: subgrid;
    align-self: stretch;
    gap: 1.5rem;
  }

  .home-grid .learn-row > .learn-card:first-child {
    grid-column: span 2;
  }

  .home-grid .learn-row .learn-chart {
    height: 200px;
  }

  /* Where $100 sits, larger in the column it has to itself. */
  .home-grid .learn-row .hundred-grid {
    width: min(15rem, 100%);
    gap: 3px;
  }

  .home-grid .learn-row .hundred-key {
    font-size: var(--text-md);
  }

  .home-grid .learn-row .hundred-key li + li {
    margin-top: 0.5rem;
  }
}

/* ---------- The top card, shorter ---------- */

/* The value chart: lower, its ranges at their own width. */
.hero-card .hero-chart-canvas {
  height: 56px;
}

.hero-card .range-chips {
  justify-content: flex-start;
  margin-bottom: 0;
}

.hero-card .range-chip {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 0.7rem;
}

/* ---------- Home: the total, its accounts, the look-through ---------- */

/* What the total is made of, each opening its own view. */
.home-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
  margin: 0.75rem 0 0;
  padding: 0.6rem 0 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}

.home-accounts li {
  min-width: 0;
}

.home-accounts li + li {
  border-left: 1px solid var(--color-border);
}

.home-account {
  display: grid;
  padding: 0.1rem 1rem;
  color: var(--color-text);
  text-decoration: none;
}

.home-accounts li:first-child .home-account {
  padding-left: 0;
}

.home-account:hover .home-account-name,
.home-account:focus-visible .home-account-name {
  color: var(--color-text);
  text-decoration: underline;
}

.home-account-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.home-account-value {
  font-size: var(--text-md);
  font-weight: 600;
}

.home-account-more {
  align-self: center;
  padding-left: 1rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Where the account list is beside the top card (past 1100px; a drawer
   below that, 44-tablet.css), the same accounts and values under the
   total said them twice (Say It Once S2, v2.1.0). A phone and a tablet
   keep them, since their account list is out of sight. */
@media (min-width: 1101px) {
  .home-accounts {
    display: none;
  }
}

/* The look-through's last row: the rest, muted and without a bar. */
.ranked-bars .is-rest .ranked-bar {
  color: var(--color-text-muted);
}

.ranked-bars .is-rest .ranked-bar-track {
  visibility: hidden;
}

.dest-link {
  margin-top: 0.5rem;
  padding: 0.25rem 0;
}

/* ---------- One list of notices ---------- */

/* Sample data, then the notices (notices.js): rows of one box, divided by
   rules, rather than boxes of their own. */
.home-notices {
  margin: 0.75rem 0 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  overflow: hidden;
}

.home-notices:not(:has(> :not([hidden]))) {
  display: none;
}

.home-notices > .sample-data-banner,
.home-notices > .pending-move,
.home-notices > .since-block,
.home-notices > .rules-block {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* Past the first three (notices.js), until "N more" is chosen. */
.home-notices > .notice-over {
  display: none;
}

.notices-more {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  background: none;
  border: 0;
  color: var(--color-highlight-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.notices-more[hidden] {
  display: none;
}

.notices-more:hover,
.notices-more:focus-visible {
  background: var(--color-hover-bg);
}

.home-notices > :not([hidden]) ~ :not([hidden]) {
  border-top: 1px solid var(--color-border);
}

/* The reader's own line stays marked as theirs: brass, at its edge. */
.home-notices > .rules-block {
  box-shadow: inset 3px 0 0 var(--color-highlight);
}

/* ---------- One row of figures ---------- */

/* Six figures on one line, divided by rules: not tiles (a border goes
   round something to act on, and the dividend figure is one). */
.stat-row-secondary {
  flex-wrap: nowrap;
  gap: 0;
  margin: 0.75rem 0;
  padding: 0.5rem 0;
  border-block: 1px solid var(--color-border);
}

.stat-row-secondary .stat-pill {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.1rem 1rem;
  background: none;
  border: 0;
  border-radius: 0;
}

.stat-row-secondary .stat-pill:first-child {
  padding-left: 0;
}

.stat-row-secondary .stat-pill + .stat-pill {
  border-left: 1px solid var(--color-border);
}

.stat-row-secondary .stat-pill-button:hover,
.stat-row-secondary .stat-pill-button:focus-visible {
  background: var(--color-hover-bg);
}

/* ---------- Away from Home ---------- */

/* On every other destination the top card folds to its one line
   (52-top-card.css), and the notices go with it, but two stay: sample
   data says what every figure is, and a move tried is asked about
   wherever it was tried. Holdings keeps the exposure detail that Home
   leaves to it; Home keeps its look-through instead. */
body[data-section]:not([data-section="home"]) .home-notices > :not(.sample-data-banner, .pending-move),
body[data-section]:not([data-section="home"]) .coming-up,
body[data-section]:not([data-section="home"]) .home-disclaimer {
  display: none;
}

body[data-section]:not([data-section="home"]) .home-notices:not(:has(> .sample-data-banner, > .pending-move:not([hidden]))) {
  display: none;
}

/* Collapsed rather than display:none: it holds a chart, and a chart
   created in a display:none box is drawn at no size (Chart.js sizes a
   chart from its box when it's made, and under display:none that is 0x0,
   which nothing brings back). Collapsing only the vertical keeps the real
   width; visibility:hidden is inherited, so nothing inside can be seen,
   clicked or focused. Learn from your own numbers (72-learn.css) is folded
   the same way away from Home.

   Home and Holdings are both the Holdings tab (app-shell.js). Home shows
   only the empty portfolio's way to add one from it (and the combined
   view's line); the table, the lots and the exposure detail are
   Holdings'. Its largest positions were here until v2.11.3; they are
   under the top card now (dashboard.html). position:relative keeps every row's
   visually-hidden label inside the fold (it once left ~440px of empty
   scroll at the foot of Home). */
body[data-section]:not([data-section="home"]) .learn-row,
body:is(:not([data-section]), [data-section="home"]) #tab-holdings > :not(.combined-view-hint, .holdings-empty) {
  height: 0;
  min-height: 0;
  margin-block: 0;
  padding-block: 0;
  border-block-width: 0;
  overflow: hidden;
  visibility: hidden;
  position: relative;
}

/* ---------- Your largest positions ---------- */

.home-largest {
  margin: 0 0 1rem;
}

.home-largest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.home-largest-head h3 {
  margin: 0;
}

.home-largest-cols,
.home-largest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem 6rem 4.5rem;
  align-items: baseline;
  gap: 0 0.75rem;
}

.home-largest-cols {
  margin: 0.25rem 0 0.2rem;
  padding: 0 0.5rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.home-largest-cols > span,
.home-largest-value,
.home-largest-today,
.home-largest-weight {
  text-align: right;
}

.home-largest-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-largest-list > li + li {
  border-top: 1px solid var(--color-border);
}

.home-largest-row {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.5rem;
  background: none;
  border: 0;
  border-radius: var(--radius-control);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.home-largest-row:hover,
.home-largest-row:focus-visible {
  background: var(--color-hover-bg);
}

.home-largest-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5rem;
  min-width: 0;
}

.home-largest-ticker {
  font-weight: 700;
}

.home-largest-account {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow-wrap: break-word;
}

/* Under Home's first row (v2.11.0; in both views since v2.11.2, and in
   one place since v2.11.3, George's choices): the top card's third part
   (dashboard.html), across the row under the total and the look-through. */
.hero-row > .home-largest {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
}

/* In Home's grid it takes a row of its own under the first, the whole
   width. Only when there is one: an empty portfolio keeps the grid it had. */
@media (min-width: 1101px) {
  .home-grid #home-largest {
    grid-area: largest;
    margin-top: 0.75rem;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid:has(> #dashboard-hero > #home-largest) {
    grid-template-areas:
      "total look"
      "stats look"
      "largest largest"
      "learn notices"
      "coming coming";
    grid-template-rows: auto 1fr auto auto auto;
  }
}

@media (min-width: 1600px) {
  body:is(:not([data-section]), [data-section="home"]) .home-grid:has(> #dashboard-hero > #home-largest) {
    grid-template-areas:
      "total look notices"
      "stats look notices"
      "largest largest largest"
      "learn learn learn"
      "coming coming coming";
    grid-template-rows: auto 1fr auto auto auto;
  }

  body:is(:not([data-section]), [data-section="home"]) .home-grid:has(> #dashboard-hero > #home-largest):has(> .home-notices:not(:has(> :not([hidden])))) {
    grid-template-areas:
      "total look look"
      "stats look look"
      "largest largest largest"
      "learn learn learn"
      "coming coming coming";
  }
}

/* On a wide screen (v2.6.0) a row the page's width had its name at one
   end and its figures 1,500px away at the other: each position is a tile
   instead, its account under it, its value, then today's change and its
   weight, each named, five across. */
@media (min-width: 1600px) {
  .home-largest-cols {
    display: none;
  }

  .home-largest-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin-top: 0.6rem;
  }

  .home-largest-list > li + li {
    border-top: 0;
  }

  .home-largest-row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "name name"
      "value value"
      "today weight";
    gap: 0.2rem 1rem;
    height: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border);
  }

  .home-largest-name {
    grid-area: name;
  }

  .home-largest-value {
    grid-area: value;
    font-size: var(--text-lg);
    font-weight: 600;
  }

  .home-largest-today {
    grid-area: today;
  }

  .home-largest-weight {
    grid-area: weight;
  }

  .home-largest-value,
  .home-largest-today,
  .home-largest-weight {
    text-align: left;
  }

  .home-largest-today,
  .home-largest-weight {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.3rem;
    font-size: var(--text-sm);
  }

  /* The names the table's head gave, said in each tile, ahead of the ▲
     or ▼ a change draws. */
  .home-largest-today .visually-hidden,
  .home-largest-weight .visually-hidden {
    order: -1;
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }
}

/* Copy for a forum is about the holdings as a list, so it's Holdings'
   (it sat on a line of its own above Home's table). And Home's table
   follows the figures closely: the header's foot and the content's top
   were 2.5rem between them. */
body:is(:not([data-section]), [data-section="home"]) .holdings-actions {
  display: none;
}

body:is(:not([data-section]), [data-section="home"]) .app-header {
  padding-bottom: 0;
}

body:is(:not([data-section]), [data-section="home"]) .tab-content-container {
  padding-top: 0.5rem;
}

/* On a computer the delayed-prices line is in the header beside "Data as
   of"; a phone's Home shows its own copy under the total. */
.home-disclaimer {
  display: none;
}

/* ---------- A phone ---------- */

@media (max-width: 720px) {
  .home-largest-cols,
  .home-largest-row {
    grid-template-columns: minmax(0, 1fr) 4.75rem 4.25rem 3rem;
    gap: 0 0.4rem;
  }
}

@media (max-width: 720px) {
  .tab-nav-brand,
  .dest-row {
    display: none;
  }

  /* More, beside "+", where the bottom bar's fifth item was. */
  .more-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-text);
    cursor: pointer;
  }

  /* The switcher gives way first, so "+" and More stay on its line at
     320px (finding 14: "+" dropped to a second row). A wrapping line
     wraps before anything on it shrinks, so its width is capped. */
  .tab-nav .sidebar-toggle-btn {
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 2 * 44px - 2 * 0.5rem);
  }

  .tab-nav .tab-scroll {
    order: 10;
  }

  .tab-nav .tab-btn {
    display: none;
  }

  body[data-section="holdings"] .tab-nav .tab-btn[data-in="holdings"],
  body[data-section="insights"] .tab-nav .tab-btn[data-in="insights"],
  body[data-section="plan"] .tab-nav .tab-btn[data-in="plan"] {
    display: block;
  }

  body[data-section="home"] .app-header-top .price-disclaimer {
    display: none;
  }

  body[data-section="home"] .home-disclaimer {
    display: block;
    margin: 0.6rem 0 0;
    line-height: 1.4;
  }

  /* One account a line, its value at the end. */
  .home-accounts {
    display: grid;
    gap: 0.25rem;
  }

  .home-accounts li + li {
    border-left: 0;
  }

  .home-account,
  .home-accounts li:first-child .home-account {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0;
  }

  .home-account-name {
    max-width: none;
    font-size: var(--text-sm);
  }

  .home-account-more {
    padding-left: 0;
  }

  /* One row that scrolls sideways, not three rows of two tiles. */
  .stat-row-secondary {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -1rem;
    padding-inline: 1rem;
  }

  .stat-row-secondary::-webkit-scrollbar {
    display: none;
  }

  .stat-row-secondary .stat-pill {
    flex: 0 0 auto;
    max-width: 11rem;
    padding-inline: 0.75rem;
  }
}

/* ===== css/70-accessibility.css ===== */

/* ---------- Usable by everyone (v1.190.0) ----------
   Release 5 of the front-end review (findings 15 to 17). Last, so its
   high-contrast rules win over every area's own. */

/* The first thing a keyboard reaches on the dashboard: out of sight until
   it has focus, then over the top left corner. */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10000;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Where it lands: focusable so the next Tab starts there, with no ring of
   its own around the whole top card. Clear of the pinned bar above it. */
#page-content {
  scroll-margin-top: 8rem;
}

#page-content:focus {
  outline: none;
}

/* Windows' high contrast (forced colours) repaints every background in
   the page's own colour, so a selection drawn as a fill or an underline
   in brand colours, and every bar or mark drawn as a filled box,
   disappeared. Selections take the system's highlight. A mark of one
   meaning takes the text colour; parts told apart by colour keep their
   own. The move preview's line keeps "now" in the system's grey and your
   limit in the highlight, so its three parts stay told apart. */
@media (forced-colors: active) {
  .dest-btn[aria-current="page"],
  .bottom-nav-btn[aria-current="page"],
  .tab-btn[aria-current="page"],
  .tab-btn.active,
  .range-chip.is-on,
  .hero-seg-btn.is-on,
  .mode-toggle-btn[aria-pressed="true"],
  .mode-toggle-btn.active,
  .hl-chip.is-on,
  .reconcile-mode.is-on,
  .portfolio-item.active,
  .sidebar-group-header.is-current,
  .coming-chip[aria-expanded="true"],
  .since-span[aria-pressed="true"],
  .ranked-bar.active {
    /* Important: each area styles its own selection more specifically
       (.tab-nav .tab-btn.active, the phone's bars), and here the system's
       colours must win over all of them. */
    forced-color-adjust: none;
    background: Highlight !important;
    color: HighlightText !important;
    border-color: Highlight !important;
  }

  .ranked-bar-fill,
  .target-bar-fill,
  .hl-weight-fill,
  .mp-line-after,
  .mp-key-after,
  .dd-mark,
  .dd-legend-mark,
  .hbar-key-swatch,
  .xr-bar-fill {
    forced-color-adjust: none;
    background: CanvasText;
  }

  /* The week's waterfall is styled in a later part (71-coming-up.css), so
     here its system colour must win by weight, not order. */
  .week-bar,
  .week-mark {
    forced-color-adjust: none;
    background: CanvasText !important;
  }

  /* Where colours tell parts apart (Rebalance's mix bar and its key, the
     costs chart's key), they keep their own, each segment edged. */
  .mix-seg,
  .mix-swatch,
  .cc-swatch {
    forced-color-adjust: none;
    box-shadow: inset 0 0 0 1px Canvas;
  }

  /* Where $100 sits (72-learn.css, a later part, so these win by
     weight): each class keeps its own colour, every square edged, and
     "other" an outline in the system's text colour. */
  .hundred-sq,
  .hundred-swatch,
  .learn-swatch {
    forced-color-adjust: none !important;
    box-shadow: inset 0 0 0 1px Canvas !important;
  }

  .hundred-sq.hundred-other,
  .hundred-swatch.hundred-other {
    box-shadow: inset 0 0 0 1px CanvasText !important;
  }

  /* See the whole (73-see-whole.css, a later part, so these win by
     weight). The flow's picked company and its ways in take the system's
     highlight; its bands and nodes the text colour, so they still show.
     Then and now's mix keeps each class's colour, segments edged, and a
     holding's history key its marks' shapes. */
  .flow-chip[aria-pressed="true"] {
    forced-color-adjust: none !important;
    background: Highlight !important;
    color: HighlightText !important;
    border-color: Highlight !important;
  }

  .flow-band.is-on,
  .flow-node.is-on {
    fill: Highlight !important;
    opacity: 1 !important;
  }

  .flow-band,
  .flow-node {
    fill: CanvasText !important;
  }

  .flow-band {
    opacity: 0.35 !important;
  }

  .flow-band.is-dim {
    opacity: 0.12 !important;
  }

  .tn-seg,
  .tn-swatch,
  .hh-swatch {
    forced-color-adjust: none !important;
    box-shadow: inset 0 0 0 1px Canvas !important;
  }

  /* Year in review (74-milestones.css, a later part, so these win by
     weight): its month bars in the text colour, the open year as the
     system's highlight. */
  .yr-bar {
    forced-color-adjust: none !important;
    background: CanvasText !important;
  }

  .yr-years a[aria-current="page"] {
    forced-color-adjust: none !important;
    background: Highlight !important;
    color: HighlightText !important;
  }

  .ranked-bar-fill.is-negative {
    background: transparent;
    border-color: CanvasText;
  }

  .mp-line-now,
  .mp-key-now {
    forced-color-adjust: none;
    background: GrayText;
    opacity: 1;
  }

  .mp-line-mark,
  .mp-key-mark {
    forced-color-adjust: none;
    background: Highlight;
  }

  .skip-link:focus {
    outline-color: Highlight;
  }
}

/* ===== css/71-coming-up.css ===== */

/* Coming up (Reasons to Come Back, Release 1; coming-up.js): the dated
   strip on Home, the week broken down, and the Your dates dialog. Gold
   marks the reader's own dates, as it marks their targets and limits
   elsewhere; everything else is ink. High contrast is in
   70-accessibility.css. */

/* ---------- The strip ---------- */
.coming-up {
  margin: 0.75rem 0 0;
  padding: 0.7rem 1rem 0.8rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
}

.coming-up[hidden] {
  display: none;
}

.coming-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.coming-head h2 {
  margin: 0;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: 700;
}

/* 30 or 90 days (v2.4.0), beside the heading; Your dates stays at the
   end of the row. */
.coming-spans {
  margin: 0 auto 0 0;
  justify-content: flex-start;
}

.coming-spans .range-chip {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 0.7rem;
}

.coming-expected {
  margin: 0.2rem 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.coming-empty {
  margin: 0.4rem 0 0;
}

/* One line of chips that scrolls sideways, rather than a tall stack
   pushing the figures down. No scroll bar (v2.6.0): a mouse resting near
   either end scrolls it (Ui.wireEdgeScroll), and the end with more beyond
   it fades out to say so. */
.coming-chips {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.coming-chips::-webkit-scrollbar {
  display: none;
}

.coming-chips.more-right {
  mask-image: linear-gradient(to right, #000 calc(100% - 4rem), transparent);
}

.coming-chips.more-left {
  mask-image: linear-gradient(to left, #000 calc(100% - 4rem), transparent);
}

.coming-chips.more-left.more-right {
  mask-image: linear-gradient(to right, transparent, #000 4rem, #000 calc(100% - 4rem), transparent);
}

.coming-chips > li {
  flex: none;
}

.coming-chip {
  display: grid;
  gap: 0.1rem;
  min-width: 7.5rem;
  max-width: 13rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.coming-chip:hover,
.coming-chip:focus-visible {
  background: var(--color-hover-bg);
}

.coming-chip[aria-expanded="true"] {
  border-color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-text);
}

/* The reader's own: gold at its edge. */
.coming-chip.coming-yours {
  box-shadow: inset 3px 0 0 var(--color-highlight);
}

.coming-chip.coming-yours[aria-expanded="true"] {
  box-shadow: inset 3px 0 0 var(--color-highlight), inset 0 0 0 1px var(--color-text);
}

.coming-when {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.coming-yours .coming-when {
  color: var(--color-highlight-text);
}

.coming-title {
  overflow: hidden;
  font-size: var(--text-sm);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.coming-amount {
  font-size: var(--text-xs);
}

.coming-more {
  align-self: center;
  padding: 0 0.25rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.coming-detail {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  background: var(--color-bg);
  border-radius: var(--radius-control);
}

.coming-detail[hidden] {
  display: none;
}

.coming-detail-text {
  margin: 0 0 0.25rem;
  font-size: var(--text-sm);
  line-height: 1.45;
}

/* ---------- The week, broken down ---------- */
.week-rows {
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
}

.week-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.12rem 0;
  font-size: var(--text-sm);
}

.week-row-start .week-label,
.week-row-end .week-label {
  color: var(--color-text-muted);
}

.week-track {
  position: relative;
  height: 0.8rem;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.week-bar {
  position: absolute;
  top: 0.1rem;
  bottom: 0.1rem;
  background: var(--color-fill-neutral);
  border-radius: 2px;
}

/* Your changes are the reader's own. */
.week-bar.week-yours {
  background: var(--color-highlight);
}

.week-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--color-text);
}

.week-figure {
  min-width: 5.5rem;
  text-align: right;
}

.week-note {
  margin: 0.35rem 0 0;
}

/* ---------- Your dates ---------- */
.dates-modal {
  max-width: 34rem;
}

.dates-list {
  margin: 0.75rem 0 1rem;
  padding: 0;
  list-style: none;
}

.dates-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 0.75rem;
  padding: 0.5rem 0 0.5rem 0.6rem;
  border-top: 1px solid var(--color-border);
  box-shadow: inset 3px 0 0 var(--color-highlight);
}

.dates-item.is-past {
  box-shadow: none;
  color: var(--color-text-muted);
}

.dates-note {
  font-weight: 600;
}

.dates-when {
  grid-column: 1;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dates-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-items: center;
  gap: 0.5rem;
}

.dates-form-title {
  margin: 0 0 0.5rem;
  font-size: var(--text-md);
}

.dates-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0 0.75rem;
}

@media (max-width: 720px) {
  .dates-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .week-row {
    grid-template-columns: minmax(5.5rem, 7rem) minmax(0, 1fr) auto;
    gap: 0.5rem;
  }

  .coming-up {
    margin-top: 0.6rem;
  }
}

/* A phone: the heading and Your dates share the first line, the 30 / 90
   days chips take the next. */
@media (max-width: 480px) {
  .coming-head {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .coming-spans {
    order: 3;
    flex-basis: 100%;
  }
}

/* ===== css/72-learn.css ===== */

/* Learn from your own numbers (Reasons to Come Back, Release 2; learn.js):
   what you paid against what it grew, where $100 sits, a lesson once, and
   the "Worked out with your figures" fold under a pinned ⓘ. Green and red
   are a gain and a loss, as everywhere; each asset class has one colour of
   its own; gold stays the reader's own. Home's grid places the row
   (69-home.css); high contrast is in 70-accessibility.css. */

:root {
  --learn-stocks: #3498db;
  --learn-bonds: #1f3a5f;
  --learn-cash: #a7b4c2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --learn-bonds: #c9d1f0;
    --learn-cash: #4a5280;
  }
}

:root[data-theme="dark"] {
  --learn-bonds: #c9d1f0;
  --learn-cash: #4a5280;
}

/* ---------- The row ---------- */
.learn-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0.75rem 0 0;
}

.learn-row:not(:has(> :not([hidden]))) {
  display: none;
}

@media (min-width: 900px) {
  .learn-row {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }

  /* One card alone takes the row. */
  .learn-row:has(> .learn-card[hidden]) > .learn-card:not([hidden]) {
    grid-column: 1 / -1;
  }
}

.learn-row .learn-card {
  margin: 0;
}

.learn-card[hidden] {
  display: none;
}

.learn-card h3 {
  margin-top: 0;
}

/* ---------- What you paid, and what it grew ---------- */
.learn-chart {
  position: relative;
  height: 180px;
}

.learn-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.learn-key li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.learn-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.learn-swatch-paid {
  background: color-mix(in srgb, var(--color-text-muted) 35%, transparent);
  box-shadow: inset 0 0 0 1px var(--color-text-muted);
}

.learn-swatch-grown {
  background: color-mix(in srgb, var(--color-gain) 40%, transparent);
}

.learn-swatch-below {
  background: color-mix(in srgb, var(--color-loss) 40%, transparent);
}

.learn-sentence {
  margin: 0.5rem 0 0;
  font-size: var(--text-sm);
}

/* ---------- Where $100 sits ---------- */
.hundred {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.25rem;
}

.hundred-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  width: min(11rem, 100%);
  flex: none;
}

.hundred-sq {
  aspect-ratio: 1;
  border-radius: 2px;
}

.hundred-key {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.hundred-key li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hundred-key li + li {
  margin-top: 0.3rem;
}

.hundred-swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 2px;
  flex: none;
}

.hundred-stocks {
  background: var(--learn-stocks);
}

.hundred-bonds {
  background: var(--learn-bonds);
}

.hundred-cash {
  background: var(--learn-cash);
}

/* "Other" is what's left: outlined, so it reads as the rest. */
.hundred-other {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--color-text-muted);
}

/* What you paid's caption at rest says how to read a day; its figures
   are in the sentence under the chart (v2.1.0). */
#paid-grown-readout.is-hint {
  font-family: inherit;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ---------- A lesson, once ---------- */
.lesson-card {
  padding: 0.7rem 1rem 0.75rem;
}

.lesson-card[hidden] {
  display: none;
}

.lesson-card h2 {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.lesson-kicker {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

.lesson-card p {
  margin: 0.35rem 0 0;
  font-size: var(--text-sm);
}

.lesson-card .lesson-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.6rem;
}

body[data-section]:not([data-section="home"]) .home-notices > .lesson-card {
  display: none;
}

/* ---------- Worked out, under a pinned ⓘ ---------- */
.tooltip-panel .tt-worked {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--color-border);
}

.tooltip-panel .tt-worked summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
}

.tooltip-panel .tt-worked ul {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.tooltip-panel .tt-worked li {
  font-size: var(--text-xs);
  line-height: 1.45;
}

.tooltip-panel .tt-worked li + li {
  margin-top: 0.2rem;
}

/* ===== css/73-see-whole.css ===== */

/* See the whole (Reasons to Come Back, Release 3; see-whole.js): the flow
   from accounts to companies on Holdings, Then and now on Performance, and
   a holding's own history in its drill-down row. One colour for the flow's
   bands, gold for what the reader picked and for their own records (their
   trades, their average cost), each asset class its own colour as in Where
   $100 sits. High contrast is in 70-accessibility.css. */

/* ---------- The flow ---------- */
.flow-scroll {
  margin: 0.5rem 0 0.25rem;
}

/* Laid out at the box's width, one unit a pixel (see-whole.js), and no
   wider than that layout. */
.flow-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.flow-band {
  fill: var(--color-text-muted);
  opacity: 0.28;
  transition: opacity 0.15s ease;
}

.flow-band.is-dim {
  opacity: 0.09;
}

.flow-band.is-near {
  opacity: 0.22;
}

.flow-band.is-on {
  fill: var(--color-highlight);
  opacity: 0.85;
}

.flow-node {
  fill: var(--color-text);
}

.flow-node.is-on {
  fill: var(--color-highlight);
}

.flow-node[data-flow-pick],
.flow-label[data-flow-pick] {
  cursor: pointer;
}

.flow-label {
  fill: var(--color-text);
  font-size: 13px;
  dominant-baseline: middle;
}

/* The middle column's names sit over the bands: a halo keeps them read. */
.flow-label-mid {
  paint-order: stroke;
  stroke: var(--color-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.flow-label.is-on {
  font-weight: 700;
}

.flow-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.25rem 0 0.5rem;
}

.flow-chip {
  min-height: 36px;
  padding: 0 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.flow-chip[aria-pressed="true"] {
  border-color: var(--color-highlight);
  box-shadow: inset 0 0 0 1px var(--color-highlight);
}

.flow-readout {
  margin: 0;
  font-size: var(--text-sm);
  max-width: 72ch;
}

/* ---------- Then and now ---------- */
.then-now-days {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

.then-now-field {
  display: grid;
  gap: 0.15rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.then-now-field input {
  min-height: 36px;
  font: inherit;
  color: var(--color-text);
}

.tn-value {
  margin: 0 0 0.6rem;
  font-weight: 600;
}

.tn-mix {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  margin: 0.3rem 0;
  font-size: var(--text-sm);
}

.tn-mix-label {
  color: var(--color-text-muted);
}

.tn-bar {
  display: flex;
  height: 0.9rem;
  border-radius: 2px;
  overflow: hidden;
  background: var(--color-border);
}

.tn-seg {
  display: block;
  height: 100%;
}

/* A holding sold out since: hatched, since nothing says what it was. */
.tn-seg-sold-since {
  background: repeating-linear-gradient(
    135deg,
    var(--color-text-muted) 0 2px,
    transparent 2px 6px
  );
}

.tn-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.4rem 0 0.6rem;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.tn-key li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tn-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
}

.tn-lines {
  margin: 0 0 0.6rem;
  padding-left: 1.1rem;
  font-size: var(--text-sm);
}

.tn-table th[scope="colgroup"] {
  text-align: center;
}

.tn-ticker {
  font-weight: 600;
}

.tn-steady td:first-child {
  color: var(--color-text-muted);
}

.tn-method {
  margin-top: 0.5rem;
}

/* ---------- A holding's own history ---------- */
.holding-history {
  margin: 0.75rem 0 0.25rem;
}

.hh-chart-box {
  position: relative;
  height: 200px;
  max-width: 760px;
}

.hh-status {
  margin: 0;
}

.hh-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.35rem 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.hh-key li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.hh-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
}

.hh-swatch-price {
  height: 2px;
  background: #3498db;
}

.hh-swatch-cost {
  height: 0;
  border-top: 2px dashed var(--color-highlight);
}

.hh-swatch-buy {
  border-radius: 50%;
  background: var(--color-highlight);
}

.hh-swatch-sell {
  border-radius: 50%;
  border: 2px solid var(--color-highlight);
}

.hh-swatch-dividend {
  width: 0.6rem;
  height: 0.6rem;
  transform: rotate(45deg);
  background: var(--color-highlight);
}

.hh-lines {
  font-weight: 400;
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: var(--text-sm);
}

.ps-chart-key .hh-key {
  margin-top: 0;
}

/* ===== css/74-milestones.css ===== */

/* Milestones (Reasons to Come Back, Release 4; milestones.js,
   year_review.html): the reader's own numbers on Home and in their
   dialog, which take the Your rules block and dialog's look (67), and the
   Year in review page, which takes the household sheet's (68). Brass is
   the reader's own amount, the tick on each bar; nothing here is red or
   green, and a reached milestone gets no flourish. High contrast is in
   70-accessibility.css. */

/* ---------- On Home and in the dialog ---------- */
.milestone-line {
  flex-direction: column;
  align-items: stretch;
}

.milestone-line .mp-line,
.milestone-row .mp-line {
  flex-basis: auto;
  max-width: 20rem;
  margin-top: 0.25rem;
}

.milestone-pace {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.milestone-row.is-reached .rule-reading {
  color: var(--color-text);
}

/* Away from Home the notices fold with the top card (69-home.css). */
body[data-section]:not([data-section="home"]) .home-notices > :is(.milestones-block, .year-review-notice) {
  display: none;
}

.year-review-notice .since-text {
  display: block;
  margin: 0.15rem 0 0;
  font-size: var(--text-sm);
}

/* The Net worth view's way in, under its assets and liabilities. */
#milestones-open-btn {
  margin-top: 0.4rem;
  padding: 0.25rem 0;
}

.milestones-modal .form-actions {
  flex-wrap: wrap;
}

.milestones-year {
  margin-right: auto;
  text-decoration: none;
}

/* ---------- Year in review ---------- */
.yr-years {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.9rem;
  margin: 0.75rem 0 1.25rem;
  font-size: var(--text-sm);
}

.yr-years a {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  color: var(--color-text);
}

.yr-years a[aria-current="page"] {
  font-weight: 700;
  text-decoration: none;
  box-shadow: inset 0 -2px 0 var(--color-text);
}

.yr-years-gap {
  flex: 1;
}

.yr-lines {
  margin: 0;
  padding-left: 1.1rem;
}

.yr-lines li {
  margin: 0 0 0.35rem;
}

.yr-sentence {
  margin: 0 0 0.6rem;
}

.yr-mix-table {
  max-width: 40rem;
}

/* Dividends by month: twelve bars in one ink, each with its month and
   figure under it in text, so the list reads without the bars. */
.yr-months {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.35rem;
  max-width: 44rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yr-months li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
}

.yr-bar-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 6rem;
  border-bottom: 1px solid var(--color-border);
}

.yr-bar {
  display: block;
  width: 100%;
  min-height: 1px;
  background: var(--color-text);
  border-radius: 2px 2px 0 0;
}

.yr-month {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.yr-amount {
  font-size: var(--text-xs, 0.75rem);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .yr-months {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    row-gap: 0.9rem;
  }

  .yr-years-gap {
    flex-basis: 100%;
  }
}

@media print {
  .yr-bar {
    background: #000;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .yr-months,
  .yr-mix-table tr {
    break-inside: avoid;
  }
}

/* ===== css/75-options.css ===== */

/* Options (docs/specs/options.md, O1): an option's terms in Add Holding
   (its call-or-put and bought-or-written choices take the purchase
   question's look, 62), and on Holdings its name, an "Expired" mark and
   the facts under its row. */

.option-terms {
  margin-top: var(--space-2);
}

.option-choice legend {
  margin-bottom: var(--space-1);
}

.option-choice {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-2);
}

.option-choice legend {
  flex-basis: 100%;
}

.option-choice label {
  flex: 1 1 10rem;
}

.option-choice label + label {
  margin-top: 0;
}

.option-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.option-pair > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.option-pair input {
  width: 100%;
  box-sizing: border-box;
}

.option-name {
  white-space: nowrap;
}

.option-expired {
  color: var(--color-text-muted);
}

.option-facts {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 719px) {
  .option-pair {
    grid-template-columns: 1fr;
  }

  .option-name {
    white-space: normal;
  }
}

/* ===== css/76-option-trade.css ===== */

/* An option's trades and what happened to it (docs/specs/options.md, O3;
   option-trade.js). Its choices take the purchase question's look (62,
   75); the preview under the fields is the server's sentences. */

.option-trade-modal {
  max-width: 34rem;
}

.option-trade-name {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* The choices are drawn into a box of their own; laid out as the
   fieldset's own labels. */
.option-trade-kinds > div {
  display: contents;
}

.option-trade-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.option-trade-fields[hidden] {
  display: none;
}

.option-trade-fields .form-row {
  min-width: 0;
}

.option-trade-fields input {
  width: 100%;
  box-sizing: border-box;
}

.option-trade-preview {
  margin: var(--space-3) 0 0;
  padding: var(--space-3) var(--space-4);
  list-style: none;
  border-left: 3px solid var(--color-border);
  font-size: var(--text-sm);
}

.option-trade-preview li + li {
  margin-top: var(--space-1);
}

.option-trade-note {
  margin-top: var(--space-3);
}

.options-ended-list {
  list-style: none;
  margin: var(--space-2) 0 0;
  padding: 0;
}

.options-ended-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.options-ended-list li + li {
  margin-top: var(--space-2);
}

@media (max-width: 719px) {
  .option-trade-fields {
    grid-template-columns: 1fr;
  }
}

/* Try a move for an option (O4): a contract not held is typed by its
   terms above the trade; what the trade does to the underlying across the
   portfolio sits under the preview, set apart from what recording does. */
.option-trade-terms {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.option-trade-exposure {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-border);
  font-size: var(--text-sm);
}

.tx-option-link {
  margin: var(--space-1) 0 0;
}

/* ===== css/77-options-exposure.css ===== */

/* What your options move like, on the Risk tab (docs/specs/options.md,
   O4; risk.html). The table is a .data-table like the bear markets'; the
   sentences under it are the server's, one block per company. */

.options-exposure {
  margin-top: 1rem;
}

.options-exposure-table {
  width: 100%;
}

.options-exposure-sentence {
  margin: var(--space-3) 0 var(--space-1);
  font-weight: 600;
}

.options-exposure-lines {
  margin: 0;
  padding-left: 1.2rem;
}

.options-exposure-lines li + li {
  margin-top: 0.2rem;
}

/* ===== css/78-dest-pop.css ===== */

/* ---------- What each destination is for (v2.12.0) ----------
   The card under Home, Holdings, Insights, Plan or Research while the
   pointer rests on it or it has the keyboard's focus (app-shell.js's
   wirePops): what the destination is for, and what's in it, a tab to a
   line. Placed in fixed pixels by popPosition. Only information, so it
   takes no clicks and the pointer passes through it. */

.dest-pop {
  position: fixed;
  z-index: 1100;
  width: 21rem;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  padding: 0.7rem 0.85rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-dialog);
  background: var(--color-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: 1.45;
  pointer-events: none;
}

.dest-pop[hidden] {
  display: none;
}

.dest-pop-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
}

.dest-pop p {
  margin: 0.1rem 0 0.5rem;
}

.dest-pop ul {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding: 0.5rem 0 0;
  border-top: 1px solid var(--color-border);
  list-style: none;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* A tab's name, then what's in it, in two columns. */
.dest-pop li:has(strong) {
  display: grid;
  grid-template-columns: 5.75rem 1fr;
  gap: 0.5rem;
}

.dest-pop li strong {
  color: var(--color-text);
  font-weight: 600;
}

/* What's on a page with no tabs of its own, a line each. */
.dest-pop li:not(:has(strong))::before {
  content: "·";
  margin-right: 0.4rem;
  color: var(--color-text-muted);
}

@media (forced-colors: active) {
  .dest-pop {
    border-color: CanvasText;
  }
}
