/* ===========================================================================
   BASS — Bamboo brand stylesheet
   ===========================================================================
   Brand tokens come from the Bamboo Brand Identity Guidelines (Task #53).
   The legacy `--bg / --panel / --text / --pass / --fail / --warn / --accent`
   tokens are repointed to bamboo values so every page picks up the new
   palette in a single pass. Pages that aren't yet polished for the new
   look (Shortlist, Watchlist, Ticker Deep-Dive) inherit the new tokens
   and will look "transitional" until Task #54 — that's expected.
   --------------------------------------------------------------------------- */

:root {
  /* --- Bamboo core palette ---------------------------------------------- */
  --bamboo-jewel-green:  #00473C;
  --bamboo-jewel-700:    #003930;
  --bamboo-jewel-900:    #001C18;
  --bamboo-green:        #00A239;
  --bamboo-lemon-green:  #E6FF55;
  --bamboo-beige:        #F4EDE4;
  --bamboo-beige-50:     #FEFDFC;
  --bamboo-beige-100:    #F9F5F0;
  --bamboo-cool-100:     #CCDAD8;
  --bamboo-cool-300:     #80A39E;
  --bamboo-black:        #181716;

  /* --- Priority semantic mapping (used sparingly per guidelines) ------- */
  --prio-high-fg:    #B5162A;   /* Rouge */
  --prio-high-bg:    #FBB99D;
  --prio-medium-fg:  #EF7F00;   /* Bamboo mustard */
  --prio-medium-bg:  #EFE5D8;
  --prio-low-fg:     #80A39E;   /* cool 300 text */
  --prio-low-bg:     #CCDAD8;   /* cool 100 tint */

  /* --- Legacy aliases — keep existing CSS working, light-themed --------- */
  --bg:      var(--bamboo-beige);
  --panel:   #FFFFFF;
  --panel-2: var(--bamboo-beige-100);
  --text:    var(--bamboo-black);
  /* Muted text — darkened (Task #95) so it passes WCAG AA on the beige
     panels and the cool-100 chip backgrounds. The previous --muted
     (#80A39E) sat at ~2.4:1 on beige; #466661 lands at ~5:1. */
  --muted:   #466661;
  --accent:  var(--bamboo-green);
  --pass:    var(--bamboo-green);
  --fail:    var(--prio-high-fg);
  --warn:    var(--prio-medium-fg);
  /* Neutral hairline borders for the white-card look (Bamboo redesign).
     Repointed from the cool-100 teal so cards/tables/controls read as
     crisp hairlines on white, matching the approved canvas mockups. */
  --border:  rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --divider: rgba(0, 0, 0, 0.06);

  /* --- Page gutter — shortest-side / 22, clamped per guidelines -------- */
  --gutter: clamp(16px, 4vw, 64px);

  /* --- Design-system tokens (Task #95) ---------------------------------
     Single source of truth for the typography scale, pill geometry and
     control radii so the whole app stays on one baseline. Anywhere you
     see a literal padding/radius/font-size in CSS below, prefer one
     of these tokens for new work.
     --------------------------------------------------------------------- */
  --fs-h1:       28px;
  --fs-h2:       18px;
  --fs-h3:       14px;
  --fs-body:     14px;
  --fs-small:    12px;
  --fs-micro:    11px;
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   16px;
  --radius-pill: 999px;
  --pill-pad-y:  3px;
  --pill-pad-x:  10px;
  --pill-fs:     11px;

  /* Layered elevation for floating surfaces (menus, tooltips). Three
     transparent layers read as more natural depth than one flat shadow. */
  --shadow-pop:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 4px 10px -2px rgba(0, 0, 0, 0.10),
    0 10px 20px -6px rgba(0, 0, 0, 0.08);

  /* Card elevation (visual refresh) — jewel-tinted, low-contrast depth so
     white cards lift off the beige canvas without the flat hairline-only
     look. --shadow-card is the resting state for in-flow cards/tables;
     --shadow-raise is for the page-level container. Tint is jewel-green
     (0,28,24) not neutral black, so the shadow reads as part of the brand. */
  --shadow-card:
    0 1px 2px rgba(0, 28, 24, 0.05),
    0 4px 16px rgba(0, 28, 24, 0.06);
  --shadow-raise:
    0 2px 6px rgba(0, 28, 24, 0.08),
    0 10px 28px rgba(0, 28, 24, 0.10);

  /* --- Type families (Bamboo redesign) --------------------------------
     Haffer SQ for display/headings, Haffer for body, Inter for numerals
     (tabular figures keep tables and scores aligned). Self-hosted from
     `bass_ui/static/fonts/`. */
  --font-display: "Haffer SQ", "Haffer", "Inter", system-ui, sans-serif;
  --font-body:    "Haffer", "Haffer SQ", "Inter", system-ui, sans-serif;
  --font-num:     "Inter", "Haffer SQ", system-ui, sans-serif;

  /* =====================================================================
     UI Overhaul (docs/UI_OVERHAUL_PLAN.md, Phase 1a) — the token layer
     the app was missing: spacing, semantic surfaces/text, elevation,
     motion, z-index. Added additively — every legacy token above keeps
     working. Semantic surface/text tokens are authored now so a dark
     theme is a later drop-in (light-only ships this pass).
     ===================================================================== */

  /* Extra lemon shades + soft surfaces — tokenise the one-off hex values
     (#d3eb44, #c8de3c, #fff4d6) that used to dodge the system. */
  --bamboo-lemon-600: #D3EB44;   /* darker lemon — hover on lemon CTAs */
  --bamboo-lemon-700: #C8DE3C;   /* lemon hairline border */
  --warn-surface:     #FFF4D6;   /* soft mustard surface — auth warning */

  /* Spacing scale (website uses 4→192px; BASS pages need 4→32 mostly). */
  --space-1: 4px;  --space-2: 6px;  --space-3: 8px;  --space-4: 10px;
  --space-5: 12px; --space-6: 16px; --space-7: 20px; --space-8: 24px;
  --space-9: 32px;

  /* Semantic surfaces (theme-ready — a dark theme just remaps these). */
  --surface-page:   var(--bamboo-beige);      /* #F4EDE4 */
  --surface-card:   #FFFFFF;
  --surface-raised: var(--bamboo-beige-50);   /* #FEFDFC */
  --surface-muted:  var(--bamboo-beige-100);  /* #F9F5F0 */

  /* Text tiers. */
  --text-primary:   var(--bamboo-black);      /* #181716 */
  --text-secondary: #466661;                  /* == legacy --muted, AA on beige */
  --text-tertiary:  var(--bamboo-cool-300);   /* #80A39E */
  --text-inverse:   #FFFFFF;

  /* Elevation (restrained, mirrors the website: subtle + hover + popover). */
  --shadow-hairline: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-hover:    0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-popover:  0 8px 32px rgba(0, 0, 0, 0.15);

  /* Motion (replaces the scattered hardcoded durations/easings). */
  --dur-fast: 120ms; --dur-base: 200ms; --dur-slow: 300ms;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);  /* mockups' spring */
  --ease-out:      cubic-bezier(0.4, 0, 0.2, 1);     /* website carousel */

  /* Z-index scale (replaces scattered 10 / 40 / 50). */
  --z-base: 1; --z-sticky: 50; --z-popover: 100; --z-modal: 200;

  /* Radius: keep sm/md/lg/pill above. Add xs for dense cards; --radius-lg
     (16px) stays reserved for outer panels. */
  --radius-xs: 8px;

  /* Product shell dimensions (Phase 1d). */
  --shell-nav-h: 64px;
}

/* ---------------------------------------------------------------------------
   Typography — Bamboo redesign three-family system, self-hosted from
   `bass_ui/static/fonts/`: Haffer SQ for display/headings, Haffer for body,
   and Inter for numerals (tabular figures keep tables/scores aligned).
   Families are consumed via the --font-display / --font-body / --font-num
   tokens above. See docs/ARCHITECTURE.md "Brand fonts" for the canonical decision.
   --------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Haffer SQ — display / headings (Bamboo redesign). */
@font-face {
  font-family: "Haffer SQ";
  src: url("/static/fonts/HafferSQXH-Medium.ttf") format("truetype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Haffer SQ";
  src: url("/static/fonts/HafferSQXH-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Haffer SQ";
  src: url("/static/fonts/HafferSQXH-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
/* Haffer — body text (Bamboo redesign). */
@font-face {
  font-family: "Haffer";
  src: url("/static/fonts/HafferXH-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Haffer";
  src: url("/static/fonts/HafferXH-Medium.ttf") format("truetype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Haffer";
  src: url("/static/fonts/HafferXH-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.small, .muted.small, td.small, p.small { font-weight: 400; }   /* <14px → Regular */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500; color: var(--bamboo-jewel-green);
  letter-spacing: -0.02em; line-height: 1.1;
  text-wrap: balance;   /* even line lengths, no orphans on short headings */
}
h1 { margin-top: 0; font-size: 28px; }
h2 { margin-top: 0; font-size: 18px; }

/* Tabular numerals helper — Inter figures stay column-aligned. */
.num, table.data td, table.data th,
.bucket__score, .stat-pill__value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

a { color: var(--bamboo-jewel-green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Keep the last line of prose from stranding a single orphan word. */
p, li, figcaption, blockquote { text-wrap: pretty; }

/* ---------------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center;
  gap: var(--space-8);
  min-height: var(--shell-nav-h);            /* 64px desktop shell (Phase 1d) */
  padding: 0 var(--gutter);
  background: var(--bamboo-jewel-700);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--bamboo-beige);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.topbar__brand { flex: 0 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
/* In-app Back control (Task #162) — sits beside the wordmark, styled to
   read on the dark topbar like the nav-search pill. */
.nav-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--bamboo-beige);
  padding: 5px 12px 5px 10px; border-radius: var(--radius-pill);
  cursor: pointer; font-size: 13px; font-weight: var(--fw-medium);
  font-family: var(--font-body); line-height: 1;
}
.nav-back:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--bamboo-lemon-green);
  border-color: rgba(255, 255, 255, 0.24);
}
.nav-back svg { display: block; }
.nav-back[hidden] { display: none; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; line-height: 1; }
.brand-logo:hover { text-decoration: none; }
.brand-lockup { height: 30px; width: auto; display: block; }
@media (max-width: 700px) {
  .brand-lockup { height: 26px; }
}
.nav {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: var(--space-8);
}
.nav__tabs {
  display: flex; align-items: center; gap: var(--space-7);
  min-width: 0;
}
.nav__tools {
  display: flex; align-items: center; gap: var(--space-3);
  margin-left: auto;
}
.nav a { color: rgba(255, 255, 255, 0.8); padding: 6px 4px; border-bottom: 2px solid transparent; font-size: 14px; font-weight: var(--fw-medium); white-space: nowrap; }
.nav a.is-active, .nav a:hover {
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-lemon-green);
  text-decoration: none;
}
.nav .nav-gear { display: inline-flex; align-items: center; justify-content: center;
                 padding: 6px; border-bottom: none; opacity: 0.65; font-size: 18px; }
.nav .nav-gear:hover, .nav .nav-gear.is-active { opacity: 1; border-bottom: none; }
.nav-search {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill); padding: 4px 4px 4px 12px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.nav-search:focus-within { border-color: rgba(230, 255, 85, 0.5); }
.nav-search__icon { font-size: 15px; color: rgba(255, 255, 255, 0.55); flex: none; }
.nav-search input {
  background: transparent; border: none; outline: none;
  color: var(--bamboo-beige); font-size: 13px; font-family: var(--font-num);
  width: 140px;
}
.nav-search input::placeholder { color: rgba(255, 255, 255, 0.5); }
.nav-search button {
  background: var(--bamboo-lemon-green); border: none;
  color: var(--bamboo-jewel-green); padding: 5px 14px;
  border-radius: var(--radius-pill); cursor: pointer; font-size: 12px;
  font-weight: 600; font-family: var(--font-num);
}
.nav-search button:hover { background: var(--bamboo-lemon-600); }

/* Shell responsiveness (Phase 1d) — below 760px the bar wraps to two rows:
   brand + tools on top, the tab group scrolling horizontally underneath, so
   nothing truncates or overlaps down to 390px. */
@media (max-width: 760px) {
  /* Stack the shell vertically so every row is full-width and the search
     pill can never push the page wider than the viewport. Row 1: brand.
     Row 2: tools (search + gear + user), right-aligned. Row 3: the tab
     group, scrolling horizontally if it can't fit. */
  .topbar {
    flex-direction: column; align-items: stretch;
    min-height: 0;
    padding-top: var(--space-3); padding-bottom: var(--space-3);
    row-gap: var(--space-4);
  }
  .nav { flex-wrap: wrap; gap: var(--space-4); min-width: 0; }
  .nav__tools { order: 1; min-width: 0; margin-left: auto; }
  .nav-search { min-width: 0; }
  .nav-search input { width: 120px; }
  .nav__tabs {
    order: 2; width: 100%;
    overflow-x: auto; gap: var(--space-6);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav__tabs::-webkit-scrollbar { display: none; }
  .nav-user-name { max-width: 96px; }
}
@media (max-width: 420px) {
  .nav-user-name { display: none; }
}

/* ---------------------------------------------------------------------------
   Page / cards
   --------------------------------------------------------------------------- */
.main {
  padding: 32px var(--gutter);
  max-width: 1400px;
  margin: 0 auto;
}
.page-intro { margin: -8px 0 20px; max-width: 720px; }

/* ---------------------------------------------------------------------------
   Task #54 — flow polish: intro banners, info-icon tooltips, tabs, hints
   --------------------------------------------------------------------------- */
.intro-banner {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bamboo-lemon-green);
  color: var(--bamboo-jewel-900);
  border: 1px solid var(--bamboo-lemon-700);
  padding: 12px 16px; border-radius: var(--radius-lg);
  margin: 0 0 18px; font-size: 13px; line-height: 1.5;
}
.intro-banner > div { flex: 1; }
.intro-banner em { font-style: normal; font-weight: 500; }
.intro-banner a { color: var(--bamboo-jewel-green); text-decoration: underline; }
.intro-banner__close {
  background: transparent; border: 0; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--bamboo-jewel-700); padding: 0 4px;
  flex-shrink: 0;
}
.intro-banner__close:hover { color: var(--bamboo-jewel-900); }

.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bamboo-cool-100); color: var(--bamboo-jewel-green);
  font-size: 10px; font-weight: 500; font-style: normal;
  font-family: ui-sans-serif, system-ui, sans-serif;
  margin-left: 4px; cursor: help; vertical-align: 1px;
  user-select: none;
}
.info-icon:hover { background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green); }

.next-step {
  margin: 18px 0 0; padding: 10px 14px;
  background: var(--bamboo-beige-100); border: 1px solid var(--border);
  border-left: 3px solid var(--bamboo-green); border-radius: 6px;
  font-size: 13px; color: var(--text); font-weight: 400;
}
.next-step a { font-weight: 500; }

.tabs {
  display: flex; gap: 4px; margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; font-size: 14px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.tab:hover { color: var(--bamboo-jewel-green); text-decoration: none; }
.tab.is-active {
  color: var(--bamboo-jewel-green);
  border-bottom-color: var(--bamboo-green);
}
.tab-count {
  background: var(--bamboo-beige-100); color: var(--muted);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 500;
}
.tab.is-active .tab-count {
  background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green);
}
.tab-panel.is-hidden { display: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

/* ---------------------------------------------------------------------------
   Buttons / generic controls
   --------------------------------------------------------------------------- */
.btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  /* <button> elements don't inherit font-family — set it so .btn buttons
     use the Haffer body font, not the browser default. */
  font-family: var(--font-body);
  /* inline-flex + line-height centers the label reliably; horizontal padding
     must exceed the pill's cap radius (~half the height) so text doesn't slide
     under the rounded ends and look pinched. */
  padding: 8px 18px; border-radius: var(--radius-pill); cursor: pointer; font-size: 13px; font-weight: 500;
  line-height: 1.2; white-space: nowrap;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { border-color: var(--bamboo-jewel-green); text-decoration: none; }
.btn.primary, .btn-primary {
  background: var(--bamboo-jewel-green); border-color: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
}
.btn.primary:hover, .btn-primary:hover { background: var(--bamboo-jewel-700); }
.btn-primary[disabled] {
  background: var(--bamboo-cool-100); border-color: var(--bamboo-cool-100);
  color: var(--muted); cursor: not-allowed;
}
.btn-reset {
  background: var(--bamboo-lemon-green); border: 1px solid var(--bamboo-lemon-green);
  color: var(--bamboo-jewel-green); margin-top: 10px;
}
.btn-reset:hover { background: var(--bamboo-lemon-600); text-decoration: none; }
.link-btn {
  background: none; border: none; padding: 0; color: var(--bamboo-jewel-green);
  cursor: pointer; font-size: 12px; font-weight: 400; text-decoration: underline;
}
.link-btn:hover { color: var(--bamboo-green); }

/* Tactile press feedback. Scoped transition properties (never `all`) and a
   0.96 press scale — anything below 0.95 reads as exaggerated. */
.btn, .btn-primary, .btn-reset, .btn-wl-add {
  transition-property: background-color, border-color, color, box-shadow, transform;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.btn:active:not([disabled]),
.btn-primary:active:not([disabled]),
.btn-reset:active:not([disabled]),
.btn-wl-add:active:not([disabled]) {
  transform: scale(0.96);
}
@media (prefers-reduced-motion: reduce) {
  .btn, .btn-primary, .btn-reset, .btn-wl-add { transition: none; }
  .btn:active, .btn-primary:active,
  .btn-reset:active, .btn-wl-add:active { transform: none; }
}

/* ---------------------------------------------------------------------------
   Generic controls block (Shortlist etc — kept transitional for Task #54)
   --------------------------------------------------------------------------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: end;
  background: var(--panel); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: var(--radius-lg); margin-bottom: 16px;
}
.controls.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: stretch; }
.controls fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; margin: 0; background: var(--bamboo-beige-100); }
.controls legend { color: var(--muted); font-size: 12px; padding: 0 4px; font-weight: 400; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 400; }
.controls label.checkbox { flex-direction: row; align-items: center; gap: 6px; }
.controls input, .controls select {
  background: var(--bamboo-beige-50); color: var(--text);
  border: 1px solid var(--border); padding: 5px 8px;
  border-radius: 4px; font-size: 13px; font-weight: 500;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; grid-column: 1 / -1; }

/* ---------------------------------------------------------------------------
   Signal Feed — bubble filter strip
   --------------------------------------------------------------------------- */
.signal-filters {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--border);
  padding: 16px 18px; border-radius: var(--radius-lg); margin-bottom: 18px;
}
.bubble-row { border: 0; padding: 0; margin: 0;
              display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bubble-row legend {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-right: 8px; padding: 0; font-weight: 500;
  /* Render legend inline with the chips. */
  float: left; margin-top: 6px;
}
.signal-filters__trailing {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  border-top: 1px solid var(--border); padding-top: 12px;
}
.window-control {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 400;
}
.window-control input {
  background: var(--bamboo-beige-50); color: var(--text);
  border: 1px solid var(--border); padding: 4px 8px;
  border-radius: 4px; font-size: 13px; width: 56px; font-weight: 500;
}

/* Bubble chips — checkbox-as-label so multi-select is free */
.bubble {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--bamboo-cool-100);
  background: transparent;
  color: var(--bamboo-jewel-green);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.bubble:hover { background: var(--bamboo-beige-100); }
.bubble:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) { .bubble:active { transform: none; } }
.bubble input { position: absolute; opacity: 0; pointer-events: none; }
.bubble:has(input:checked) {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-jewel-green);
}
.bubble--all { font-weight: 500; }
.bubble--all.is-active {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-jewel-green);
}
/* Priority bubbles tint to the semantic priority palette when checked */
.bubble--prio:has(input:checked) {
  background: var(--prio-high-bg); color: var(--prio-high-fg); border-color: var(--prio-high-bg);
}
.bubble--prio-medium:has(input:checked) {
  background: var(--prio-medium-bg); color: var(--prio-medium-fg); border-color: var(--prio-medium-bg);
}
.bubble--prio-low:has(input:checked) {
  background: var(--prio-low-bg); color: var(--prio-low-fg); border-color: var(--prio-low-bg);
}
.bubble--prio-critical:has(input:checked) {
  background: var(--prio-high-bg); color: var(--prio-high-fg); border-color: var(--prio-high-fg);
}

/* "How priority works" reference block on /signals — kept out of the way
   so the editorial feed stays the focal point. */
.priority-rubric {
  margin: 24px 0 8px;
  font-size: 13px;
  color: var(--text-muted, #555);
}
.priority-rubric > summary {
  cursor: pointer;
  font-weight: var(--fw-medium, 500);
  color: var(--text, #222);
  padding: 4px 0;
  list-style: revert;
}
.priority-rubric__table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.priority-rubric__table th,
.priority-rubric__table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.priority-rubric__table th {
  font-weight: var(--fw-medium, 500);
  background: #fafafa;
}
.priority-rubric__note {
  margin-top: 10px;
  font-style: italic;
}

/* ---------------------------------------------------------------------------
   Tables
   --------------------------------------------------------------------------- */
table.sortable th[data-sort] { user-select: none; }
table.sortable th[data-dir="asc"]::after  { content: ' ▲'; color: var(--bamboo-green); font-size: 10px; }
table.sortable th[data-dir="desc"]::after { content: ' ▼'; color: var(--bamboo-green); font-size: 10px; }

table.data {
  width: 100%; border-collapse: collapse; margin-top: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
}
table.data th, table.data td {
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--divider);
  vertical-align: top;
}
table.data th {
  color: var(--bamboo-jewel-green); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bamboo-beige-100);
  border-bottom: 1px solid var(--border);
}
/* Ticker symbols in data tables (Testlist, Watchlist, peers) wear the
   display face, matching the Signal Feed cards, so they read as
   identifiers. Surrounding cells keep the numeral font for alignment. */
table.data td a[href^="/ticker/"] {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}

/* Sortable column headers (Testlist). Each header pairs its label with a
   stacked up / down arrow; the active sort direction's arrow is filled
   bamboo-green (readable on the beige header) while the inactive one
   stays a faint hairline hint. */
table.data th.sortable { white-space: nowrap; }
table.data th.sortable .th-inner {
  display: inline-flex; align-items: center; gap: 6px;
}
.th-arrows {
  display: inline-flex; flex-direction: column;
  line-height: 0.7; font-size: 8px;
}
.th-arrow {
  color: var(--border-strong); text-decoration: none;
  cursor: pointer; padding: 0 1px;
  transition: color 0.12s ease;
}
.th-arrow:hover { color: var(--bamboo-jewel-green); }
.th-arrow.is-active { color: var(--bamboo-green); }
table.data tr:hover td { background: var(--bamboo-beige-100); }
table.data tr:last-child td { border-bottom: none; }
table.data tr.raw-row td { background: var(--bamboo-beige); padding: 10px 14px; }
table.data tr.raw-row:hover td { background: var(--bamboo-beige); }
table.kv { width: 100%; }
table.kv th { text-align: left; color: var(--muted); font-weight: 400; padding: 4px 8px 4px 0; }
table.kv td { padding: 4px 0; }
.col-actions { white-space: nowrap; text-align: right; width: 1%; }
.table-meta { margin: 8px 0 6px; }

/* Key-facts chip column (shared multi-type view) — sits on the same
   geometry baseline as .pill so the Signal Feed key-facts row aligns
   with priority pills in the next column. */
.key-facts__chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fact-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 20px;
  background: var(--bamboo-beige-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: var(--pill-pad-y) var(--pill-pad-x);
  font-size: var(--fs-small); font-weight: var(--fw-medium);
  line-height: 1.2; white-space: nowrap;
}
.fact-chip__k {
  color: var(--muted);
  font-size: var(--pill-fs); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.type-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 20px;
  padding: var(--pill-pad-y) var(--pill-pad-x);
  border-radius: var(--radius-pill);
  background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green);
  font-size: var(--pill-fs); font-weight: var(--fw-medium);
  letter-spacing: 0.02em; line-height: 1.2; white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Pills — priority + status
   --------------------------------------------------------------------------- */
/* Canonical pill — one geometry (height, padding, radius, font size)
   everywhere a status/priority/tag chip appears. Modifier classes only
   set the colour pair so pills line up on a single baseline across
   Signal Feed, Shortlist, Scored, Testlist and Ticker pages. */
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 20px;
  padding: var(--pill-pad-y) var(--pill-pad-x);
  border-radius: var(--radius-pill);
  font-size: var(--pill-fs); font-weight: var(--fw-medium);
  letter-spacing: 0.02em; line-height: 1.2; white-space: nowrap;
  background: var(--bamboo-beige-100); color: var(--text);
}
.p-pass, .pill-pass    { background: rgba(0,162,57,0.18);   color: #006B26; }
.p-fail, .pill-fail    { background: var(--prio-high-bg);   color: var(--prio-high-fg); }
.p-warn, .pill-warn    { background: var(--prio-medium-bg); color: #8A4400; }
.p-off                 { background: var(--bamboo-cool-100);color: var(--muted); }
.p-critical            { background: var(--prio-high-bg);   color: var(--prio-high-fg); }
.p-high                { background: var(--prio-high-bg);   color: var(--prio-high-fg); }
.p-medium              { background: var(--prio-medium-bg); color: #8A4400; }
.p-low                 { background: var(--bamboo-cool-100);color: var(--muted); }
.pill-running          { background: rgba(0,71,60,0.12);    color: var(--bamboo-jewel-green); }

/* ---------------------------------------------------------------------------
   Empty / debug / misc
   --------------------------------------------------------------------------- */
.empty-state {
  text-align: center; padding: 56px 24px;
  background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
/* Ticker deep-dive: download row above the page split. Sits as one
   tidy flex row so the four CSVs line up on the same baseline. */
.ticker-downloads {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; margin: -4px 0 18px;
}

/* ---------------------------------------------------------------------
 * Ticker deep-dive (Task #102) — baseline header, price block, scored
 * rubric, tabs.
 * ------------------------------------------------------------------- */
.ticker-header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.ticker-header__top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap;
}
.ticker-header__identity { min-width: 0; flex: 1 1 auto; }
.ticker-header__eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.04em;
}
.ticker-header__symbol-chip {
  display: inline-block;
  background: var(--bamboo-jewel-green, #00473C);
  color: var(--bamboo-lemon-green, #E6FF55);
  font-weight: 500; font-size: 12px;
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.08em;
}
.ticker-header__name {
  margin: 6px 0 0; font-size: 28px; line-height: 1.15;
  color: var(--bamboo-jewel-green, var(--text));
  font-weight: 500;
}
/* Prominent quote block directly under the company name (Phase 4). */
.ticker-header__priceblock {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  margin-top: var(--space-3);
}
.ticker-header__quote {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-3);
}
.ticker-header__price-last {
  font-family: var(--font-num); font-size: 36px; font-weight: 600;
  line-height: 1.05; color: var(--text-primary);
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.ticker-header__price-change {
  font-family: var(--font-num); font-size: 14px; font-weight: 500;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ticker-header__price-pct { font-weight: 400; }
.ticker-header__price-date {
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.ticker-header__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px;
}
.ticker-header__actions {
  display: flex; gap: 8px; align-items: center;
}
.ticker-header__actions details summary {
  list-style: none; user-select: none;
}
.ticker-header__actions details summary::-webkit-details-marker { display: none; }
.ticker-header__actions details[open] .ticker-downloads__menu { display: flex; }
.ticker-downloads__menu {
  display: none;
  position: absolute;
  margin-top: 6px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  box-shadow: var(--shadow-pop);
}
.is-up   { color: #006B26; }
.is-down { color: var(--prio-high-fg); }
.ticker-header__desc {
  margin: 16px 0 0; padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text); font-size: 13px; line-height: 1.55;
}

/* Stat pill grid — uniform fundamentals tiles, six across, under the header. */
.stat-pill-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
  .stat-pill-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .stat-pill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat-pill {
  background: var(--bamboo-beige-100, #F4EDE4);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-pill__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.stat-pill__value {
  font-size: 18px; font-weight: 500; line-height: 1.2;
  color: var(--text);
}
.stat-pill__value--sm { font-size: 15px; }
.stat-pill__sub { font-size: 12px; margin-top: 2px; }

/* About panel — "what does this company do?" answered up top. */
.ticker-about {
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ticker-about__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 6px;
}
.ticker-about__body {
  margin: 0; font-size: 14px; line-height: 1.6; color: var(--text);
}


/* Neutral pill — sector / generic tag chip on the header. */
.p-neutral { background: var(--bamboo-cool-100); color: var(--bamboo-jewel-green); }
/* Sector-momentum status pills — applied dynamically on the Ticker page as
   p-{{ sector_mom.status|lower }}, where status is HOT / NEUTRAL / COLD. */
.p-hot     { background: var(--prio-medium-bg); color: #8A4400; }
.p-cold    { background: var(--bamboo-cool-100); color: var(--muted); }

.bucket-grid {
  /* Lay the four buckets out horizontally to use the full-width score box
     (UI Overhaul Phase 4). Falls back to 2-up, then 1-up on narrow. */
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-5);
}
@media (max-width: 1100px) { .bucket-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .bucket-grid { grid-template-columns: 1fr; } }
.bucket {
  background: var(--bamboo-beige-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.bucket__head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 6px;
}
.bucket__heading {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.bucket__label { font-weight: 500; color: var(--bamboo-jewel-green); line-height: 1.2; }
.bucket__tagline { font-weight: 400; font-size: 12px; line-height: 1.3; }
.bucket__score {
  font-weight: 500; font-size: 18px; white-space: nowrap;
  flex: 0 0 auto; line-height: 1.2; color: var(--bamboo-jewel-green);
}
.bucket__score-max { font-size: 13px; color: var(--muted); font-weight: 400; }
.bucket__bar {
  height: 6px; background: var(--border); border-radius: 3px;
  overflow: hidden; margin-bottom: 8px;
}
.bucket__bar-fill {
  height: 100%; background: var(--bamboo-green); transition: width 0.3s ease;
}
.bucket__sub {
  list-style: none; padding: 0; margin: 4px 0 0;
  display: flex; flex-direction: column; gap: 8px;
}
.sub-row {
  border-top: 1px solid var(--border); padding-top: 6px;
  cursor: pointer; outline: none;
}
.sub-row:first-child { border-top: 0; padding-top: 0; }
.sub-row--skipped { opacity: 0.72; }
.sub-row:hover .sub-row__label,
.sub-row:focus-visible .sub-row__label { color: var(--bamboo-jewel-green); }
.sub-row__head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 2px 8px; font-size: 12px; font-weight: 500;
}
.sub-row__chev {
  color: var(--muted); font-size: 10px;
  transition: transform 120ms ease;
  display: inline-block; flex: 0 0 auto; order: 0;
}
.sub-row.is-open .sub-row__chev { transform: rotate(90deg); }
.sub-row__label { color: var(--text); flex: 0 1 auto; order: 1; }
.sub-row__explanation-inline {
  color: var(--muted); font-weight: 400; font-size: 11px;
  order: 3; flex: 1 1 100%; min-width: 0;
  padding-left: 18px; white-space: normal;
}
.sub-row__score {
  order: 2; flex: 1 1 100%;
  margin-left: 0; padding-left: 18px;
  color: var(--bamboo-jewel-green);
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sub-row__pts { font-family: var(--font-num); font-weight: 500; white-space: nowrap; }
.sub-row--skipped .sub-row__pts { color: var(--muted); font-weight: 400; }
.sub-row__detail {
  font-size: 12px; line-height: 1.5; margin-top: 6px;
  padding: 8px 10px; background: var(--bamboo-beige-100);
  border-radius: 6px; border-left: 2px solid var(--bamboo-jewel-green);
  cursor: default;
}
.sub-row__detail.is-hidden { display: none; }
.sub-row__what,
.sub-row__band { margin: 0 0 6px; }
.sub-row__why { margin: 0; }

.score-intro {
  margin: 12px 0 6px; line-height: 1.55; font-size: 15px;
  color: var(--text); width: 100%;
}
.score-subnote {
  margin: 0 0 16px; line-height: 1.5; width: 100%;
}

/* Scored-shortlist expandable drawer (Task #121). */
.scored-table .scored-row { cursor: pointer; }
.scored-table .scored-row:hover td { background: var(--bamboo-beige-100); }
.scored-row__chev { color: var(--muted); user-select: none; }
.scored-row.is-open .scored-row__chev span { display: inline-block; transform: rotate(90deg); }
.scored-detail.is-hidden { display: none; }
.scored-detail td { background: var(--bamboo-beige-100); padding: 14px 18px; }
.scored-detail__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.scored-detail__bucket {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.scored-detail__bhead {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px; margin-bottom: 6px;
}

.ticker-excerpt {
  margin-top: 4px; padding-left: 8px;
  border-left: 2px solid var(--border); font-style: italic;
}
.empty-state h3 { margin: 0 0 8px; color: var(--bamboo-jewel-green); }
.empty-state p { color: var(--muted); margin: 0 0 16px; }

pre { background: var(--bamboo-beige-100); padding: 10px; border-radius: 6px;
      overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word;
      border: 1px solid var(--border); color: var(--text); font-weight: 400; }
pre.mini { max-width: 100%; max-height: 220px; }
details summary { cursor: pointer; color: var(--bamboo-jewel-green); }

ul.gaps { margin: 0; padding-left: 16px; font-size: 12px; }
ul.gaps code { color: var(--text); background: var(--bamboo-beige-100); padding: 1px 4px; border-radius: 3px; }

.scheduler-msg { margin: 8px 0 4px; }

/* ---------------------------------------------------------------------------
   HTMX indicators / spinners — preserved from prior pipeline UI
   --------------------------------------------------------------------------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-indicator.htmx-request { display: inline-flex; }
.spinner {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid rgba(0,71,60,0.25); border-top-color: currentColor;
  border-radius: 50%; animation: bass-spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes bass-spin { to { transform: rotate(360deg); } }
.btn-run-screening .btn-label-busy { display: none; }
.btn-run-screening[disabled] .btn-label-idle { display: none; }
.btn-run-screening[disabled] .btn-label-busy { display: inline-flex; align-items: center; gap: 6px; }
.btn-run-screening[disabled] { opacity: 1; cursor: progress; }
.controls .form-actions button[disabled] { opacity: 0.55; cursor: progress; }
.run-status {
  display: none; align-items: center; gap: 8px;
  padding: 10px 14px; margin: 0 0 10px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--bamboo-green); border-radius: 6px;
  color: var(--text); font-size: 13px;
}
.run-status.htmx-request { display: inline-flex; }
#shortlist-results.htmx-request { opacity: 0.45; pointer-events: none; transition: opacity 0.15s ease; }
#testlist-results.htmx-request { opacity: 0.45; pointer-events: none; transition: opacity 0.15s ease; }

/* ---------------------------------------------------------------------------
   Admin / pipeline panel — preserved
   --------------------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.hero { text-align: center; padding: 40px 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 32px; }
.card { background: var(--panel); padding: 20px; border-radius: var(--radius-lg); color: var(--text);
        text-align: left; border: 1px solid var(--border); }
.card:hover { border-color: var(--bamboo-jewel-green); text-decoration: none; }
.card h3 { margin-top: 0; }
.card p { color: var(--muted); margin-bottom: 0; }

.pipeline-panel { margin: 18px 0 24px; padding: 14px 16px; background: var(--panel);
                  border: 1px solid var(--border); border-radius: 8px; }
.pipeline-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pipeline-form { display: flex; gap: 10px; align-items: center; margin: 0; }
.pipeline-date { color: var(--muted); display: flex; gap: 6px; align-items: center; font-size: 13px; }
.pipeline-date input { background: var(--bamboo-beige-50); border: 1px solid var(--border);
                       color: var(--text); padding: 4px 6px; border-radius: 4px; }
.pipeline-progress { display: flex; gap: 10px; align-items: center; }
.pipeline-summary { margin-top: 10px; font-size: 12px; }
.pipeline-substep { margin-top: 10px; padding: 8px 10px; background: var(--bamboo-beige-100);
                    border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
                    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pipeline-substep .substep-label { font-weight: 500; color: var(--text); }
.pipeline-substep .substep-progress { color: var(--muted); font-variant-numeric: tabular-nums; }
.pipeline-substep .substep-bar { flex: 1 1 120px; min-width: 120px; height: 6px;
                                 background: var(--border); border-radius: 3px; overflow: hidden; }
.pipeline-substep .substep-bar-fill { height: 100%; background: var(--bamboo-green); transition: width 0.4s ease; }
.pipeline-recent { margin-top: 10px; }
.pipeline-recent-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
                         color: var(--muted); margin-bottom: 4px; }
.pipeline-recent ul { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.pipeline-recent li { padding: 2px 0; color: var(--muted);
                      font-variant-numeric: tabular-nums; display: flex; gap: 8px; }
.pipeline-recent li .recent-label { color: var(--text); min-width: 130px; }
.pipeline-recent li.recent-failed .recent-label { color: var(--fail); }
.pipeline-panel--conflict { border-color: var(--warn); }
.pipeline-conflict { display: inline-block; margin-bottom: 10px; }

/* ---------------------------------------------------------------------
 * Auth (Task #59) — login page card + nav user widget.
 * ------------------------------------------------------------------- */
.auth-card {
  max-width: 420px;
  margin: 64px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
}
.auth-logo { height: 40px; width: auto; display: block; margin: 0 auto 18px; }
.auth-card h1 { margin-top: 0; }
.auth-google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.auth-google svg { display: inline-block; }

/* ---------------------------------------------------------------------
 * Watchlist (Task #60) — add button + inline note editor.
 * ------------------------------------------------------------------- */
.btn-wl-add {
  /* Sits on the same baseline as .pill so it lines up next to status
     pills in the col-actions column. */
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 20px;
  background: var(--bamboo-beige-100);
  border: 1px solid var(--bamboo-cool-100);
  color: var(--bamboo-jewel-green);
  padding: var(--pill-pad-y) var(--pill-pad-x);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: var(--pill-fs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
}
.btn-wl-add:hover {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-jewel-green);
}
.btn-wl-add.is-on {
  background: var(--bamboo-lemon-green);
  border-color: var(--bamboo-lemon-green);
  color: var(--bamboo-jewel-green);
  cursor: default;
  opacity: 0.85;
}
.h1-wl-btn { margin-left: 10px; vertical-align: middle; font-size: 12px; }
.wl-note-form { margin: 0; }
.wl-note-input {
  width: 100%;
  min-width: 180px;
  background: var(--bamboo-beige-50);
  border: 1px solid transparent;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
}
.wl-note-input {
  transition: border-color 0.14s ease, background-color 0.14s ease;
}
.wl-note-input:hover { border-color: var(--border); background: var(--bamboo-beige-100); }
.wl-note-input:focus {
  outline: none;
  border-color: var(--bamboo-jewel-green);
  background: var(--bamboo-beige-50);
}
.auth-warning {
  background: var(--warn-surface);
  border: 1px solid #e6c97a;
  color: var(--bamboo-black);
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
  text-align: left;
}
.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding-left: 12px;
  /* On the dark jewel topbar the global black-alpha --border is nearly
     invisible — use a light divider so the separator reads. */
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.nav-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bamboo-cool-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-medium);
  font-size: 13px;
  color: var(--bamboo-jewel-green);
  object-fit: cover;
}
.nav-user-name {
  font-size: 13px;
  font-weight: var(--fw-medium);
  /* Off-white so the user's name is readable against the jewel-green
     topbar — the previous --text token was the dark body colour and
     disappeared into the header. */
  color: var(--bamboo-beige);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-user-logout { margin: 0; }
.nav-user-logout button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  color: var(--bamboo-cool-100);
}
.nav-user-logout button:hover { color: var(--bamboo-lemon-green); }

/* ---------------------------------------------------------------------------
   Testlist (Task #91 / Task #95) — hoisted out of an inline <style> block
   in templates/testlist.html so the second-layer screener sits on the
   same design tokens (pill geometry, typography, jewel-green accents)
   as the rest of the app. Naming kept stable so the existing markup
   keeps working.
   --------------------------------------------------------------------------- */
.tl-form {
  display: flex; flex-direction: column;
  gap: 16px; margin: 0;
}

.tl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 16px 17px;
  box-shadow: var(--shadow-card);
}
.tl-card h3 {
  margin: 0 0 10px 0;
  font-size: var(--fs-h3);
  color: var(--bamboo-jewel-green);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: var(--fw-medium);
}
.order-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5em; height: 1.5em; border-radius: var(--radius-pill);
  background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green);
  font-size: var(--fs-small); font-weight: var(--fw-medium);
  margin-right: 8px; font-variant-numeric: tabular-nums;
}

.tl-row {
  display: grid;
  grid-template-columns: 11em 1fr 5em;
  align-items: center; gap: 6px 12px;
  margin: 6px 0;
}
.tl-row label {
  font-size: var(--fs-body); color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.tl-row input[type=range] { width: 100%; accent-color: var(--bamboo-jewel-green); }
.tl-row .slider-value {
  font-variant-numeric: tabular-nums; font-weight: var(--fw-medium);
  color: var(--bamboo-jewel-green); text-align: right;
  font-size: var(--fs-body);
}
.tl-row input[type=number] {
  width: 100%; padding: 4px 8px;
  font-size: var(--fs-body);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bamboo-beige-50);
  color: var(--text);
  font-variant-numeric: tabular-nums; text-align: right;
}

.tl-multi {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 700px) { .tl-multi { grid-template-columns: 1fr; } }
.tl-multi > div > label {
  display: block; font-size: var(--fs-body); color: var(--text);
  margin-bottom: 6px; font-weight: var(--fw-medium);
}
.tl-multi .muted { font-size: var(--fs-small); margin-top: 6px; }

/* ---- Pill multi-select — chips reuse the canonical pill geometry ---- */
.pillpick-wrap { position: relative; }
.pillpick {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bamboo-beige-50);
  padding: 6px;
  display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; min-height: 36px;
}
.pillpick__chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 20px;
  padding: var(--pill-pad-y) var(--pill-pad-x);
  border-radius: var(--radius-pill);
  font-size: var(--pill-fs); font-weight: var(--fw-medium);
  line-height: 1.2;
  background: rgba(0,71,60,0.10);
  color: var(--bamboo-jewel-green);
  border: 1px solid rgba(0,71,60,0.20);
  white-space: nowrap;
}
.pillpick__chip button {
  border: none; background: transparent; cursor: pointer;
  color: var(--bamboo-jewel-green); padding: 0; line-height: 1;
  font-weight: var(--fw-medium); font-size: 14px;
}
.pillpick__chip button:hover { color: var(--prio-high-fg); }
.pillpick__add {
  border: none; background: transparent; outline: none;
  flex: 1; min-width: 8em; padding: 2px 4px;
  font-size: var(--fs-body); color: var(--text);
}
.pillpick__menu {
  position: absolute; z-index: 40;
  background: var(--bamboo-beige-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  max-height: 260px; overflow-y: auto;
  min-width: 18em; font-size: var(--fs-body);
}
.pillpick__menu[hidden] { display: none; }
.pillpick__option {
  padding: 6px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.pillpick__option:hover,
.pillpick__option[aria-selected="true"] {
  background: var(--bamboo-beige-100);
}
.pillpick__option.is-picked { color: var(--muted); cursor: default; }
.pillpick__option.is-picked::after {
  content: " ✓"; color: var(--bamboo-green);
}
.pillpick__empty {
  padding: 8px 12px; color: var(--muted); font-style: italic;
}

.tl-actions {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 6px;
}
.tl-actions .spacer { flex: 1; }
/* Trim the action buttons just enough that all three fit one line in the
   320px rail; flex-wrap remains a graceful fallback on any narrower render. */
.tl-actions .btn { padding-left: var(--space-6); padding-right: var(--space-6); }

details.advanced { margin-top: 10px; }
details.advanced > summary {
  cursor: pointer; padding: 6px 10px;
  background: var(--bamboo-beige-100);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-medium);
  font-size: var(--fs-body);
  list-style: revert;
}
details.advanced[open] > summary { margin-bottom: 8px; }



.tl-warn {
  background: var(--prio-medium-bg);
  border: 1px solid var(--prio-medium-fg);
  color: #6b4500;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin: 12px 0; font-size: var(--fs-body);
}

/* ---- Info popover (used on Testlist + a few other surfaces) ---- */
.info-popover { position: relative; display: inline-block; }
.info-popover .info-icon {
  cursor: help;
  border: 1px solid var(--bamboo-cool-300);
  border-radius: 50%;
  width: 1.1em; height: 1.1em; line-height: 1em; padding: 0;
  background: var(--bamboo-beige-100); color: var(--bamboo-jewel-green);
  font-size: 0.75em; font-style: italic; font-weight: var(--fw-medium);
  display: inline-flex; align-items: center; justify-content: center;
}
.info-popover__panel {
  position: absolute; left: 1.4em; top: -0.3em; z-index: 50;
  width: 22em; padding: 10px 14px;
  background: var(--bamboo-beige-50); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-small); line-height: 1.35; font-weight: var(--fw-regular);
  display: grid; grid-template-columns: 4.5em 1fr; gap: 4px 10px;
  white-space: normal;
}
.info-popover__row { color: var(--bamboo-jewel-green); font-weight: var(--fw-medium); }
.info-popover:hover .info-popover__panel,
.info-popover [aria-expanded="true"] + .info-popover__panel { display: grid; }
.info-popover__panel[hidden] { display: none; }
.info-popover:hover .info-popover__panel[hidden],
.info-popover [aria-expanded="true"] + .info-popover__panel[hidden] { display: grid; }

/* ---- Auth sub-line under "Sign in" heading ---- */
.auth-sub { margin: -8px 0 16px; color: var(--muted); }


/* Priority chip — dot + label, semantic colour. Shared by feed
   rows, SoD card, and Top 3 cards. */
.prio-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: var(--fw-medium);
  background: var(--bamboo-beige-100);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.prio-chip__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
/* CRITICAL is the rarest, highest-conviction signal (e.g. a first
   positive EBITDA turn). It gets the strongest treatment — a solid jewel
   chip with lemon text, matching the ticker symbol chip — so it reads as
   the top of the ladder rather than falling back to the neutral base
   chip. Previously undefined, so critical rows rendered as plain grey. */
.prio-chip--critical {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-jewel-green);
}
.prio-chip--high {
  background: rgba(230,255,85,0.25);
  color: var(--bamboo-jewel-green);
  border-color: var(--bamboo-lemon-green);
}
.prio-chip--medium {
  background: var(--bamboo-cool-100);
  color: var(--bamboo-jewel-green);
  border-color: var(--bamboo-cool-300);
}
.prio-chip--low {
  background: var(--bamboo-beige-100);
  color: var(--muted);
}


/* =============================================================
   Signal Feed — ticker cards (Task #120).
   Each ticker appears once as a card. The card head carries the
   ticker link, sector, "N signals" count, max-priority chip and
   the Watchlist add button; the body lists that ticker's signals
   as compact sub-rows.
   ============================================================= */

.ticker-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticker-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-card);
  overflow: hidden;
  box-shadow: var(--shadow-hairline);
  transition: box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.ticker-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}
@media (prefers-reduced-motion: reduce) {
  .ticker-card { transition: none; }
}

.ticker-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bamboo-beige-100);
  border-bottom: 1px solid var(--border);
}

.ticker-card__ticker {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--fw-semibold);
  color: var(--bamboo-jewel-green);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.ticker-card__ticker:hover { text-decoration: underline; }

.ticker-card__sector {
  color: var(--muted);
  font-size: 12px;
}

.ticker-card__count {
  font-size: 11px;
  font-weight: var(--fw-medium);
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.ticker-card__action {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ticker-card__action .btn-wl-add { font-size: 11px; padding: 2px 8px; }

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

/* Sub-row: TYPE · PRIORITY · DATE · KEY FACTS · ACTION.
   Ticker / sector live on the card head, so they're omitted here. */
.signal-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 180px)  /* type */
    minmax(90px, 110px)   /* priority */
    100px                 /* date */
    minmax(0, 1fr)        /* key facts */
    auto;                 /* action */
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.signal-row:last-child { border-bottom: 0; }
.signal-row:hover { background: var(--bamboo-beige-100); }

.signal-row__date { white-space: nowrap; }
.signal-row__facts {
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.signal-row__action {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 10px;
}
.signal-row__raw-toggle { font-size: 11px; white-space: nowrap; }

.signal-raw-row {
  list-style: none;
  padding: 8px 14px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bamboo-beige-100);
}
.signal-raw-row:last-child { border-bottom: 0; }
.signal-raw-row[hidden] { display: none; }
.signal-raw-row__json {
  margin: 0;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 320px;
  overflow: auto;
  white-space: pre;
}

@media (max-width: 760px) {
  .signal-row {
    grid-template-columns: 1fr auto;
    row-gap: 6px;
  }
  .signal-row__type   { grid-column: 1 / -1; }
  .signal-row__facts  { grid-column: 1 / -1; white-space: normal; }
  .signal-row__action { grid-column: 2; grid-row: 1; }
  .signal-row__date   { grid-column: 1; }
  .signal-row__prio   { grid-column: 2; }
  .ticker-card__head { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------------
 * Analyst flags (Task #133) — story-level signals surfaced for a human
 * to judge, never scored. Deliberately styled apart from the scored
 * panels: a warm dashed frame + "not scored" badge so an analyst never
 * mistakes these for inputs to the 0–100 score.
 * ------------------------------------------------------------------- */
/* Untracked-ticker notice (Task #167): an informational banner shown when
 * a ticker is not in tracked_tickers. Warm warning tones so it reads as a
 * notice without alarming, consistent with the medium-priority palette. */
.untracked-banner {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--prio-medium-bg);
  border: 1px solid var(--prio-medium-fg);
  border-radius: 10px;
}
.untracked-banner__badge {
  flex: none;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #8A4400;
}
.untracked-banner__body {
  margin: 0; max-width: 70ch;
  font-size: 0.85rem; color: var(--text);
}

.analyst-flags {
  margin: 22px 0;
  padding: 18px 18px 6px;
  background: var(--panel-2);
  border: 1px dashed var(--accent);
  border-radius: 12px;
}
.analyst-flags__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.analyst-flags__head h2 { margin: 0; }
.analyst-flags__badge {
  background: rgba(0,71,60,0.12); color: var(--bamboo-jewel-green);
  text-transform: none; letter-spacing: 0;
}
.analyst-flags__intro { margin: 6px 0 14px; max-width: 70ch; }

.flag-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.flag-card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.flag-card__head h3 { margin: 0; font-size: 1rem; }
.flag-card--stub { opacity: 0.85; }
.flag-subhead {
  margin: 12px 0 4px; font-size: 0.8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}

.flag-deals { list-style: none; margin: 0; padding: 0; }
.flag-deal {
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.flag-deal:last-child { border-bottom: none; }
.flag-deal__row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.ticker-excerpt { margin-top: 6px; }

/* ---------------------------------------------------------------------
 * Audit panel — read-only explainer of how the BASS Score is built.
 * Lives on /admin in place of the old Screening Diagnostics block. The
 * outer frame is given a jewel-green accent so it reads as a distinct,
 * reference-style section. All colours/tokens come from :root above.
 * ------------------------------------------------------------------- */
.audit {
  border: 2px solid var(--bamboo-jewel-green);
}
.audit__head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.audit__head h2 { margin: 0; }
.audit__badge {
  background: rgba(0,71,60,0.10); color: var(--bamboo-jewel-green);
  text-transform: none; letter-spacing: 0;
}
.audit__intro { max-width: 78ch; margin: 0 0 8px; }
.audit__h3 {
  margin: 26px 0 4px;
  font-size: var(--fs-h2);
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.audit__sub { max-width: 80ch; margin: 0 0 14px; }

/* Pipeline flow strip */
.audit-flow {
  display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.audit-flow__step {
  flex: 1 1 200px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.audit-flow__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.audit-flow__num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--radius-pill);
  background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green);
  font-family: var(--font-num); font-size: 12px; font-weight: var(--fw-semibold);
}
.audit-flow__title { font-weight: var(--fw-semibold); }
.audit-flow__body { margin: 0; color: var(--muted); font-size: var(--fs-small); }
.audit-flow__arrow {
  display: flex; align-items: center; color: var(--bamboo-cool-300);
  font-size: 18px; padding: 0 2px;
}

/* "How the math works" jewel callout */
.audit-math {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-beige-50);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 18px 0 8px;
}
.audit-math__title {
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  font-size: var(--fs-h2); margin-bottom: 6px;
}
.audit-math__body { margin: 0 0 14px; max-width: 80ch; color: rgba(255,255,255,0.88); }
.audit-math__body strong { color: var(--bamboo-lemon-green); font-weight: var(--fw-semibold); }
.audit-math__buckets { display: flex; flex-wrap: wrap; gap: 10px; }
.audit-bucketstat {
  flex: 1 1 120px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.audit-bucketstat__name { font-size: var(--fs-small); color: rgba(255,255,255,0.78); }
.audit-bucketstat__val {
  font-family: var(--font-num); font-size: 22px; font-weight: var(--fw-medium);
  color: var(--bamboo-lemon-green); display: flex; align-items: baseline; gap: 5px;
}
.audit-bucketstat__val span { font-size: var(--fs-small); color: rgba(255,255,255,0.7); }

/* Generic responsive tile grids */
.audit-grid { display: grid; gap: 12px; margin-bottom: 8px; }
.audit-grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.audit-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.audit-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.audit-tile__title { font-weight: var(--fw-semibold); margin-bottom: 4px; }
.audit-tile__body { margin: 0; color: var(--muted); font-size: var(--fs-small); }
.audit-tile--stub { opacity: 0.8; border-style: dashed; }

/* Bucket group + metric cards */
.audit-bucket { margin-bottom: 16px; }
.audit-bucket__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 10px;
}
.audit-bucket__name { font-family: var(--font-display); font-weight: var(--fw-semibold); font-size: 16px; }
.audit-metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.audit-metric__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.audit-metric__name { font-weight: var(--fw-semibold); }
.audit-metric__weight {
  background: var(--bamboo-lemon-green); color: var(--bamboo-jewel-green);
  border-radius: var(--radius-pill); padding: 2px 9px;
  font-size: var(--fs-small); font-weight: var(--fw-semibold); white-space: nowrap;
}
.audit-metric__field { margin-bottom: 9px; }
.audit-metric__label {
  font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: var(--fw-semibold); margin-bottom: 2px;
}
.audit-metric__value { font-size: var(--fs-small); color: var(--text); }
.audit-metric__example {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 11px;
}
.audit-metric__example-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}
.audit-metric__label--ex { margin-bottom: 0; }
.audit-metric__earned {
  color: var(--bamboo-jewel-green); font-size: var(--fs-small);
  font-weight: var(--fw-semibold); white-space: nowrap;
}

/* End-to-end worked scorecard */
.audit-total {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
  margin-bottom: 8px;
}
.audit-total__cell {
  flex: 1 1 120px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.audit-total__name { font-size: var(--fs-small); color: var(--muted); }
.audit-total__val {
  font-family: var(--font-num); font-size: 20px; font-weight: var(--fw-medium);
  display: flex; align-items: baseline; gap: 4px;
}
.audit-total__val span { font-size: var(--fs-small); color: var(--muted); }
.audit-total__cell--score {
  background: var(--bamboo-jewel-green); border-color: var(--bamboo-jewel-green);
}
.audit-total__cell--score .audit-total__name { color: rgba(255,255,255,0.8); }
.audit-total__score {
  font-family: var(--font-num); font-size: 26px; font-weight: var(--fw-semibold);
  color: var(--bamboo-lemon-green); display: flex; align-items: baseline; gap: 4px;
}
.audit-total__score span { font-size: var(--fs-small); color: rgba(255,255,255,0.75); }

/* Accounts panel: two inline action forms (role + active) per row. Give
   the second a small gap so the buttons don't touch. */
table.data td form + form { margin-left: 6px; }

/* ===========================================================================
   UI OVERHAUL — design-system component classes (Phase 1b, additive)
   ===========================================================================
   These are net-new class names, unused by existing markup, so adding them
   changes nothing visually until a page opts in. Pages migrate onto them
   phase by phase; legacy classes (.panel, .bubble*, table.data, .pillpick*)
   stay until the Phase 5 cleanup. Built on the Phase 1a tokens above so the
   whole system stays on one spacing / surface / motion baseline.
   --------------------------------------------------------------------------- */

/* ---- Shell + layout -------------------------------------------------------
   The product-shell scaffold (Phase 1d wires base.html onto .app-shell /
   .app-main; .page-header replaces the ad-hoc per-page H1 blocks). */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.app-main {
  flex: 1 1 auto;
  padding: var(--space-9) var(--gutter);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-8); flex-wrap: wrap;
  margin: 0 0 var(--space-8);
}
.page-header__lede { min-width: 0; max-width: 720px; }
.page-header__meta {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  font-size: var(--fs-micro); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 var(--space-2);
}
.page-header__title {
  margin: 0; font-size: var(--fs-h1); line-height: 1.1;
  color: var(--bamboo-jewel-green); text-wrap: balance;
}
.page-header__sub {
  margin: var(--space-2) 0 0; color: var(--text-secondary);
  font-size: var(--fs-body); line-height: 1.5; text-wrap: pretty;
}
.page-header__actions {
  display: flex; align-items: center; gap: var(--space-3);
  flex: 0 0 auto; flex-wrap: wrap;
}

/* ---- Surfaces -------------------------------------------------------------
   One card primitive on the semantic surface tokens; modifiers shift tone. */
.surface {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-8);
  box-shadow: var(--shadow-hairline);
}
.surface--raised { background: var(--surface-raised); box-shadow: var(--shadow-hover); }
.surface--muted  { background: var(--surface-muted); box-shadow: none; }
.surface--flush  { padding: 0; overflow: hidden; }

/* ---- Metric / score modules ----------------------------------------------
   Consumed by Ticker (Phase 4) and Signal Feed cards (Phase 2). */
.metric-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--space-5) var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-1);
}
.metric-card__label {
  font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.metric-card__value {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: var(--fs-h2); font-weight: var(--fw-medium);
  color: var(--text-primary); line-height: 1.2;
}

/* SVG score ring — see the score_dial() macro in _ui_macros.html. The macro
   emits the geometry (108×108, r=48, stroke 8); these rules colour + animate
   it. Colour bands: green ≥0.66, mustard 0.4–0.66, rouge <0.4. */
.score-dial { display: inline-flex; position: relative; }
.score-dial__track { stroke: var(--border); fill: none; }
.score-dial__value {
  fill: none; stroke: var(--bamboo-green); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset var(--dur-slow) var(--ease-standard);
}
.score-dial--mid  .score-dial__value { stroke: var(--prio-medium-fg); }
.score-dial--low  .score-dial__value { stroke: var(--prio-high-fg); }
.score-dial__label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; text-align: center;
}
.score-dial__num {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: var(--fw-semibold); line-height: 1;
  color: var(--bamboo-jewel-green);
}
.score-dial__den { font-size: var(--fs-micro); color: var(--text-secondary); }

/* Horizontal score bar (list contexts — Testlist mini bar, Phase 3). */
.score-bar {
  position: relative; height: 6px; width: 100%;
  background: var(--border); border-radius: var(--radius-pill);
  overflow: hidden;
}
.score-bar__fill {
  position: absolute; inset: 0 auto 0 0; height: 100%;
  background: var(--bamboo-green); border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-standard);
}
.score-bar--mid .score-bar__fill { background: var(--prio-medium-fg); }
.score-bar--low .score-bar__fill { background: var(--prio-high-fg); }

/* Labelled bucket bar (score breakdown rows). */
.bucket-bar { display: flex; flex-direction: column; gap: var(--space-2); }
.bucket-bar__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3); font-size: var(--fs-small);
}
.bucket-bar__label { color: var(--text-primary); font-weight: var(--fw-medium); }
.bucket-bar__score {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  color: var(--bamboo-jewel-green); font-weight: var(--fw-medium);
}

/* ---- Controls -------------------------------------------------------------
   One chip/pill API to supersede .bubble* / .pillpick* / .filter (Phase 5
   collapses the old dialects into these). */
/* Base sprite icon (emitted by the ui.icon() macro): 1em, inherits colour. */
.icon {
  width: 1em; height: 1em; display: inline-block;
  vertical-align: -0.125em; fill: none; stroke: currentColor;
  flex: none;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-md); color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-muted); color: var(--bamboo-jewel-green); }
.icon-btn:focus-visible {
  outline: 2px solid var(--bamboo-jewel-green); outline-offset: 2px;
}
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--sm svg { width: 16px; height: 16px; }

.command-search {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-5);
}
.command-search:focus-within {
  border-color: var(--bamboo-jewel-green);
  box-shadow: 0 0 0 3px rgba(0, 71, 60, 0.10);
}
.command-search input {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-num);
  font-size: var(--fs-body); width: 160px;
}
.command-search input::placeholder { color: var(--text-tertiary); }

.segmented {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 2px;
}
.segmented__item {
  display: inline-flex; align-items: center; justify-content: center;
  padding: var(--space-1) var(--space-5); min-height: 30px;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: var(--fs-small);
  font-weight: var(--fw-medium); color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.segmented__item:hover { color: var(--bamboo-jewel-green); }
.segmented__item.is-active,
.segmented__item[aria-pressed="true"] {
  background: var(--bamboo-jewel-green); color: var(--bamboo-lemon-green);
}

/* Filter chip — checkbox-as-label, so multi-select stays CSS-only. Supersedes
   .bubble. Tinted-when-checked; a --clear variant covers the "All" reset. */
.filter-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 30px; padding: var(--space-1) var(--space-5);
  border: 1px solid var(--bamboo-cool-100); background: transparent;
  color: var(--bamboo-jewel-green);
  border-radius: var(--radius-pill);
  font-size: var(--fs-body); font-weight: var(--fw-medium);
  cursor: pointer; user-select: none;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.filter-chip:hover { background: var(--surface-muted); }
.filter-chip:focus-within {
  outline: 2px solid var(--bamboo-jewel-green); outline-offset: 2px;
}
.filter-chip input { position: absolute; opacity: 0; pointer-events: none; }
.filter-chip:has(input:checked),
.filter-chip.is-active {
  background: var(--bamboo-jewel-green);
  color: var(--bamboo-lemon-green);
  border-color: var(--bamboo-jewel-green);
}

/* ---- Data tables ----------------------------------------------------------
   Sticky header, right-aligned tabular numerics, one intentional hover.
   Supersedes table.data; --compact tightens rows, --interactive adds hover. */
.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface-card);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  overflow: hidden;
  font-size: var(--fs-body);
}
.data-table th, .data-table td {
  text-align: left; padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--divider); vertical-align: middle;
}
.data-table thead th {
  position: sticky; top: var(--shell-nav-h); z-index: var(--z-base);
  background: var(--surface-muted);
  color: var(--bamboo-jewel-green); font-weight: var(--fw-medium);
  font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num, .data-table td.num, .data-table th.num {
  text-align: right; font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.data-table--compact th, .data-table--compact td {
  padding: var(--space-2) var(--space-5);
}
.data-table--interactive tbody tr {
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.data-table--interactive tbody tr:hover td { background: var(--surface-muted); }
/* Single sort affordance — one caret on the active column, no stacked arrows. */
.data-table th.is-sortable { cursor: pointer; user-select: none; }
.data-table th.is-sortable[aria-sort="ascending"]::after  { content: " ↑"; color: var(--bamboo-green); }
.data-table th.is-sortable[aria-sort="descending"]::after { content: " ↓"; color: var(--bamboo-green); }

/* ---- States: loading + inline alert (empty-state already exists above) ----
   .loading-state preserves height so an HTMX swap doesn't collapse layout. */
.loading-state {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-3); min-height: 160px;
  color: var(--text-secondary); font-size: var(--fs-small);
}
.inline-alert {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--border); border-left: 3px solid var(--bamboo-green);
  border-radius: var(--radius-xs);
  background: var(--surface-muted); color: var(--text-primary);
  font-size: var(--fs-small); line-height: 1.5;
}
.inline-alert--warn { border-left-color: var(--prio-medium-fg); background: var(--warn-surface); }
.inline-alert--error { border-left-color: var(--prio-high-fg); background: var(--prio-high-bg); }

/* Respect reduced-motion across every new transition/animation. */
@media (prefers-reduced-motion: reduce) {
  .score-dial__value, .score-bar__fill, .icon-btn, .segmented__item,
  .filter-chip, .data-table--interactive tbody tr {
    transition: none;
  }
}

/* ===========================================================================
   UI OVERHAUL — Phase 2: Signal Feed slice
   ===========================================================================
   Page-header, filter surface (one chip language), funnel/summary strip, and
   the smooth HTMX swap. The ticker-card refinements live inline above with
   the legacy card rules. Legacy .editorial-hero / .signal-filters / .bubble*
   stay until the Phase 5 cleanup.
   --------------------------------------------------------------------------- */

/* CSV / action buttons that lead with a sprite icon. */
.btn--with-icon { display: inline-flex; align-items: center; gap: var(--space-2); }
.btn--with-icon .icon { font-size: 15px; }

/* Filter surface — one chip language for type / priority / window. */
.signal-filter { display: flex; flex-direction: column; gap: var(--space-6); }
.signal-filter__group { border: 0; margin: 0; padding: 0; min-width: 0; }
.signal-filter__legend {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 0; margin: 0 0 var(--space-4);
  font-size: var(--fs-micro); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary);
}
.signal-filter__legend-icon { font-size: 14px; color: var(--text-tertiary); }
.signal-filter__chips {
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
}
.signal-filter__row {
  display: flex; flex-wrap: wrap; gap: var(--space-7) var(--space-9);
  align-items: flex-start;
  border-top: 1px solid var(--divider); padding-top: var(--space-6);
}
.signal-filter__window { display: flex; flex-direction: column; }
.window-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: var(--space-2) var(--space-5);
}
.window-pill:focus-within {
  border-color: var(--bamboo-jewel-green);
  box-shadow: 0 0 0 3px rgba(0, 71, 60, 0.10);
}
.window-pill input {
  width: 44px; background: transparent; border: none; outline: none;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold); font-size: var(--fs-body);
  color: var(--text-primary); text-align: right;
}
.window-pill__unit { font-size: var(--fs-small); color: var(--text-secondary); }

/* Funnel / result summary strip above the cards. */
.feed-summary {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-5); flex-wrap: wrap;
  margin: var(--space-8) 0 var(--space-5);
}
.feed-summary__counts { margin: 0; font-size: var(--fs-small); color: var(--text-secondary); }
.feed-summary__counts .num { color: var(--text-primary); font-weight: var(--fw-semibold); }
.feed-summary__sort {
  font-size: var(--fs-small); color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: var(--space-2);
}

/* Smooth HTMX swap: the target dims while loading, and the freshly rendered
   card list fades/translates in. Both respect reduced-motion. */
#signals-table { transition: opacity var(--dur-base) var(--ease-out); }
#signals-table.htmx-request { opacity: 0.45; }
@keyframes feed-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.ticker-card-list { animation: feed-fade-in var(--dur-base) var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  #signals-table { transition: none; }
  .ticker-card-list { animation: none; }
}

/* ===========================================================================
   UI OVERHAUL — Phase 3: Testlist
   ===========================================================================
   Funnel card, sticky filter rail + results split, results table on
   .data-table with a single sort affordance and score mini-bars. Legacy
   .tl-stats / table.data rules stay until the Phase 5 cleanup.
   --------------------------------------------------------------------------- */

/* Funnel — replaces the inline .tl-stats row. One card, four steps joined
   by chevrons; the final "Shortlist" step is highlighted in jewel + lemon. */
.tl-funnel {
  display: flex; align-items: stretch; flex-wrap: wrap;
  background: var(--surface-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hairline);
  overflow: hidden; position: relative;
  margin: 0 0 var(--space-8);
}
.tl-funnel__step {
  flex: 1 1 160px;
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-6) var(--space-8);
}
.tl-funnel__label {
  font-size: var(--fs-micro); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.tl-funnel__value {
  font-size: 30px; font-weight: var(--fw-medium); line-height: 1.05;
  color: var(--bamboo-jewel-green);
  font-variant-numeric: tabular-nums;
}
.tl-funnel__sub { font-size: var(--fs-small); color: var(--text-tertiary); }
.tl-funnel__arrow {
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--space-4); color: var(--bamboo-cool-300);
  font-size: 22px; font-weight: 300;
}
.tl-funnel__step--final { background: var(--bamboo-jewel-green); }
.tl-funnel__step--final .tl-funnel__label { color: var(--bamboo-lemon-green); }
.tl-funnel__step--final .tl-funnel__value { color: #FFFFFF; }
.tl-funnel__step--final .tl-funnel__sub { color: rgba(255, 255, 255, 0.7); }
.tl-funnel__custom { position: absolute; top: var(--space-4); right: var(--space-5); }
@media (max-width: 760px) {
  .tl-funnel__arrow { display: none; }
  .tl-funnel__step { flex-basis: 45%; }
}

/* Two-column split: sticky 320px filter rail + fluid results column. */
.tl-layout {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-8); align-items: start;
}
/* The rail flows with the page rather than being a nested scroll region.
   A sticky + max-height + overflow rail traps a scroll box (and the CSS spec
   promotes the un-set axis to `auto`, which spawned a spurious horizontal
   scrollbar). Letting it scroll with the page keeps every filter reachable. */
.tl-rail { align-self: start; min-width: 0; }
.tl-results-col { min-width: 0; }
@media (max-width: 1024px) {
  .tl-layout { grid-template-columns: 1fr; }
}

/* The rail is only 320px, so collapse the form's full-width grids: stack the
   Size/Tradability pair, and lay each control row out as label-on-top with
   the control + live value underneath. */
.tl-rail .tl-multi { grid-template-columns: 1fr; }
.tl-rail .tl-row {
  grid-template-columns: 1fr auto;
  grid-template-areas: "label label" "control value";
  gap: 4px 10px;
}
.tl-rail .tl-row > label { grid-area: label; }
.tl-rail .tl-row input[type=number] { min-width: 0; }

/* Table scrolls horizontally inside its own column — the page body never does. */
.tl-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface-card);
}
.tl-table-wrap .data-table { border: 0; border-radius: 0; }
/* Inside the horizontal-scroll wrap the generic viewport-sticky header (top:
   nav height) detaches and floats mid-table, so pin it off. The funnel and
   results header already give the table context above it. */
.tl-table-wrap .data-table thead th { position: static; }
/* Keep numeric cells on one line so "26.3 / 38" never wraps mid-value. */
.tl-table-wrap .data-table td.num,
.tl-table-wrap .data-table th { white-space: nowrap; }
.tl-ticker { font-weight: var(--fw-medium); }
.tl-empty { text-align: center; padding: var(--space-9) var(--space-6); }

/* Header sort link fills the cell so the whole header is the hit target. */
.data-table th.is-sortable .th-sort {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: inherit; text-decoration: none;
}
.data-table th.is-sortable .th-sort:hover { color: var(--bamboo-jewel-green); }
.data-table th.is-sortable[aria-sort] .th-sort { color: var(--bamboo-jewel-green); }
/* Caret travels inside the link, right next to its label, so it stays put on
   right-aligned numeric headers. Suppress the generic ::after here to avoid a
   double arrow. */
.tl-table-wrap .data-table th.is-sortable[aria-sort]::after { content: none; }
.th-sort__caret { color: var(--bamboo-green); font-size: 0.85em; line-height: 1; }

/* Score cell — headline number + lemon-tracked mini bar (mockup). */
.tl-score { display: inline-flex; align-items: center; gap: var(--space-3); justify-content: flex-end; }
.tl-score__num {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold); color: var(--bamboo-jewel-green);
  min-width: 34px; text-align: right;
}
.tl-score__bar { width: 44px; flex: none; }

/* Loading swap: dim + preserve height so the layout doesn't collapse. */
#testlist-results { transition: opacity var(--dur-base) var(--ease-out); }
#testlist-results.htmx-request { opacity: 0.45; min-height: 240px; }
@media (prefers-reduced-motion: reduce) {
  #testlist-results { transition: none; }
}

/* ===========================================================================
   UI OVERHAUL — Phase 4: Ticker deep-dive
   ===========================================================================
   BASS Score promoted into a hero (score panel + TradingView rail) above the
   tabs, a headline score dial, colour-banded bucket bars, and a compact
   untracked banner. The scored_v2 data model / TradingView embed are unchanged.
   --------------------------------------------------------------------------- */

/* Full-width area chart directly under the header (clean symbol-overview
   widget, not the candle advanced chart). */
.ticker-chart {
  background: var(--surface-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hairline);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  overflow: hidden;
}
.ticker-chart .tradingview-widget-container,
.ticker-chart .tradingview-widget-container__widget {
  width: 100%; height: 400px;
}

/* Score panel head — dial + verdict + coverage chips. */
.ticker-score__head {
  display: flex; align-items: center; gap: var(--space-8);
  flex-wrap: wrap;
  margin: var(--space-3) 0 var(--space-5);
}
.ticker-score__lead { flex: 1 1 260px; min-width: 0; }
.ticker-score__verdict {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-body); line-height: 1.55; color: var(--text-primary);
  text-wrap: pretty;
}
.ticker-score__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Colour-banded bucket bars (green default; mustard 40–66%; rouge <40%). */
.bucket__bar-fill--mid { background: var(--prio-medium-fg); }
.bucket__bar-fill--low { background: var(--prio-high-fg); }

/* Company-site link with the external-link glyph. */
.ticker-header__site { display: inline-flex; align-items: center; gap: 4px; }
.ticker-header__site .icon { font-size: 13px; }

/* Compact, high-signal untracked banner (kept .untracked-banner for tests). */
.untracked-banner {
  gap: var(--space-3); align-items: center;
  margin: 0 0 var(--space-5); padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xs);
}
.untracked-banner__body { font-size: var(--fs-small); }

/* ===========================================================================
   UI OVERHAUL — Phase 5: Watchlist + Admin
   ===========================================================================
   Watchlist table on .data-table with an icon remove control and a note
   field save affordance; a reusable .table-scroll wrap for Admin tables.
   --------------------------------------------------------------------------- */

/* Reusable horizontal-scroll wrap for wide tables (page body never scrolls
   sideways). Pins the sticky header off since the wrap becomes the scroll
   context. Used by Admin's accounts / recent-runs tables. */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface-card);
}
.table-scroll .data-table { border: 0; border-radius: 0; }
.table-scroll .data-table thead th { position: static; }

.wl-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface-card);
}
.wl-table-wrap .data-table { border: 0; border-radius: 0; }
.wl-table-wrap .data-table thead th { position: static; }

/* Remove control turns rouge on hover so its intent is unmistakable. */
.wl-remove:hover { background: var(--prio-high-bg); color: var(--prio-high-fg); }

/* Inline note field — deliberate editing affordance (Phase 5). */
.wl-note-input {
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.wl-note-input:focus { box-shadow: 0 0 0 3px rgba(0, 71, 60, 0.10); }
/* On a successful save the note JS adds .wl-note-saved briefly — flash the
   ring green so the analyst sees the note stuck. */
.wl-note-input.wl-note-saved {
  border-color: var(--bamboo-green);
  box-shadow: 0 0 0 3px rgba(0, 162, 57, 0.15);
}
@media (prefers-reduced-motion: reduce) {
  .wl-note-input { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bucket__bar-fill { transition: none; }
}
