/* ============================================================
   Pulse — Design System · Blue · Grey · Orange
   Type: Space Grotesk (single family — display, UI, and numbers),
         self-hosted, no external font CDN. Numbers use tabular figures.
   ORANGE = brand identity (logo, brand moments); BLUE = actions
   (buttons, links, focus, score bars); green/red = market direction ONLY.
============================================================ */

/* ── Self-hosted Space Grotesk (variable, one file covers 300–700 via the
      wght axis). Service-worker cached, so it loads instantly and offline. ──── */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("/static/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
}

:root {
  /* ── Surfaces (grey) ──────────────────────────────── */
  --bg:           #f5f7fa;   /* app background */
  --surface:      #ffffff;   /* cards, panels, table */
  --surface-2:    #eef2f7;   /* recessed: table head, inset cards */

  /* ── Ink ──────────────────────────────────────────── */
  --ink:          #101828;   /* primary text, headings */
  --ink-soft:     #475569;   /* secondary text — ink2 */
  --muted:        #94a3b8;   /* muted / labels — ink3 (handoff spec) */
  --muted-soft:   #cbd5e1;   /* fainter dividers / non-text marks */

  /* ── Lines ────────────────────────────────────────── */
  --line:         #e3e8ef;   /* hairline borders */
  --line-strong:  #d3dae4;   /* form fields / dividers */

  /* ── Primary action · BLUE (buttons, links, focus, score bars) ──────────
     Mapped onto the app's --accent* names so every existing action re-skins. */
  --accent:       #1d4ed8;   /* primary action */
  --accent-soft:  #e8efff;   /* row hover / selected / tint bg (primaryTint) */
  --accent-deep:  #1e3a8a;   /* pressed / heading-on-tint (primaryDeep) */

  /* ── Brand identity · ORANGE (logo, halal, brand CTAs, brand moments) ──── */
  --brand:        #f2711c;
  --brand-deep:   #d95f12;   /* hover / pressed accent */
  --brand-soft:   #fff1e6;   /* tag / highlight fills */

  /* ── Market semantics (use ONLY for direction) ────── */
  --positive:     #15803d;   /* gains / upgrades / beats */
  --positive-bg:  #dcfce7;
  --negative:     #b91c1c;   /* losses / downgrades / misses */
  --negative-bg:  #fee2e2;
  --neutral:      #475569;   /* unclassified / flat */

  /* ── Tag palette (timing classifications) ─────────── */
  --tag-bmo-bg:   #cffafe;   /* before market open — cyan */
  --tag-bmo-fg:   #0e7490;

  /* ── Signal scale (5-step bull↔bear) ──────────────── */
  --sig-extreme-bull:  #15803d;
  --sig-slight-bull:   #86efac;
  --sig-neutral:       #cbd5e1;
  --sig-slight-bear:   #fbbf24;
  --sig-extreme-bear:  #ef4444;

  /* ── Status dots ──────────────────────────────────── */
  --status-success: #16a34a;
  --status-failed:  #dc2626;
  --status-running: var(--accent);

  /* ── Focus / row-wash ─────────────────────────────── */
  --focus-ring:   rgba(29,78,216,.18);   /* blue focus ring */
  --row-hover:    #e8efff;                /* table row hover wash — primaryTint */

  /* ── Type families — Space Grotesk single family (numbers use tabular-nums,
     applied globally below). --font-mono kept as a token for numeric runs. ── */
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-sans:    "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono:    "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-brand:   "Space Grotesk", system-ui, -apple-system, sans-serif;

  /* ── Type scale ───────────────────────────────────── */
  --fs-micro: 12px; --fs-tiny: 13px; --fs-xs: 14px; --fs-sm: 15px;
  --fs-base: 16px; --fs-md: 16px; --fs-lg: 19px; --fs-xl: 23px; --fs-2xl: 27px;

  /* ── Weights / line-heights / tracking ────────────── */
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; --fw-black: 700;
  --lh-tight: 1.1; --lh-snug: 1.4; --lh-normal: 1.5; --lh-relaxed: 1.6;
  --tracking-display: -.02em; --tracking-tight: -.02em;
  --tracking-label: .16em; --tracking-tag: .1em;

  /* ── Radius ───────────────────────────────────────── */
  --r-sm:   6px;
  --r:      10px;
  --r-lg:   16px;
  --r-pill: 999px;

  /* ── Shadows (soft, downward — border-led UI; use sparingly) ── */
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 6px 16px rgba(16,24,40,.05);
  --shadow:    0 4px 12px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.14);

  /* ── Motion ───────────────────────────────────────── */
  --ease:      cubic-bezier(.2,.7,.2,1);
  --dur-fast:  .12s;
  --dur:       .15s;
  --dur-slow:  .25s;

  /* ── Layout ───────────────────────────────────────── */
  --sidebar-w:    220px;
  --sidebar-w-sm: 60px;
  --content-max:  1480px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Space Grotesk is a single family for text + numbers; tabular figures keep
     price/%/ticker/date columns aligned everywhere (handoff spec). */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; }
input  { font: inherit; }

/* ── Global polish (safe, additive) ───────────────────────────────────────── */
::selection { background: var(--accent-soft); color: var(--accent-deep); }

/* Keyboard-only focus ring — visible for tab users, invisible on mouse click. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* Thin, unobtrusive slate scrollbars so long tables/panels read cleaner. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ===========================================
   Auth page
=========================================== */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 0% -20%, rgba(37,99,235,.12), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(148,163,184,.10), transparent 60%),
    var(--bg);
}
.auth-shell {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 24px;
  padding: 32px 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-logo img { max-width: 200px; }
.auth-card .muted { margin: 0 0 24px; color: var(--muted); }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 6px; }
.auth-card label span { font-size: 14px; color: var(--ink-soft); font-weight: 500; letter-spacing: .03em; text-transform: uppercase; }
.auth-card input {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 12px 14px;
  font-size: 16px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.auth-card .alert {
  background: var(--negative-bg);
  color: var(--negative);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 15px;
  margin-bottom: 12px;
}
.btn-primary {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--r);
  padding: 13px 16px;
  font-weight: 600;
  font-size: 16px;
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.btn-primary:hover { background: var(--accent-deep); transform: translateY(-1px); }

/* Accent (ORANGE) button — brand / CTA moments ("Log this trade") */
.btn-accent {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-weight: 600;
  transition: transform .12s var(--ease), background .15s var(--ease);
}
.btn-accent:hover { background: var(--brand-deep); transform: translateY(-1px); }
.auth-footer { text-align: center; color: var(--muted); font-size: 14px; font-family: var(--font-mono); }
.auth-footer-fixed {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  opacity: 0.7;
  white-space: nowrap;
}


/* ===========================================
   App shell
=========================================== */

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.brand svg { color: var(--accent); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -.015em;
}
.brand-tag {
  margin-left: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}
.header-actions { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 7px 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  transition: all .15s var(--ease);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-ghost.spinning { opacity: .6; pointer-events: none; }
.btn-link {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 15px;
}
.btn-link:hover { color: var(--ink); }

/* Run strip */
.run-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.run-strip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 22px;
}
.metric { display: grid; gap: 4px; }
.metric-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
}
.metric-value {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  color: var(--ink);
  letter-spacing: -.01em;
}

/* Filters */
.filters {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin: 14px 0 12px;
}
.filter-group { display: grid; gap: 6px; }
.filter-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--line-strong); }
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.search {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 8px 12px;
  font-size: 15px;
  min-width: 220px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-sm);
}
.results-table {
  width: 100%;
  border-collapse: collapse;
}
.results-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.results-table thead th:hover { color: var(--ink); }
.results-table thead th.sort-asc::after  { content: " ↑"; color: var(--accent); }
.results-table thead th.sort-desc::after { content: " ↓"; color: var(--accent); }
.results-table th.num, .results-table td.num { text-align: right; }
.results-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  vertical-align: middle;
}
.results-table tbody tr { transition: background .12s var(--ease); }
.results-table tbody tr:hover { background: var(--row-hover); }
.results-table tbody tr:last-child td { border-bottom: 0; }

.rank-cell  { font-family: var(--font-mono); color: var(--muted); font-size: 14px; }
.sym-cell { font-weight: 700; font-size: 16px; letter-spacing: -.005em; white-space: nowrap; }
.sym-cell .halal-moon { display: inline-block; vertical-align: middle; }

.timing-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: var(--pe-neutral-bg, #f1f5f9);
  color: var(--pe-neutral-text, #475569);
  vertical-align: middle;
  font-family: var(--font-sans);
}
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.tag-amc { background: var(--accent-soft); color: var(--accent-deep); }
.tag-bmo { background: #e0f2fe; color: #075985; }
.tag-dmh { background: var(--negative-bg); color: var(--negative); }
.tag-unknown { background: #f3f4f6; color: var(--neutral); }

.entry-when {
  font-size: 14px;
  color: var(--ink-soft);
}
.entry-today {
  color: var(--accent-deep);
  font-weight: 600;
}

.score-bar {
  position: relative;
  display: inline-block;
  min-width: 38px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink);
}
.score-bar::before {
  content: "";
  position: absolute;
  left: -8px; right: -8px; top: -3px; bottom: -3px;
  background: linear-gradient(90deg, rgba(37,99,235,.16), rgba(37,99,235,.04));
  border-radius: 4px;
  z-index: -1;
}

.actions-cell { display: flex; gap: 6px; }
.btn-action {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: .03em;
  transition: all .14s var(--ease);
  white-space: nowrap;
}
.btn-action:hover {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-style: italic;
}

.app-footer {
  margin-top: 22px;
  text-align: center;
}
.muted { color: var(--muted); }


/* ===========================================
   Modal
=========================================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,.36);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s var(--ease);
}
.modal-wide .modal-card { max-width: 1100px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-soft);
  z-index: 1;
}
.modal-close:hover { color: var(--accent-deep); border-color: var(--accent); }
.modal-body { padding: 36px 36px 30px; }

@keyframes modal-in {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* Watch window inner */
.ww h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 27px;
  letter-spacing: -.015em;
  margin: 0 0 4px;
}
.ww h2 .ticker { color: var(--accent-deep); font-weight: 700; }
.ww .sub { color: var(--muted); font-size: 15px; margin-bottom: 24px; }
.ww-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}
.ww-section h3 {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.ww-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}
.ww-stat .stat-label {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .06em;
}
.ww-stat .stat-val {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 23px;
  letter-spacing: -.01em;
  margin-top: 2px;
}
.ww-stat .stat-sub { color: var(--muted); font-size: 14px; font-family: var(--font-mono); }

.ww-trade {
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-top: 16px;
}
.ww-trade .row {
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
  font-size: 15px;
}
.ww-trade .row strong { font-family: var(--font-mono); color: var(--ink); }
.ww-trade .note {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.ww-unreliable {
  background: var(--negative-bg);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--negative);
  margin-bottom: 14px;
}

.ww-points {
  margin-top: 12px;
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 14px;
}
.ww-points th, .ww-points td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.ww-points th { color: var(--muted); font-weight: 500; }


/* Details modal styles */
.dt h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 27px;
  letter-spacing: -.015em;
  margin: 0;
}
.dt h2 .ticker { color: var(--accent-deep); font-weight: 700; }
.dt .company {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 22px;
}
.dt-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.dt-tab {
  background: none;
  border: 0;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all .15s var(--ease);
}
.dt-tab:hover { color: var(--ink); }
.dt-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.dt-pane { display: none; }
.dt-pane.active { display: block; }

.dt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.dt-card {
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 14px 18px;
}
.dt-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.dt-card .big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 25px;
  letter-spacing: -.01em;
}
.dt-row {
  display: flex; justify-content: space-between;
  font-size: 15px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.dt-row:last-child { border-bottom: 0; }
.dt-row span:first-child { color: var(--muted); }
.dt-row span:last-child { font-family: var(--font-mono); color: var(--ink); }

.dt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.dt-table th, .dt-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.dt-table th { color: var(--muted); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.dt-table td.num { font-family: var(--font-mono); text-align: right; }
.beat-pos { color: var(--positive); }
.beat-neg { color: var(--negative); }

.dt-news {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.dt-news-item {
  border-left: 2px solid var(--accent);
  padding: 8px 14px;
}
.dt-news-item .date { font-size: 13px; color: var(--muted); font-family: var(--font-mono); }
.dt-news-item .title { font-size: 15px; font-weight: 500; margin-top: 2px; }

.dt-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.dt-pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  font-family: var(--font-mono);
}

/* Sector performance */
.sect-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.sect-row:last-child { border-bottom: 0; }
.sect-pos { color: var(--positive); font-family: var(--font-mono); }
.sect-neg { color: var(--negative); font-family: var(--font-mono); }

@media (max-width: 920px) {
  .run-strip-row { grid-template-columns: repeat(2, 1fr); }
  .dt-grid { grid-template-columns: 1fr; }
  .ww-grid { grid-template-columns: 1fr; }
  .app-shell { padding: 16px; }
  .results-table { font-size: 14px; }
  .results-table tbody td, .results-table thead th { padding: 8px 10px; }
}


/* ===========================================
   Historical run banner
=========================================== */

.history-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(37,99,235,.3);
  border-radius: var(--r);
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 15px;
  color: var(--accent-deep);
  font-weight: 500;
}
.history-banner-close {
  background: none;
  border: 1px solid rgba(194,65,12,.3);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 14px;
  color: var(--accent-deep);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all .14s var(--ease);
}
.history-banner-close:hover {
  background: var(--accent-deep);
  color: #fff;
  border-color: var(--accent-deep);
}


/* ===========================================
   History modal
=========================================== */

.history-modal-body {
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.history-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.history-search-section {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.history-search-input {
  width: 100%;
  min-width: unset;
  margin-bottom: 12px;
}
.history-search-results { margin-top: 4px; }

.history-runs-section { display: flex; flex-direction: column; gap: 12px; }

/* Shared history table */
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.hist-table thead th {
  background: var(--surface-2);
  padding: 9px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.hist-table thead th.num { text-align: right; }
.hist-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 15px;
}
.hist-table tbody td.num { text-align: right; font-family: var(--font-mono); }
.hist-table tbody tr:last-child td { border-bottom: 0; }
.hist-table tbody tr.hist-row {
  cursor: pointer;
  transition: background .12s var(--ease);
}
.hist-table tbody tr.hist-row:hover { background: var(--row-hover); }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
.status-dot-success { background: #16a34a; }
.status-dot-failed  { background: #dc2626; }
.status-dot-running { background: var(--accent); animation: pulse-dot 1.2s ease-in-out infinite; }

/* Pagination */
.history-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding-top: 4px;
}
.hist-page-label {
  font-size: 15px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  min-width: 100px;
  text-align: center;
}
.hist-page-btn { padding: 6px 14px; font-size: 15px; }


/* ===========================================
   Run indicator dot
=========================================== */

.run-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1;  transform: scale(1); }
  50%       { opacity: .4; transform: scale(.7); }
}


/* ===========================================
   Run modal — phase-based progress (shared by both screeners)
=========================================== */

.run-modal-content {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.run-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 56px 14px 24px;
  border-bottom: 1px solid var(--line);
}
.run-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
}
.run-meta {
  margin-left: auto;
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}
.phase-list {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}
.phase-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.phase-row:last-child { border-bottom: 0; }
.phase-status {
  font-family: var(--font-mono);
  width: 20px;
  text-align: center;
  font-weight: 600;
  flex-shrink: 0;
}
.phase-label {
  flex: 1;
  color: var(--ink);
}
.phase-detail {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-soft);
  text-align: right;
}
.phase-row.waiting   .phase-status { color: var(--ink-soft); opacity: .55; }
.phase-row.waiting   .phase-label  { color: var(--ink-soft); }
.phase-row.running   .phase-status { color: var(--accent-deep); }
.phase-row.running   .phase-label  { color: var(--ink); font-weight: 500; }
.phase-row.done      .phase-status { color: #16a34a; }
.phase-row.failed    .phase-status,
.phase-row.cancelled .phase-status { color: #dc2626; }
.phase-row.phase-skipped { opacity: .3; }

.phase-spinner {
  display: inline-block;
  animation: phase-spin 1s linear infinite;
}
@keyframes phase-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.raw-log-collapse {
  border-top: 1px solid var(--line);
  padding: 8px 24px 0;
}
.raw-log-collapse summary {
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
  padding: 6px 0;
  user-select: none;
  list-style: none;
}
.raw-log-collapse summary::-webkit-details-marker { display: none; }
.raw-log-collapse summary::before {
  content: "▸ ";
  display: inline-block;
  width: 12px;
  transition: transform .12s var(--ease);
}
.raw-log-collapse[open] summary::before { content: "▾ "; }
.run-raw-log {
  margin: 0 0 8px;
  padding: 12px;
  background: #0d0d0f;
  border: 1px solid #1e1e22;
  border-radius: var(--r);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.run-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 24px 18px;
  border-top: 1px solid var(--line);
}
.btn-warn {
  background: rgba(234,88,12,.08);
  border: 1px solid #ea580c;
  border-radius: var(--r);
  padding: 7px 16px;
  color: #ea580c;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.btn-warn:hover { background: #ea580c; color: #fff; }
.btn-warn:disabled { opacity: .55; pointer-events: none; }

/* ── News feed ────────────────────────────────────────────────────────────── */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.news-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
  transition: border-color .15s var(--ease);
}
.news-card:hover { border-color: var(--line-strong); }
.news-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 5px;
}
.news-source {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.news-date {
  font-size: 13px;
  color: var(--muted);
}
.news-title {
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
}
.news-title:hover { text-decoration: underline; }
.news-preview {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Trade Setup signals ──────────────────────────────────────────────────── */
.signal-stance {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.signal-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}
.signal-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.signal-dot.extreme-bullish  { background: #15803d; }
.signal-dot.slightly-bullish { background: #86efac; }
.signal-dot.neutral          { background: #d1d5db; }
.signal-dot.slightly-bearish { background: #fbbf24; }
.signal-dot.extreme-bearish  { background: #ef4444; }
.signal-stance-text {
  font-size: 15px;
  color: var(--ink);
}
.signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) { .signal-grid { grid-template-columns: 1fr; } }
.signal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
}
.signal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}
.signal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.score-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.score-badge.extreme-bullish  { background: #14532d; color: #fff; }
.score-badge.slightly-bullish { background: var(--positive-bg); color: var(--positive); }
.score-badge.neutral          { background: #f3f4f6; color: #6b7280; }
.score-badge.slightly-bearish { background: #fef3c7; color: #92400e; }
.score-badge.extreme-bearish  { background: var(--negative-bg); color: var(--negative); }
.signal-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  margin-bottom: 5px;
}
.signal-interp {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Post-earnings drift ──────────────────────────────────────────────────── */
.drift-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ── New-run notification badge ───────────────────────────────────────────── */
.btn-ghost.has-badge { position: relative; }
.btn-ghost.has-badge::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #dc2626;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* =============================================================
   Trade Journal
============================================================= */

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  max-width: 320px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  pointer-events: auto;
}
.toast.toast-visible { opacity: 1; transform: translateY(0); }
.toast.toast-success { border-left: 3px solid var(--positive); color: var(--positive); }
.toast.toast-error   { border-left: 3px solid var(--negative); color: var(--negative); }
.toast.toast-info    { border-left: 3px solid var(--accent); }

/* ── Trade form ─────────────────────────────────────────────── */
.trade-form-wrap { padding: 4px 0; }
.trade-modal-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 14px;
}
.trade-context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
}
.ctx-item { display: flex; gap: 6px; align-items: baseline; }
.ctx-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ctx-val   { font-size: 15px; font-weight: 600; font-family: var(--font-mono); }

.trade-form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 5px; }
.form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .02em;
}
.form-req { color: var(--negative); }
.form-opt { color: var(--muted); font-weight: 400; }
.form-input, .form-textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font: inherit;
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 72px; }
select.form-input { cursor: pointer; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 9px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-deep); }

/* ── Dual-timezone picker ───────────────────────────────────── */
.tz-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.tz-utc-display {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.tz-field { display: flex; flex-direction: column; gap: 4px; }
.tz-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tz-date, .tz-time {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font: inherit;
  font-size: 14px;
  font-family: var(--font-mono);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.tz-date:focus, .tz-time:focus { border-color: var(--accent); }

/* ── Confidence dot picker ──────────────────────────────────── */
.conf-dots { display: flex; gap: 8px; }
.conf-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background .12s;
}
.conf-dot.filled { background: var(--accent); }
.conf-dot:hover  { background: var(--accent-soft); }
.conf-dot.filled:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

/* ── Late-log pill ──────────────────────────────────────────── */
.late-log-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Trades list table ──────────────────────────────────────── */
.tl-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
}
.tl-tab {
  background: none;
  border: none;
  padding: 8px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tl-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tl-tab:hover  { color: var(--ink-soft); }

.tl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.tl-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tl-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tl-table tr:last-child td { border-bottom: none; }
.tl-row { cursor: pointer; }
.tl-row:hover td { background: var(--surface-2); }
.btn-close-trade {
  font-size: 14px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--negative);
  font-weight: 600;
  transition: background .12s;
}
.btn-close-trade:hover { background: var(--negative-bg); }

/* ── Trade detail panel ─────────────────────────────────────── */
.trade-detail { padding: 4px 0; }

@media (max-width: 640px) {
  .tz-picker { grid-template-columns: 1fr; }
  .trade-context-bar { flex-direction: column; gap: 8px; }
}


/* ===========================================
   Responsive — tablet (≤768px) and phone (≤480px)
   Desktop layout is untouched above these breakpoints.
=========================================== */

@media (max-width: 768px) {
  .app-shell { padding: 12px 12px 48px; }

  /* Header: wrap instead of overflow */
  .app-header { flex-wrap: wrap; gap: 10px; }
  .header-actions { flex-wrap: wrap; gap: 6px; }

  /* Table: horizontal scroll wrapper */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modals: full-width, anchored to bottom, scrollable */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .modal-wide .modal-card { max-width: 100%; }
  .modal-body { padding: 24px 16px 20px; }
  .history-modal-body { padding: 20px 16px 16px; }
}

@media (max-width: 480px) {
  /* Run strip: stack vertically */
  .run-strip-row { grid-template-columns: 1fr; gap: 8px; }
  .metric-value { font-size: 19px; }

  /* Filters: stack vertically */
  .filters { flex-direction: column; align-items: stretch; }
  .search { min-width: unset; width: 100%; }

  /* Brand tag: hide to save space */
  .brand-tag { display: none; }
}


/* ===========================================
   OHLC expandable detail row
=========================================== */

/* Expand chevron in the rank cell */
.expand-btn {
  background: none;
  border: none;
  padding: 0;
  margin-right: 5px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  transition: transform .15s var(--ease), color .15s var(--ease);
}
.expand-btn:hover { color: var(--accent); }
.expand-btn.expanded {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Detail row */
.ohlc-detail-row td.ohlc-detail-cell {
  background: var(--surface-2);
  padding: 0;
  border-bottom: 1px solid var(--line);
}

/* Two-column layout: T-0 and T-1 side by side */
.ohlc-detail-wrap {
  display: flex;
  gap: 28px;
  padding: 16px 20px 18px;
}
.ohlc-unavail {
  margin: 0;
  padding: 14px 20px;
  font-style: italic;
}
.ohlc-half {
  flex: 1;
  min-width: 0;
}
.ohlc-half-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.ohlc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ohlc-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.ohlc-table th:not(:first-child) { text-align: right; }
.ohlc-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.ohlc-table tbody tr:last-child td { border-bottom: 0; }
.ohlc-date { color: var(--ink-soft); white-space: nowrap; }
.ohlc-nodata {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-sans);
}
.ohlc-score-line {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: right;
  font-family: var(--font-mono);
}
.ohlc-score-line strong { color: var(--ink); }

@media (max-width: 768px) {
  .ohlc-detail-wrap { flex-direction: column; gap: 16px; }
}


/* =============================================================
   App layout — sidebar + main area (Stage 2 restructure)
============================================================= */

body.app-layout { overflow-x: hidden; }

.layout-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────── */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  padding: 24px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 200;
  transition: transform 0.25s var(--ease);
}

/* Logo area */
.sidebar-brand {
  margin-bottom: 24px;
}
.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
/* Mark (orange tile) + HTML wordmark in real Space Grotesk — the lockup SVG's
   text can't load the webfont when used as <img>, so the wordmark is markup. */
.brand-mark { display: block; width: 34px; height: 34px; flex: 0 0 auto; }
.brand-word {
  font-family: var(--font-brand); font-weight: 700; font-size: 24px;
  letter-spacing: -.02em; color: var(--ink); line-height: 1;
}
/* legacy aliases (kept so any old markup still renders the mark) */
.logo-full  { display: none; }
.logo-mark  { display: block; width: 34px; height: auto; }

/* Version chip */
.sidebar-version {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  opacity: 0.6;
  text-transform: uppercase;
  margin-top: 4px;
  margin-bottom: 0;
}

/* Nav items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 16px;
  font-weight: 400;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--ink);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 500;
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
.nav-item svg { flex-shrink: 0; }

/* ── Sidebar overlay (mobile) ─────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,.4);
  z-index: 190;
}
.sidebar-overlay.overlay-open { display: block; }

/* ── Main wrapper ─────────────────────────────────── */

.main-wrapper {
  flex: 1;
  margin-left: 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top bar */
.main-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.hamburger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-right: auto;
}
.hamburger:hover { border-color: var(--accent); color: var(--accent-deep); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main content */
.main-area {
  padding: 24px 32px;
  flex: 1;
}

/* ── Page header + breadcrumb ─────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--ink-soft);
}
.breadcrumb-link {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.12s;
}
.breadcrumb-link:hover { color: var(--ink); }
.breadcrumb-sep { color: var(--muted); user-select: none; }
.breadcrumb-current { color: var(--ink); font-weight: 500; }

/* ── Screeners landing cards ──────────────────────── */

.screeners-grid {
  display: grid;
  /* Responsive auto-fill: ~4-5 compact cards per row on wide screens, reflowing
     down to fewer as the viewport narrows. */
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 1280px;
}

.screener-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.screener-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.screener-card:hover .card-icon {
  background: var(--accent);
  color: #fff;
}
.screener-card-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Icon sits in a soft rounded accent tile that fills on hover. */
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  line-height: 1;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.card-icon svg { width: 21px; height: 21px; }
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-desc {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  flex: 1;
  /* Clamp to keep card heights even regardless of description length. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-cta {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent-deep);
  margin-top: 2px;
}
.card-coming-soon {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ── Placeholder pages ────────────────────────────── */

.placeholder-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  text-align: center;
  gap: 16px;
}
.placeholder-icon { color: var(--accent); opacity: 0.7; }
.placeholder-title {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
}
.placeholder-desc { margin: 0; }

/* ── Responsive collapse ──────────────────────────── */

/* Tablet (≤768px): sidebar icon-only, labels hidden */
@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 16px 8px; }
  .brand-word { display: none; }             /* collapsed: mark only */
  .sidebar-logo-link { justify-content: center; }
  .logo-mark { display: block; }
  .sidebar-version { display: none; }
  .nav-item { justify-content: center; padding: 12px 8px; gap: 0; }
  .nav-label { display: none; }
  .nav-item.active { border-left: 3px solid var(--accent); padding-left: 5px; }
  .main-wrapper { margin-left: 60px; }
  .main-topbar { padding: 10px 16px; }
  .main-area { padding: 16px; }
  /* keep the compact cards responsive on tablet/phone — smaller min so 2-4 fit
     by available width, collapsing to 1 only on the narrowest screens. */
  .screeners-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 12px; }
}

/* Phone (≤480px): sidebar fully hidden, hamburger shown */
@media (max-width: 480px) {
  .sidebar {
    width: 220px;
    padding: 24px 16px;
    transform: translateX(-100%);
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.sidebar-open .brand-word { display: block; }
  .sidebar.sidebar-open .sidebar-logo-link { justify-content: flex-start; }
  .sidebar.sidebar-open .sidebar-version { display: block; }
  .sidebar.sidebar-open .nav-item { justify-content: flex-start; padding: 10px 12px; gap: 12px; }
  .sidebar.sidebar-open .nav-label { display: inline; }
  .sidebar.sidebar-open .nav-item.active { padding-left: 9px; }
  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }
  .main-area { padding: 12px; }
}


/* ============================================================
   Halal Checker
============================================================ */

/* Search bar */
.halal-search-bar {
  max-width: 560px;
  margin-bottom: 24px;
}

.halal-search-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.halal-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.halal-search-icon {
  flex-shrink: 0;
  margin: 0 10px 0 14px;
  color: var(--muted);
}

.halal-search-input {
  flex: 1;
  min-height: 44px;
  padding: 0 8px;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 16px;
  background: transparent;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.halal-search-input::placeholder { text-transform: none; letter-spacing: 0; color: var(--muted); }

.halal-search-btn {
  margin: 0;
  height: auto;
  padding: 0 22px;
  border-radius: 0;
  border-left: 1.5px solid var(--line-strong);
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.halal-input-error {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--negative);
  min-height: 18px;
}

/* Recent pills */
.halal-recent-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.halal-recent-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.halal-recent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.halal-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .03em;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.halal-pill:hover { border-color: var(--accent); background: var(--accent-soft); }

.halal-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.halal-pill[data-verdict="COMPLIANT"]       .halal-pill-dot { background: #16a34a; }
.halal-pill[data-verdict="NON_COMPLIANT"]   .halal-pill-dot { background: #dc2626; }
.halal-pill[data-verdict="QUESTIONABLE"]    .halal-pill-dot { background: #d97706; }

/* Loading */
.halal-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  font-size: 16px;
  color: var(--muted);
}

.halal-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* Verdict banner */
.halal-verdict-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  margin-bottom: 24px;
  border: 1.5px solid transparent;
}

.halal-verdict-banner.compliant {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}

.halal-verdict-banner.non-compliant {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.halal-verdict-banner.questionable {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.halal-verdict-icon {
  font-size: 29px;
  line-height: 1;
  flex-shrink: 0;
}

.halal-verdict-body { flex: 1; }

.halal-verdict-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 2px;
}

.halal-verdict-name {
  font-size: 23px;
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1.1;
}

.halal-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font-mono);
  background: rgba(255,255,255,.6);
  border: 2px solid currentColor;
  flex-shrink: 0;
}

/* Cards */
.halal-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.halal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
}

.halal-card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

/* Qualitative verdict badge */
.halal-qual-verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 10px;
}

.halal-qual-verdict.pass    { background: #dcfce7; color: #166534; }
.halal-qual-verdict.fail    { background: #fee2e2; color: #991b1b; }
.halal-qual-verdict.questionable { background: #fef9c3; color: #854d0e; }

/* Ratio table */
.halal-ratio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.halal-ratio-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 8px;
}

.halal-ratio-table td {
  padding: 6px 0;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.halal-ratio-table td:last-child { text-align: right; }

.halal-ratio-name { color: var(--ink-soft); }

.halal-ratio-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.halal-ratio-pass   { color: #16a34a; }
.halal-ratio-fail   { color: #dc2626; }
.halal-ratio-questionable { color: #d97706; }

.halal-ratio-bar-wrap {
  width: 80px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}

.halal-ratio-bar {
  height: 100%;
  border-radius: 2px;
  transition: width .3s var(--ease);
}

.halal-ratio-bar.pass   { background: #16a34a; }
.halal-ratio-bar.fail   { background: #dc2626; }
.halal-ratio-bar.questionable { background: #d97706; }

/* Purification card */
.halal-purif-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.halal-purif-icon {
  font-size: 23px;
  flex-shrink: 0;
  margin-top: 2px;
}

.halal-purif-body { flex: 1; }
.halal-purif-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.halal-purif-text  { font-size: 15px; color: var(--ink-soft); line-height: 1.5; }

/* Methodology footer */
.halal-methodology {
  margin-top: 32px;
  padding: 16px 20px;
  background: var(--surface-2);
  border-radius: var(--r);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.halal-methodology strong { color: var(--ink-soft); }

/* Meta row */
.halal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--muted);
}

.halal-meta-company { font-weight: 600; color: var(--ink-soft); font-size: 16px; }
.halal-meta-symbol  { font-family: var(--font-mono); font-size: 15px; }

/* Qual text */
.halal-qual-reason { font-size: 15px; color: var(--ink-soft); line-height: 1.5; margin-top: 8px; }
.halal-qual-industry { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* Responsive */
@media (max-width: 640px) {
  .halal-cards { grid-template-columns: 1fr; }
  .halal-ratio-bar-wrap { display: none; }
}

/* Halal icon in screener table */
.halal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform .1s;
  vertical-align: middle;
}
.halal-icon:hover { transform: scale(1.2); }
.halal-icon.compliant     { color: #16a34a; }
.halal-icon.questionable  { color: var(--accent); }
.halal-icon.non-compliant { color: #dc2626; }
.halal-icon.unknown       { color: var(--muted); }
.halal-moon { display: block; flex-shrink: 0; }
.halal-icon.unknown .halal-moon { opacity: .5; }

/* ===========================================
   Bounce Screener — drop severity colours
=========================================== */

.drop-moderate { color: #d97706; font-weight: 600; }
.drop-large    { color: #ea580c; font-weight: 600; }
.drop-extreme  { color: #dc2626; font-weight: 600; }
.drop-panic    { color: #9f1239; font-weight: 700; }

/* Status tags */
.status-tag {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: var(--r-sm);
  padding: 2px 8px;
}

.status-watching {
  background: #dbeafe;
  color: #1e40af;
}

.status-bouncing {
  background: #dcfce7;
  color: #166534;
}

/* ===========================================
   Attribution chips
=========================================== */

.attr-cell { white-space: nowrap; }

.attr-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  margin-right: 3px;
  vertical-align: middle;
  transition: opacity .1s;
}
.attr-chip:hover { opacity: .8; }

.attr-sector    { background: #dbeafe; color: #1d4ed8; }
.attr-market    { background: #e5e7eb; color: #374151; }
.attr-earnings  { background: #ede9fe; color: #6d28d9; }
.attr-downgrade { background: #ffedd5; color: #c2410c; }
.attr-guidance  { background: #ffedd5; color: #c2410c; }
.attr-fda       { background: #fee2e2; color: #b91c1c; }
.attr-legal     { background: #fee2e2; color: #b91c1c; }
.attr-mgmt      { background: #fef3c7; color: #92400e; }
.attr-short     { background: #fee2e2; color: #b91c1c; }
.attr-customer  { background: #ffedd5; color: #c2410c; }
.attr-insider   { background: #ffedd5; color: #c2410c; }
.attr-unknown   { background: #f3f4f6; color: #6b7280; }
.attr-more      { background: #f3f4f6; color: #374151; font-size: 12px; }

/* ===========================================
   Attribution modal
=========================================== */

.attr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.attr-modal[hidden] { display: none; }

.attr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.attr-modal-box {
  position: relative;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: min(560px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.attr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.attr-modal-sym {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.attr-modal-close {
  background: none;
  border: none;
  font-size: 21px;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
  line-height: 1;
}
.attr-modal-close:hover { color: var(--ink); }

.attr-modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.attr-evidence-card {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.attr-evidence-header {
  background: var(--surface-raised);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  color: var(--ink-soft);
  letter-spacing: .03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.attr-evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.attr-evidence-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.4;
}
.attr-evidence-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
  width: 110px;
}
.attr-evidence-table tr:last-child td {
  border-bottom: none;
}
.attr-evidence-table a {
  color: var(--accent);
  text-decoration: none;
}
.attr-evidence-table a:hover { text-decoration: underline; }

body.modal-open { overflow: hidden; }


/* ===========================================
   Bounce Stage 2C — Score column + breakdown modal
=========================================== */

.score-cell {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s var(--ease);
}
.score-cell:hover { border-color: var(--accent); }
.score-cell.score-strong { background: rgba(22, 163, 74, .12); border-color: #16a34a; color: #15803d; }
.score-cell.score-good   { background: rgba(234, 179, 8,  .12); border-color: #ca8a04; color: #a16207; }
.score-cell.score-fair   { background: rgba(100, 116, 139, .10); border-color: #94a3b8; color: #475569; }
.score-cell.score-weak   { background: rgba(220, 38, 38,  .08); border-color: #fca5a5; color: #b91c1c; }
.score-cell.score-na     { color: var(--ink-soft); border-style: dashed; }

.provisional-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  border-radius: 3px;
  background: rgba(234, 88, 12, .12);
  border: 1px solid #ea580c;
  color: #ea580c;
  vertical-align: middle;
}

.stale-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ea580c;
  margin-right: 5px;
  vertical-align: middle;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.score-breakdown {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 15px;
}
.score-row {
  display: grid;
  grid-template-columns: 180px 60px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.score-row:last-child { border-bottom: 0; }
.score-row-label { color: var(--ink); }
.score-row-value {
  text-align: right;
  font-weight: 600;
  color: var(--ink);
}
.score-row-notes {
  font-size: 14px;
}
.score-row-total {
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  margin-top: 4px;
  padding-top: 12px;
}
.score-row-total .score-row-label,
.score-row-total .score-row-value {
  font-weight: 700;
  font-size: 16px;
}


/* ============================================================
   Pre-Earnings Detail Modal — v2 redesign
   ----------------------------------------------------------------
   Modern card-driven layout. The static markup lives in
   web/templates/dashboard.html under #pre-earnings-detail-modal;
   web/static/js/app.js handles population.

   Full HTML reference (HUBG example) — kept in sync with the
   template scaffold above:

     <div id="pre-earnings-detail-modal" class="pe-modal">
       <div class="pe-modal-backdrop" data-close-detail></div>
       <div class="pe-modal-box">
         <header class="pe-modal-header">
           <div class="pe-modal-header-left">
             <h2 class="pe-modal-symbol">HUBG</h2>
             <span class="pe-modal-sep"></span>
             <div class="pe-modal-halal"><svg.../>COMPLIANT (B)</div>
             <span class="pe-modal-sep"></span>
             <span class="pe-modal-meta">Industrials · Integrated Freight</span>
             <span class="pe-modal-sep"></span>
             <span class="pe-modal-meta">$2.5B</span>
           </div>
           <button class="pe-modal-close">×</button>
         </header>
         <div class="pe-modal-scroll">
           <section class="pe-hero" data-band="extreme">
             <div class="pe-hero-score">10<span class="pe-hero-score-denom">/ 10</span></div>
             <div class="pe-hero-mid">
               <div class="pe-hero-band">EXTREME</div>
               <div class="pe-hero-drift">↑ +7.8% Q1 drift</div>
             </div>
             <div class="pe-hero-cta">
               <button class="pe-btn-primary">📓 Log this trade</button>
             </div>
           </section>
           <section class="pe-grid">
             <div class="pe-col">
               <article class="pe-card">…upcoming earnings…</article>
               <article class="pe-card">…sector context…</article>
             </div>
             <div class="pe-col">
               <article class="pe-card">…technical context…</article>
               <article class="pe-card">…score breakdown…</article>
             </div>
           </section>
           <section class="pe-quarters">
             <article class="pe-card pe-quarter-card">…Q1…</article>
             <article class="pe-card pe-quarter-card">…Q2…</article>
           </section>
         </div>
       </div>
     </div>
============================================================ */

:root {
  --pe-success:      #16a34a;
  --pe-success-bg:   #dcfce7;
  --pe-danger:       #dc2626;
  --pe-danger-bg:    #fee2e2;
  --pe-warn:         #d97706;
  --pe-warn-bg:      #fef3c7;
  --pe-info:         #2563eb;
  --pe-info-bg:      #dbeafe;
  --pe-neutral-bg:   #f1f5f9;
  --pe-neutral-text: #475569;

  /* Band gradients for the hero band */
  --pe-band-extreme:     linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  --pe-band-very-strong: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --pe-band-strong:      #16a34a;
  --pe-band-notable:     #22c55e;
  --pe-band-weak:        #475569;
  --pe-band-none:        #64748b;
}

/* ---- Outer modal ------------------------------------------------ */

.pe-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pe-fade-in 200ms var(--ease);
}
.pe-modal[hidden] { display: none; }

.pe-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 24, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pe-modal-box {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  width: min(1100px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 30px 80px -10px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  animation: pe-slide-up 250ms var(--ease) 50ms backwards;
}

@keyframes pe-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pe-slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Section 1: Sticky header ----------------------------------- */

.pe-modal-header {
  height: 80px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.pe-modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.pe-modal-symbol {
  font-family: var(--font-mono);
  font-size: 29px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.02em;
}

.pe-modal-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.pe-modal-halal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--pe-success);
}
.pe-modal-halal .halal-moon { color: var(--pe-success); }

.pe-modal-meta {
  font-size: 15px;
  color: var(--muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pe-modal-close {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 120ms var(--ease);
  flex-shrink: 0;
}
.pe-modal-close:hover {
  color: var(--ink);
  background: var(--line);
}

/* ---- Scrollable body ------------------------------------------- */

.pe-modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: var(--bg);
}

/* ---- Section 2: Hero score band -------------------------------- */

.pe-hero {
  min-height: 120px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  color: #fff;
  background: var(--pe-band-none);
}
.pe-hero[data-band="extreme"]     { background: var(--pe-band-extreme); }
.pe-hero[data-band="very_strong"] { background: var(--pe-band-very-strong); }
.pe-hero[data-band="strong"]      { background: var(--pe-band-strong); }
.pe-hero[data-band="notable"]     { background: var(--pe-band-notable); }
.pe-hero[data-band="weak"]        { background: var(--pe-band-weak); }

.pe-hero-score {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 160px;
}
.pe-hero-score-denom {
  font-size: 19px;
  font-weight: 400;
  opacity: 0.7;
}

.pe-hero-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pe-hero-band {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pe-hero-drift {
  font-size: 15px;
  opacity: 0.85;
  font-family: var(--font-mono);
}

.pe-hero-cta { flex-shrink: 0; }

.pe-btn-primary {
  background: #fff;
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.pe-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); }

/* ---- Section 3: Full-width score breakdown row ----------------- */

.pe-score-row {
  padding: 20px 24px 0;
}
.pe-score-card {
  padding: 18px;
}
.pe-score-inner {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}
.pe-score-bars {
  border-right: 1px solid var(--line);
  padding-right: 20px;
}
.pe-score-text {
  min-width: 0;
}
.pe-score-text .pe-card-subtitle:first-child { margin-top: 0; }

/* ---- Section 4: 3-column grid ---------------------------------- */

.pe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px 24px 0;
  align-items: start;
}

/* ---- Card primitives ------------------------------------------ */

.pe-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pe-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.pe-card-icon { margin-right: 4px; }
.pe-card-tag {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.pe-card-subtitle {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 12px 0 6px;
}
.pe-card-subtitle:first-child { margin-top: 0; }

.pe-card-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.pe-card-footnote {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

/* ---- Stat grid (label / value rows) --------------------------- */

.pe-stat-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;
  column-gap: 16px;
  margin: 0;
  font-size: 15px;
  font-feature-settings: "tnum";
}
.pe-stat-grid dt {
  color: var(--ink-soft);
  font-weight: 400;
}
.pe-stat-grid dd {
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14.5px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.pe-stat-with-bar, .pe-stat-with-pill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.pe-strong { font-weight: 700 !important; color: var(--ink) !important; }
.pe-faded { opacity: 0.55; }
.pe-scored-dot { color: var(--pe-warn); font-size: 13px; margin-left: 4px; }

/* ---- Trend direction colors ----------------------------------- */

.pe-up   { color: var(--pe-success); }
.pe-down { color: var(--pe-danger); }
.pe-flat { color: var(--muted); }

/* ---- Pills ----------------------------------------------------- */

.pe-pill {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.5;
}
.pe-pill:empty { display: none; }
.pe-pill-success { background: var(--pe-success-bg); color: var(--pe-success); }
.pe-pill-danger  { background: var(--pe-danger-bg);  color: var(--pe-danger); }
.pe-pill-warn    { background: var(--pe-warn-bg);    color: var(--pe-warn); }
.pe-pill-info    { background: var(--pe-info-bg);    color: var(--pe-info); }
.pe-pill-neutral { background: var(--pe-neutral-bg); color: var(--pe-neutral-text); }

/* ---- Upcoming earnings card ----------------------------------- */

.pe-upcoming-date {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 14px;
}
.pe-mini-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pe-mini-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.pe-mini-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.pe-mini-value {
  font-family: var(--font-mono);
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.pe-mini-value.pe-mini-empty { color: var(--muted); font-weight: 400; }
.pe-mini-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}
.pe-mini-compare {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-family: var(--font-mono);
}
.pe-mini-vs { color: var(--muted); }
.pe-mini-delta { font-weight: 600; }

/* ---- Sector heat card ----------------------------------------- */

.pe-sector-heat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.pe-heat-bar-lg svg { display: block; }
.pe-sector-heat-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pe-sector-heat-window {
  font-size: 13px;
  color: var(--muted);
}

.pe-bar-mini {
  display: inline-flex;
  align-items: center;
  width: 80px;
  margin-left: 4px;
}
.pe-bar-mini svg { display: block; }
.pe-bar-mini-scored { /* the highlight ring for the scored quarter */
  filter: drop-shadow(0 0 1px rgba(217, 119, 6, 0.35));
}

.pe-rsi-bar {
  display: inline-flex;
  width: 80px;
  height: 6px;
  background: var(--pe-neutral-bg);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.pe-rsi-bar > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 400ms var(--ease);
}

.pe-peers {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pe-peers li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
}
.pe-peers li .pe-peer-sym {
  font-weight: 600;
  color: var(--ink);
  min-width: 56px;
}
.pe-peers li .pe-peer-meta { color: var(--muted); }
.pe-peers li.pe-empty {
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-sans);
}

/* ---- Callouts -------------------------------------------------- */

.pe-callout {
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--pe-neutral-bg);
  color: var(--pe-neutral-text);
  border-left: 3px solid var(--muted);
  margin-top: 12px;
}
.pe-callout-success { background: var(--pe-success-bg); color: #064e2c; border-left-color: var(--pe-success); }
.pe-callout-danger  { background: var(--pe-danger-bg);  color: #7f1d1d; border-left-color: var(--pe-danger); }
.pe-callout-warn    { background: var(--pe-warn-bg);    color: #78350f; border-left-color: var(--pe-warn); }
.pe-callout-info    { background: var(--pe-info-bg);    color: #1e3a8a; border-left-color: var(--pe-info); }
.pe-callout-neutral { background: var(--pe-neutral-bg); color: var(--pe-neutral-text); border-left-color: var(--muted); }

/* ---- Score breakdown / risks list ---------------------------- */

.pe-reading {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 6px;
}
.pe-risks {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  padding-left: 18px;
}

/* ---- Section 4: Quarter cards --------------------------------- */

.pe-quarters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 24px 24px;
}
.pe-quarter-card {
  padding: 16px;
}
.pe-quarter-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.pe-quarter-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 2px 0;
  color: var(--ink);
}
.pe-quarter-date {
  font-size: 13px;
  color: var(--muted);
}
.pe-quarter-tag {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--pe-neutral-bg);
  padding: 3px 8px;
  border-radius: 999px;
}
.pe-quarter-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
}

/* ---- Responsive ----------------------------------------------- */

@media (max-width: 800px) {
  .pe-grid { grid-template-columns: 1fr 1fr; }
  .pe-score-inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .pe-score-bars {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
  }
}
@media (max-width: 600px) {
  .pe-grid { grid-template-columns: 1fr; }
  .pe-quarters { grid-template-columns: 1fr; }
  .pe-modal-header { padding: 0 16px; }
  .pe-modal-symbol { font-size: 23px; }
  .pe-modal-sep { display: none; }
  .pe-score-row, .pe-grid, .pe-quarters { padding-left: 16px; padding-right: 16px; }
  .pe-hero { padding: 16px; gap: 14px; flex-wrap: wrap; }
  .pe-hero-score { font-size: 48px; min-width: 0; }
  .pe-hero-cta { width: 100%; }
}



/* ============================================================
   Multi-user RBAC + PWA — components & mobile
============================================================ */

/* Global touch niceties */
html { -webkit-text-size-adjust: 100%; }

/* Generic primary button (used by admin/account pages) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-sm { padding: 5px 10px; font-size: 15px; }

.page-title { font-family: var(--font-display); font-size: 27px; margin: 0; }
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.topbar-user { font-size: 15px; color: var(--ink-soft); font-weight: 500; padding: 0 4px; }

/* Tables (admin) */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.data-table th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-weight: 500; font-size: 14px;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* Role + status badges */
.role-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.role-admin  { background: var(--accent-soft); color: var(--accent-deep); }
.role-member { background: var(--surface-2); color: var(--ink-soft); }
.status-on  { color: var(--positive); font-weight: 500; }
.status-off { color: var(--muted); }

.mod-cell { max-width: 360px; }
.mod-chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2);
  border-radius: 6px; padding: 2px 8px; font-size: 14px; margin: 2px 4px 2px 0;
}
.mod-chip em { color: var(--accent-deep); font-style: normal; font-size: 13px; text-transform: uppercase; }

/* Form fields (admin modal + account) */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-label { font-size: 15px; color: var(--ink-soft); font-weight: 500; }
.field input, .field select, .perm-select {
  font-family: inherit; font-size: 17px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .perm-select:focus { outline: none; border-color: var(--accent); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline input { width: auto; }

.modal-title { font-family: var(--font-display); font-size: 21px; margin: 0 0 16px; padding-right: 30px; }
.admin-form { display: block; }
.perm-section { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 6px 0 16px; }
.perm-section-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.perm-row:last-child { border-bottom: none; }
.perm-mod { font-size: 16px; }
.perm-select { min-width: 140px; }
.admin-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.admin-divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.admin-danger { display: flex; flex-direction: column; gap: 10px; }
.admin-danger .field { margin-bottom: 6px; }

/* Account page */
.account-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; max-width: 780px;
}
.account-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.account-subtitle {
  font-size: 15px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 18px 0 12px; font-weight: 600;
}
.account-role { margin: 4px 0 0; }
.access-list { list-style: none; padding: 0; margin: 0; }
.access-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 16px;
}
.access-list li:last-child { border-bottom: none; }
.access-mod { color: var(--ink); }
.access-lvl {
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft);
}
.access-lvl-run { background: #e0f2fe; color: #075985; }
.access-lvl-admin { background: var(--accent-soft); color: var(--accent-deep); }
.account-form { display: block; max-width: 360px; }
.account-msg { display: block; margin-top: 8px; font-size: 15px; }
.account-msg.ok { color: var(--positive); }
.account-msg.err { color: var(--negative); }

/* ── Mobile bottom tab bar (hidden on desktop) ─────────── */
.bottom-nav { display: none; }
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 7px 0 4px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 12px; font-weight: 500;
  text-decoration: none; min-height: 48px;
}
.bottom-nav-item svg { stroke: currentColor; }
.bottom-nav-item.active { color: var(--accent-deep); }

/* ============================================================
   Mobile (≤768px): off-canvas sidebar + bottom nav (app feel)
   Placed last so it overrides the earlier ≤768 icon-rail rules.
============================================================ */
@media (max-width: 768px) {
  .sidebar {
    width: 240px; padding: 24px 16px;
    transform: translateX(-100%);
  }
  .logo-full { display: block; }
  .logo-mark { display: none; }
  .sidebar-version { display: block; }
  .nav-item { justify-content: flex-start; padding: 10px 12px; gap: 12px; }
  .nav-label { display: inline; }
  .nav-item.active { padding-left: 9px; }
  .sidebar.sidebar-open { transform: translateX(0); box-shadow: var(--shadow-lg); }

  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }

  /* Make room for the bottom bar (+ iOS home indicator). */
  .main-area { padding: 16px 16px calc(72px + env(safe-area-inset-bottom)); }

  .bottom-nav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 180;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px -6px rgba(20,20,20,.18);
  }

  .account-grid { grid-template-columns: 1fr; }
  .perm-select { min-width: 120px; }
}


/* ============================================================
   Data Harvester
============================================================ */

/* Disabled (coming-soon) module cards on the landing grid */
.screener-card-disabled {
  position: relative;
  opacity: .62;
  cursor: not-allowed;
  pointer-events: none;
}
.card-soon-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted);
  padding: 3px 8px; border-radius: 999px;
}
.card-cta-muted { color: var(--muted); }

.breadcrumb-link { color: var(--muted); text-decoration: none; }
.breadcrumb-link:hover { color: var(--accent-deep); }
.breadcrumb-sep { color: var(--line-strong); margin: 0 6px; }

/* Cards / sections */
.harvester-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.har-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}
.har-field-wide { grid-column: 1 / -1; }
.har-field-wide select { min-height: 120px; }

.har-run-row {
  display: flex; align-items: center; gap: 16px;
  margin-top: 18px; flex-wrap: wrap;
}
.har-estimate { font-size: 15px; }

.har-results-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.har-progress-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 14px 0 4px; flex-wrap: wrap;
}
.har-progress-count { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }

.har-actions { margin-top: 16px; }

.har-summary {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--r);
  font-size: 16px; line-height: 1.6;
}
.har-summary.ok { background: var(--positive-bg); color: var(--positive); }
.har-summary.err { background: var(--negative-bg); color: var(--negative); }

.har-preview-wrap { margin-top: 20px; }
.har-preview-table { font-size: 14px; white-space: nowrap; }
.har-preview-table th, .har-preview-table td { padding: 6px 10px; }
.har-preview-table td { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .har-form-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   Data Harvester — extraction progress (shared by all 3 modules)
============================================================ */

.hv-progress-head-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 6px 0 8px;
}
.hv-progress-head { font-weight: 600; font-size: 16px; color: var(--ink); }
.hv-elapsed { font-variant-numeric: tabular-nums; font-size: 15px; }

.hv-progress {
  height: 10px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--line);
}
.hv-progress-fill {
  height: 100%; width: 2%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width .5s ease;
}
/* Animated barber-pole stripe while running, so a long single phase still
   visibly "moves" even when the width is steady. */
.hv-progress.running .hv-progress-fill {
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 10px, transparent 10px 20px),
    linear-gradient(90deg, var(--accent), var(--accent-deep));
  background-size: 28px 28px, 100% 100%;
  animation: hv-stripe 0.9s linear infinite;
}
.hv-progress.done .hv-progress-fill { background: #16a34a; animation: none; }
.hv-progress.failed .hv-progress-fill { background: #dc2626; animation: none; }
@keyframes hv-stripe {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 28px 0, 0 0; }
}

/* Stepper polish — only inside harvester cards (modal phase-list untouched) */
.harvester-card .hv-stepper { padding: 6px 0 2px; }
.harvester-card .hv-stepper .phase-row {
  padding: 9px 12px; border-bottom: 0; border-radius: var(--r-sm);
  transition: background .15s ease;
}
.harvester-card .hv-stepper .phase-row.running {
  background: var(--accent-soft);
}
.harvester-card .hv-stepper .phase-row.running .phase-label { font-weight: 600; }
.harvester-card .hv-stepper .phase-status {
  width: 22px; height: 22px; line-height: 22px; border-radius: 50%;
  background: var(--surface-2); font-size: 14px;
}
.harvester-card .hv-stepper .phase-row.done .phase-status {
  background: #dcfce7; color: #16a34a;
}
.harvester-card .hv-stepper .phase-row.running .phase-status {
  background: var(--accent); color: #fff;
}


/* ============================================================
   Post-Earnings Drop Watchlist (discretionary screener)
============================================================ */

/* Framing banner — must stay visible (not a signal, candidate list only) */
.ped-framing-banner {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--neutral);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.ped-banner-grey { background: #f1f5f9; border-left-color: #94a3b8; margin: 4px 0 16px; }

/* Pattern pills */
.ped-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.ped-pill-beat  { background: var(--positive-bg); color: var(--positive); }  /* beat = green */
.ped-pill-miss  { background: var(--negative-bg); color: var(--negative); }
.ped-pill-mixed { background: var(--surface-2); color: var(--ink-soft); }
.ped-pill-noest { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }

/* Table cell helpers */
.ped-table .pos, #ped-modal-body .pos { color: var(--positive); font-weight: 500; }
.ped-table .neg, #ped-modal-body .neg { color: var(--negative); font-weight: 500; }
.ped-table .ped-sym { font-weight: 700; }
.ped-table .ped-days { font-size: 13px; }
.ped-timing {
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
  background: var(--surface-2); color: var(--ink-soft);
  padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
.ped-row { cursor: pointer; }
.ped-row:hover { background: var(--accent-soft); }

/* 5-segment sector heat bar */
.ped-heatbar { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; }
.ped-heatbar i { width: 5px; height: 11px; border-radius: 1px; display: inline-block; }

/* Detail modal */
.ped-modal-sub { font-size: 15px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ped-card {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 14px; background: var(--surface);
}
.ped-card h4 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ped-kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 16px; border-bottom: 1px solid var(--line); }
.ped-kv:last-child { border-bottom: 0; }
.ped-kv span { color: var(--ink-soft); }

/* Mini price-reaction chart */
.ped-minichart { display: flex; align-items: flex-end; gap: 14px; height: 110px; padding: 8px 4px 0; margin-bottom: 12px; }
.ped-mc-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; }
.ped-mc-bar { width: 70%; border-radius: 3px 3px 0 0; }
.ped-mc-bar.pos { background: var(--positive); }
.ped-mc-bar.neg { background: var(--negative); }
.ped-mc-lab { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ped-mc-val { font-size: 13px; font-variant-numeric: tabular-nums; }

/* Decision support box — light blue, prominent */
.ped-decision-box {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--r);
  padding: 16px 18px; margin-top: 4px;
}
.ped-decision-box h4 { margin: 0 0 10px; font-size: 16px; color: #1e40af; }
.ped-decision-box ul { margin: 0; padding-left: 18px; }
.ped-decision-box li { font-size: 16px; color: #1e3a8a; margin-bottom: 6px; line-height: 1.5; }

@media (max-width: 768px) {
  .ped-minichart { gap: 8px; height: 90px; }
}


/* ============================================================
   Screener polish — run-modal progress bar + mobile refinements
============================================================ */

/* Progress bar inside the shared run-modal (pre-earnings + bounce) */
.run-modal-progress { padding: 14px 24px 6px; }
.run-modal-progress .hv-progress-head-row { margin: 0 0 8px; }
.run-modal-content .hv-stepper .phase-row.running { background: var(--accent-soft); }

@media (max-width: 768px) {
  /* Keep wide screener tables readable: scroll horizontally, don't squish. */
  .results-table { min-width: 740px; }

  /* Bigger tap targets for filter chips */
  .chip { padding: 7px 13px; font-size: 14px; }
  .filters { gap: 14px; }
  .filter-group { width: 100%; }

  /* Detail (attr) modal → bottom sheet, consistent with other mobile modals */
  .attr-modal { align-items: flex-end; }
  .attr-modal-box {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .run-modal-progress { padding: 12px 16px 6px; }
}


/* ============================================================
   IPO Front-Run Spillover screener
============================================================ */

.ipofr-table .pos, #ipofr-modal-body .pos { color: var(--positive); font-weight: 500; }
.ipofr-table .neg, #ipofr-modal-body .neg { color: var(--negative); font-weight: 500; }
.ipofr-table .ipofr-sym { font-weight: 700; }
.ipofr-row { cursor: pointer; }
.ipofr-row:hover { background: var(--accent-soft); }
.ipofr-ipocell { max-width: 220px; }

/* Score pill (colored by band) */
.ipofr-score-pill {
  display: inline-block; min-width: 34px; text-align: center;
  color: #fff; font-weight: 700; font-size: 14px;
  padding: 2px 8px; border-radius: 999px;
}

/* Days-until pill */
.ipofr-days-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.ipofr-days-opt  { background: #dcfce7; color: #166534; }   /* 5-7 (optimal) */
.ipofr-days-mid  { background: #fef3c7; color: #b45309; }   /* 3-4 */
.ipofr-days-late { background: var(--negative-bg); color: var(--negative); }  /* 1-2 */

/* Volume bar */
.ipofr-volbar {
  display: inline-block; width: 46px; height: 8px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden; vertical-align: middle; margin-right: 5px;
}
.ipofr-volbar i { display: block; height: 100%; border-radius: 999px; }
.ipofr-volnum { font-variant-numeric: tabular-nums; font-size: 14px; }

/* Detail modal */
.ipofr-modal-sub { font-size: 15px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ipofr-hero {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; margin-bottom: 14px;
}
.ipofr-hero-score { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1; }
.ipofr-hero-score span { font-size: 17px; color: var(--muted); font-weight: 500; }
.ipofr-hero-band { font-size: 16px; font-weight: 600; text-transform: capitalize; margin-bottom: 4px; }

.ipofr-confirmed {
  display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  background: #dcfce7; color: #166534; padding: 1px 7px; border-radius: 999px; margin-left: 6px;
}

.ipofr-breakdown { width: 100%; border-collapse: collapse; font-size: 15px; }
.ipofr-breakdown td { padding: 5px 0; border-bottom: 1px solid var(--line); }
.ipofr-breakdown td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; width: 48px; }
.ipofr-breakdown tr:last-child td { border-bottom: 0; }

.ipofr-risk { color: var(--negative); font-size: 15px; margin: 8px 0 0; }

/* Trade plan card — distinct (blue accent) */
.ipofr-tradeplan {
  background: var(--accent-soft); border: 1px solid rgba(37,99,235,.25); border-radius: var(--r);
  padding: 16px 18px; margin-top: 4px;
}
.ipofr-tradeplan h4 { margin: 0 0 10px; font-size: 16px; color: var(--accent-deep); }
.ipofr-tradeplan .ped-kv { border-bottom-color: rgba(37,99,235,.18); }


/* ============================================================
   Analyst Upgrade Cluster screener
============================================================ */

.acl-table .pos, #acl-modal-body .pos { color: var(--positive); font-weight: 500; }
.acl-table .neg, #acl-modal-body .neg { color: var(--negative); font-weight: 500; }
.acl-table .acl-sym { font-weight: 700; }
.acl-row { cursor: pointer; }
.acl-row:hover { background: var(--accent-soft); }
.acl-cluster { font-size: 14px; white-space: nowrap; }
.acl-expired-row { opacity: .7; }
.acl-expired-row:hover { opacity: 1; }

.acl-score-pill {
  display: inline-block; min-width: 34px; text-align: center;
  color: #fff; font-weight: 700; font-size: 14px; padding: 2px 8px; border-radius: 999px;
}

/* Day-progress dots (●●●○○○○○○○) */
.acl-dots { display: inline-flex; gap: 3px; align-items: center; }
.acl-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.acl-dots i.on { background: var(--accent); }

/* Action status pills */
.acl-action-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.acl-act-fresh  { background: #dcfce7; color: #166534; }
.acl-act-active { background: #dbeafe; color: #1e40af; }
.acl-act-exit   { background: #fef3c7; color: #b45309; }
.acl-act-expired { background: var(--surface-2); color: var(--muted); }

/* Detail modal */
.acl-modal-sub { font-size: 15px; margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acl-hero {
  display: flex; align-items: center; gap: 18px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px;
}
.acl-hero-score { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1; }
.acl-hero-score span { font-size: 17px; color: var(--muted); font-weight: 500; }
.acl-hero-band { font-size: 16px; font-weight: 600; text-transform: capitalize; margin-bottom: 4px; }

/* Trade-progress timeline */
.acl-timeline-card {
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px;
  background: var(--surface);
}
.acl-tl-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.acl-tl-cur { font-weight: 700; font-size: 16px; }
.acl-tl-track { display: flex; justify-content: space-between; position: relative; padding: 4px 0 0; }
.acl-tl-track::before { content: ""; position: absolute; top: 9px; left: 4%; right: 4%; height: 2px; background: var(--line); }
.acl-tl-tick { display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; z-index: 1; flex: 1; }
.acl-tl-tick i { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line-strong); }
.acl-tl-tick span { font-size: 11px; color: var(--muted); }
.acl-tl-tick.past i { background: var(--accent); border-color: var(--accent); }
.acl-tl-tick.cur i { background: var(--accent-deep); border-color: var(--accent-deep); box-shadow: 0 0 0 4px var(--accent-soft); }
.acl-tl-tick.cur span { color: var(--accent-deep); font-weight: 700; }
.acl-tl-extremes { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; }
.acl-tl-gain { color: var(--positive); font-weight: 500; }
.acl-tl-dd { color: var(--negative); font-weight: 500; }

/* Score breakdown — 2-column split */
.acl-breakdown-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.acl-plain p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }

/* Choppy-path warning — must be prominent */
.acl-path-warning {
  background: #fef3c7; border: 1px solid #fcd34d; border-left: 4px solid #f59e0b;
  border-radius: var(--r); padding: 14px 16px; margin-top: 6px;
  font-size: 15px; line-height: 1.6; color: #92400e;
}

@media (max-width: 768px) {
  .acl-breakdown-split { grid-template-columns: 1fr; }
  .acl-tl-tick span { font-size: 10px; }
}

/* ============================================================
   News-Swing screener
   ============================================================ */
.ns-score {
  font-weight: 700; font-family: var(--font-mono);
  background: linear-gradient(90deg, rgba(37,99,235,.16), rgba(37,99,235,.04));
  border-radius: var(--r-sm); padding: 2px 8px;
}
.ns-setup {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.ns-setup-follow  { color: var(--sig-extreme-bull); background: rgba(21,128,61,.10); border-color: rgba(21,128,61,.25); }
.ns-setup-fade    { color: #b45309;                 background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.30); }
.ns-setup-neutral { color: var(--muted);            background: var(--surface-2); border-color: var(--line); }
.ns-cat {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 15px;
}
.ns-summary {
  margin: 4px 0 14px; padding: 10px 12px; background: var(--surface-2);
  border-radius: var(--r-sm); border-left: 2px solid var(--accent);
  font-size: 15.5px; line-height: 1.5;
}
.ns-headline { margin: 8px 0 0; font-size: 15px; line-height: 1.45; }
.ns-headline .ns-src { display: block; margin-top: 3px; font-size: 13.5px; color: var(--muted); }
.ns-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.ns-flag {
  font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}

/* News-Swing: buy/awareness badges + sizing */
.ns-buy-badge {
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em; vertical-align: middle;
  color: #fff; background: var(--sig-extreme-bull); border-radius: var(--r-sm);
  padding: 1px 5px; margin-left: 5px;
}
.ns-aware-badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em; vertical-align: middle;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 1px 5px; margin-left: 5px; text-transform: uppercase;
}
.ns-row-buy .ns-sym { font-weight: 800; }
.ns-row:not(.ns-row-buy) { opacity: .82; }
.ns-size { font-family: var(--font-mono); font-weight: 700; }

/* ============================================================
   Trade Card — shared rich modal (chart + context)
   ============================================================ */
body.tc-open { overflow: hidden; }
.tc-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.tc-modal[hidden] { display: none; }
.tc-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); }
.tc-sheet {
  position: relative; z-index: 1; width: min(980px, 96vw); max-height: 92vh;
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  overflow: hidden;
}
.tc-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 8px; }
.tc-id { display: flex; align-items: center; gap: 6px; }
.tc-id-main { display: flex; flex-direction: column; line-height: 1.1; }
.tc-id-main h2 { margin: 0; font-size: 23px; font-weight: 800; font-family: var(--font-mono); letter-spacing: -.01em; }
.tc-name { font-size: 13px; color: var(--muted); }
.tc-nav { width: 26px; height: 26px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 8px; font-size: 17px; cursor: pointer; }
.tc-nav:hover { color: var(--accent); border-color: var(--accent); }
.tc-quote { margin-left: auto; display: flex; align-items: baseline; gap: 8px; }
.tc-price { font-size: 21px; font-weight: 700; font-family: var(--font-mono); }
.tc-chg { font-size: 15px; font-weight: 700; }
.tc-actions { display: flex; gap: 6px; }
.tc-act { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 8px; font-size: 15px;
  font-weight: 700; cursor: pointer; text-decoration: none; }
.tc-act:hover { color: var(--accent); border-color: var(--accent); }
.tc-close { font-size: 21px; }
.tc-sub { padding: 0 16px 6px; font-size: 14px; color: var(--muted); }
.tc-rangebar { display: flex; align-items: center; gap: 8px; padding: 2px 16px 8px; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.tc-rb-track { position: relative; flex: 1; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--neg, #ef4444), var(--surface-2), var(--pos, #16a34a)); }
.tc-rb-dot { position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); transform: translate(-50%, -50%); }
.tc-chart-wrap { padding: 0 12px; }
.tc-chart-bar { display: flex; align-items: center; gap: 10px; padding: 4px 4px 6px; flex-wrap: wrap; }
.tc-tf { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px; }
.tc-tf-btn { border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); cursor: pointer; }
.tc-tf-btn.active { background: var(--accent); color: #fff; }
.tc-legend { font-size: 13px; font-family: var(--font-mono); color: var(--muted); flex: 1; min-width: 120px; }
.tc-overlays { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.tc-overlays label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.tc-chart { width: 100%; height: 320px; }
.tc-skel { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 120px; color: var(--muted); font-size: 15px; }
.tc-chart-skel { height: 320px; }
.tc-body { padding: 10px 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.tc-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tc-card h4 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.tc-plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tc-plan-grid > div { display: flex; flex-direction: column; }
.tc-plan-grid span { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tc-plan-grid b { font-size: 16px; font-family: var(--font-mono); }
.tc-plan-note { margin-top: 8px; font-size: 13.5px; }
.tc-buy { font-size: 12px; font-weight: 800; color: #fff; background: var(--sig-extreme-bull, #16a34a); border-radius: 5px; padding: 1px 6px; vertical-align: middle; }
.tc-watch { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; vertical-align: middle; text-transform: uppercase; }
.tc-mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tc-mini h5, .tc-news h5 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tc-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; padding: 2px 0; }
.tc-kv span { color: var(--muted); }
.tc-kv b { font-family: var(--font-mono); }
.tc-news { margin-top: 10px; }
.tc-news-item { display: flex; flex-direction: column; padding: 5px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink); text-decoration: none; }
.tc-news-item:hover { color: var(--accent); }
.tc-news-src { font-size: 12.5px; margin-top: 1px; }
.tc-ewarn { color: #b45309; font-weight: 700; }
@media (max-width: 720px) {
  .tc-modal { align-items: flex-end; }
  .tc-sheet { width: 100vw; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .tc-chart { height: 240px; }
  .tc-plan-grid { grid-template-columns: repeat(2, 1fr); }
  .tc-mini-grid { grid-template-columns: 1fr; }
}

/* Table-row sparklines */
.tc-spark { display: block; }
.ns-spark-cell { width: 70px; min-width: 62px; padding: 2px 8px; vertical-align: middle; }

.dt-chart { width: 100%; height: 260px; margin: 0 0 14px; }

/* Bounce rows are clickable → trade card */
#bounce-results-body tr[data-symbol] { cursor: pointer; }
#bounce-results-body tr[data-symbol]:hover { background: var(--row-hover); }

/* ============================================================
   RSI(14) Oversold — two-line pick cards
   ============================================================ */
.rsio-list { display: flex; flex-direction: column; gap: 8px; }
.rsio-empty { padding: 24px; text-align: center; color: var(--muted); }

.rsio-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s;
}
.rsio-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.rsio-rank { font-family: var(--font-mono); color: var(--muted); font-size: 15px; min-width: 22px; text-align: right; }
.rsio-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.rsio-line1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; }
.rsio-ticker { font-weight: 700; font-size: 17px; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.rsio-moon { display: inline-flex; }
.rsio-price { font-family: var(--font-mono); }
.rsio-price b { color: var(--ink); }

.rsio-metric { font-size: 14px; color: var(--muted); font-family: var(--font-mono); }
.rsio-metric b { color: var(--ink); margin-left: 2px; }
.rsio-mlabel { text-transform: uppercase; letter-spacing: .03em; font-size: 12px; }

/* session pill (LIVE / PRE / POST / CLOSE) */
.rsio-sess {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; letter-spacing: .04em; vertical-align: middle;
}
.rsio-sess-live   { background: var(--positive-bg); color: var(--positive); }
.rsio-sess-pre    { background: var(--accent-soft); color: var(--accent-deep); }
.rsio-sess-post   { background: #f3e8ff; color: #7e22ce; }
.rsio-sess-closed { background: var(--surface-2); color: var(--muted); }

.rsio-line2 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 18px; font-size: 14.5px; }
.rsio-news { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; max-width: 62%; }
.rsio-news-link, .rsio-news > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsio-news-link { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--line-strong); }
.rsio-news-link:hover { color: var(--accent-deep); border-bottom-color: var(--accent); }
.rsio-sector { color: var(--muted); }

.rsio-chip {
  font-size: 12px; font-weight: 700; font-family: var(--font-mono);
  background: var(--surface-2); color: var(--ink);
  padding: 1px 6px; border-radius: 999px; white-space: nowrap;
}
.rsio-details { flex-shrink: 0; }

@media (max-width: 720px) {
  .rsio-news { max-width: 100%; }
  .rsio-line1, .rsio-line2 { gap: 4px 12px; }
}
