/*
 * assets/css/app.css: the ONE app stylesheet (portal spec §11). Theme tokens + every shared
 * component class. Nothing else in the app hard-codes a theme colour.
 *
 * The look: compact, dark, flat, dense, purposeful. Small type, tight rows, hairline borders,
 * ONE accent colour, no shadows except on floating surfaces, no gradients, no icon fonts.
 *
 * The accent is used for exactly four things: primary buttons, the active nav item's left
 * border, input focus rings, and accent-tinted badges. Resist a second accent.
 *
 * Z-INDEX LADDER (fixed once; add new layers here with a reason):
 *   1030  nav / rail backdrop (narrow screens)
 *   1035  left nav, right agent rail
 *   1040  topbar, footer
 *   1080  notification banner   (must outrank the topbar: it is a global status surface)
 *   1090  modals, Confirm/Prompt (must outrank the banner)
 */

:root {
  --nav-w:            220px;
  --rail-w:           320px;   /* right agent-status column (design C-20, §12.1) */
  --rail-collapsed-w: 44px;
  --topbar-h:         48px;
  --footer-h:         76px;    /* the 34px info line + a 6px gap + two 18px ticker rows (the footer ticker, owner request 2026-10-07) */
  --content-max:      1200px;  /* data-dense pages widen it with .page-wide (design §12.1) */

  --accent:   #635bff;
  --accent-hover: #5249f0;
  --accent-active: #463ddb;
  --accent-rgb: 99, 91, 255;
  --panel:    #15181f;         /* chrome + card surface */
  --panel-2:  #1a1d25;         /* raised / hover / header surface */
  --border:   #23262f;
  --ink:      #e6e8ee;
  --muted:    #8b92a1;         /* lightened from the spec's #6c7280 for contrast on --panel (spec §23.5 names that pairing as a likely WCAG failure) */
  --page:     #0f1115;
  /* Charts (M4, design §10.4): read by research-company.js via getComputedStyle, so the chart follows the theme */
  --chart-up:     #3fb68b;
  --chart-down:   #ef5350;
  --chart-sma20:  #4dabf7;
  --chart-sma50:  #f0b429;
  --chart-sma200: #e86f9c;
  --chart-ema:    #b197fc;
  --chart-ema20:  #63e6be;    /* EMA 20: the long-term strategy's short-term trend line (§5.4) */
  --chart-band:   #6c7a89;
  --chart-signal: #9aa3b2;    /* deterministic candidates are small GREY triangles; agent-chosen signals get colour in M5 */
  --panel-blue:   #1c2531;    /* a darker, blue-tinted --panel-2 -- the grand-total row on a page that also has per-group subtotal rows (trading/sold.php), so the one true total reads as a different, heavier surface than the subtotals */
}
html { font-size: 14px; }                                  /* the compactness lever: everything is rem-based */
body { background: var(--page); color: var(--ink); }
[x-cloak] { display: none !important; }                     /* no raw binding syntax before Alpine boots */
a { color: #9aa0ff; }
a:hover { color: #b8bcff; }
.text-muted, .text-secondary { color: var(--muted) !important; }
code { color: #b8bcff; }

/* ── Chrome ─────────────────────────────────────────────────────────────────────────── */
.app-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 1040;
  background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .75rem; padding: 0 .75rem;
}
.app-topbar .brand { font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-topbar .brand .app-name { color: var(--muted); font-weight: 500; margin-right: .5rem; }
/* The divider between the site name and the page title; decorative, so screen readers skip it (empty alt text). */
.app-topbar .brand .app-name::after { content: "›" / ""; margin-left: .5rem; color: #4a5060; font-weight: 400; }
.app-topbar .who { margin-left: auto; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.app-topbar .who a { color: var(--muted); text-decoration: none; margin-left: .75rem; }
.app-topbar .who a:hover { color: var(--ink); }
.icon-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 6px;
  height: 32px; min-width: 32px; padding: 0 .4rem; display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}
.icon-btn:hover { color: var(--ink); background: var(--panel-2); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .35); }

.app-nav {
  position: fixed; top: var(--topbar-h); bottom: var(--footer-h); left: 0; width: var(--nav-w); z-index: 1035;
  background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; padding: .5rem 0 1rem;
  transform: translateX(-100%); transition: transform .18s ease;
}
html.nav-open .app-nav { transform: translateX(0); }
/* The Trader/Research/Admin toggle (owner request 2026-10-08): sticky at the top of the scrolling
   nav list, same surface/border tokens as the rest of the chrome. */
.nav-view-toggle { position: sticky; top: 0; z-index: 1; display: flex; gap: 2px; background: var(--panel); border-bottom: 1px solid var(--border); padding: .5rem; }
.nav-view-btn {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; padding: .32rem .2rem; border-radius: 4px;
}
.nav-view-btn:hover { color: var(--ink); }
.nav-view-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.app-nav .nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem 1rem .3rem; }
.app-nav a.nav-link-item {
  display: block; padding: .32rem 1rem .32rem 1.35rem; font-size: .9rem; color: var(--ink); text-decoration: none;
  border-left: 3px solid transparent;
}
.app-nav a.nav-link-item:hover { background: var(--panel-2); }
.app-nav a.nav-link-item.active { border-left-color: var(--accent); background: var(--panel-2); }

/* Right agent-status rail (design §11, §12.1). Collapses to a strip, and overlays below 1400px. */
.agent-rail {
  position: fixed; top: var(--topbar-h); bottom: var(--footer-h); right: 0; width: var(--rail-w); z-index: 1035;
  background: var(--panel); border-left: 1px solid var(--border); display: flex; flex-direction: column;
  transition: width .18s ease, transform .18s ease;
}
html.rail-collapsed .agent-rail { width: var(--rail-collapsed-w); }
html.rail-collapsed .agent-rail .rail-body, html.rail-collapsed .agent-rail .rail-title { display: none; }
.agent-rail .rail-head { display: flex; align-items: center; gap: .4rem; padding: .45rem .5rem; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.agent-rail .rail-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.agent-rail .rail-body { overflow-y: auto; padding: .5rem; flex: 1; }
.rail-group { border: 1px solid var(--border); border-radius: 6px; margin-bottom: .5rem; background: var(--page); }
.rail-group-head { display: flex; align-items: center; gap: .4rem; padding: .4rem .5rem; font-size: .85rem; border-bottom: 1px solid var(--border); }
.rail-row { display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; font-size: .8rem; border-bottom: 1px solid var(--border); }
.rail-row:last-child { border-bottom: 0; }
.rail-row .what { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.rail-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 1.5rem .5rem; }
/* Rail header controls: the 7-day history switch sits beside the running counter (owner request, M2). */
.rail-controls { display: flex; align-items: center; gap: .5rem; }
.rail-history-switch { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: .25rem; padding-left: 2.1em; min-height: 0; }
.rail-history-switch .form-check-input { margin-top: 0; cursor: pointer; }
.rail-history-switch .form-check-label { cursor: pointer; }
html.rail-collapsed .agent-rail .rail-controls .rail-history-switch { display: none; }
/* Rail containers are accordions (owner request, M2): the header is a button; the chevron turns when open. */
.rail-group-toggle { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--ink); text-align: left; cursor: pointer; }
.rail-group-toggle:hover { background: var(--panel-2); }
.rail-group-toggle:focus-visible { outline: none; box-shadow: inset 0 0 0 .15rem rgba(var(--accent-rgb), .45); }
.rail-group.is-collapsed .rail-group-toggle { border-bottom: 0; }
/* A drawn SVG chevron, not a text glyph: the "▸" character was too small to read its direction (owner feedback).
   It points right when collapsed and down when expanded. */
.rail-chevron { flex: 0 0 auto; width: 14px; height: 14px; color: var(--muted); transition: transform .15s ease, color .15s ease; transform: rotate(90deg); }
.rail-group-toggle:hover .rail-chevron, .rail-group-toggle:focus-visible .rail-chevron { color: var(--ink); }
.rail-group.is-collapsed .rail-chevron { transform: rotate(0deg); }
.rail-group-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-group-summary { margin-left: auto; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Rail items: two lines (label + badge / what + when). Finished items stay listed but recede a little. */
.rail-item { padding: .4rem .5rem; border-bottom: 1px solid var(--border); font-size: .8rem; }
.rail-item:last-child { border-bottom: 0; }
.rail-item-top { display: flex; align-items: center; gap: .4rem; }
.rail-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.rail-item-sub { display: flex; gap: .4rem; margin-top: .15rem; color: var(--muted); font-size: .75rem; }
.rail-item-sub .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item-sub .when { white-space: nowrap; }
.rail-item.is-done .rail-item-label { color: var(--muted); }
.rail-item.is-error .rail-item-sub .what { color: #ff8a95; }
.rail-item .badge { font-size: .65rem; font-weight: 500; }
.state-pill { font-size: .7rem; padding: .05rem .4rem; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.state-pill.is-running { border-color: rgba(var(--accent-rgb), .6); color: #b8bcff; }
.state-pill.is-done { border-color: #1f6f43; color: #6fd39a; }
.state-pill.is-error { border-color: #7a2630; color: #ff8a95; }

.nav-backdrop { position: fixed; inset: var(--topbar-h) 0 var(--footer-h) 0; background: rgba(0,0,0,.45); z-index: 1030; display: none; }

.app-main { padding: calc(var(--topbar-h) + 1rem) 1rem calc(var(--footer-h) + 1.5rem); transition: padding .18s ease; }
.app-main > .container-fluid { max-width: var(--content-max); }
body.page-wide { --content-max: 1600px; }

/* Desktop: nav and rail PUSH content. Narrow: they OVERLAY with a backdrop. */
@media (min-width: 992px) { html.nav-open .app-main { padding-left: calc(var(--nav-w) + 1rem); } }
@media (min-width: 1400px) {
  html:not(.rail-collapsed) .app-main { padding-right: calc(var(--rail-w) + 1rem); }
  html.rail-collapsed .app-main { padding-right: calc(var(--rail-collapsed-w) + 1rem); }
}
@media (max-width: 991.98px) { html.nav-open .nav-backdrop { display: block; } }
@media (max-width: 1399.98px) {
  html:not(.rail-open-narrow) .agent-rail { transform: translateX(100%); }
  html.rail-open-narrow .agent-rail { width: var(--rail-w); }
  html.rail-open-narrow .agent-rail .rail-body, html.rail-open-narrow .agent-rail .rail-title { display: block; }
  html.rail-open-narrow .nav-backdrop { display: block; }
}
html.no-nav-transition .app-nav, html.no-nav-transition .agent-rail, html.no-nav-transition .app-main { transition: none !important; }

.app-footer {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--footer-h); z-index: 1040;
  background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem;
  display: flex; flex-direction: column;
}
.app-footer-info { display: flex; align-items: center; gap: 1rem; padding: 0 .75rem; height: 34px; flex: 0 0 34px; }
.app-footer .ms-auto { margin-left: auto; }

/* The footer ticker (owner request 2026-10-07; partials/_footer-ticker.html, assets/js/footer-ticker.js): two
   independent marquees, each list duplicated back-to-back in .ticker-track so the loop has no visible seam. */
.ticker-row { overflow: hidden; white-space: nowrap; height: 18px; line-height: 18px; font-size: .68rem; border-top: 1px solid var(--border); }
.ticker-prices { margin-top: 6px; }   /* a little breathing room at the top of the footer, not flush against its own top edge */
.ticker-track { display: inline-flex; animation: ticker-scroll linear infinite; animation-duration: 50s; }
.ticker-news .ticker-track { animation-duration: 280s; }   /* headlines are long and this list is read, not glanced at -- much slower than the price row */
.ticker-row:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: .35rem; padding: 0 1rem; white-space: nowrap; color: var(--muted); text-decoration: none; }
.ticker-prices .ticker-item { color: var(--ink); }
.ticker-prices .ticker-item:hover { text-decoration: underline; }
.ticker-sym { font-weight: 600; color: var(--ink); }
.ticker-time, .ticker-source { color: var(--muted); }
/* The news row's per-item tag (owner 2026-10-08): the held symbol (reuses .ticker-sym's look) or "Market" for a
   general market-wide story, so the two kinds of headline are never ambiguous at a glance. */
.ticker-news-tag { font-weight: 600; }
.ticker-market-tag { color: var(--accent); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* ── Bootstrap overrides via its own variables (spec §11.3) ──────────────────────────── */
.card { --bs-card-bg: var(--panel); --bs-card-border-color: var(--border); border-radius: 6px; }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--panel-2); --bs-table-color: var(--ink); margin-bottom: 0; }
.table > :not(caption) > * > * { padding-top: .5rem; padding-bottom: .5rem; }
.table thead th { background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: .85rem; border-bottom-color: var(--border); white-space: nowrap; }
/* Tables inside a card: give cells room, and inset the first/last columns to the same 1rem as the
   card's .settings-group-header, so the table lines up with its title instead of touching the border
   (owner feedback, M2). Applies to every card table app-wide; no per-page padding. */
.card .table > :not(caption) > * > * { padding-left: .6rem; padding-right: .6rem; }
.card .table > :not(caption) > * > *:first-child { padding-left: 1rem; }
.card .table > :not(caption) > * > *:last-child { padding-right: 1rem; }
.table tr.is-archived { opacity: .55; }
.form-control, .form-select { background-color: var(--page); border-color: var(--border); color: var(--ink); }
.form-control:focus, .form-select:focus { background-color: var(--page); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .25); }
.form-control::placeholder { color: #5b6170; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .25); }
.btn-primary {
  --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: var(--accent-active); --bs-btn-active-border-color: var(--accent-active);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: var(--accent-rgb);
}
.badge.text-bg-accent { background: rgba(var(--accent-rgb), .2) !important; color: #c9ccff !important; border: 1px solid rgba(var(--accent-rgb), .45); }
.badge.text-bg-warning, .badge.text-bg-info, .badge.text-bg-light { color: #111 !important; }   /* dark text on light fills, for contrast */
/* SPECIFICITY NOTE (spec §11.3): .page-link:hover and Bootstrap's .active > .page-link tie on
   specificity, so hover won by source order and flattened the active item's fill. Scoping to
   .page-item.active .page-link fixes it. Don't "simplify" this back into the bug. */
.pagination { --bs-pagination-bg: var(--panel); --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--ink);
  --bs-pagination-hover-bg: var(--panel-2); --bs-pagination-hover-color: var(--ink); --bs-pagination-hover-border-color: var(--border);
  --bs-pagination-focus-bg: var(--panel-2); --bs-pagination-focus-color: var(--ink); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .25);
  --bs-pagination-disabled-bg: var(--panel); --bs-pagination-disabled-border-color: var(--border); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-link:focus { color: var(--ink); background: var(--panel-2); }   /* href="#" anchors keep focus after a click */

/* ── Page head (spec §11.4) ──────────────────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; margin-bottom: 1rem; }
.page-head h4 { font-weight: 600; margin-bottom: .25rem; }
.page-head .page-blurb { color: var(--muted); font-size: .875rem; margin: 0; }
.page-head .page-actions { margin-left: auto; display: flex; gap: .5rem; }

/* ── Filter bar (spec §11.5) ─────────────────────────────────────────────────────────── */
.filter-bar { padding: .5rem; margin-bottom: 1rem; }
.filter-bar .form-label { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }
.search-input-wrap { position: relative; }
.search-input-wrap .clear-btn { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); }
.search-input-wrap input:placeholder-shown + .clear-btn { display: none; }

/* ── Settings pattern (spec §11.6): a stack of cards, each a list of label-left/control-right rows ── */
.settings-page { max-width: 820px; }
.settings-page-head { margin-bottom: 1rem; }
.settings-page-head h4 { font-weight: 600; margin-bottom: .25rem; }
.settings-page-head p { color: var(--muted); font-size: .875rem; margin: 0; }
.settings-group { margin-bottom: 1rem; overflow: hidden; }
.settings-group-header { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem 1rem; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.settings-group-title { font-size: .95rem; font-weight: 600; margin: 0; }
.settings-group-desc { color: var(--muted); font-size: .825rem; margin: .2rem 0 0; }
.settings-group-actions { margin-left: auto; display: flex; gap: .5rem; }
/* The body has NO vertical padding: its rows bring their own. That's why a button row needs
   .settings-group-footer (whose padding matches the header) instead of sitting in the body. */
.settings-group-body { padding: 0 1rem; }
.settings-group-footer { padding: .75rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }
.settings-row { display: flex; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.settings-row:last-child { border-bottom: 0; }
.settings-row-label { flex: 1; min-width: 0; }
.settings-row-title { font-weight: 500; }
.settings-row-desc { color: var(--muted); font-size: .825rem; margin-top: .15rem; }
.settings-row-control { flex: 0 0 auto; min-width: 200px; display: flex; justify-content: flex-end; }
.settings-row.is-empty { justify-content: center; color: var(--muted); padding: 1.5rem 0; }
@media (max-width: 575.98px) { .settings-row { flex-direction: column; align-items: stretch; } .settings-row-control { justify-content: flex-start; } }

/* ── Modals (spec §11.8): ONE convention, hand-rolled, driven by component state ─────── */
.app-modal { position: fixed; inset: 0; z-index: 1090; display: flex; align-items: flex-start; justify-content: center;
  padding: calc(var(--topbar-h) + 1.5rem) 1rem 2rem; overflow-y: auto; }
.app-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); }
.app-modal-dialog { position: relative; width: 100%; max-width: 560px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.app-modal-dialog.is-wide { max-width: 860px; }
.app-modal-dialog.is-xwide { max-width: 1060px; }

/* ── Global notification banner (spec §12.3) ─────────────────────────────────────────── */
.notify-banner { position: fixed; top: calc(var(--topbar-h) + .5rem); left: 50%; transform: translateX(-50%); z-index: 1080;
  min-width: 260px; max-width: min(640px, 92vw); padding: .5rem .75rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--panel-2); box-shadow: 0 8px 24px rgba(0,0,0,.45); display: none; align-items: center; gap: .6rem; font-size: .9rem; }
.notify-banner.is-visible { display: flex; }
.notify-banner.is-success { border-color: #1f6f43; }
.notify-banner.is-error { border-color: #7a2630; }
.notify-banner .spinner-border { display: none; width: 1rem; height: 1rem; border-width: .15em; }
.notify-banner.is-loading .spinner-border { display: inline-block; }
.notify-banner .notify-close { display: none; margin-left: auto; }
.notify-banner.is-error .notify-close { display: inline-flex; }

/* ── Shared small components (spec §11.9) ────────────────────────────────────────────── */
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: .8rem; line-height: 1; cursor: help; }
.help-btn:hover { color: var(--ink); border-color: var(--muted); }
/* A rich (table/multi-line) tooltip a bare title="" attribute can't render -- shown on hover or keyboard focus of
   the wrapping span, positioned below the (?) and re-centred so it doesn't run off either edge. */
.help-wrap { position: relative; display: inline-flex; vertical-align: middle; margin-left: .3rem; outline: none; }
.help-pop {
  display: none; position: absolute; top: 135%; left: 50%; transform: translateX(-50%); z-index: 1050;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); white-space: nowrap; text-align: left; font-size: .8rem;
}
.help-wrap:hover .help-pop, .help-wrap:focus .help-pop, .help-wrap:focus-within .help-pop { display: block; }
.help-pop table th, .help-pop table td { padding: .2rem .5rem; white-space: nowrap; }
.filtered-summary { background: rgba(var(--accent-rgb), .12); }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty-state .empty-title { color: var(--ink); font-weight: 500; margin-bottom: .25rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 400; }
.kv dd { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.env-banner { background: #5a3d00; color: #ffd98a; text-align: center; font-size: .8rem; padding: .15rem; }

/* ── Screener (M3, design §8) ────────────────────────────────────────────────────────── */
.tax-tree { max-height: 520px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: .25rem .5rem;
            display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; align-items: start; }
@media (max-width: 767.98px) { .tax-tree { grid-template-columns: minmax(0, 1fr); } }
.tax-sector { padding: .15rem 0; }
.tax-row { display: flex; align-items: center; }
.tax-toggle { height: 24px; min-width: 24px; }
.tax-toggle .rail-chevron { transform: rotate(0deg); }
.tax-toggle .rail-chevron.is-open { transform: rotate(90deg); }
.tax-industries { padding: .1rem 0 .3rem 3.1rem; }
.tax-industry { display: flex; align-items: center; font-size: .9rem; padding: .08rem 0; cursor: pointer; }
.builder-panes { border-top: 1px solid var(--border); }
.builder-catalog { border-right: 1px solid var(--border); }
@media (max-width: 991.98px) { .builder-catalog { border-right: 0; border-bottom: 1px solid var(--border); } }
.catalog-list { max-height: 560px; overflow-y: auto; padding: .25rem 0 .5rem; }
.catalog-cat { position: sticky; top: 0; background: var(--panel-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .3rem .75rem; z-index: 1; }
.catalog-item { display: flex; align-items: flex-start; padding: .3rem .75rem; cursor: pointer; font-size: .92rem; }
.catalog-item:hover { background: var(--panel-2); }
.catalog-item.is-unavailable { opacity: .55; cursor: default; }
.catalog-desc { display: block; white-space: normal; overflow-wrap: anywhere; }   /* no Bootstrap .d-block here: its display:block !important beats x-show's inline display:none. Shown only with the Descriptions switch on; the hover tooltip has it otherwise */
.builder-criteria { padding: .5rem .75rem; max-height: 620px; overflow-y: auto; }
.crit-row { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; margin-bottom: .5rem; }
.crit-row.is-restrictive { border-color: rgba(255, 193, 7, .5); }
.crit-head { display: flex; align-items: center; gap: .5rem; }
.crit-tools { margin-left: auto; display: flex; gap: .1rem; }
.crit-tools .icon-btn { height: 26px; min-width: 26px; }
.crit-body { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .35rem; }
.crit-basis { width: auto; min-width: 11rem; }
.crit-num { width: 7.5rem; }
.crit-missing { width: auto; }
.dist-strip { margin-top: .4rem; max-width: 34rem; }
.dist-track { position: relative; height: 6px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border); }
.dist-range { position: absolute; top: -1px; bottom: -1px; background: rgba(var(--accent-rgb), .55); border-radius: 3px; }
.dist-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--muted); }
.dist-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.run-bar { position: sticky; bottom: calc(var(--footer-h) + .5rem); z-index: 5; box-shadow: 0 -4px 16px rgba(0, 0, 0, .35); }
.flag-mark { color: #ffc107; cursor: help; margin-left: .2rem; }
.has-tip { cursor: help; user-select: none; }   /* an element whose meaning is in its tooltip: show the ? cursor, not the text cursor */
.results-table th { white-space: nowrap; cursor: pointer; user-select: none; }
.results-table th.sorted::after { content: attr(data-dir); color: var(--muted); margin-left: .25rem; }
.results-table td.num, .results-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Company page (M4, design §12.3, §10.4, §10.5 item 12) ───────────────────────────── */
.co-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.co-head h4 { margin: 0; }
/* The Company page's About card (C-36) */
.about-head { display: flex; align-items: center; gap: .75rem; }
.about-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; border: 1px solid #fff; }
.about-logo-light { background: var(--panel-2); }   /* a white/light logo (IMAX etc.) on the white tile is invisible; lib/about.php:about_logo_is_light() */
.about-facts { display: flex; flex-wrap: wrap; column-gap: 1.25rem; row-gap: .25rem; }
.about-desc { max-width: 80rem; }
.about-desc.clamped { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.co-price { font-size: 1.6rem; font-weight: 600; line-height: 1; }
.co-search { position: relative; margin-left: auto; width: 18rem; }
.co-search .dropdown-menu { width: 100%; }
.chart-box { height: 460px; position: relative; }
.hist-chart { height: 180px; position: relative; }
.chart-sub { height: 150px; position: relative; border-top: 1px solid var(--border); }
.chart-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.chart-legend { font-size: .8rem; color: var(--muted); }
.chart-legend .sw { display: inline-block; width: .8rem; height: 2px; vertical-align: middle; margin: 0 .25rem 0 .6rem; }
.ff { position: relative; }
.ff-row { display: grid; grid-template-columns: 13rem 1fr 7.5rem; gap: .75rem; align-items: center; padding: .3rem 0; }
.ff-track { position: relative; height: 18px; background: var(--panel-2); border-radius: 3px; }
.ff-bar { position: absolute; top: 3px; bottom: 3px; background: rgba(var(--accent-rgb), .55); border-radius: 2px; }
.ff-base { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.ff-price { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--chart-sma50); }
.pct-bar { display: inline-block; width: 64px; height: 6px; background: var(--panel-2); border-radius: 3px; position: relative; vertical-align: middle; }
.pct-bar > span { position: absolute; top: -2px; width: 4px; height: 10px; margin-left: -2px; border-radius: 1px; background: var(--accent); }
.sens-grid td, .sens-grid th { text-align: right; font-variant-numeric: tabular-nums; padding: .2rem .45rem; }
.sens-grid td.centre { outline: 1px solid var(--accent); font-weight: 600; }
.sens-grid td.up { color: var(--chart-up); } .sens-grid td.down { color: var(--chart-down); }
.whatif input { max-width: 6.5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Anonymous pages (login, set password) ───────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-body { padding: 1.5rem; }
.auth-brand { font-weight: 600; font-size: 1.05rem; margin-bottom: .25rem; }

/* ── Accessibility baseline (spec §11.10): focus rings are restyled, never removed ───── */
.btn:focus-visible, a:focus-visible { outline: none; box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .35); }

/* ── Report page (M6, design §9.17 items 3–6) ─────────────────────────────────────────── */
.rep-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem; margin-bottom: .75rem; }
.rep-head h4 { margin: 0; }
.rep-sec > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.rep-sec > summary::-webkit-details-marker { display: none; }
.rep-sec > summary::before { content: '▸'; color: var(--muted); width: .8rem; }
.rep-sec[open] > summary::before { content: '▾'; }
.claim { border-left: 3px solid var(--border); padding: .15rem 0 .15rem .55rem; margin-bottom: .35rem; cursor: pointer; border-radius: 0 3px 3px 0; }
.claim:hover, .claim.is-open { background: var(--panel-2); }
.claim-verified { border-left-color: var(--chart-up); }
.claim-flagged { border-left-color: #f0b429; }
.claim-struck { border-left-color: var(--chart-down); }
.claim-struck .claim-text { text-decoration: line-through; color: var(--muted); }
.claim-unverified { border-left-color: var(--chart-band); }
.claim-ico { display: inline-block; width: 1.1rem; font-weight: 600; }
.claim-verified .claim-ico { color: var(--chart-up); } .claim-flagged .claim-ico { color: #f0b429; } .claim-struck .claim-ico { color: var(--chart-down); } .claim-unverified .claim-ico { color: var(--muted); }
.ev-panel { position: fixed; top: var(--topbar-h); right: 0; bottom: var(--footer-h); width: min(30rem, 100vw); z-index: 1040; background: var(--panel); border-left: 1px solid var(--border);
            box-shadow: -6px 0 18px rgba(0, 0, 0, .35); overflow-y: auto; padding: 1rem; }
.ev-item { border: 1px solid var(--border); border-radius: 4px; padding: .5rem .6rem; margin-bottom: .5rem; }
.ev-item pre { white-space: pre-wrap; font-size: .78rem; max-height: 14rem; overflow: auto; margin: .35rem 0 0; color: var(--muted); }
.print-only { display: none; }
.pillar-sparks { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: .25rem 0 .1rem 1.1rem; }
.spark { display: inline-flex; align-items: center; gap: .35rem; }
.spark svg { display: block; }
.spark-label { font-size: .72rem; color: var(--muted); }
.lvl-pill { display: inline-block; padding: .05rem .4rem; border-radius: 3px; font-size: .78rem; line-height: 1.35; }
.lvl-swatch { display: inline-block; width: 18px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 4px; }
.lvl-swatch.dashed { border-top-style: dashed; }
.report-md h1, .report-md h2 { font-size: 1.05rem; font-weight: 600; margin: .9rem 0 .4rem; }
.report-md h3, .report-md h4 { font-size: .95rem; font-weight: 600; margin: .75rem 0 .35rem; }
.report-md > :first-child { margin-top: 0; }

@media print {
  .app-topbar, .app-nav, .agent-rail, .app-footer, .no-print, .ev-panel, .app-modal { display: none !important; }
  .print-only { display: block; }
  html, body, .app-main, .card, .ev-item { background: #fff !important; color: #000 !important; }
  .app-main, html.nav-open .app-main, html.rail-collapsed .app-main { padding: 0 !important; margin: 0 !important; }
  .alert { background: #fff !important; color: #000 !important; border: 1px solid #999 !important; }
  .app-main > .container-fluid { max-width: none !important; }
  .card { border: 1px solid #bbb !important; break-inside: avoid-page; }
  .text-secondary, .text-muted { color: #444 !important; }
  .claim { break-inside: avoid; }
  .badge { border: 1px solid #888; color: #000 !important; background: #fff !important; }
  .lvl-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
  .chart-box { height: 340px; }
  .rep-sec > summary::before { content: ''; width: 0; }
}

/* ── Help → User Guide ─────────────────────────────────────────────────────────────────── */
.guide-toc { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - var(--footer-h) - 2rem); overflow-y: auto; font-size: .85rem; }
.guide-toc a { display: block; color: var(--muted); text-decoration: none; padding: .15rem 0; }
.guide-toc a:hover { color: var(--ink); }
.guide-toc .toc-group { color: var(--ink); font-weight: 600; margin-top: .6rem; }
.guide-toc .toc-sub { padding-left: .75rem; }
.guide section { scroll-margin-top: calc(var(--topbar-h) + 1rem); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.guide h5 { font-weight: 600; margin-bottom: .5rem; }
.guide h6 { font-weight: 600; margin: 1rem 0 .35rem; color: var(--ink); }
.guide p, .guide li { font-size: .92rem; line-height: 1.55; }
.guide .page-path { font-size: .8rem; color: var(--muted); }
.guide .use-case { border-left: 3px solid var(--accent); background: rgba(var(--accent-rgb), .08); padding: .6rem .9rem; margin-top: .75rem; border-radius: 0 6px 6px 0; }
.guide .use-case-title { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.guide .tip { border-left: 3px solid var(--chart-sma50); padding: .4rem .9rem; margin-top: .75rem; background: rgba(240, 180, 41, .07); border-radius: 0 6px 6px 0; }
.guide .layout-map { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; line-height: 1.35; color: var(--muted); white-space: pre; overflow-x: auto; }
.guide ol.steps > li { margin-bottom: .45rem; }
@media print { .guide-toc { display: none; } }

/* Strategy Rules → Pattern review (L2): one small chart per labelled item. */
.pattern-review-chart { height: 480px; }
.audit-chart { height: 640px; }                      /* Signal audit (§10a): full width, panes sized by the recipe */
@media print { .audit-page .btn, .audit-page select, .audit-page textarea { display: none !important; } }

/* Company page → Trade plan (L3): the left edge carries the action's colour. */
.trade-plan { border-left-width: 4px !important; }
.trade-plan-buy { border-left-color: var(--chart-up) !important; }
.trade-plan-watch { border-left-color: var(--chart-sma20) !important; }
.trade-plan-avoid { border-left-color: var(--chart-band) !important; }
.trade-plan-reduce { border-left-color: var(--chart-sma50) !important; }
.trade-plan-exit { border-left-color: var(--chart-down) !important; }

/* Portfolio → Positions (L6): concentration bars, full at the limit, red past it. */
.conc-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.conc-bar > div { height: 100%; background: var(--chart-sma20); }
.conc-bar > div.over { background: var(--chart-down); }

/* ── Strategy templates (STRATEGY-TEMPLATES-PLAN.md T1) ─────────────────────────────── */
.settings-row.is-dirty .form-control { border-color: var(--bs-warning); box-shadow: 0 0 0 1px var(--bs-warning); }
.cmp-table tr.cmp-head td { background: var(--panel); border-top: 2px solid var(--border); }
.cmp-table td.cmp-best { color: var(--bs-success); font-weight: 600; }

/* ── Agents: the Control Center (AUTONOMOUS-AGENT-FRAMEWORK-PLAN.md §11, §6A.6) ─────────────────────────────── */
.ag-strip { display: flex; flex-wrap: wrap; gap: .75rem; }
.ag-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; min-width: 140px; }
.ag-stat-wide { min-width: 260px; }
.ag-stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .2rem; }
.ag-progress { height: 6px; width: 120px; display: inline-flex; vertical-align: middle; margin: 0 .35rem; background: var(--panel-2); }
.ag-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; background: var(--muted); }
.ag-dot.ok { background: var(--chart-up); } .ag-dot.bad { background: var(--chart-down); }
/* A team chip: shape = horizon, colour stripe = team, then its code. Meaning never rests on colour alone. */
.ag-chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border); border-left: 4px solid var(--team, var(--muted));
           border-radius: 4px; padding: .05rem .45rem; font-size: .8rem; background: var(--panel-2); white-space: nowrap; }
.ag-chip-sm { font-size: .72rem; padding: 0 .35rem; }
.ag-shape { color: var(--team, var(--muted)); }
.ag-chip-btn { background: none; border: 0; padding: 0; margin-right: .35rem; }
.ag-chip-btn.off { opacity: .4; }
.ag-scope { display: flex; flex-wrap: wrap; align-items: center; }
/* The scope bar on every Agents page (AG7b): desk chips (admins), then team chips; shapes are Bootstrap Icons (AG-31). */
.ag-scope-bar { row-gap: .35rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
.ag-chip .bi { font-size: .8em; line-height: 1; }
.ag-chip-desk { border-left-color: var(--muted); }
.ag-chip-desk .bi { font-size: .85em; color: var(--muted); }
a.ag-chip-btn:hover .ag-chip, button.ag-chip-btn:hover .ag-chip { border-color: var(--team, var(--muted)); }
.ag-band, .ag-flow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: stretch; }
.ag-flow-step { display: flex; align-items: center; gap: .5rem; }
.ag-arrow { color: var(--muted); }
.ag-node { display: block; min-width: 150px; max-width: 260px; padding: .4rem .6rem; border: 1px solid var(--border); border-left-width: 4px; border-radius: 6px;
           background: var(--panel-2); color: var(--ink); text-decoration: none; transition: box-shadow .3s; }
.ag-node:hover { color: var(--ink); border-color: var(--muted); }
.ag-node-name { font-weight: 600; font-size: .85rem; }
.ag-node-sub { font-size: .75rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ag-node.st-ok { border-left-color: var(--chart-up); } .ag-node.st-running { border-left-color: var(--accent); }
.ag-node.st-wait, .ag-node.st-paused { border-left-color: var(--chart-sma50); } .ag-node.st-bad { border-left-color: var(--chart-down); }
.ag-node.st-idle, .ag-node.st-off { border-left-color: var(--muted); }
.ag-node.st-unbuilt { opacity: .45; border-style: dashed; }
.ag-node.flash { box-shadow: 0 0 0 2px var(--accent); }
.ag-node.st-running .ag-node-name::after { content: ' ●'; color: var(--accent); animation: ag-pulse 1.2s infinite; }
@keyframes ag-pulse { 50% { opacity: .2; } }
.ag-lane { margin-top: .9rem; padding: .6rem .75rem; border: 1px solid var(--border); border-left: 4px solid var(--team, var(--muted)); border-radius: 6px; }
.ag-lane-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.ag-lane-foot { margin-top: .5rem; color: var(--ink); }
.ag-row-between { display: flex; justify-content: space-between; align-items: center; }
.ag-filter { width: auto; }
.ag-timeline { max-height: 460px; overflow-y: auto; }
.ag-ev { display: flex; align-items: baseline; gap: .45rem; padding: .2rem 0; border-bottom: 1px solid var(--border); font-size: .82rem; }
.ag-ev-time { font-size: .72rem; min-width: 70px; } .ag-ev-type { font-size: .68rem; } .ag-ev-sum { flex: 1; }
.ag-ev.sev-warning .ag-ev-sum, .ag-ev.sev-high .ag-ev-sum, .ag-ev.sev-critical .ag-ev-sum { color: var(--chart-down); }
.ag-inc { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.ag-trace .ag-step { border-left: 3px solid var(--border); padding: .35rem 0 .6rem .8rem; margin-left: .3rem; }
.ag-step-h { font-weight: 600; margin-bottom: .2rem; }
/* The confidence bar: hatched when the evidence is weak or insufficient, so a high number on thin data never looks solid (§6B.7). */
.ag-conf-bar { display: inline-block; vertical-align: middle; width: 120px; height: 8px; margin: 0 .4rem; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.ag-conf-bar > span { display: block; height: 100%; background: var(--accent); }
.ag-conf-bar.weak > span { background: repeating-linear-gradient(45deg, var(--accent) 0 4px, transparent 4px 8px); }
.ag-perm select { min-width: 92px; }
.ag-perm-group td { background: var(--panel-2); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.ld-total td { background: var(--panel-2); }   /* trading/live.php's held-total row */
.ts-grand-total td { background: var(--panel-blue); }   /* trading/sold.php's grand-total row, one shade heavier/bluer than its own per-month subtotal rows (.ld-total) */
.ag-days { width: 70px; }
.ag-pre { white-space: pre-wrap; font-size: .75rem; background: var(--panel-2); padding: .4rem; border-radius: 4px; max-height: 260px; overflow: auto; margin: 0; }
.ag-diff { font-family: var(--bs-font-monospace); white-space: pre-wrap; max-height: 320px; overflow: auto; }
.ag-diff .add { color: var(--chart-up); } .ag-diff .del { color: var(--chart-down); text-decoration: line-through; }
.ag-test { border-top: 1px solid var(--border); padding-top: .4rem; margin-top: .4rem; }
.ag-report { white-space: normal; }

/* Agents → Teams, the team page and the new-team wizard (AG7b) */
.ag-team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .75rem; }
.ag-team-card { border-left: 4px solid var(--team, var(--muted)) !important; }
.ag-dim { opacity: .6; }
.ag-desk-strip { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
/* Agents → Teams: the desk's email notifications, two labelled panels (desk summaries, Profit Watch alerts). */
.ag-email { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.ag-email-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; margin-bottom: .5rem; }
.ag-email-panel { height: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: .375rem; background: var(--panel-2); }
.ag-email-title { font-weight: 600; }
.ag-email-sub { color: var(--bs-secondary-color); margin-bottom: .35rem; }
.ag-email-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .4rem 0; border-top: 1px solid var(--border); }
.ag-email-label { flex: 1 1 auto; margin: 0; }
.ag-email-desc { display: block; color: var(--bs-secondary-color); font-size: .85em; }
.ag-email-ctl { flex: 0 0 13.5rem; width: 13.5rem; }
.ag-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-steps { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; padding: 0; counter-reset: agstep; }
.ag-steps li { counter-increment: agstep; color: var(--muted); }
.ag-steps li::before { content: counter(agstep) ". "; }
.ag-steps li.active, .ag-steps li.active .btn-link { font-weight: 600; color: var(--bs-body-color); }
.ag-steps li.done .btn-link { color: var(--bs-success); }
.ag-swatch { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid transparent; margin: 0 .2rem; vertical-align: middle; padding: 0; }
.ag-swatch.on { border-color: var(--bs-body-color); box-shadow: 0 0 0 2px var(--bs-body-bg) inset; }
.ag-form-grid { display: grid; grid-template-columns: max-content minmax(6rem, 9rem); gap: .3rem .6rem; align-items: center; }
.ag-form-grid .contents { display: contents; }
/* Agents → Performance (AG8) */
.ag-perf-chart { height: 240px; }
.ag-progress { height: .4rem; max-width: 16rem; }
/* Agents → Control Center: the orchestration graph (§11.1 panel A; assets/js/agents-control.js graphSvg) */
.ag-graph { width: 100%; max-width: 1070px; height: auto; display: block; }
.ag-graph .ag-edge { stroke: var(--muted); stroke-width: 1.2; opacity: .55; }
.ag-graph .ag-edge.pulse { stroke: var(--accent); stroke-width: 2.5; opacity: 1; animation: ag-pulse 1.2s infinite; }
.ag-graph .ag-edge-label { font-size: 9px; fill: var(--muted); }
.ag-graph .ag-gnode { fill: var(--panel); stroke: var(--muted); stroke-width: 1.5; }
.ag-graph .ag-gnode.st-ok { stroke: var(--chart-up); } .ag-graph .ag-gnode.st-running { stroke: var(--accent); stroke-width: 2.5; }
.ag-graph .ag-gnode.st-wait, .ag-graph .ag-gnode.st-paused { stroke: var(--chart-sma50); } .ag-graph .ag-gnode.st-bad { stroke: var(--chart-down); stroke-width: 2.5; }
.ag-graph .ag-gnode.st-unbuilt { stroke-dasharray: 4 3; opacity: .5; }
.ag-graph .ag-gnode-name { font-size: 11px; font-weight: 600; fill: var(--ink); }
.ag-graph .ag-gnode-sub { font-size: 9px; fill: var(--muted); }
.ag-graph a:hover .ag-gnode { stroke-width: 3; }
/* Agents → Registry and Data Feeds: the schedule editor */
.ag-sched { border-left: 3px solid var(--muted); padding-left: .6rem; }
/* Agents → Performance: the confidence calibration panel (agents-confidence.js; two categorical slots validated on --panel) */
.cf-rel { width: 240px; max-width: 100%; height: auto; } .cf-drift { width: 100%; max-width: 360px; height: auto; }
.cf-rel .cf-grid, .cf-drift .cf-grid { stroke: var(--border); stroke-width: 1; }
.cf-rel .cf-diag, .cf-drift .cf-diag { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.cf-rel .cf-tick, .cf-drift .cf-tick { font-size: 9px; fill: var(--muted); }
.cf-hold { stroke: #3987e5; stroke-width: 2; } .cf-hold-m { fill: #3987e5; stroke: var(--panel); stroke-width: 2; }
.cf-live { stroke: #d95926; stroke-width: 2; } .cf-live-m { fill: #d95926; stroke: var(--panel); stroke-width: 2; }
.cf-hit { fill: transparent; stroke: none; } .cf-hit:hover { fill: rgba(255, 255, 255, .08); }
.cf-sw { display: inline-block; width: .7rem; height: .7rem; vertical-align: -1px; margin-right: .25rem; }
.cf-sw.hold { background: #3987e5; border-radius: 50%; } .cf-sw.live { background: #d95926; border-radius: 1px; }
/* Research → Market Horizon (research/horizon.php, MARKET-HORIZON-DESIGN.md §7): label | chart | stats on one grid so every
   chart column, the section breadth horizons and the sticky date axis line up exactly (the crosshair relies on it). */
.hz-page { --hz-row-h: 24px; }
.hz-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr) 200px; gap: 0 .6rem; align-items: center; }
.hz-axis-row { position: sticky; top: var(--topbar-h); z-index: 5; background: var(--page); border-bottom: 1px solid var(--border); padding: 2px 0; }
.hz-axis { height: 18px; color: var(--muted); }
.hz-axis svg { display: block; overflow: visible; }
.hz-sec { border-bottom: 1px solid var(--border); }
.hz-sec-head { padding: 4px 0; cursor: pointer; background: var(--panel); }
.hz-sec-head:hover, .hz-ind-head:hover { background: var(--panel-2); }
.hz-ind-head { padding: 2px 0; cursor: pointer; border-top: 1px solid var(--border); }
.hz-ind-head .hz-head-label { padding-left: 1rem; }
.hz-head-label { display: flex; align-items: center; gap: .35rem; min-width: 0; white-space: nowrap; overflow: hidden; line-height: 1.5; padding: 2px 0; }
.hz-head-label b, .hz-head-label > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.hz-caret { color: var(--muted); width: .8rem; flex: none; }
.hz-cls-bar { display: flex; flex: none; width: 40px; height: 6px; margin-left: auto; border-radius: 2px; overflow: hidden; background: var(--border); }
.hz-cls-bar span { display: block; height: 100%; }
.hz-cls-bar .hz-bull { background: var(--chart-up); } .hz-cls-bar .hz-flat { background: var(--chart-band); } .hz-cls-bar .hz-bear { background: var(--chart-down); }
.hz-head-stats, .hz-row-stats { display: flex; justify-content: flex-end; gap: .5rem; font-size: .8rem; white-space: nowrap; overflow: hidden; line-height: 1.5; padding: 2px 0; }   /* room for descenders: overflow:hidden clipped them (owner, 2026-10-21) */
.hz-chart { position: relative; height: var(--hz-row-h); }
.hz-breadth { height: 16px; }
.hz-chart canvas { display: block; width: 100%; height: 100%; }
.hz-row { border-top: 1px solid rgba(255, 255, 255, .03); }
.hz-row .hz-chart { height: auto; }
.hz-row canvas.hz-price { height: var(--hz-row-h); }
.hz-row canvas.hz-vol { height: calc(var(--hz-row-h) * .4); margin-top: 1px; }
.hz-row-label { display: flex; align-items: center; gap: .35rem; font-size: .85rem; white-space: nowrap; overflow: hidden; line-height: 1.5; padding: 2px 0 2px 2rem; }
.hz-row-label a { font-weight: 600; text-decoration: none; min-width: 3.6rem; }
.hz-dens-compact .hz-row-label, .hz-dens-compact .hz-row-stats { font-size: .75rem; }
.hz-cls { font-size: .75rem; }
.hz-bull, .hz-up { color: var(--chart-up); } .hz-bear, .hz-down { color: var(--chart-down); } .hz-flat { color: var(--chart-band); }
.hz-badge { font-size: .6rem; font-weight: 500; }
.hz-star { background: none; border: 0; padding: 0; color: var(--muted); visibility: hidden; margin-left: auto; }
.hz-row:hover .hz-star { visibility: visible; } .hz-star:hover { color: var(--chart-sma50); }
.hz-loading { position: absolute; left: .3rem; top: 0; color: var(--muted); font-size: .75rem; }
.hz-chip { border: 1px solid var(--border); color: var(--muted); opacity: .55; }
.hz-chip.active { opacity: 1; background: var(--panel-2); }
.hz-chip.hz-bull.active { border-color: var(--chart-up); color: var(--chart-up); }
.hz-chip.hz-bear.active { border-color: var(--chart-down); color: var(--chart-down); }
.hz-chip.hz-flat.active { border-color: var(--chart-band); color: var(--ink); }
.hz-chip-n { margin-left: .3rem; color: var(--muted); }
.hz-pick { max-height: 360px; overflow-y: auto; min-width: 280px; }
.hz-symq { width: 9rem; }
.hz-symlist { position: absolute; top: 100%; left: 0; min-width: 18rem; z-index: 20; }
.hz-sym-chip { display: inline-flex; align-items: center; gap: .25rem; font-weight: 500; }
.hz-sym-chip .btn-close { font-size: .5rem; }
.hz-num { width: 4.5rem; }
.hz-tile { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; color: var(--ink); padding: 2px 8px; display: inline-flex; gap: .4rem; align-items: baseline; }
.hz-tile:hover { background: var(--panel-2); }
.hz-tile.up { border-color: var(--chart-up); } .hz-tile.down { border-color: var(--chart-down); }
.hz-tile-pct { font-weight: 600; } .hz-tile.up .hz-tile-chg { color: var(--chart-up); } .hz-tile.down .hz-tile-chg { color: var(--chart-down); } .hz-tile-chg { color: var(--muted); font-size: .75rem; }
.hz-cross { position: fixed; top: var(--topbar-h); bottom: var(--footer-h); width: 1px; background: rgba(255, 255, 255, .45); pointer-events: none; z-index: 6; }
.hz-readout { position: fixed; z-index: 7; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.hz-flex { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; } .hz-flex-tight { gap: .25rem; }   /* not d-flex: x-show must be able to hide it */
