/* =============================================================
   Design tokens
   Subject: a quantitative "control room" for an ASX portfolio —
   ink/brass palette (brass nods to resources-heavy ASX, teal nods
   to the "robust / defended" side of the comparison), a serif
   display face for the editorial hero moment, monospace for all
   figures so numbers read like a terminal, not a marketing page.
   ============================================================= */
:root {
  --ink: #0F131A;
  --panel: #161B24;
  --panel-2: #1B2230;
  --border: #2A3242;
  --border-soft: #232B39;

  --text: #E7E9EE;
  --text-muted: #8B93A5;
  --text-faint: #5C6579;

  --teal: #4FA88F;
  --teal-soft: rgba(79, 168, 143, 0.14);
  --brass: #C99A3D;
  --brass-soft: rgba(201, 154, 61, 0.14);
  --red: #D1495B;
  --red-soft: rgba(209, 73, 91, 0.14);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;

  --font-display: "Fraunces", "Iowan Old Style", ui-serif, Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --shadow-lift: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(79, 168, 143, 0.08), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(201, 154, 61, 0.06), transparent 55%);
}

a { color: var(--teal); }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

::selection { background: rgba(79, 168, 143, 0.3); }

/* Focus visibility (kept even though we quiet outlines visually) */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* =============================================================
   App shell
   ============================================================= */
.app-shell {
  display: grid;
  /* Sidebar widened from 340 -> 380px: at 340px, the region-select hint
     text and preset labels were wrapping onto 4+ lines (verified live).
     Main content's track is capped further down (.main's own max-width)
     rather than pinned to a hard px here, so it can actually grow to use
     the screen instead of leaving a dead margin on wide monitors. */
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* -------- Sidebar -------- */
.sidebar {
  background: linear-gradient(180deg, var(--panel), #131922);
  border-right: 1px solid var(--border-soft);
  padding: 28px 22px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

@media (max-width: 900px) {
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border-soft); }
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-mark {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  height: 20px;
}
.brand-mark span {
  width: 4px;
  background: var(--teal);
  border-radius: 2px;
  display: block;
}
.brand-mark span:nth-child(3) { background: var(--brass); }

.brand h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0;
}

.sidebar .tagline {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 6px 0 26px;
}

.side-section {
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.side-section:last-of-type { border-bottom: none; }

.side-section h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin: 0 0 12px;
  font-weight: 600;
}

/* -------- Ticker builder -------- */
.ticker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ticker-row input[type="text"] {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ticker-row input[type="text"]:focus { border-color: var(--teal); }

.ticker-row .ticker-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  width: 64px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--red); color: var(--red); }

.add-ticker-btn {
  width: 100%;
  margin-top: 4px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}
.add-ticker-btn:hover { border-color: var(--teal); color: var(--teal); }
.add-ticker-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.reset-link {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 11.5px;
  text-decoration: underline;
  padding: 0;
  margin-top: 10px;
}
.reset-link:hover { color: var(--teal); }

/* -------- Sliders -------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field label .val {
  font-family: var(--font-mono);
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
  height: 4px;
}

input[type="number"] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

select.select-input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
select.select-input:focus { border-color: var(--teal); }

/* -------- Decision Aid -------- */
.da-lens-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 30px;
}
@media (max-width: 900px) { .da-lens-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .da-lens-grid { grid-template-columns: 1fr; } }

.da-lens-card {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 16px 18px;
  display: flex; flex-direction: column; gap: 9px;
  border-top: 3px solid var(--lens-accent, var(--teal));
}
.da-lens-card.growth { --lens-accent: var(--brass); }
.da-lens-card.value { --lens-accent: var(--teal); }
.da-lens-card.dividend { --lens-accent: #6FA3E0; }
.da-lens-card.risk { --lens-accent: var(--red); }
.da-lens-card.sell { --lens-accent: #9C7BD9; }
.da-lens-card.macro { --lens-accent: #5FC7C2; }
.da-lens-card.research { --lens-accent: #E0975C; }
.da-lens-card h4 { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; margin: 0; }

.lens-badge {
  align-self: flex-start; font-family: var(--font-mono); font-size: 10.5px;
  padding: 3px 9px; border-radius: 6px; font-weight: 600;
}
.lens-favor { background: var(--teal-soft); color: var(--teal); }
.lens-neutral { background: var(--panel); color: var(--text-muted); border: 1px solid var(--border); }
.lens-caution { background: var(--red-soft); color: var(--red); }

.da-lens-card p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-muted); }
.da-lens-card .why {
  font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border-soft);
  padding-top: 8px; margin-top: auto; line-height: 1.5;
}

.regime-pill {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; display: inline-flex;
  background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal);
}
.regime-pill.stressed { background: var(--red-soft); color: var(--red); border-color: var(--red); }

/* -------- News list -------- */
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item {
  display: flex;
  gap: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.news-item .news-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--panel);
}
.news-item .news-body { min-width: 0; }
.news-item h4 { margin: 0 0 4px; font-size: 14px; }
.news-item h4 a { color: var(--text); text-decoration: none; }
.news-item h4 a:hover { color: var(--teal); text-decoration: underline; }
.news-item p { margin: 0 0 6px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.news-item .news-meta { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }

.field .hint {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 4px;
  line-height: 1.4;
}

/* -------- Data source tabs -------- */
.pill-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pill-tab {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}
.pill-tab.active {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}

.data-panel { display: none; }
.data-panel.active { display: block; }

/* -------- Estimation mode / risk measure toggles -------- */
/* Separate class names from .pill-tab/.pill-tabs on purpose — that pair's
   JS handler is a global querySelectorAll wired to the data-source panels
   specifically; reusing the same classes here would make clicking one
   toggle group incorrectly deactivate the other. */
.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mode-tab {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}
.mode-tab.active {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}

textarea.csv-input {
  width: 100%;
  min-height: 90px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 10px;
  border-radius: var(--radius-sm);
  resize: vertical;
}

.file-drop {
  display: block;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 8px;
  cursor: pointer;
}
.file-drop:hover { border-color: var(--teal); color: var(--teal); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
}
.btn-primary { background: var(--teal); color: #0B1712; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); }
.btn-sm { padding: 6px 10px; font-size: 12px; width: auto; }

.run-btn {
  margin-top: 4px;
  padding: 13px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

/* Quick Start -- the one button a first-time user needs. Deliberately NOT
   another teal button (teal is used everywhere else in this sidebar) --
   brass is this app's own second accent color (see the palette comment at
   the top of this file: "brass nods to resources-heavy ASX"), so this
   reads as a distinct, special call-to-action rather than blending into
   the rest of the controls. */
.quick-start-section { margin-bottom: 4px; }
.btn-quickstart {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brass);
  background: linear-gradient(135deg, var(--brass) 0%, #E0B24F 100%);
  color: #241B08;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(201, 154, 61, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-quickstart:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(201, 154, 61, 0.4);
  filter: brightness(1.04);
}
.btn-quickstart:active:not(:disabled) { transform: translateY(0); }
.btn-quickstart:disabled { opacity: 0.65; cursor: default; }
.btn-quickstart-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.btn-quickstart-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.btn-quickstart-title { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.btn-quickstart-sub { font-size: 11px; font-weight: 500; opacity: 0.8; }

.status-line {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 10px;
  min-height: 16px;
  line-height: 1.5;
}
.status-line.warn { color: var(--brass); }
.status-line.err { color: var(--red); }
.status-line.ok { color: var(--teal); }

/* Themed <progress> -- native browser styling defaults to whatever the
   OS chrome looks like (bright, doesn't match a dark control-room UI),
   so both the track and the WebKit/Firefox fill pseudo-elements need
   explicit rules. */
progress {
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border: none;
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel-2);
}
progress::-webkit-progress-bar { background: var(--panel-2); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 3px; transition: width 0.15s ease; }
progress::-moz-progress-bar { background: var(--teal); border-radius: 3px; }

/* =============================================================
   Main content
   ============================================================= */
.main {
  padding: 34px 40px 80px;
  /* Originally capped at 1180px, then raised to 1760px -- both still left
     a real, reported dead strip of empty background on a large monitor
     while wide tables (the Scanner's 20 columns) still had to scroll
     internally right next to that empty space. Text-heavy elements
     (.hero p, .section-note) already carry their OWN narrower max-width
     directly, independent of this one, so widening this outer cap doesn't
     make prose unreadably wide -- only wide elements (tables, grids)
     actually grow to fill it. Raised to a much larger ceiling so this
     track effectively fills whatever the sidebar leaves behind on any
     realistic monitor, with 2400px kept only as a sanity bound against a
     genuinely absurd single-window ultrawide, not as an everyday limit.
     Grid items default to min-width:auto, which lets a wide child (a
     many-column table) inflate this whole track past the viewport
     instead of scrolling within itself. Without this, a wide table
     anywhere in .main pushes the entire app-shell sideways on a phone,
     making the right side look "inaccessible" rather than just scrolled. */
  max-width: 2400px;
  min-width: 0;
}
@media (max-width: 900px) { .main { padding: 24px 18px 60px; } }

/* Wide tables (correlation matrix, weights, etc.) scroll within their
   own card instead of forcing the page to overflow horizontally.
   Touch already pans natively (overflow-x:auto); cursor:grab signals the
   mouse-drag equivalent added by drag-scroll.js. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.table-scroll.dragging {
  cursor: grabbing;
  user-select: none;
}

.hero {
  margin-bottom: 30px;
}
.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 10px;
}
.hero h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 12px;
  max-width: 720px;
}
.hero p {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 640px;
  line-height: 1.6;
  margin: 0;
}

.empty-state {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 60px 30px;
  text-align: center;
  color: var(--text-muted);
  background: var(--panel);
}
.empty-state .glyph { font-size: 28px; margin-bottom: 14px; }
.empty-state h3 { font-family: var(--font-display); color: var(--text); font-weight: 600; margin: 0 0 8px; }
.empty-state p { font-size: 13.5px; max-width: 420px; margin: 0 auto; line-height: 1.6; }

/* -------- Tabs -------- */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 26px;
  row-gap: 8px;
}
.view-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: -1px;
}
.view-tab.active { color: var(--text); border-bottom-color: var(--teal); }
.view {
  display: none;
  animation: fadeIn 0.25s ease;
}
.view.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

/* -------- Cards / grids -------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.card h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 4px;
  font-weight: 600;
}
.card .card-sub { font-size: 12px; color: var(--text-faint); margin-bottom: 16px; }

.model-card.classical { border-top: 3px solid var(--red); }
.model-card.robust { border-top: 3px solid var(--teal); }

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.metric-row:last-child { border-bottom: none; }
.metric-row .label { color: var(--text-muted); }
.metric-row .value { font-family: var(--font-mono); font-weight: 600; }

.chart-wrap { position: relative; height: 300px; }
.chart-wrap.tall { height: 360px; }

/* -------- Shares Scanner: Investment Growth Forecast chips -------- */
.fc-chip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.fc-chip {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}
.fc-chip-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fc-chip-value { font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--text); margin-top: 4px; }
.fc-chip-range { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.fc-chip.fc-chip-headline {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.fc-chip.fc-chip-headline .fc-chip-value { color: var(--teal); }
.fc-chip.fc-chip-headline::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--teal);
  animation: fc-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes fc-pulse {
  0%   { opacity: 0.7; transform: scale(1); }
  70%  { opacity: 0; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .fc-chip.fc-chip-headline::before { animation: none; }
}

/* -------- My Research: saved setups / history rows -------- */
.my-research-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.my-research-row:last-child { border-bottom: none; }
.my-research-row-main { min-width: 0; }
.my-research-row-title { font-weight: 600; font-size: 14px; }
.my-research-row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.my-research-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.my-research-row-actions .btn { width: auto; }

.section-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 34px 0 6px;
}
.section-note { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; line-height: 1.6; max-width: 720px; }

/* -------- Region select (Shares Scanner sidebar) -------- */
.region-section { padding-bottom: 20px; }
select.region-select {
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 12px;
  border-color: var(--border);
  background: var(--panel-2);
}
select.region-select:focus { border-color: var(--teal); }

/* -------- Screener actions row + filter toolbar -------- */
.screener-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.screener-actions-row .pick-count {
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-mono);
}

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin: 0 0 16px;
}
.filter-toolbar .toolbar-label {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  flex-shrink: 0;
}
.filter-toolbar .search-input { width: 200px; }
.filter-toolbar .toolbar-field {
  display: flex;
  align-items: center;
  gap: 7px;
}
.filter-toolbar .toolbar-field span {
  color: var(--text-faint);
  font-size: 12px;
  flex-shrink: 0;
}
.filter-toolbar .toolbar-field select.select-input { width: auto; }
.filter-toolbar .toolbar-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .filter-toolbar { flex-direction: column; align-items: stretch; }
  .filter-toolbar .search-input { width: 100%; }
  .filter-toolbar .toolbar-count { margin-left: 0; }
}

/* Scanner results table has 20 real columns -- even with .main's widened
   track above, a typical window still can't show all of them without some
   horizontal scroll. A plain scrollbar means the Ticker (and Signal, the
   other column worth keeping in view while scanning down 19 rows) scrolls
   out of sight along with everything else, so a row you're looking at
   loses its own identity -- reported live, same real problem this exact
   sticky-column pattern already fixed on the Ver2 sibling app's table.
   Scoped to #scScreenerTable specifically -- .weights-table is reused by
   several other, differently-shaped tables across this app that should
   NOT get this treatment. */
#scScreenerTable th:nth-child(1), #scScreenerTable td:nth-child(1) {
  position: sticky; left: 0; width: 38px; min-width: 38px;
  background: var(--panel); z-index: 2;
}
#scScreenerTable th:nth-child(2), #scScreenerTable td:nth-child(2) {
  position: sticky; left: 38px; background: var(--panel); z-index: 2;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.3);
}
#scScreenerTable thead th:nth-child(1), #scScreenerTable thead th:nth-child(2) { z-index: 3; }
#scScreenerTable tbody tr:hover td:nth-child(1),
#scScreenerTable tbody tr:hover td:nth-child(2) { background: var(--panel-2); }

table.weights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.weights-table th, table.weights-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
}
table.weights-table th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.weights-table td.num, table.weights-table th.num { font-family: var(--font-mono); text-align: right; }

table.weights-table th[onclick] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.weights-table th[onclick]:hover { color: var(--text); }
table.weights-table th.sorted { color: var(--teal); }
table.weights-table th .sort-arrow { display: inline-block; margin-left: 3px; opacity: 0.4; font-size: 9px; }
table.weights-table th.sorted .sort-arrow { opacity: 1; }

input[type="text"].search-input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}
input[type="text"].search-input:focus { border-color: var(--teal); outline: none; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-red { background: var(--red-soft); color: var(--red); }

/* Scanner's mcap tier (good/warn/bad) + analyst-coverage flag tags -- were
   referenced in scanner-app.js's markup (class="tag good/warn/bad", and
   the low-n analyst-coverage flag) with no matching rule anywhere, so they
   rendered as unstyled inline text instead of a badge. */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.tag.good { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
.tag.warn, .tag.tag-amber { background: var(--brass-soft); color: var(--brass); border-color: var(--brass); }
.tag.bad { background: var(--red-soft); color: var(--red); border-color: var(--red); }

.big-num { font-family: var(--font-mono); font-size: 26px; font-weight: 600; }

.callout {
  border-left: 3px solid var(--brass);
  background: var(--brass-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin: 16px 0;
}
.callout.danger { border-left-color: var(--red); background: var(--red-soft); }
.callout.info { border-left-color: var(--teal); background: var(--teal-soft); }
/* Real bug found 2026-08-29: renderComposite() in leading-indicators.js
   has been assigning "callout ok/warn/err" since it was written, but
   those class names were never actually defined here -- only .danger and
   .info exist, so the leading-indicators severity callout has silently
   rendered in plain base (amber) styling regardless of severity the
   entire time. Fixing alongside adding the Class 3 tier CIA's threat
   banner already has: 0=info(teal), 1=base(amber), 2=danger(red),
   3+=critical(bold red). */
.callout.critical { border-left-color: var(--red); border-left-width: 6px; background: var(--red-soft); font-weight: 600; }

.methodology p, .methodology li {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
}
.methodology h4 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text);
  margin: 22px 0 8px;
}
.methodology code {
  font-family: var(--font-mono);
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

footer.app-footer {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 12.5px;
}
.install-banner.show { display: flex; }

/* -------- Glossary cross-links -------- */
.gloss-link {
  color: var(--teal);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}
.gloss-link:hover { color: var(--brass); }
@keyframes gloss-flash {
  0% { background: var(--teal-soft); }
  100% { background: transparent; }
}
.gloss-highlight { animation: gloss-flash 1.6s ease-out; border-radius: var(--radius-sm); }

/* -------- Analysis Report -------- */
.report-header { text-align: center; }
.report-header-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.report-header-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.report-header-date { color: var(--text-faint); font-size: 11.5px; font-family: var(--font-mono); }

.report-recommendations { margin: 0; padding-left: 20px; }
.report-recommendations li {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 10px;
}
.report-recommendations li:last-child { margin-bottom: 0; }
.report-recommendations b { color: var(--teal); }

.report-diag-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.report-diag-row:last-child { border-bottom: none; }
.report-diag-row .label { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.report-diag-row .value { font-family: var(--font-mono); font-size: 13px; color: var(--text); text-align: right; }

/* =============================================================
   Print / "Save as PDF"
   Hides chrome (sidebar, tabs, buttons) and prints only the
   currently-active view as a clean report.
   ============================================================= */
@media print {
  body { background: #fff; color: #111; }
  .sidebar, .view-tabs, .install-banner, .hero, footer.app-footer, .no-print { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; max-width: 100%; }
  .card { background: #fff; border: 1px solid #ccc; break-inside: avoid; }
  .callout { background: #f3f3f3; color: #111; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  canvas { max-width: 100% !important; }
  .metric-row .value, table.weights-table td { color: #111; }
}
