:root {
  color-scheme: dark;
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Serif display face for h1/headings only — everything else (body
     copy, tables, buttons, chart labels) stays on Inter, which is
     genuinely the right choice for dense small-size data legibility.
     The pairing gives headings some editorial weight (a considered
     financial-publication feel) instead of Inter doing every job at
     every size, which is what "foundational polish" is fixing here. */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --bg-page: #07111f;
  --bg-gradient-1: #13253f;
  --bg-gradient-2: #07111f;
  --bg-gradient-3: #030812;

  --bg-card: rgba(15, 23, 42, 0.86);
  --bg-panel: rgba(2, 8, 23, 0.45);
  --bg-panel-strong: rgba(2, 8, 23, 0.5);
  --bg-input: #0f172a;
  --bg-tooltip: rgba(7, 17, 31, 0.96);
  --bg-tooltip-soft: rgba(7, 17, 31, 0.92);

  --bg-chart-gradient-1: rgba(2, 8, 23, 0.88);
  --bg-chart-gradient-2: rgba(15, 23, 42, 0.82);

  --border-subtle: rgba(148, 163, 184, 0.16);
  --border: rgba(148, 163, 184, 0.24);
  --border-soft: rgba(148, 163, 184, 0.14);
  --border-hover: rgba(148, 163, 184, 0.45);
  --border-tab: rgba(148, 163, 184, 0.22);

  /* SVG chart tick/axis colors — the four line-chart functions in
     script.js (renderCumReturnsChart, renderCagrChart,
     renderSipPeriodChart, renderRollingReturnsChart) reference these
     directly via fill="var(--chart-tick)" etc. in their generated
     markup, so the chart canvas properly follows the theme instead of
     staying permanently dark. */
  --chart-grid: rgba(148, 163, 184, 0.12);
  --chart-axis-line: rgba(148, 163, 184, 0.3);
  --chart-zero-line: rgba(148, 163, 184, 0.45);
  --chart-crosshair: rgba(148, 163, 184, 0.55);
  --peer-fund-line: #19b978;
  --peer-benchmark-line: #94a3b8;

  /* Categorical palette for multi-series charts (currently: the Peer
     Comparison holdings sunburst's industry ring) — 8 hues, fixed order,
     assigned in sequence and never cycled or re-ordered per-chart, so a
     given industry keeps the same color across renders. Validated
     (validate_palette.js) against this app's actual dark card surface
     (~#0f172a): all pass at CVD ΔE >= 8.4 / normal-vision >= 19.3,
     contrast >= 3:1. Individual stock segments nested under an industry
     wedge use color-mix() shades of that industry's own hue rather than
     a 9th+ color — see renderPortfolioSunburst in script.js. */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --series-other: rgba(148, 163, 184, 0.5);

  --shadow-card: rgba(2, 8, 23, 0.28);
  --shadow-tooltip: rgba(2, 8, 23, 0.4);
  --shadow-btn-hover: rgba(56, 189, 248, 0.2);

  --text-primary: #f8fafc;
  --text-body: #e2e8f0;
  --text-muted: #cbd5e1;
  --text-faint: #94a3b8;
  --text-dim: #64748b;
  --text-error: #f87171;
  --text-btn: #020617;

  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --accent-secondary: #818cf8;
  --accent-bg-soft: rgba(56, 189, 248, 0.1);
  --accent-bg-medium: rgba(56, 189, 248, 0.15);
  --accent-bg-selected: rgba(56, 189, 248, 0.08);
  --accent-border-hover: rgba(56, 189, 248, 0.4);

  --info-btn-border: rgba(125, 211, 252, 0.5);
  --info-btn-bg: rgba(125, 211, 252, 0.1);
  --info-btn-bg-hover: rgba(125, 211, 252, 0.22);

  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg-page: #eef2f7;
  --bg-gradient-1: #e2e8f0;
  --bg-gradient-2: #f4f6f9;
  --bg-gradient-3: #ffffff;

  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-panel: rgba(15, 23, 42, 0.045);
  --bg-panel-strong: rgba(15, 23, 42, 0.05);
  --bg-input: #ffffff;
  --bg-tooltip: rgba(255, 255, 255, 0.98);
  --bg-tooltip-soft: rgba(255, 255, 255, 0.96);

  --bg-chart-gradient-1: rgba(255, 255, 255, 0.9);
  --bg-chart-gradient-2: rgba(241, 245, 249, 0.85);

  --border-subtle: rgba(15, 23, 42, 0.1);
  --border: rgba(15, 23, 42, 0.16);
  --border-soft: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.3);
  --border-tab: rgba(15, 23, 42, 0.14);

  --chart-grid: rgba(15, 23, 42, 0.1);
  --chart-axis-line: rgba(15, 23, 42, 0.25);
  --chart-zero-line: rgba(15, 23, 42, 0.35);
  --chart-crosshair: rgba(15, 23, 42, 0.45);
  --peer-fund-line: #0b9f67;
  --peer-benchmark-line: #7b8798;

  /* Same 8-hue categorical set, light-mode steps — validated against
     this app's actual light card surface (#ffffff): all pass, with 3
     slots (aqua/yellow/magenta) below 3:1 fill contrast, which is why
     the sunburst always ships direct labels (>=5% segments) and a hover
     tooltip as the relief channel rather than relying on fill alone. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --series-other: rgba(15, 23, 42, 0.28);

  --shadow-card: rgba(15, 23, 42, 0.08);
  --shadow-tooltip: rgba(15, 23, 42, 0.12);
  --shadow-btn-hover: rgba(2, 132, 199, 0.18);

  --text-primary: #0f172a;
  --text-body: #1e293b;
  --text-muted: #475569;
  --text-faint: #64748b;
  --text-dim: #94a3b8;
  --text-error: #dc2626;
  --text-btn: #ffffff;

  --accent: #0369a1;
  --accent-strong: #0284c7;
  --accent-secondary: #4f46e5;
  --accent-bg-soft: rgba(2, 132, 199, 0.08);
  --accent-bg-medium: rgba(2, 132, 199, 0.12);
  --accent-bg-selected: rgba(2, 132, 199, 0.06);
  --accent-border-hover: rgba(2, 132, 199, 0.35);

  --info-btn-border: rgba(3, 105, 161, 0.4);
  --info-btn-bg: rgba(3, 105, 161, 0.08);
  --info-btn-bg-hover: rgba(3, 105, 161, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 55%, var(--bg-gradient-3) 100%);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.2rem 1.2rem 3.5rem;
}

.hero, .card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  /* Two-layer elevation — a tight contact shadow plus a soft ambient
     one — reads as a considered surface instead of the flat single-blur
     drop-shadow every card had before. */
  box-shadow: 0 1px 2px var(--shadow-card), 0 20px 45px var(--shadow-card);
}

.hero {
  padding: 1.6rem;
}

.theme-toggle {
  display: flex;
  gap: 0.4rem;
}

.eyebrow {
  margin: 0.4rem 0 0;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-size: 0.8rem;
}

/* Global Direct/Regular switch, directly under the eyebrow. Styled as a
   quiet segmented control rather than a prominent button pair — it is a
   standing preference the user sets once, not an action they take often,
   and Direct is the default nearly everyone should stay on. */
.plan-toggle {
  display: inline-flex;
  gap: 0.25rem;
  margin-top: 0.9rem;
  padding: 0.2rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-inset, rgba(127, 127, 127, 0.08));
}

.plan-btn {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.plan-btn:hover {
  color: var(--text-primary, inherit);
}

.plan-btn.active {
  background: var(--accent);
  color: var(--bg-card);
  font-weight: 600;
}

.plan-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tracking-error badge, shown on index funds in place of the
   return-percentile badge. Neutral colouring on purpose: it is a
   descriptive figure, not an award. */
.tag-tracking-error {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Index-family filter above an index-fund leaderboard. Deliberately
   quiet — it's a narrowing control, not a headline, and it only appears
   when the list actually spans more than one index. */
.index-family-filter {
  margin: 0.7rem 0 0.25rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-inset, rgba(127, 127, 127, 0.06));
}

.index-family-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.index-family-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.index-family-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Each option is a self-contained chip: checkbox, then name, then count,
   all on one line. The previous layout let the label wrap onto the line
   BELOW its own checkbox, which is what made a 12-family list read as a
   four-row wall of disconnected boxes and text. */
.index-family-option {
  display: inline-flex;
  /* Explicit: the global `label` rule sets flex-direction: column, which
     otherwise stacks the checkbox, the name and the count on three
     separate lines inside every chip. */
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem 0.25rem 0.45rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-card);
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease;
}

.index-family-option:hover {
  border-color: var(--accent);
}

.index-family-option input {
  margin: 0;
  flex: none;
}

/* A ticked chip reads as active at a glance, not just by its checkbox. */
.index-family-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.index-family-name {
  font-weight: 500;
}

.index-family-count {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.74rem;
}

.index-family-more,
.index-family-clear {
  margin-top: 0.45rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.index-family-clear {
  margin-top: 0;
}

.index-family-more:hover,
.index-family-clear:hover {
  text-decoration: underline;
}

/* The realised Direct-vs-Regular gap on the Fund Details card. The gap
   itself is the point of the line, so it carries the accent while the
   two raw CAGRs stay in normal text. */
.fmc-plan-cost {
  line-height: 1.5;
}

.fmc-plan-gap {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* Shown next to the toggle while Regular is selected, so the non-default
   view is never mistaken for the default one. */
.plan-note {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-wrap: balance;
}

/* The "SIPthesis" wordmark doubles as a home link — from any tab, it
   jumps back to the Categories tab (where the homepage launchpad
   lives). Reset to plain text by default; the underline only shows on
   hover/focus so it doesn't look like a clickable link at rest, since
   readers scanning past the title shouldn't need to wonder if it's
   interactive. */
.home-logo-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-decoration: none;
}

.home-logo-btn:hover,
.home-logo-btn:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.home-logo-btn:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
  border-radius: 4px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.checkbox-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-body);
}

input[type="date"], input[type="number"], select, button {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
  font: inherit;
}

.form-subheading {
  margin: 1rem 0 0.6rem;
  font-weight: 600;
  color: var(--text-body);
}

/* .grid (below, later in source) sets its own default 2-column split at
   equal specificity — combined with .grid here so this one reliably wins
   regardless of source order, instead of silently losing to it. */
.grid.calc-toc-grid {
  grid-template-columns: 220px 1fr;
}

.grid.screener-toc-grid {
  grid-template-columns: 280px 1fr;
}

.grid.category-toc-grid {
  grid-template-columns: 280px 1fr;
}

/* Market Valuation tab's two PDF cards are equal-weight siblings, not a
   main+sidebar pair — the base .grid's 1.15fr/0.85fr split (built for
   that main+sidebar shape) would make them visibly different widths. */
.grid.marketvaluation-grid {
  grid-template-columns: 1fr 1fr;
}

.calc-toc-group {
  margin-bottom: 1.2rem;
}

.calc-toc-group:last-child {
  margin-bottom: 0;
}

.calc-toc-group-toggle {
  margin-bottom: 0.8rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
}

.calc-toc {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.calc-toc-item {
  text-align: left;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  color: var(--text-body);
}

.calc-toc-item.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.calc-strategy-panel {
  display: none;
}

.calc-strategy-panel.active {
  display: block;
}

.topup-strategy-row {
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.8rem;
  margin-bottom: 0.6rem;
}

/* Border-left color is set inline per row by applyTopupStrategyColors()
   (script.js) to match TOPUP_COLORS[(index+1)] — the same color each
   strategy's line/markers use on the two charts below, so a strategy's
   input card and its chart series are visually tied together. */

.ccs-strategy-card {
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.8rem;
}

/* Matches CHART_COLORS[3]/[1]/[2] — the exact colors
   runCompoundingCaseStudy() already assigns to each strategy's line in
   the chart below, so a strategy's inputs and its chart line are
   visually tied together the same way as the Topup tab's rows. */
.ccs-strategy-card.strategy-a { border-left-color: #34d399; }
.ccs-strategy-card.strategy-b { border-left-color: #818cf8; }
.ccs-strategy-card.strategy-c { border-left-color: #f59e0b; }

/* input[type="number"].topup-rolling-months (not just .topup-rolling-months)
   so this beats the shared `input[type="date"], input[type="number"],
   select, button` rule on specificity — an attribute selector counts the
   same as a class, so that rule would otherwise win over a bare class
   selector regardless of source order and silently keep its much larger
   padding, making this tiny box look cramped/barely visible. */
input[type="number"].topup-rolling-months,
input[type="number"].topup-tier-threshold,
input[type="number"].topup-tier-amount,
input[type="number"].topup-random-count,
input[type="number"].topup-random-amount {
  padding: 0.35rem 0.4rem;
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-hover);
  text-align: center;
}

input[type="number"].topup-rolling-months,
input[type="number"].topup-tier-threshold,
input[type="number"].topup-random-count {
  width: 3.6rem;
}

input[type="number"].topup-tier-amount,
input[type="number"].topup-random-amount {
  width: 5.2rem;
}

.topup-refs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Indented + connected to .topup-refs above by a shared left border, so
   it reads as "tiers belong to the dip references above them" rather
   than a peer top-level section — matches the toggle in script.js that
   hides this whole block when no dip reference is checked. */
.topup-tiers-section {
  margin-top: 0.5rem;
  margin-left: 0.6rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--border-soft);
}

.topup-tiers-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-body);
}

.topup-tiers-label .helper-text {
  font-weight: 400;
  font-size: 0.8rem;
}

/* Round "?" help button — originally built for the Top-up strategy
   rows, generic enough to reuse anywhere a short hover definition is
   useful (e.g. the Portfolio Turnover Ratio card). */
.topup-strategy-help-btn, .info-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  margin-left: 0.3rem;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
}

.topup-strategy-help-btn:hover, .info-help-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.topup-strategy-description, .info-help-box {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  white-space: pre-line;
  font-size: 0.85rem;
  color: var(--text-body);
}

.topup-tier-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
  margin-bottom: 0.4rem;
  color: var(--text-body);
  font-size: 0.8rem;
  white-space: nowrap;
}

.topup-remove-strategy-btn {
  display: block;
  margin-top: 0.9rem;
}

.topup-tier-remove-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}

.topup-insight {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: var(--accent-bg-soft);
  border: 1px solid var(--accent-border-hover);
  border-left: 3px solid var(--accent-strong);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0.8rem 0;
  color: var(--text-body);
  font-size: 0.84rem;
  line-height: 1.55;
}

.topup-insight-icon {
  flex-shrink: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}

.topup-insight strong {
  color: var(--accent);
  font-weight: 700;
}

button {
  border: none;
  color: var(--text-btn);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-secondary));
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px var(--shadow-btn-hover);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px var(--shadow-btn-hover);
}

button:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Nothing in the app had a custom focus-visible treatment before this —
   every input/button/tab fell back to the browser's default outline
   (inconsistent across browsers, easy to lose against a dark
   background). Keyboard-only via :focus-visible so mouse clicks don't
   show a ring they didn't ask for. Pill-shaped controls (inputs,
   .tab-btn, .range-btn) get a matching rounded glow instead of a boxy
   outline, which would visibly clip the rounded corners. */
button:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
.tab-btn:focus-visible,
.range-btn:focus-visible,
.calc-toc-item:focus-visible {
  outline: none;
  border-color: var(--accent-strong) !important;
  box-shadow: 0 0 0 3px var(--accent-bg-medium);
}

.status {
  margin: 0.8rem 0 0;
  color: var(--text-body);
}

.helper-text {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

#screenerResultsHeader {
  font-size: 0.78rem;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin-top: 1rem;
}

/* Grid items default to min-width: auto, which refuses to shrink below
   the item's content min-content size — so a wide input, a long line of
   text, or (as found on the Topup tab) a flex row set to nowrap can
   force the whole card, the whole grid track, and the whole page wider
   than the viewport even though the track itself is "1fr" or collapsed
   to a single column on mobile. This is the actual fix; the
   max-width:840px/480px breakpoints above only reflow column *counts*,
   they don't do anything about a child refusing to shrink. */
.grid > * {
  min-width: 0;
}

.card {
  padding: 1.2rem;
  margin-top: 1rem;
}

.card h2 {
  margin-top: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

/* Same treatment as .ccs-strategy-card / .topup-strategy-row — a colored
   left border so shared inputs stand out from the strategy panels below. */
.calc-inputs-card {
  border-left: 3px solid var(--accent-strong);
}

/* SIP Calculator for Goal: Parameters vs. Summary get distinct accent
   colors so the two cards read as separate at a glance — Summary's
   color matches CHART_COLORS[3], the same green used for the "Projected
   corpus" line on the chart below it. */
.goal-params-card {
  border-left: 3px solid var(--accent-strong);
}

.goal-summary-card {
  border-left: 3px solid #34d399;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-body);
}

.fund-input,
select {
  background: var(--bg-input);
  color: var(--text-primary);
}

.fund-input {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.7rem 0.9rem;
}

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.suggestions button {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  background: var(--bg-panel);
  color: var(--text-body);
  border: 1px solid var(--border-soft);
}

select[multiple] {
  min-height: 120px;
  border-radius: 16px;
}

.benchmarks-block {
  margin-top: 0.9rem;
}

.compare-controls {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.currency-toggle {
  display: flex;
  gap: 0.4rem;
}

.fund-info-grid {
  display: grid;
  /* Wide enough for the mini holdings sunburst each card now carries
     (renderFundInfo in script.js) — was 220px back when these cards
     were text-only. */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.8rem;
}

.fund-info-card-item {
  display: flex;
  gap: 0.7rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0.9rem;
}

.fund-info-dot {
  width: 8px;
  min-width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.35rem;
}

.fund-info-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.fund-info-name {
  margin: 0 0 0.4rem;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.fund-info-row {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.fund-info-row span {
  color: var(--accent);
  font-weight: 500;
  min-width: 62px;
}

.fund-info-row a {
  color: var(--accent);
  text-decoration: none;
}

.fund-info-row a:hover {
  text-decoration: underline;
}

.auth-widget {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.auth-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.auth-form input {
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  width: 140px;
}

.auth-form button {
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
}

.auth-error {
  color: var(--text-error);
  font-size: 0.78rem;
  margin: 0;
  width: 100%;
  text-align: right;
}

.auth-menu-wrap {
  position: relative;
}

.auth-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px var(--shadow-tooltip);
  padding: 0.6rem;
  z-index: 30;
}

.auth-dropdown-item {
  width: 100%;
  text-align: left;
  border-radius: 10px !important;
  padding: 0.5rem 0.7rem !important;
  background: var(--bg-panel);
  color: var(--text-body);
  border: 1px solid var(--border-soft) !important;
  font-size: 0.85rem;
}

.auth-dropdown-item:hover {
  border-color: var(--border-hover) !important;
  transform: none;
  box-shadow: none;
}

.auth-dropdown-back {
  align-self: flex-start;
  background: none;
  color: var(--text-faint);
  border: none !important;
  padding: 0 !important;
  font-size: 0.78rem;
}

.auth-dropdown-back:hover {
  color: var(--text-body);
  transform: none;
  box-shadow: none;
}

.auth-profile-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-profile-info .fund-info-row {
  font-size: 0.8rem;
}

.auth-dropdown .auth-form {
  flex-direction: column;
  align-items: stretch;
}

.auth-dropdown .auth-form input {
  width: 100%;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0 0.4rem;
}

.tab-btn {
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab) !important;
  border-radius: 999px !important;
  color: var(--text-faint);
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all 140ms ease;
}

.tab-btn:hover {
  color: var(--text-body);
  transform: none;
  box-shadow: none;
}

.tab-btn.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong) !important;
  color: var(--accent-strong);
}

/* A link in the tab bar that opens another page (the admins' audit
   report). Looks like a tab, but is not one: it never becomes active. */
.tab-link {
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  text-decoration: none;
  transition: all 140ms ease;
}

.tab-link:hover,
.tab-link:focus-visible {
  color: var(--text-body);
  border-color: var(--accent-strong);
  outline: none;
}

.tab-panel {
  display: none;
}

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

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.leaderboard-rank {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-bg-medium);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.leaderboard-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--text-body);
  font-size: 0.88rem;
}

.leaderboard-aum {
  font-size: 0.76rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* AUM and the Foreign Equity tag sit side by side on one line below the
   fund name, instead of each getting its own row inside .leaderboard-name's
   column flex — wraps if both don't fit a narrow row. */
.leaderboard-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.leaderboard-meta-row .tag-foreign-equity {
  margin-left: 0;
}

.leaderboard-meta-row .tag-consistent-top10,
.leaderboard-meta-row .tag-crown-top10 {
  margin-left: 0;
}

.leaderboard-value {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Opens a fund's Equity Style Box inline, right below its own
   leaderboard row (see toggleLeaderboardStyleBoxPanel) — placement
   (before the % value, not next to the name or AUM) was picked by the
   user from a live 3-option demo. Sits inside .leaderboard-value
   (already flex) rather than after the value text, so the % stays the
   rightmost, most-scannable element in a numbers-heavy list. */
.leaderboard-style-box-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-faint);
  cursor: pointer;
  flex: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.leaderboard-style-box-btn:hover,
.leaderboard-style-box-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

.leaderboard-style-box-panel {
  margin: -0.2rem 0 0.5rem;
  padding: 0.9rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.leaderboard-row.selected-fund {
  border-color: var(--accent-strong);
  border-left-width: 3px;
  background: var(--accent-bg-selected);
}

/* holdings-diff card: two side-by-side lists (Net Adds / Net Trims),
   each a colored heading over the same .leaderboard-row shape everything
   else already uses. Green/red here is a buy/sell direction, not a
   good/bad status judgment, so it deliberately reuses the same --series-3
   (green, already used for "Top 10 Percentile"/positive tags) rather than
   the reserved status-color tokens. */
.holdings-diff-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}

.holdings-diff-col-heading {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.6rem;
}

.holdings-diff-col-heading.adds { color: var(--series-3); }

/* Rows past the default 5 sit inside this wrapper, hidden via inline
   style until "Show N more" is clicked — a nested block, not a direct
   .leaderboard-list flex child, so it needs its own matching gap or
   the extra rows would touch with no spacing between them. */
.holdings-diff-extra {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.holdings-diff-col-heading.trims { color: #f87171; }

.holdings-diff-meta {
  font-size: 0.76rem;
  color: var(--text-faint);
}

.holdings-diff-ca-tag {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--zone-caution);
}

.holdings-diff-tag {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
}

.holdings-diff-tag.new {
  color: var(--series-3);
  background: color-mix(in srgb, var(--series-3) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-3) 40%, transparent);
}

.holdings-diff-tag.exited {
  color: #f87171;
  background: color-mix(in srgb, #f87171 16%, transparent);
  border: 1px solid color-mix(in srgb, #f87171 40%, transparent);
}

/* Categories tab's top-10 drilldown rows — see openPeerComparisonForCode
   in script.js. Peer Comparison's own leaderboard rows never get this
   class, so their cursor/hover stays inert (clicking them wouldn't do
   anything new — that fund's peer comparison is already on screen). */
.leaderboard-row-clickable {
  cursor: pointer;
  transition: all 120ms ease;
}

.leaderboard-row-clickable:hover,
.leaderboard-row-clickable:focus-visible {
  border-color: var(--accent-strong);
  background: var(--accent-bg-soft);
  outline: none;
}

/* Screener's fund-name cell — same "open this fund's Peer Comparison"
   navigation as the Categories drilldown rows above, styled as an
   inline link since it lives inside a dense results table. */
.screener-fund-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}

/* Smaller than the app's default table text (th, td) — this table has
   grown wide with the Returns/Risk/Composition columns, so a smaller
   size fits more on screen before horizontal scroll kicks in. */
.screener-table th,
.screener-table td {
  font-size: 0.78rem;
}

.screener-fund-link:hover,
.screener-fund-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* "Foreign Equity" exposure tag — same hue as the sunburst/asset-history
   charts' own Foreign Equity segment (--series-5) so the color means the
   same thing everywhere it appears, not a fresh color invented per view. */
.tag-foreign-equity {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--series-5);
  background: color-mix(in srgb, var(--series-5) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-5) 40%, transparent);
  vertical-align: middle;
}

/* "Consistent Top 10%" tag (Categories tab drilldown) — top-decile in
   BOTH 3Y and 5Y of the selected metric, not just the currently-viewed
   period. Same pill shape as .tag-foreign-equity; green (--series-3,
   already theme-adjusted light/dark) since this is a positive
   performance signal, not a neutral accent. */
.tag-consistent-top10 {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--series-3);
  background: color-mix(in srgb, var(--series-3) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-3) 40%, transparent);
  vertical-align: middle;
}

/* "Crown" tier — top-decile in 3Y, 5Y AND 7Y at once, strictly harder
   than (and a subset of) .tag-consistent-top10's 3Y-&-5Y bar, so it
   replaces rather than stacks with that badge. Same pill shape, but
   the amber series color (--series-4, already theme-adjusted) marks
   it as the higher tier rather than reusing the green. */
.tag-crown-top10 {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--series-4);
  background: color-mix(in srgb, var(--series-4) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--series-4) 40%, transparent);
  vertical-align: middle;
}

.heat-bar-wrap {
  position: relative;
  margin-top: 2.4rem;
}

.heat-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f87171, #f59e0b, #34d399);
}

/* PE's low end is the "good" (cheap) one, opposite of every other
   heat-bar user (returns, percentile rank, EPS) where low is bad —
   flips the same red/amber/green gradient rather than needing a whole
   second color scale. */
.heat-bar--reversed {
  background: linear-gradient(90deg, #34d399, #f59e0b, #f87171);
}

/* Some metrics have NO good direction and must not be painted as if
   they did. A higher portfolio YTM is not better than a lower one — it
   is more yield in exchange for more risk, and which a reader wants
   depends on why they hold the fund. The red-to-green track would hand
   them a verdict the number doesn't support, so these get a neutral
   ramp that still shows POSITION in the peer range without grading it. */
.heat-bar--neutral {
  background: linear-gradient(90deg, var(--border-soft), var(--text-dim));
}

.heat-bar-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--text-primary), 0 2px 6px var(--shadow-card);
  transform: translate(-50%, -50%);
}

.heat-bar-marker-label {
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.heat-bar-endpoints {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* Returns Rank + Percentile Rank now share one card (see index.html) —
   a rule instead of the card's usual full margin/padding gap, since
   .card h2's own margin-top:0 would otherwise butt "Percentile Rank"
   right up against the endpoints line above it. */
#categoryHeatBarPercentile {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-tab);
}

/* Riskometer color legend (Categories tab) + the small per-fund risk
   box it introduces elsewhere — same 6 colors SEBI's own Riskometer
   uses on every fund's real disclosure, not an invented palette (see
   RISK_LEVEL_META, script.js). The legend's boxes step up in height
   left-to-right so severity reads from shape as well as hue — a
   colorblind or grayscale view of this row still shows an ascending
   staircase, not six same-sized swatches distinguishable only by color. */
/* Plain 6-box color strip + a single arrow + one "Risk" caption below —
   the strip reads as one continuous low-to-high scale (green to red),
   not six individually-labeled chips. Fixed-size boxes (not flex:1)
   since there's no text to accommodate anymore, so a fixed row width
   plus wrap is enough to guarantee this never overflows into a sibling
   card the way the min-width-per-box version did. */
#categorySearchBox {
  margin-bottom: 0.6rem;
}

.category-choice-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.15rem 0 0.7rem;
  color: var(--text-dim);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.category-choice-divider::before,
.category-choice-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

#categorySearchBox .fund-input {
  width: 100%;
  max-width: 320px;
  text-align: center;
  margin: 0 auto;
}

.risk-legend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0.7rem 0 1rem;
  overflow: visible;
}

.risk-legend-boxes {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  max-width: 280px;
  gap: 0.4rem;
}

.risk-legend-box {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 34px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 2px 5px rgba(15, 23, 42, 0.18);
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.risk-legend-box:hover {
  transform: translateY(-2px);
}

.risk-legend-box:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 1px 2px rgba(15, 23, 42, 0.2);
}

.risk-legend-box.active {
  z-index: 2;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent-strong);
  transform: translateY(-2px);
}

.risk-legend-clear {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.12rem 0.38rem;
  margin: 0;
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.risk-legend-arrow {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
}

.risk-legend-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
}

.risk-legend-caption {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  white-space: nowrap;
}

.risk-legend-caption strong {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Wraps the "Start with a decision" launchpad and the risk/search
   card — a distinctive gradient-bordered panel at the top of the
   Categories tab, ported from the Android build's own homepage. */
.home-launchpad {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border-soft));
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 5%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 38%),
    linear-gradient(145deg, var(--bg-card), var(--bg-panel));
  box-shadow: 0 12px 32px var(--shadow-card);
}

.home-launch-copy {
  max-width: 620px;
  margin-bottom: 0.75rem;
}

.home-launch-copy h2 {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.45rem;
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.home-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.85rem;
  text-align: left;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-card) 82%, var(--home-action-color, var(--accent)) 18%);
  color: var(--text-body);
}

.home-action-peer { --home-action-color: #17a673; }
.home-action-screen { --home-action-color: #3987e5; }
.home-action-compare { --home-action-color: #8b75de; }
.home-action-plan { --home-action-color: #d58b24; }

.home-action-icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--home-action-color) 22%, transparent);
  color: var(--home-action-color);
  font-size: 1.1rem;
  font-weight: 700;
}

.home-action strong {
  display: block;
  font-size: 0.84rem;
}

.home-action-arrow {
  color: var(--text-faint);
  font-size: 1.25rem;
}

.home-section-intro {
  margin: 1.1rem 0 0.7rem 0.25rem;
}

.home-section-intro h2 {
  margin: 0.12rem 0 0;
  font-family: var(--font-sans);
  font-size: 1rem;
}

.home-guidance-card {
  min-width: 0;
  overflow: hidden;
  padding: 1rem 1rem 0;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--bg-card);
  box-shadow: 0 8px 22px var(--shadow-card);
}

.home-guidance-when {
  grid-column: span 2;
}

.home-guidance-direct {
  cursor: pointer;
  padding-bottom: 1rem;
}

.home-guidance-direct:active {
  border-color: var(--accent-border-hover);
  background: var(--accent-bg-soft);
}

.home-guidance-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 3.25rem;
}

.home-guidance-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 12px;
  background: var(--accent-bg-medium);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 750;
}

.home-guidance-how .home-guidance-mark {
  color: #b66c0a;
  background: color-mix(in srgb, #e8a33d 18%, transparent);
}

.home-guidance-when .home-guidance-mark {
  color: #8067cf;
  background: color-mix(in srgb, #8b75de 18%, transparent);
}

.home-guidance-card h3 {
  margin: 0 0 0.28rem;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.25;
}

.home-mini-tabs {
  display: flex;
  gap: 1.1rem;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--border-soft);
}

.home-mini-tabs::-webkit-scrollbar {
  display: none;
}

.home-mini-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0.7rem 0.05rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 650;
  white-space: nowrap;
}

.home-mini-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

.home-mini-tab.active {
  color: var(--text-body);
}

.home-mini-tab.active::after {
  background: var(--accent-strong);
}

.home-category-tools {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.home-category-tools > .card {
  margin: 0;
}

@media (max-width: 760px) {
  .home-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .home-launchpad {
    padding: 1rem;
    border-radius: 18px;
  }

  .home-launch-copy h2 {
    font-family: var(--font-sans);
    font-size: 1.15rem;
  }

  .home-action {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.72rem;
  }

  .home-action-arrow {
    display: none;
  }

  .home-guidance-card {
    padding: 0.9rem 0.9rem 0;
  }

  .home-guidance-heading {
    min-height: 0;
    padding-bottom: 0.8rem;
  }

  .home-guidance-card h3 {
    font-size: 0.92rem;
  }

  .home-mini-tab {
    font-size: 0.7rem;
  }
}

/* Compact per-fund badge (riskBoxMarkup) — reused wherever a single
   fund's own risk level is shown next to its name. */
.risk-box {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: middle;
}

.risk-box-md {
  padding: 0.1rem 0.5rem;
}

.risk-box-sm {
  padding: 0.03rem 0.4rem;
  font-size: 0.62rem;
}

/* Peer Comparison / Compare Pro's Risk Meter card — the gauge
   (riskGaugeMarkup), one per fund. */
.risk-meter-fund-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
}

.risk-gauge-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 11rem;
}

.risk-gauge-svg {
  max-width: 100%;
  height: auto;
}

.risk-gauge-fund-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  text-align: center;
  margin-top: -0.3rem;
}

.risk-gauge-level-label {
  font-size: 0.72rem;
  font-weight: 700;
}

/* Fit against the signed-in user's own risk profile
   (riskProfileFitMarkup, script.js). */
.risk-fit {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.risk-fit--within {
  color: var(--peer-fund-line);
  background: color-mix(in srgb, var(--peer-fund-line) 12%, transparent);
}

.risk-fit--above {
  color: var(--text-error);
  background: color-mix(in srgb, var(--text-error) 12%, transparent);
}

.risk-fit--prompt {
  border: 1px dashed var(--border-hover);
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.risk-fit--prompt:hover {
  border-color: var(--accent-strong);
}

.leaderboard-divider {
  margin: 0.3rem 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
}

/* Peer Comparison's "Surveillance, Ownership & Trading Risk" card —
   renderPeerRiskFlags in script.js. Deliberately restrained/neutral
   tones, not alarm-red — this is a diagnostic exposure panel, not a
   verdict (see NSE's own ASM FAQ wording quoted in script.js). */
.risk-exposure-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.risk-exposure-row {
  display: grid;
  grid-template-columns: 13rem 1fr 6.5rem;
  align-items: center;
  gap: 0.6rem;
}
/* Pledge split by size, under the pledge row (2026-11-04). */
.risk-exposure-row--sub .risk-exposure-label {
  padding-left: 1rem;
  font-size: 0.7rem;
}
.risk-exposure-row--sub .risk-exposure-fill {
  opacity: 0.55;
}
.risk-exposure-row--sub .risk-exposure-pct {
  font-weight: 500;
}
.risk-exposure-note {
  margin: -0.2rem 0 0.1rem 1rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.risk-exposure-unit {
  font-weight: 400;
  color: var(--text-dim);
}
.risk-exposure-count {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-dim);
}
.risk-summary {
  margin: 0.2rem 0 0.3rem;
  font-size: 0.9rem;
  color: var(--text-body);
}
@media (max-width: 620px) {
  .risk-exposure-row {
    grid-template-columns: 1fr 6.5rem;
    row-gap: 0.2rem;
  }
  .risk-exposure-label {
    grid-column: 1 / -1;
  }
}
.risk-exposure-label {
  font-size: 0.74rem;
  color: var(--text-dim);
}
.risk-exposure-track {
  height: 0.5rem;
  background: var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
}
.risk-exposure-fill {
  height: 100%;
  border-radius: 999px;
}
.risk-exposure-fill--asm { background: #f2a765; }
.risk-exposure-fill--gsm { background: #e8c96b; }
.risk-exposure-fill--pledge { background: var(--accent-secondary); }
.risk-exposure-fill--notrade { background: var(--text-dim); }
.risk-exposure-fill--any { background: var(--accent-strong); }
.risk-exposure-pct {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.risk-flagged-holdings-details {
  margin-top: 0.5rem;
}
.risk-flagged-holdings-details summary {
  cursor: pointer;
}
.risk-flagged-holdings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-height: 20rem;
  overflow-y: auto;
}
.risk-flagged-holding {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
}
.risk-flagged-holding-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.risk-flagged-holding-symbol {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-body);
}
.risk-flagged-holding-weight {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.risk-flagged-holding-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}
.risk-flag-chip {
  font-size: 0.66rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.risk-flag-chip--asm { border-color: #f2a765; color: #f2a765; }
.risk-flag-chip--gsm { border-color: #e8c96b; color: #e8c96b; }
.risk-flag-chip--pledge { border-color: var(--accent-secondary); color: var(--accent-secondary); }
.risk-flag-chip--notrade { border-color: var(--text-dim); color: var(--text-dim); }

/* Peer Comparison's Rolling Returns Record — renderRollingRecord in
   script.js (2026-11-04). Periods as columns; each cell a main figure
   with its margin or dates on a smaller line under it. */
.rolling-record-wrap {
  overflow-x: auto;
  margin: 0.6rem 0;
}
.rolling-record-table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  /* The four period columns share the width equally. */
  table-layout: fixed;
}
.rolling-record-table th,
.rolling-record-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: center;
  vertical-align: top;
}
.rolling-record-table thead th {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rolling-record-table tbody th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-body);
  text-transform: none;
  letter-spacing: 0;
}
.rolling-record-table thead th:first-child,
.rolling-record-table tbody th {
  width: 28%;
}
/* Phones: the row labels stay put while the periods scroll sideways. */
@media (max-width: 620px) {
  .rolling-record-table {
    min-width: 32rem;
  }
  .rolling-record-table tbody th,
  .rolling-record-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-input);
    width: 8rem;
    min-width: 8rem;
    font-size: 0.74rem;
  }
}
.rolling-main {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.rolling-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}

/* Peer Comparison's Style Box card — Value/Blend/Growth x
   Large/Mid/Small (equity) and Credit Quality x Duration (debt), see
   renderPeerStyleBox in script.js. Deliberately compact (small grid,
   small type) — a 9-cell heat-map only needs to communicate one
   highlighted cell, not command a large chunk of the page; the user
   asked to shrink this same grid twice (once as the leaderboard's own
   inline expand panel, then here on its original dedicated card too),
   so both now share one small sizing instead of keeping two. */
.style-box-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem 2rem;
}

.style-box-group {
  max-width: 22rem;
}

/* Quality's card outgrew the shared 22rem cap once a 4th gauge (QMJ
   Modified) was added 2026-09-15 — it was wrapping onto its own row.
   Overridden here rather than changing the shared class, which other
   cards (Momentum, Style Box) still rely on at the narrower width.
   Widened again 2026-09-16 for an 8th gauge (BSE-formula, a faithful
   replica of BSE Index Services' real Quality index methodology). */
.style-box-group-quality {
  max-width: 66rem;
}

.style-box-heading {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-body);
}

.style-box-content {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.style-box-grid {
  display: grid;
  gap: 2px;
  align-items: stretch;
  flex: 1 1 9rem;
  min-width: 8rem;
  max-width: 11rem;
}

.style-box-corner {
  min-width: 2.4rem;
}

.style-box-colhead,
.style-box-rowhead {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  padding: 0.1rem;
}

.style-box-rowhead {
  justify-content: flex-end;
  padding-right: 0.35rem;
  text-align: right;
}

.style-box-cell {
  aspect-ratio: 1 / 1;
  min-height: 1.7rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease;
}

/* Continuous "50+ / 25-49 / 10-24 / 0-9" weight% heat scale, same
   bands Morningstar's own Stock Style box uses — see weightTier() in
   script.js. Built from --accent-strong via color-mix so it stays
   theme-correct in both light and dark without separate overrides. */
.style-box-cell--w0 {
  background: color-mix(in srgb, var(--accent-strong) 10%, var(--bg-panel));
  color: var(--text-dim);
}

.style-box-cell--w1 {
  background: color-mix(in srgb, var(--accent-strong) 35%, var(--bg-panel));
  color: var(--text-body);
}

.style-box-cell--w2 {
  background: color-mix(in srgb, var(--accent-strong) 62%, var(--bg-panel));
  color: #fff;
}

.style-box-cell--w3 {
  background: color-mix(in srgb, var(--accent-strong) 92%, var(--bg-panel));
  color: #fff;
}

.style-box-cell--muted {
  background: repeating-linear-gradient(
    45deg, var(--bg-panel), var(--bg-panel) 4px, var(--border-subtle) 4px, var(--border-subtle) 5px
  );
  border-style: dashed;
}

.style-box-legend {
  flex: none;
  min-width: 5.5rem;
  padding-top: 0;
}

/* Floating "Ask SIPthesis" chatbot — position: fixed so it stays put
   across tab switches; lives outside every .tab-panel in index.html. */
.fund-chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 500;
}

.fund-chat-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-page);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow-tooltip);
  transition: transform 140ms ease;
}

.fund-chat-toggle:hover {
  transform: scale(1.06);
}

.fund-chat-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(380px, calc(100vw - 2.5rem));
  max-height: min(560px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 12px 32px var(--shadow-tooltip);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.fund-chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display, inherit);
  font-weight: 600;
  color: var(--text-primary);
}

.fund-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fund-chat-new {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-faint);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
}

.fund-chat-new:hover {
  color: var(--text-primary);
  border-color: var(--text-faint);
}

/* Minimise: the panel shrinks to its title bar (conversation kept);
   clicking the bar or the restore arrow brings it back. Close (x) hides
   the panel entirely. */
.fund-chat-minimize {
  background: none;
  border: none;
  color: var(--text-faint);
  line-height: 0;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
}

.fund-chat-minimize:hover {
  color: var(--text-primary);
}

.fund-chat-icon-restore,
.fund-chat-panel.is-minimized .fund-chat-icon-min {
  display: none;
}

.fund-chat-panel.is-minimized .fund-chat-icon-restore {
  display: inline;
}

.fund-chat-panel.is-minimized {
  width: min(240px, calc(100vw - 2.5rem));
}

.fund-chat-panel.is-minimized > :not(.fund-chat-panel-header),
.fund-chat-panel.is-minimized .fund-chat-new {
  display: none;
}

.fund-chat-panel.is-minimized .fund-chat-panel-header {
  border-bottom: none;
  cursor: pointer;
}

.fund-chat-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}

.fund-chat-close:hover {
  color: var(--text-primary);
}

.fund-chat-panel-hint {
  margin: 0.5rem 0.9rem;
  font-size: 0.76rem;
}

/* One scrollable region owns everything that can grow tall (transcript,
   greeting screen, the example-question tree) so the input bar below it
   can never be pushed out of view / clipped by the panel's own
   `overflow: hidden` + capped max-height — confirmed as a real bug: on
   a shorter viewport the greeting's icon+heading+3 buttons alone could
   exceed the panel's height, silently hiding the input entirely. */
.fund-chat-style-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.6rem;
}

.fund-chat-scroll {
  flex: 1;
  min-height: 0; /* required for a flex child to actually shrink/scroll instead of forcing the panel taller */
  overflow-y: auto;
}

.fund-chat-messages {
  padding: 0 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fund-chat-messages:not(:empty) {
  min-height: 2rem;
  margin-bottom: 0.4rem;
}

.fund-chat-form,
.fund-chat-disclaimer {
  flex-shrink: 0; /* always stay visible, regardless of how tall the scroll region's content gets */
}

.fund-chat-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem 1rem 0.5rem;
  gap: 0.15rem;
}

.fund-chat-greeting-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, var(--accent), var(--accent-strong, var(--accent)));
  color: var(--bg-page);
  margin-bottom: 0.35rem;
}

.fund-chat-greeting-time {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.fund-chat-greeting-heading {
  margin: 0.1rem 0 0.7rem;
  font-family: var(--font-display, inherit);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.fund-chat-featured {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.fund-chat-featured-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab);
  border-radius: 10px;
  color: var(--text-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.fund-chat-featured-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
}

.fund-chat-featured-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fund-chat-explore-toggle {
  margin-top: 0.6rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem;
}

.fund-chat-explore-toggle:hover {
  text-decoration: underline;
}

.fund-chat-disclaimer {
  margin: 0.35rem 0.9rem 0.7rem;
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-faint);
}

.fund-chat-message--question {
  color: var(--text-faint);
  font-size: 0.82rem;
  font-style: italic;
  align-self: flex-end;
  text-align: right;
}

.fund-chat-message--answer {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.86rem;
  color: var(--text-body);
  line-height: 1.5;
}

.fund-chat-examples {
  padding: 0.6rem 0.9rem 0;
  max-height: 12rem;
  overflow-y: auto;
}

.fund-chat-topic-group {
  border-bottom: 1px solid var(--border-soft);
}

.fund-chat-topic-group:last-child {
  border-bottom: none;
}

.fund-chat-topic {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.1rem;
  cursor: pointer;
}

.fund-chat-topic:hover {
  color: var(--accent);
}

.fund-chat-topic-categories {
  padding-left: 0.6rem;
  border-left: 2px solid var(--border-soft);
  margin: 0 0 0.5rem 0.15rem;
}

.fund-chat-example-group {
  border-bottom: 1px solid var(--border-soft);
}

.fund-chat-example-group:last-child {
  border-bottom: none;
}

.fund-chat-example-category {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.1rem;
  cursor: pointer;
}

.fund-chat-example-category:hover {
  color: var(--text-primary);
}

.fund-chat-example-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-bottom: 0.5rem;
}

.fund-chat-example-btn {
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 0.78rem;
  padding: 0.32rem 0.75rem;
  cursor: pointer;
  transition: all 140ms ease;
}

.fund-chat-example-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border);
}

.fund-chat-example-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fund-chat-action-btn {
  display: inline-block;
  margin-top: 0.4rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.fund-chat-action-btn:hover {
  background: var(--accent);
  color: var(--bg-card);
}

/* --- Structured answer cards (category_comparison/fund_metric/
   fund_ranking/clarification) — compact result cards instead of a wall
   of prose, per external review, 2026-09-23: "one card per answer,
   showing only what was requested." Reuses this app's own existing
   tokens (--bg-input, --border-soft, --macro-up/--macro-down for
   above/below-category direction) rather than a separate palette, so it
   stays in step with the app's own light/dark themes automatically. */
.fund-chat-card {
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 0.84rem;
  color: var(--text-body);
}

.fund-chat-card-head {
  margin-bottom: 0.5rem;
}

.fund-chat-card-fund {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.92rem;
}

.fund-chat-card-meta,
.fund-chat-card-notice {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.fund-chat-card-coverage {
  color: var(--text-faint);
  font-size: 0.74rem;
}

.fund-chat-card-coverage {
  margin-top: 0.5rem;
}

.fund-chat-card-headline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.fund-chat-headline-glyph {
  font-size: 0.7rem;
  line-height: 1;
}

/* Colour is never the ONLY signal — every headline already carries the
   verdict as a label ("Ahead of category..."); colour + glyph reinforce
   it rather than stand alone for it. */
.fund-chat-card-headline--ahead { color: var(--macro-up); }
.fund-chat-card-headline--ahead .fund-chat-headline-glyph { color: var(--macro-up); }
.fund-chat-card-headline--behind { color: var(--macro-down); }
.fund-chat-card-headline--behind .fund-chat-headline-glyph { color: var(--macro-down); }
.fund-chat-card-headline--even .fund-chat-headline-glyph,
.fund-chat-card-headline--mixed .fund-chat-headline-glyph,
.fund-chat-card-headline--unavailable .fund-chat-headline-glyph { color: var(--macro-neutral); }

.fund-chat-card-basis {
  color: var(--text-faint);
  font-size: 0.76rem;
  margin-bottom: 0.55rem;
}

.fund-chat-period-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}

.fund-chat-period-tab {
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  cursor: pointer;
}

.fund-chat-period-tab:hover {
  border-color: var(--text-faint);
  color: var(--text-primary);
}

.fund-chat-period-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-card);
}

.fund-chat-compare-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  column-gap: 0.5rem;
  row-gap: 0.3rem;
  align-items: center;
}

.fund-chat-compare-colhead {
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 600;
  text-align: right;
}

.fund-chat-compare-label {
  color: var(--text-body);
  font-size: 0.78rem;
}

.fund-chat-compare-cell {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 1.35rem;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-panel-strong);
}

.fund-chat-compare-bar {
  position: absolute;
  inset: 0 0 0 auto;
  height: 100%;
  border-radius: 4px;
  opacity: 0.35;
}

.fund-chat-compare-cell--fund .fund-chat-compare-bar { background: var(--accent); }
.fund-chat-compare-cell--category .fund-chat-compare-bar { background: var(--text-faint); }

.fund-chat-compare-num {
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-primary);
  padding: 0 0.4rem;
}

.fund-chat-how-calculated {
  margin-top: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-faint);
}

.fund-chat-how-calculated summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.fund-chat-how-calculated p {
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.fund-chat-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin-top: 0.6rem;
}

.fund-chat-card-actions .fund-chat-action-btn {
  margin-top: 0;
}

.fund-chat-card-secondary-wrap .fund-chat-action-btn {
  border-color: var(--border-soft);
  color: var(--text-faint);
  font-weight: 500;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
}

.fund-chat-card-secondary-wrap .fund-chat-action-btn:hover {
  background: none;
  border-color: var(--text-faint);
  color: var(--text-primary);
}

.fund-chat-metric-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.6rem;
  row-gap: 0.3rem;
}

.fund-chat-metric-label {
  color: var(--text-faint);
  font-size: 0.78rem;
}

.fund-chat-metric-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.84rem;
}

.fund-chat-ranking-group-label {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0.5rem 0 0.25rem;
}

.fund-chat-ranking-group-label:first-child {
  margin-top: 0;
}

.fund-chat-ranking-row {
  display: grid;
  grid-template-columns: 1.3rem 1fr auto;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.fund-chat-ranking-row:last-child {
  border-bottom: none;
}

.fund-chat-ranking-rank {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.fund-chat-ranking-name {
  color: var(--text-body);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fund-chat-ranking-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fund-chat-card--clarification {
  border-color: var(--accent);
}

.fund-chat-clarification-text {
  color: var(--text-primary);
  line-height: 1.45;
}

/* --- fund_overview / fund_holdings / reading-only signals ------------
   Second design pass, external review 2026-09-23: a full research-app
   overview (size, period-tabbed returns, a reading-only "Portfolio
   signals" table, expandable holdings/valuation/managers/methodology)
   instead of a flat fact list, plus a real allocation-bar table for
   holdings. Percentile numbers are never displayed in a card — only the
   reading (Strong/Positive/Neutral/Weak/Very weak) with a subtle colour
   dot alongside the label text (colour is never the only signal). */
.fund-chat-section-heading {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.7rem 0 0.35rem;
}

.fund-chat-card-body:first-of-type .fund-chat-section-heading,
.fund-chat-card--overview > .fund-chat-section-heading:first-child {
  margin-top: 0;
}

.fund-chat-reading-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.fund-chat-reading-dot--positive { background: var(--macro-up); }
.fund-chat-reading-dot--neutral { background: var(--macro-neutral); }
.fund-chat-reading-dot--negative { background: var(--macro-down); }

.fund-chat-signal-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 0.3rem;
  align-items: center;
}

.fund-chat-signal-label {
  color: var(--text-body);
  font-size: 0.78rem;
}

.fund-chat-signal-reading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.8rem;
  font-weight: 700;
}

.fund-chat-signal-reading--positive { color: var(--macro-up); }
.fund-chat-signal-reading--neutral { color: var(--macro-neutral); }
.fund-chat-signal-reading--negative { color: var(--macro-down); }

.fund-chat-expandable {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.5rem;
}

.fund-chat-expandable summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.8rem;
}

.fund-chat-expandable summary::marker {
  color: var(--accent);
}

/* Copy / thumbs up / thumbs down under each chat answer (2026-10-17). */
.fund-chat-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin-top: 0.4rem;
}

.fund-chat-feedback-btn {
  display: inline-flex;
  padding: 0.3rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
}

.fund-chat-feedback-btn:hover,
.fund-chat-feedback-btn:focus-visible {
  color: var(--text-primary);
  background: var(--accent-bg-soft);
  outline: none;
}

.fund-chat-feedback-btn[aria-pressed="true"] {
  color: var(--accent-strong);
}

.fund-chat-feedback-status {
  margin-left: 0.3rem;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.fund-chat-feedback-comment {
  display: flex;
  gap: 0.35rem;
  width: 100%;
  margin-top: 0.3rem;
}

.fund-chat-feedback-comment input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  background: var(--bg-input, transparent);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.78rem;
}

.fund-chat-feedback-comment button {
  padding: 0.35rem 0.7rem;
  background: none;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

/* Fund evaluation in the chat's fund card (2026-10-17). */
.fund-chat-eval-summary {
  margin: 0.3rem 0 0.6rem;
  color: var(--text-body);
  font-size: 0.84rem;
  line-height: 1.45;
}

.fund-chat-scorecard {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fund-chat-score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 2.6rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-body);
}

.fund-chat-score-dim {
  min-width: 0;
}

.fund-chat-score-value {
  display: block;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.fund-chat-score-pill {
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid currentColor;
}

.fund-chat-score-pill--positive { color: var(--macro-up); }
.fund-chat-score-pill--negative { color: var(--macro-down); }
.fund-chat-score-pill--neutral { color: var(--macro-neutral); }
/* Momentum: no colour (user decision, 2026-10-17). */
.fund-chat-score-pill--none { color: var(--text-muted); }
.fund-chat-reading-dot--none { display: none; }
.fund-chat-signal-reading--none { color: var(--text-body); }

.fund-chat-score-rank {
  text-align: right;
  color: var(--text-faint);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.fund-chat-peer-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.fund-chat-peer-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.6rem 4.6rem;
  align-items: center;
  gap: 0.4rem;
}

.fund-chat-peer-line--head {
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 600;
  text-align: right;
}

.fund-chat-peer-line--head span:first-child {
  text-align: left;
  font-weight: 500;
}

.fund-chat-peer-name {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--text-body);
  line-height: 1.25;
}

.fund-chat-peer-rank {
  flex: none;
  min-width: 1rem;
  color: var(--text-faint);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.fund-chat-peer-line--this .fund-chat-peer-name {
  color: var(--text-primary);
  font-weight: 700;
}

.fund-chat-peer-line--this {
  padding: 0.2rem 0.3rem;
  margin: 0 -0.3rem;
  border-radius: 6px;
  background: var(--accent-bg-soft);
}

.fund-chat-peer-line--avg .fund-chat-peer-name {
  color: var(--text-faint);
  font-style: italic;
}

.fund-chat-compare-cell--peer .fund-chat-compare-bar { background: var(--text-muted); opacity: 0.22; }

.fund-chat-peer-gaps {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  color: var(--text-body);
}

.fund-chat-peer-gap {
  font-weight: 600;
  white-space: nowrap;
}

.fund-chat-peer-gap--up { color: var(--macro-up); }
.fund-chat-peer-gap--down { color: var(--macro-down); }

.fund-chat-observations {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fund-chat-observation {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-body);
}

.fund-chat-observation-icon {
  font-weight: 700;
  text-align: center;
}

.fund-chat-observation--positive .fund-chat-observation-icon { color: var(--macro-up); }
.fund-chat-observation--negative .fund-chat-observation-icon { color: var(--macro-down); }
.fund-chat-observation--neutral .fund-chat-observation-icon { color: var(--text-faint); }

.fund-chat-link-btn {
  padding: 0;
  background: none;
  border: none;
  color: var(--accent-strong);
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fund-chat-link-btn:hover,
.fund-chat-link-btn:focus-visible {
  color: var(--text-primary);
}

.fund-chat-detail-note {
  margin: 0.4rem 0 0;
  color: var(--text-faint);
  font-size: 0.74rem;
  line-height: 1.4;
}

.fund-chat-suitability-disclaimer {
  margin: 0 0 0.6rem;
  color: var(--text-body);
  font-size: 0.8rem;
  font-style: italic;
}

.fund-chat-holdings-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fund-chat-holdings-list--compact {
  margin-top: 0.4rem;
  gap: 0.25rem;
}

.fund-chat-holding-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.15rem;
}

.fund-chat-card--holdings .fund-chat-holding-row {
  grid-template-columns: 1fr 4rem 3rem;
}

.fund-chat-holding-name {
  color: var(--text-body);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
}

.fund-chat-holding-sector {
  color: var(--text-faint);
  font-size: 0.68rem;
}

.fund-chat-holding-bar-track {
  height: 0.4rem;
  border-radius: 3px;
  background: var(--bg-panel-strong);
  overflow: hidden;
}

.fund-chat-holding-bar {
  display: block;
  height: 100%;
  background: var(--accent);
  opacity: 0.7;
  border-radius: 3px;
}

.fund-chat-holding-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.fund-chat-explore-links {
  padding: 0.4rem 0.9rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.fund-chat-explore-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.fund-chat-explore-item .fund-chat-action-btn {
  margin-top: 0;
  padding: 0.15rem 0.5rem;
  font-size: 0.74rem;
}

.fund-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
}

.fund-chat-input {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
}

.fund-chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fund-chat-submit {
  background: var(--accent);
  color: var(--bg-page);
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.fund-chat-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.style-box-legend-title {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--text-body);
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.style-box-legend-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.64rem;
  color: var(--text-body);
  margin-bottom: 0.15rem;
}

.style-box-legend-swatch {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  flex: none;
}

.style-box-coverage {
  margin-top: 0.4rem;
  font-size: 0.62rem;
  max-width: 26rem;
}

/* Momentum score — shares the Style Box card (equityStyleBoxHtml/
   debtStyleBoxHtml above it): a vertical High-to-Low gauge (Morningstar-
   style capsule + marker dot) alongside the band/percentile/stats. */
.style-box-momentum {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.style-box-momentum-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: none;
}

.style-box-momentum-gauge-label {
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.style-box-momentum-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.style-box-momentum-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* Legend under the gauge, one item per line (user's request 2026-10-06). */
.style-box-momentum-legend--stacked {
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.6rem 0 0;
}

.style-box-momentum-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.style-box-momentum-swatch {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  flex: none;
}

.style-box-momentum-swatch--range {
  opacity: 0.35;
  border-radius: 2px;
}

.style-box-momentum-swatch--avg {
  background: var(--text-primary);
  width: 0.5rem;
  height: 0.5rem;
}

.style-box-momentum-band {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.style-box-momentum-pct {
  font-size: 0.64rem;
  color: var(--text-dim);
}

/* Small print under each Quality gauge ("Scored: x% NAV", holdings date),
   the same size as Momentum's 3M/6M/12-1M line. */
.style-box-quality-meta {
  font-size: 0.64rem;
  line-height: 1.45;
  margin: 4px 0 0;
}
.style-box-momentum-stats {
  display: flex;
  gap: 0.6rem;
  font-size: 0.64rem;
  color: var(--text-body);
}

.style-box-momentum-gauge-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 6.5rem;
}

.style-box-momentum-gauge-sublabel {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-body);
}

.style-box-quality-smallcap-note {
  max-width: 9rem;
  font-size: 0.58rem;
  text-align: center;
  color: var(--text-dim);
}

.style-box-quality-na {
  max-width: 9rem;
  font-size: 0.62rem;
  text-align: center;
  margin: 0.4rem 0 0;
}

.style-box-momentum-stat-label {
  color: var(--text-dim);
  margin-right: 0.15rem;
}

/* Categories tab's "Explore by investing style" checkbox tree — reuses
   .screener-category-group/-broad-row/-expand-btn/-subcategory-list
   wholesale (no new picker CSS needed at all, same tree the Screener's
   own Category/Benchmark/Risk-ratio filters use). Only the results
   list below is new. */
.style-universe-fund-list {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 420px;
  overflow-y: auto;
}

.style-universe-fund-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-soft);
}

.style-universe-fund-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.style-universe-fund-link {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.style-universe-fund-link:hover {
  text-decoration: underline;
}

.style-universe-fund-meta {
  font-size: 0.74rem;
  color: var(--text-faint);
}

.heat-bar-divider {
  margin: 0.9rem 0;
  border: none;
  border-top: 1px solid var(--border-subtle);
}

.eps-growth-bar {
  cursor: pointer;
  transition: opacity 0.1s ease;
}

.eps-growth-bar:hover {
  opacity: 0.75;
}

.valuation-warning {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in oklch, #f59e0b 12%, var(--bg-card) 88%);
  border: 1px solid color-mix(in oklch, #f59e0b 35%, var(--bg-card) 65%);
  color: var(--text-body);
  font-size: 0.78rem;
}

.filter-bar {
  margin-top: 0.4rem;
}

.filter-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent-bg-medium);
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  font-size: 0.78rem;
  color: var(--accent-strong);
}

.active-filter-chip-remove {
  background: none;
  border: none !important;
  color: inherit;
  padding: 0 0.25rem !important;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.active-filter-chip-remove:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.filter-picker-wrap {
  position: relative;
}

.filter-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 30px var(--shadow-tooltip);
  padding: 0.7rem;
  z-index: 30;
}

.filter-popover .fund-input {
  width: 100%;
}

.screener-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  color: var(--text-body);
  font-size: 0.85rem;
}

.screener-filter-section {
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.8rem;
}

.screener-filter-section:last-child {
  border-bottom: none;
}

.screener-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none !important;
  padding: 0 !important;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.screener-section-toggle:hover {
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

.screener-toggle-arrow {
  color: var(--text-faint);
  font-size: 0.75rem;
}

/* Thin CSS-drawn chevron (border-corner trick) instead of a filled
   Unicode triangle — renders identically across every OS/font, and
   reads as "expand/collapse" the way a modern app's chevron does
   rather than a solid ▾/▴ glyph. Points down at rest; toggle the
   `.open` class to rotate it to point up, rather than swapping text. */
.chevron {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease;
  margin-bottom: 2px;
}

.chevron.open {
  transform: rotate(-135deg);
  margin-bottom: -2px;
}

/* Range-slider metric filters (Screener) — a dual-handle slider via two
   overlapping native <input type="range"> elements (the standard
   lightweight technique: both share the same track, pointer-events
   disabled on the input itself so only its thumb is interactive). */
.range-filter-block {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.range-filter-block:last-child {
  border-bottom: none;
}

/* A slider block sitting directly under the period checkbox that
   revealed it (Screener's range-filter picker) rather than in a
   separate list — indented to match .screener-suboption so it reads
   as belonging to that one checkbox, not the whole metric group. */
.screener-range-period-row .range-filter-block {
  padding-left: 1.6rem;
  border-bottom: none;
}

.range-filter-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 0.5rem;
}

.range-slider-wrap {
  position: relative;
  height: 20px;
  margin: 0.3rem 0 0.6rem;
}

.range-slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
  background: var(--border);
  border-radius: 999px;
}

.range-slider-fill {
  position: absolute;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: var(--accent);
  border-radius: 999px;
}

.range-slider-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

.range-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  cursor: pointer;
  margin-top: 0;
}

.range-slider-input::-moz-range-thumb {
  pointer-events: auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  cursor: pointer;
}

.range-slider-input::-webkit-slider-runnable-track,
.range-slider-input::-moz-range-track {
  background: transparent;
}

.range-filter-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.range-filter-inputs input[type="number"] {
  width: 0;
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  text-align: center;
}

.range-filter-inputs span {
  color: var(--text-faint);
  font-size: 0.75rem;
}

.range-filter-presets {
  display: flex;
  gap: 0.4rem;
}

.range-filter-presets button {
  flex: 1;
  padding: 0.3rem 0;
  font-size: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-body);
  cursor: pointer;
}

.range-filter-presets button.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong) !important;
  color: var(--accent-strong);
}

/* Target Asset Allocation (Peer Comparison → Portfolio History → Target
   Range view) — a static min/max capsule per asset class, SEBI's
   category-wide mandate rather than this one fund's actual holdings
   (compare to Asset Mix, the stacked-bar ACTUAL view in the same card).
   Built on the same track+fill anatomy as .range-slider-* above, just
   thicker (a filled capsule, not a thin line) and non-interactive — no
   thumb, since there's nothing to drag. */
.target-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin: 1rem 0 0.6rem;
}

.target-alloc-row {
  display: grid;
  grid-template-columns: 132px 1fr 84px;
  align-items: center;
  gap: 0.75rem;
}

.target-alloc-row__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
}

.target-alloc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.target-alloc-row__bar {
  position: relative;
  height: 10px;
}

.target-alloc-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  transform: translateY(-50%);
  background: var(--border-soft);
  border-radius: 999px;
}

.target-alloc-fill {
  position: absolute;
  top: 0;
  height: 10px;
  border-radius: 999px;
}

.target-alloc-row__value {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.target-alloc-note {
  font-size: 0.78rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
  padding-top: 0.6rem;
  margin: 0.8rem 0 0;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .target-alloc-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .target-alloc-row__value {
    text-align: left;
  }
}

/* Asset Allocation / Cap Size (Equity) cards' shared "Current | History"
   pipe-tab pattern — both panes get the same reserved height so
   switching tabs doesn't visibly resize the card. The History pane's
   own stacked-bar chart (SVG height 240 + its legend row) is the taller
   of the two, so that's the height both panes reserve. */
.outer-view-pane {
  min-height: 300px;
}

/* Current Asset Allocation card — flat donut (deliberately not 3D/
   tilted, see script.js's renderCurrentAssetAllocation comment) + an
   always-visible list, so a fund's latest asset-class mix (the same
   numbers the Asset Mix bar's hover tooltip shows for one month) reads
   without needing to hover anything. */
.current-alloc-layout {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  /* Narrow screens wrap the list below the donut (flex-wrap) — the
     same 1.5rem gap value then also stacks as vertical space between
     donut and list, which is more than needed once they're no longer
     side by side. */
  .current-alloc-layout {
    gap: 0.6rem;
  }
  .current-alloc-list {
    min-width: 0;
    width: 100%;
  }
}

.current-alloc-arc {
  cursor: pointer;
  transition: opacity 0.15s ease;
  outline: none;
}

.current-alloc-arc.is-dimmed {
  opacity: 0.35;
}

.current-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 180px;
}

.current-alloc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  cursor: default;
  transition: background 0.15s ease;
}

.current-alloc-row.is-active {
  background: var(--accent-bg-soft);
}

.current-alloc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.current-alloc-name {
  font-size: 0.85rem;
  color: var(--text-body);
  flex: 1;
}

.current-alloc-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* "Current Asset Allocation Mod" card's outer tab pair — a plain
   text-style switcher ("Asset Allocation | History") rather than the
   app's usual pill-button .range-btn/.cum-btn-group treatment, so the
   two tab styles used inside the same card (this one, plus the
   History pane's own nested .range-btn toggle) stay visually distinct
   from each other rather than looking like one confusing 5-way row. */
.pipe-tab-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.pipe-tab {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-faint);
  cursor: pointer;
}

.pipe-tab.active {
  color: var(--accent-strong);
}

.pipe-tab-sep {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.screener-filter-options {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 200px;
  overflow-y: auto;
  /* A real, non-overlay scrollbar (Windows' classic style, or macOS set
     to "Always show scrollbars") is ~15-17px wide — the old 0.3rem
     (4.8px) here left it sitting right on top of each row's own
     trailing content (the "?" info button and the expand chevron in
     .screener-broad-row, both flush against this container's right
     edge via justify-content: space-between). scrollbar-gutter: stable
     alone was tried first and didn't help — it has no effect on Safari
     versions before 18.2, which is exactly the gap a screenshot from a
     real device caught. A flatly generous padding-right works in every
     browser regardless of scrollbar-gutter support, so it's the actual
     fix; scrollbar-gutter stays as a harmless no-op improvement where
     it IS supported (reserves genuine scrollbar width on top of this
     padding rather than overlapping it, never less than what's here). */
  padding-right: 1.25rem;
  scrollbar-gutter: stable;
}

.screener-option {
  display: flex;
  width: 100%;
  font-size: 0.82rem;
  padding: 0.15rem 0;
}

.screener-category-group {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.3rem;
  margin-bottom: 0.3rem;
}

.screener-category-group:last-child {
  border-bottom: none;
}

.screener-range-group-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0.7rem 0 0.35rem;
}

.screener-broad-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.screener-broad-row .screener-option {
  flex: 1;
  min-width: 0;
}

.screener-expand-btn {
  flex-shrink: 0;
  background: none;
  border: none !important;
  color: var(--text-faint);
  padding: 0.1rem 0.3rem !important;
  font-size: 0.7rem;
  cursor: pointer;
}

.screener-expand-btn:hover {
  color: var(--text-body);
  transform: none;
  box-shadow: none;
}

/* Vertical connector line linking each sub-category back up to its
   broad category, matching the TickerTape reference's nested-tree look. */
.screener-subcategory-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 1rem;
  margin-top: 0.3rem;
  margin-left: 0.5rem;
  border-left: 1px solid var(--border-subtle);
}

.screener-suboption {
  font-size: 0.78rem;
  color: var(--text-faint);
}

#screenerFundHouseOptions {
  padding-left: 1.3rem;
}

#screenerFundHouseOptions .screener-option {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.screener-note-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.screener-note-row .fund-input {
  flex: 1;
  min-width: 220px;
}

.screener-metric-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin: 0.8rem 0;
}

.screener-sortable {
  cursor: pointer;
  user-select: none;
}

.screener-sortable:hover {
  color: var(--accent);
}

.screener-pagination {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.fund-house-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 168px;
  overflow-y: auto;
  padding: 0.6rem 0 0;
}

.fund-house-chip {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle) !important;
  border-radius: 999px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.78rem;
  color: var(--text-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 140ms ease;
}

.fund-house-chip:hover {
  border-color: var(--border-hover) !important;
  transform: none;
  box-shadow: none;
}

.fund-house-chip.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong) !important;
  color: var(--accent-strong);
}

.fund-house-chip-count {
  color: var(--text-dim);
  font-size: 0.7rem;
}

.fund-house-chip.active .fund-house-chip-count {
  color: var(--accent);
}

.category-groups {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-group-count {
  color: var(--text-dim);
  font-weight: 400;
}

/* Same collapsible-section chrome as the Screener tab's filter tree
   (.screener-filter-section/.screener-section-toggle/.screener-toggle-arrow
   are shared, unchanged) — .category-broad-options is the Categories
   tab's own equivalent of .screener-filter-options, deliberately with no
   max-height/scroll cap: on Screener the filter list is secondary to the
   results below it, but here the category list *is* the primary content,
   so it grows with the page instead of getting its own inner scrollbar. */
.category-broad-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-toc-item {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.category-toc-name-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.category-toc-name {
  font-weight: 600;
  font-size: 0.85rem;
}

/* Per-category color swatch (Categories TOC row) — same colors/meaning
   as .risk-legend-box, just sized down for an inline row. No text: the
   legend above the list already establishes the color scale once. */
.risk-swatch {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.category-toc-count {
  color: var(--text-faint);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Equity ETFs' categories under their row (2026-11-07), with the
   Screener tree's connector line (.screener-subcategory-list). */
.etf-group-subrows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-left: 0.6rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-subtle);
}

.etf-group-subrows .category-toc-name {
  font-weight: 500;
}

.chart-frame {
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--bg-chart-gradient-1), var(--bg-chart-gradient-2));
  padding: 0.6rem;
}

/* Market Valuation tab — ICICI Prudential's EVI/DVI PDFs, proxied
   through /api/market-valuation/*.pdf (see server.js) since the
   originals refuse to be framed directly. Both are a single tall
   portrait page (800 x 1328.52pt per pdfinfo) — the aspect-ratio box
   keeps the iframe sized to that shape instead of an arbitrary fixed
   height that would either crop the page or leave dead space. */
.pdf-embed-card {
  display: flex;
  flex-direction: column;
}

.pdf-embed-frame {
  width: 100%;
  max-width: 620px;
  aspect-ratio: 800 / 1328.52;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.pdf-embed-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
}

.heatmap-wrap {
  position: relative;
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) repeat(8, minmax(92px, 1fr));
  gap: 0.5rem;
  min-width: 980px;
}

.heatmap-header,
.heatmap-cell {
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

.heatmap-header {
  color: var(--accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.info-btn {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--info-btn-border) !important;
  background: var(--info-btn-bg);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  padding: 0 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-btn:hover {
  background: var(--info-btn-bg-hover);
  transform: none;
  box-shadow: none;
}

/* Standard SEBI-style disclaimer — appears once at the top of a tab
   whose content could otherwise read as a directive (valuation zones,
   forward returns), not repeated per-card. Proximity to the actual
   feature is what makes a disclaimer meaningful, not just its presence
   somewhere on the site. */
.disclaimer-banner {
  margin: 0 0 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1.5;
}

.screener-filter-card {
  position: relative;
}

.info-box {
  position: absolute;
  max-width: 260px;
  background: var(--bg-tooltip);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-body);
  box-shadow: 0 12px 30px var(--shadow-tooltip);
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
  z-index: 20;
}

.info-box.visible {
  opacity: 1;
  pointer-events: auto;
}

.heatmap-cell {
  color: var(--text-primary);
}

.heatmap-cell.fund-name {
  color: var(--text-body);
}

.cum-range-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.cum-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.range-btn {
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab) !important;
  border-radius: 999px !important;
  color: var(--text-faint);
  font-size: 0.78rem;
  padding: 0.28rem 0.72rem;
  cursor: pointer;
  transition: all 140ms ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.range-btn:hover {
  color: var(--text-body);
  border-color: var(--border-hover) !important;
  transform: none;
  box-shadow: none;
}

.range-btn.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong) !important;
  color: var(--accent-strong);
}

.eps-pe-legend-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem 1rem;
  margin-bottom: 0.5rem;
}

.eps-pe-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.eps-pe-legend-swatch {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  display: inline-block;
}

.eps-pe-legend-swatch.dashed {
  height: 0;
  border-top: 2px dashed currentColor;
  background: none !important;
  border-top-color: var(--series-5);
}

.eps-pe-marker {
  cursor: pointer;
}

.cum-tooltip {
  position: absolute;
  background: var(--bg-tooltip-soft);
  border: 1px solid var(--border-tab);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms ease;
  font-size: 0.78rem;
  min-width: 110px;
  max-width: 220px;
  z-index: 10;
}

.cum-tt-date {
  color: var(--accent);
  font-size: 0.72rem;
  margin-bottom: 0.3rem;
}

.cum-tt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}

.cum-tt-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cum-tt-value {
  flex-shrink: 0;
}

/* Peer Comparison tab's holdings sunburst — see renderPortfolioSunburst
   in script.js. Same tooltip pattern as .cum-tooltip (position:absolute
   overlay, not native title=), so it can carry the value/label hierarchy
   the dataviz interaction spec calls for (value first, name second). */
.sunburst-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.sunburst-svg-box {
  position: relative;
  flex: 0 0 auto;
  width: min(360px, 100%);
}

/* "Download PNG"/"Download CSV" — see downloadSunburstPng/downloadCsv in
   script.js. Absolutely positioned within .sunburst-wrap (which already
   has position:relative) so the toolbar sits in the card's top-right
   corner without pushing the chart or legend out of their flex layout. */
.sunburst-toolbar {
  position: absolute;
  top: -0.35rem;
  right: 0;
  display: flex;
  gap: 0.4rem;
  z-index: 5;
}

.sunburst-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: all 140ms ease;
}

.sunburst-download-btn:hover {
  color: var(--text-body);
  border-color: var(--accent-strong);
}

.sunburst-download-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.sunburst-arc {
  cursor: pointer;
  transition: opacity 120ms ease;
}

.sunburst-arc:hover,
.sunburst-arc:focus-visible {
  opacity: 0.82;
  outline: none;
}

.sunburst-label {
  font-family: var(--font-sans);
  pointer-events: none;
  /* fill (white or dark ink) is set per-element by renderPortfolioSunburst
     from each wedge's own actual rendered color — a class-level fill here
     would win the cascade over that per-element attribute and defeat it.
     font-size is likewise set per-element (font-size="..." attribute) to
     match exactly what renderPortfolioSunburst measured the label against —
     a fixed value here would silently drift out of sync with that fit
     math and either overflow wedges or under-show labels that'd fit. */
}

.sunburst-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  max-width: 40%;
}

.sunburst-center-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: normal;
  line-height: 1.15;
}

.sunburst-center-label {
  display: block;
  font-size: 0.66rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.sunburst-tooltip {
  position: absolute;
  background: var(--bg-tooltip-soft);
  border: 1px solid var(--border-tab);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms ease;
  font-size: 0.78rem;
  min-width: 110px;
  max-width: 220px;
  z-index: 10;
}

.sunburst-tt-value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sunburst-tt-label {
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.sunburst-legend {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.78rem;
}

/* Portfolio Breakdown's click-to-expand legend — see renderPortfolioBreakdown
   in script.js. Each sector is its own accordion row; clicking one
   reveals that sector's individual holdings inline. */
.sector-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sector-list-item {
  border: 1px solid var(--border-tab);
  border-radius: 10px;
  overflow: hidden;
}

.sector-list-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
  text-align: left;
}

.sector-list-row:hover,
.sector-list-row:focus-visible {
  background: var(--accent-bg-soft);
  outline: none;
}

.sector-list-chevron {
  flex-shrink: 0;
  width: 0.8em;
  color: var(--text-faint);
  transition: transform 150ms ease;
}

.sector-list-item.expanded .sector-list-chevron {
  transform: rotate(90deg);
}

.sector-list-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sector-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.sector-list-holdings {
  display: none;
  padding: 0.15rem 0.75rem 0.55rem 2.1rem;
  border-top: 1px solid var(--border-tab);
}

.sector-list-item.expanded .sector-list-holdings {
  display: block;
}

.sector-list-show-more {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  border-top: 1px solid var(--border-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
  text-align: left;
  cursor: pointer;
}

.sector-list-show-more:hover,
.sector-list-show-more:focus-visible {
  background: var(--accent-bg-soft);
  outline: none;
}

/* Category analysis "Show all N funds" under the top-10 list. */
.drilldown-show-all {
  margin-top: 0.5rem;
  border-top: none;
  border-radius: 8px;
  text-align: center;
}

.sector-list-holding-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sector-list-holding-row + .sector-list-holding-row {
  border-top: 1px dashed var(--border-tab);
}

.sector-list-holding-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-list-holding-pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* Compare tab's Fund details card — each fund's mini holdings sunburst
   (renderMiniHoldingsSunburst in script.js) sits inside that same fund's
   .fund-info-card-item, below its AMC/category/AUM rows, rather than a
   separate "Holdings" card. .mini-sunburst-svg-box overrides
   .sunburst-svg-box's own 360px width to the smaller 260-unit viewBox
   these charts actually use — a mismatch here would silently scale
   every label-fit measurement wrong, the same viewBox/rendered-width
   bug fixed earlier for the full-size chart. */
.fund-info-sunburst {
  margin-top: 0.3rem;
  align-self: center;
}

.mini-sunburst-svg-box {
  width: min(260px, 100%);
}

.mini-sunburst-svg-box .sunburst-center-value {
  font-size: 0.68rem;
}

.mini-sunburst-svg-box .sunburst-center-label {
  font-size: 0.56rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background-color: var(--bg-panel);
}

/* Screener's checkbox + Name columns stay put while the rest of the
   (now very wide, with Returns/Risk/Composition columns) table scrolls
   horizontally underneath — sticky needs an opaque background of its
   own since a transparent cell would show scrolled-past columns
   showing through, and a fixed left offset that matches the checkbox
   column's own fixed width for the Name column to sit flush after it. */
.screener-sticky-col {
  position: sticky;
  background: var(--bg-card);
  z-index: 2;
}

.screener-sticky-checkbox {
  left: 0;
  width: 40px;
  min-width: 40px;
}

.screener-sticky-name {
  left: 40px;
  min-width: 180px;
  max-width: 220px;
  box-shadow: 2px 0 6px -2px var(--shadow-card);
}

thead .screener-sticky-col {
  z-index: 3;
  background: var(--bg-card);
}

tbody tr:hover .screener-sticky-col {
  /* Was var(--bg-panel) — a translucent rgba() token, so the very
     scrolled-under columns the opaque .screener-sticky-col rule below
     exists to hide became visible again (bleeding through as garbled
     overlapping text) on every row hover, since :hover's extra
     specificity wins the cascade over that later opaque rule. Needs
     its own solid, hover-tinted color, not the translucent panel
     token every other hover state in this app safely uses (those
     aren't sitting on top of scrolled content). */
  background: var(--table-sticky-bg-hover);
}

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

  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Must match .grid.calc-toc-grid's specificity (two classes) above —
     a plain .calc-toc-grid here would be outranked by that rule and
     never actually collapse to one column on narrow screens. */
  .grid.calc-toc-grid {
    grid-template-columns: 1fr;
  }

  .grid.screener-toc-grid {
    grid-template-columns: 1fr;
  }

  .grid.category-toc-grid {
    grid-template-columns: 1fr;
  }

  /* On a narrow screen, the card's own 1.2rem side padding plus the
     chart-frame's own 0.6rem padding adds up to a large share of the
     available width (well over a third of it combined on both sides at
     phone widths) being spent on padding instead of the actual plot.
     Bleeding the frame out to the card's edges reclaims that — and since
     every chart already measures its container's real clientWidth at
     render time (see measuredChartWidth in script.js), it automatically
     renders wider to fill the reclaimed space with no JS changes needed.
     Only the flat left/right edges are affected, not the card's rounded
     corners (those are at the top/bottom, untouched here), so this is
     safe with no corner-clipping artifacts — but the frame's own corners
     need to go square, or they'd show as an odd notch mid-edge. */
  .chart-card .chart-frame {
    margin-left: -1.2rem;
    margin-right: -1.2rem;
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 1.4rem 0.8rem 2.4rem;
  }

  .tab-btn,
  .tab-link {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  /* .topup-tier-row is deliberately nowrap at normal/tablet widths (see
     its rule above) so the remove button stays on the same line as the
     tier fields — but on a phone-width screen there just isn't room for
     "Dip ≥ [_] % → ₹ [_____] ×" on one line, so fall back to wrapping
     rather than forcing horizontal overflow/scroll. */
  .topup-tier-row {
    flex-wrap: wrap;
  }

  .topup-tier-remove-btn {
    margin-left: 0;
  }
}

/* Market Valuation card (Nifty PE/PB zones) — status colors, kept
   separate from the chart --series-N palette since these mean
   "cheap/fair/rich", not "which series is this". */
:root {
  --zone-undervalued: #16a34a;
  --zone-fair: #2563eb;
  --zone-caution: #d97706;
  --zone-overvalued: #dc2626;
}
:root[data-theme="dark"] {
  --zone-undervalued: #4ade80;
  --zone-fair: #60a5fa;
  --zone-caution: #fbbf24;
  --zone-overvalued: #f87171;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --zone-undervalued: #4ade80;
    --zone-fair: #60a5fa;
    --zone-caution: #fbbf24;
    --zone-overvalued: #f87171;
  }
}

.valuation-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.valuation-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.valuation-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.valuation-stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.valuation-stat-percentile {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.valuation-zone-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.valuation-zone-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.valuation-action-text {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.5;
}

.valuation-zone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.valuation-zone-table th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  color: var(--text-primary);
  font-weight: 700;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-soft);
}
.valuation-zone-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.valuation-zone-table tr.valuation-zone-row {
  background: color-mix(in oklch, var(--zone-row-color, var(--zone-fair)) 9%, var(--bg-card) 91%);
}
.valuation-zone-table tr.valuation-zone-row.current-zone {
  background: color-mix(in oklch, var(--zone-row-color, var(--zone-fair)) 20%, var(--bg-card) 80%);
}
.valuation-zone-table td.valuation-zone-cell {
  font-weight: 700;
  color: var(--zone-row-color, var(--zone-fair));
}
.valuation-zone-table tr.current-zone td.valuation-zone-cell:first-child {
  position: relative;
  padding-left: 1rem;
}
.valuation-zone-table tr.current-zone td.valuation-zone-cell:first-child::before {
  content: "▸";
  position: absolute;
  left: 0.1rem;
}

.forward-returns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.forward-returns-cell {
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
}
.forward-returns-cell .horizon-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}
.forward-returns-cell .win-rate {
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.forward-returns-cell .avg-return {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* --- Peer Comparison "Fund Details" card --- */
.fmc-fund-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-body);
  margin: 0 0 0.9rem;
  line-height: 1.3;
}

.fmc-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.7rem 1rem;
  margin-bottom: 0.9rem;
}

/* Local Overview/Fund Managers switcher for this card only — visually
   matches the app-wide .tab-btn pill style, but kept as its own class
   pair (not .tab-btn/.tab-panel) since those are wired to a single
   global, page-wide click handler keyed on data-tab; reusing them here
   would make this card's local switch also try to toggle unrelated
   top-level page sections. */
.fmc-tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.fmc-tab-btn {
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-tab);
  border-radius: 999px;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: all 140ms ease;
}

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

.fmc-tab-btn.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.fmc-tab-panel {
  display: none;
}

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

.fmc-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}

.fmc-stat-value {
  font-size: 0.92rem;
  color: var(--text-body);
  font-weight: 500;
}

/* A base-only expense ratio (no total published yet); tooltip explains. */
.expense-basis-note {
  cursor: help;
}

/* Where a Fund Details value came from, when not the factsheet. */
.fmc-stat-note {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-faint);
  line-height: 1.35;
  margin-top: 0.15rem;
}

.fmc-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}

/* Alpha/Beta/Sharpe + whichever of PE/PB (equity sleeve) or YTM/
   duration (debt sleeve) this fund actually has — small tiles rather
   than the label/value stat-grid above, since these are numbers people
   scan and compare across funds, not read as prose. */
.fmc-quant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.fmc-quant-stat {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-soft);
}

.fmc-quant-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.fmc-quant-stat-label {
  font-size: 0.64rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.fmc-exit-load-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fmc-exit-load-text.fmc-expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.fmc-exit-load-list {
  padding-left: 1.1rem;
  list-style: disc;
}

.fmc-exit-load-list li {
  margin-bottom: 0.35rem;
}

.fmc-exit-load-list li:last-child {
  margin-bottom: 0;
}

.fmc-toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.3rem 0 0;
}

.fmc-toggle-btn:hover {
  text-decoration: underline;
}

.fmc-manager-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-soft);
}

.fmc-manager-row:last-child {
  border-bottom: none;
}

.fmc-manager-row-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.fmc-manager-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent-strong);
  cursor: pointer;
}

.fmc-manager-link:hover {
  text-decoration: underline;
}

/* Fallback for a fund whose managers are known by name but have no
   disclosed tenure date at all (the timeline above has nothing to plot
   in that case) — a plain chip per manager, still clicking through to
   the same profile popup via .fmc-manager-link's own click wiring. */
.fmc-plain-manager-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.fmc-plain-manager-chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.fmc-plain-manager-chip:hover {
  border-color: var(--accent-strong);
  text-decoration: none;
}

.fmc-manager-since {
  font-size: 0.75rem;
  color: var(--text-faint);
}

.fmc-manager-count {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-left: auto;
}

.fmc-manager-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fmc-manager-chip {
  font-size: 0.68rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
}

.fmc-manager-chip-exp {
  background: var(--accent-bg-soft);
  border-color: transparent;
  color: var(--accent-strong);
  font-weight: 600;
}

.fmc-disclosed {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin: 0.7rem 0 0;
}

.fmc-factsheet-link {
  color: var(--accent);
  text-decoration: none;
}

.fmc-factsheet-link:hover {
  text-decoration: underline;
}

.fmc-factsheet-link-plain {
  color: var(--text-faint);
  cursor: default;
}

/* Manager funds modal — centered overlay, unlike .filter-popover's
   anchored dropdown, since this needs to sit above the whole viewport. */
.fmc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
}

.fmc-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px var(--shadow-tooltip);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fmc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-soft);
}

.fmc-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-body);
}

.fmc-modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.fmc-modal-close:hover {
  color: var(--text-body);
}

/* The manager's own bio/experience/tenure, above the returns table in
   the "Fund Details" manager popup. Bio text is clamped to 6 lines with
   a toggle for the (occasionally long) AMC-website biographies, so the
   returns table below isn't pushed far down the modal by default. */
.fmc-manager-profile {
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-panel);
}

.fmc-manager-profile h4,
.fmc-managed-schemes-heading {
  margin: 0 0 0.5rem;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.fmc-manager-profile p {
  margin: 0;
  color: var(--text-body);
  font-size: 0.78rem;
  line-height: 1.55;
}

.fmc-manager-bio-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.fmc-manager-bio-clamped.expanded {
  display: block;
  overflow: visible;
}

.fmc-bio-toggle {
  margin-top: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Experience/AMC-tenure/AUM as scannable numbers, not a sentence —
   small stat tiles ahead of the education/employer tags and the bio
   paragraph, matching the stat-grid style already used above them in
   the main card. */
.fmc-manager-stats {
  display: flex;
  gap: 1.4rem;
  margin-bottom: 0.85rem;
}

.fmc-manager-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.fmc-manager-stat-label {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.fmc-manager-tag-group {
  margin-bottom: 0.7rem;
}

.fmc-manager-tag-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}

.fmc-manager-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fmc-manager-tag {
  font-size: 0.72rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-panel-strong);
  border: 1px solid var(--border-soft);
  color: var(--text-body);
}

.fmc-manager-tag-edu {
  background: var(--accent-bg-soft);
  border-color: transparent;
  color: var(--accent-strong);
  font-weight: 600;
}

.fmc-manager-experience-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fmc-manager-experience-list li {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-body);
}

.fmc-manager-amc-join {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
  margin: 0 0 0.7rem;
}

.fmc-manager-profile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.fmc-manager-profile-facts span {
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-bg-soft);
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* Fund tenure timeline — one bar per fund this manager currently runs,
   positioned by its own disclosed "managing since" date and running to
   today (arrow tip = ongoing; this app has no way to show a past
   manager's end date on a fund yet, only who's on it now and since
   when). Reuses .fmc-manager-profile's own card shell. */
.fmc-tenure-timeline {
  overflow-x: auto;
}

.fmc-tl-grid {
  position: relative;
  height: 20px;
  margin: 0 0 6px 150px;
}

.fmc-tl-grid-months {
  height: 46px;
}

.fmc-tl-gridline {
  position: absolute;
  top: 0;
  bottom: -6px;
  border-left: 1px dashed var(--border-subtle);
}

.fmc-tl-gridline span {
  position: absolute;
  top: 0;
  left: 4px;
  font-size: 0.62rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.fmc-tl-grid-months .fmc-tl-gridline span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.fmc-tl-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Wraps .fmc-tl-grid + .fmc-tl-rows together so they always share the
   exact same width (gets an inline min-width from JS, scaled to the
   real year span) — keeps gridlines aligned with bar positions no
   matter how wide the scrollable content ends up being. */
.fmc-tl-scroll-content {
  min-width: 100%;
}

.fmc-tl-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fmc-tl-label {
  width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  /* Timelines can now span many years (real multi-year data) and need
     to scroll horizontally to stay legible — the name/label column
     stays pinned in place while the bars/dates scroll underneath it.
     Needs an opaque background per context (set below) so scrolled
     bar content doesn't show through the sticky column. */
  position: sticky;
  left: 0;
  z-index: 2;
  padding-right: 8px;
}
.fmc-fund-tl .fmc-tl-label { background: var(--bg-card); }
.fmc-tenure-timeline .fmc-tl-label { background: var(--bg-panel); }

.fmc-tl-fund-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.fmc-tl-years {
  font-size: 0.62rem;
  color: var(--text-faint);
}

.fmc-tl-track {
  position: relative;
  flex: 1;
  height: 20px;
  background: var(--bg-panel-strong);
  border-radius: 4px;
}

.fmc-tl-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--accent-strong);
  display: flex;
  align-items: center;
  padding-left: 7px;
  padding-right: 12px;
  min-width: 18px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}

.fmc-tl-date {
  font-size: 0.6rem;
  color: #05121f;
  white-space: nowrap;
  font-weight: 600;
}

@media (max-width: 560px) {
  .fmc-tl-label { width: 96px; }
  .fmc-tl-grid { margin-left: 96px; }
  .fmc-tl-date { display: none; }
}

/* The same timeline, inline in the Fund Manager(s) sub-tab itself
   (rather than inside the modal) — one row per current manager of
   THIS fund. Sits above the plain name/chip list already there. */
.fmc-fund-tl {
  margin-bottom: 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.fmc-tl-name-link {
  font-size: 0.78rem;
  text-align: left;
  white-space: normal;
  line-height: 1.25;
}

.fmc-tl-departed-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
  line-height: 1.25;
}

.fmc-tl-departed-tag {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fmc-tl-bar-past {
  background: var(--text-faint);
  opacity: 0.55;
  clip-path: none;
  border-radius: 3px;
}

.fmc-modal-body {
  padding: 0.6rem 1.2rem 1.2rem;
  overflow-y: auto;
  overflow-x: auto;
}

.fmc-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.fmc-modal-table th {
  text-align: right;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.fmc-modal-table th:first-child {
  text-align: left;
}

.fmc-modal-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: right;
  font-size: 0.82rem;
  white-space: nowrap;
}

.fmc-modal-table td:first-child {
  text-align: left;
  white-space: normal;
  color: var(--text-body);
  font-weight: 500;
}



/* Compounding case study: assumed-rate vs real-history switch. */
.ccs-basis-toggle {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

/* The inflation checkbox sits beside the date input, so it needs the
   horizontal layout the global `label` column rule would otherwise
   override (the same trap the index-family chips hit). */
.ccs-inflation-toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  align-self: end;
  padding-bottom: 0.5rem;
}
.ccs-inflation-toggle input { margin: 0; flex: none; }

/* ---- Compounding case study: real-history result cards ----
   The run produces up to four views of the same money (nominal rupees,
   real rupees, nominal dollars, real dollars) plus an FD comparison.
   Rendered as flat label/value rows that became a wall of numbers, so
   each strategy gets a card: one headline figure, the alternative lenses
   demoted beneath it, and the FD contrast given its own bar chart
   because it's a different instrument rather than another way of
   measuring the same one. */
.ccs-results {
  display: grid;
  gap: 0.85rem;
}

.ccs-result {
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--ccs-accent, var(--accent));
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--bg-inset, rgba(127, 127, 127, 0.05));
}

.ccs-result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.ccs-result-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.ccs-result-sub {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.ccs-result-period {
  font-size: 0.74rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ccs-trunc {
  display: block;
  color: var(--zone-caution);
}

/* The headline: what went in, what came out. Deliberately the largest
   thing on the card — every other figure is a qualification of it. */
.ccs-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0.7rem 0 0.2rem;
}

.ccs-headline-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.ccs-invested {
  font-size: 0.9rem;
  color: var(--text-faint);
}

.ccs-arrow {
  color: var(--text-faint);
}

.ccs-final {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ccs-accent, var(--accent));
  letter-spacing: -0.01em;
}

.ccs-badges {
  display: flex;
  gap: 0.35rem;
}

.ccs-badge {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ccs-accent, var(--accent)) 16%, transparent);
  color: var(--ccs-accent, var(--accent));
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ccs-badge.is-muted {
  background: rgba(127, 127, 127, 0.14);
  color: var(--text-faint);
}

/* Alternative lenses — same money, different yardstick. */
.ccs-lenses {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-subtle);
}

.ccs-lens {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.ccs-lens-title {
  color: var(--text-body);
  white-space: nowrap;
}

.ccs-lens-note {
  display: block;
  font-size: 0.7rem;
  color: var(--text-faint);
}

.ccs-lens-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.ccs-lens-value strong {
  color: var(--text-primary);
  font-weight: 600;
}

.ccs-lens-rate {
  color: var(--text-faint);
  font-size: 0.76rem;
}

/* SENSEX vs FD, as two bars on a shared scale — the length difference
   carries the comparison faster than two numbers side by side. */
.ccs-vs {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-subtle);
}

.ccs-vs-head {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 0.45rem;
}

.ccs-vs-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}

.ccs-vs-label {
  color: var(--text-faint);
}

.ccs-vs-bar {
  height: 0.6rem;
  border-radius: 999px;
  min-width: 4px;
}

.ccs-vs-bar.is-index {
  background: var(--ccs-accent, var(--accent));
}

.ccs-vs-bar.is-fd {
  background: rgba(127, 127, 127, 0.45);
}

.ccs-vs-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .ccs-vs-row { grid-template-columns: 4.5rem 1fr; }
  .ccs-vs-value { grid-column: 2; text-align: right; }
}

/* The real-terms footnote under the SENSEX-vs-FD bars. */
.ccs-vs-note {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--text-faint);
  line-height: 1.45;
}

.ccs-vs-note strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---- Holdings diff: disclosure-month tabs ----
   The card compares two adjacent monthly disclosures; these pick WHICH
   pair. Hidden by the renderer when a fund has only one comparable pair,
   so a single lonely tab never appears. */
.holdings-diff-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.holdings-diff-periods:empty { display: none; }

/* Trade size as a share of the whole fund, under the rupee figure —
   a secondary reading of the same number, so it is demoted in both
   size and colour rather than competing with it. */
.holdings-diff-aum-pct {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted, #8b93a7);
  font-variant-numeric: tabular-nums;
}

/* Instrument kind (Bond / T-Bill / G-Sec / SDL / Money-market paper),
   shown only for non-equity rows. Reads as an annotation on the name,
   not as another data column. */
.holdings-diff-instrument {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted, #8b93a7);
  background: rgba(139, 147, 167, 0.14);
  vertical-align: middle;
  white-space: nowrap;
}

/* --- Debt-fund cards (Peer Comparison) — see debt-profile.js ---------
   Credit tiers use their own SEQUENTIAL ramp, deliberately not the app
   accent: the accent means "this fund" throughout the tab, and reusing
   it here would imply an emphasis that isn't there. The ramp runs cool
   (safe) to warm (risky) and also descends in lightness, so the ordering
   survives red-green colour deficiency and greyscale printing. */
/* This stylesheet is DARK-FIRST: bare :root is the dark theme (see
   color-scheme: dark at the top) and :root[data-theme="light"] overrides
   it. These follow that convention rather than inventing a second one. */
:root {
  --credit-sovereign: #5eead4;
  --credit-a1plus: #38bdf8;
  --credit-aaa: #a78bfa;
  --credit-aa: #e8c96b;
  --credit-a: #f2a765;
  --credit-low: #f87171;
  --credit-unrated: #94a3b8;
  --debt-down: #fca5a5;
  --debt-up: #86efac;
}
:root[data-theme="light"] {
  --credit-sovereign: #0f766e;
  --credit-a1plus: #0369a1;
  --credit-aaa: #6d28d9;
  --credit-aa: #8a7434;
  --credit-a: #b06a2c;
  --credit-low: #a83a24;
  --credit-unrated: #6b7280;
  --debt-down: #b91c1c;
  --debt-up: #15803d;
}

.debt-stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 4px; }
.debt-stat {
  flex: 1 1 140px; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: 10px;
}
.debt-stat-label { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.debt-stat-value { font-size: 1.5rem; font-weight: 650; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.debt-stat-sub { font-size: 0.76rem; color: var(--text-dim); }

.debt-chip { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); cursor: help; }
.debt-chip--disclosed { border-color: var(--credit-sovereign); color: var(--credit-sovereign); }
.debt-chip--computed { border-color: var(--border-hover); }

.debt-driver { margin: 12px 0 4px; color: var(--text-body); line-height: 1.5; }
.debt-section-label { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin: 14px 0 6px; }
.debt-disclaimer { margin-top: 14px; }

.rate-shock-rows { display: flex; flex-direction: column; gap: 6px; }
.rate-shock-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; }
.rate-shock-key { font-size: 0.8rem; color: var(--text-muted); }
.rate-shock-track { height: 8px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
.rate-shock-fill { height: 100%; border-radius: 999px; }
.rate-shock-fill--down { background: var(--debt-down); }
.rate-shock-fill--up { background: var(--debt-up); }
.rate-shock-val { font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.rate-shock-val--down { color: var(--debt-down); }
.rate-shock-val--up { color: var(--debt-up); }

/* 2px gaps between segments, so adjacent tiers read as separate bands
   rather than one blended ribbon. */
.credit-bar { display: flex; gap: 2px; height: 26px; border-radius: 6px; overflow: hidden; margin: 10px 0 12px; }
.credit-seg { min-width: 2px; cursor: help; }
.credit-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.credit-legend-item { display: flex; align-items: center; gap: 7px; font-size: 0.84rem; color: var(--text-muted); }
.credit-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.credit-legend-value { font-variant-numeric: tabular-nums; color: var(--text-body); font-weight: 600; }

@media (max-width: 560px) {
  .rate-shock-row { grid-template-columns: 84px 1fr auto; }
  .debt-stat-value { font-size: 1.3rem; }
}

/* SEBI mandate check on the debt Yield & Risk card. Semantic colour, not
   the accent — "within/outside" is a state, and states are read by form
   as well as hue, so the dot plus the wording carry it too. */
.mandate-line { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--text-muted); }
.mandate-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.mandate-line--within .mandate-dot { background: var(--debt-up); }
.mandate-line--outside .mandate-dot { background: var(--debt-down); }
.mandate-line--outside { color: var(--text-body); }

/* The Yield & Risk help panel carries real prose, unlike the one-liner
   help boxes elsewhere, so it needs paragraph rhythm and a readable
   measure rather than a single dense block. */
#yieldRiskHelpBox p { margin: 0 0 10px; line-height: 1.55; max-width: 68ch; }
#yieldRiskHelpBox p:last-child { margin-bottom: 0; }
#yieldRiskHelpBox strong { color: var(--text-primary); }

/* --- Screener on a phone -------------------------------------------
   The table already scrolls inside .table-wrap and already pins its
   checkbox + name columns via .screener-sticky-col, so neither of those
   needed inventing. Two things were genuinely wrong:

   1. THE PINNED CELLS WERE TRANSLUCENT. .screener-sticky-col used
      var(--bg-card), which is rgba(...,0.86) — so the scrolling columns
      were faintly visible THROUGH the pinned fund name. Sticky cells
      need an opaque ground.

   2. NOTHING PINNED VERTICALLY. Scrolling down a long result list lost
      the column headers, which on a phone is worse than losing the
      fund name, because every remaining cell is a bare number.

   And on a 390px phone the pinned columns ate 220px of a 324px window
   (40px checkbox + 180px name), leaving ~100px for the metrics the user
   came to compare. */
:root { --table-sticky-bg: #0f172a; }
:root[data-theme="light"] { --table-sticky-bg: #ffffff; }
/* Opaque hover tint for the same sticky columns — see the .screener-
   sticky-col :hover rule's own comment for why this needs to be a
   solid color, not the translucent --bg-panel token other hover
   states use. One shade lighter/darker than --table-sticky-bg so the
   hover highlight still reads, same pairing convention as that token. */
:root { --table-sticky-bg-hover: #1e293b; }
:root[data-theme="light"] { --table-sticky-bg-hover: #f1f5f9; }

.screener-sticky-col,
thead .screener-sticky-col {
  background: var(--table-sticky-bg);
}

/* Header row pins to the top of ITS OWN scroll container — which has
   to be .screener-table-wrap itself, not the page. Confirmed via an
   isolated minimal reproduction: position: sticky on a <th> NEVER
   pins relative to the page from inside a wrapper that has
   overflow-x: auto (needed here regardless, for the table's many
   columns) — every browser treats that wrapper as the sticky
   containing block once it has ANY non-visible overflow on either
   axis, even if that wrapper's own height just grows to fit its
   content and never independently scrolls. There is no bare-CSS way
   to keep overflow-x: auto on a wrapper while making a sticky child
   inside it track the page instead — border-collapse: separate (still
   required — the generic `table` rule above sets collapse, which
   independently also breaks sticky <th> positioning, same fix
   .macro-table already needed) fixes one blocker but not this one.
   So the wrapper gets a real bounded height + its own overflow-y:auto
   below, making it a genuine scroll box the header can stick inside —
   same shape as a frozen-header spreadsheet view (Tickertape's own
   screener works this way), not an ever-growing page-flow table. */
.screener-table {
  border-collapse: separate;
  border-spacing: 0;
}
.screener-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-sticky-bg);
}
.screener-table-wrap {
  max-height: 75vh;
  overflow-y: auto;
}

/* Alternating row tint — a wide, many-column table (Returns/Risk/
   Composition/Valuation all at once) is easy to lose your place in
   scanning left to right; a faint stripe every other row gives the eye
   a rail to follow without competing with the real data. Deliberately
   translucent (not the opaque --table-sticky-bg) since it layers over
   the ordinary scrolling cells, not the pinned checkbox/name columns —
   those already have their own opaque background and are unaffected.
   The :hover rule is repeated at matching specificity and placed AFTER
   this one so a hovered row always wins over the stripe on source-order
   tie-break, rather than leaving it to accidental specificity. */
:root { --table-zebra-bg: rgba(255, 255, 255, 0.035); }
:root[data-theme="light"] { --table-zebra-bg: rgba(15, 23, 42, 0.035); }
.screener-table tbody tr:nth-child(even) {
  background-color: var(--table-zebra-bg);
}
.screener-table tbody tr:hover {
  background-color: var(--bg-panel);
}

/* The chatbot's "Open in Screener" action highlights the specific fund
   it was answering about, without excluding its peers from the table —
   a left accent bar plus a tinted background, strong enough to spot at
   a glance in a many-row table, never removing or dimming other rows. */
:root { --screener-highlight-bg: rgba(99, 102, 241, 0.12); }
:root[data-theme="light"] { --screener-highlight-bg: rgba(79, 70, 229, 0.08); }
.screener-table tbody tr.screener-highlighted-row {
  background-color: var(--screener-highlight-bg) !important;
  box-shadow: inset 3px 0 0 var(--accent);
}

@media (max-width: 720px) {
  /* Reclaim the checkbox column: multi-select comparison is a
     desktop-shaped task, and 40px is 12% of the visible table on a
     phone. The rest of the row still works. */
  .screener-sticky-checkbox { display: none; }
  .screener-sticky-name {
    left: 0;
    min-width: 8.5rem;
    max-width: 40vw;
  }
  .screener-table th,
  .screener-table td {
    font-size: 0.74rem;
    padding: 7px 8px;
    white-space: nowrap;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
}

/* --- Macroeconomic indicators heat map ------------------------------ */
/* Wide by nature: one column per month, growing as the series builds.
   It scrolls inside its own container so the page never scrolls
   sideways, and the indicator column stays pinned while months scroll
   past — without that, a row's numbers become unreadable once you have
   scrolled away from its name. */
:root {
  --macro-up: #34d399;
  --macro-down: #fb7185;
  /* For the rows where neither direction is the good one — merchandise
     imports rise on strong demand and on a widening gap alike. A third
     colour, not a muted green or red, so the row is not read as a faint
     verdict. */
  --macro-neutral: #7aa2d8;
}

/* A bounded scroll box, so the month header stays visible while the
   rows scroll beneath it. position: sticky cannot pin to the PAGE from
   inside an overflow-x: auto wrapper (the same limit the Screener hit;
   see .screener-table-wrap), so the header pins to the top of this box
   instead. The first column stays sticky on the left for horizontal
   scrolling, so both the months and the indicator names stay in view. */
.macro-table-wrap {
  overflow-x: auto;
  max-height: 75vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

/* --bg-card is translucent; a sticky cell needs a solid fill, or the
   values scrolling under it show through. */
.macro-table {
  --macro-sticky-bg: linear-gradient(var(--bg-card), var(--bg-card)), var(--bg-page);
}

.macro-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  /* Digits must line up down a column to be comparable at a glance. */
  font-variant-numeric: tabular-nums;
}

.macro-table th,
.macro-table td {
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
}

.macro-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: right;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--macro-sticky-bg);
  border-bottom: 1px solid var(--border);
}

/* The newest month is what most readers came for, so it is separated
   from the history rather than being one column among many. */
.macro-table thead th.macro-latest-head {
  color: var(--text-primary);
  border-left: 1px solid var(--border);
}

.macro-value.macro-latest {
  border-left: 1px solid var(--border-subtle);
  font-weight: 600;
}

.macro-table thead th:first-child,
.macro-indicator {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--macro-sticky-bg);
}

.macro-table thead th:first-child { z-index: 4; }

.macro-indicator {
  font-weight: 500;
  color: var(--text-body);
  max-width: 22rem;
  white-space: normal;
  border-right: 1px solid var(--border-subtle);
  /* The global table styling shouts these in capitals; an indicator name
     is a proper noun, not a label, and reads better as written. */
  text-transform: none;
  letter-spacing: normal;
}

.macro-name { display: block; }

/* The unit belongs with the name, not repeated in every cell. */
.macro-unit {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0.02em;
}

.macro-value {
  text-align: right;
  color: var(--text-body);
  transition: background 0.15s ease;
}

.macro-table tbody tr:hover .macro-value { filter: brightness(1.12); }

/* The heading cell spans every column, so sticking the CELL left does
   nothing once the table scrolls sideways; the label inside it is pinned
   instead, or the heading scrolls out of view and leaves a blank band. */
.macro-category-label {
  position: sticky;
  left: 0.8rem;
  display: inline-block;
}

.macro-category-row td {
  padding: 0.95rem 0.8rem 0.35rem;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  background: var(--macro-sticky-bg);
  position: sticky;
  left: 0;
}

/* Best and worst carry a glyph as well as a tint, so the reading never
   depends on telling red from green. */
.macro-mark {
  margin-left: 0.28rem;
  font-size: 0.62rem;
  opacity: 0.85;
}

.macro-mark-best { color: var(--macro-up); }
.macro-mark-worst { color: var(--macro-down); }
.macro-best, .macro-worst { font-weight: 700; }

/* "vs:" search + the legend cards share one row when there's room
   (desktop had a lot of dead horizontal space with these stacked) —
   wraps to two lines below the width both need side by side. */
.peer-cum-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.55rem;
  margin: 0.15rem 0 0.65rem;
}

.peer-cum-summary-row .peer-cum-vs-row {
  margin: 0;
  flex: 0 1 320px;
}

.peer-cum-summary-row .peer-cum-legend {
  margin: 0;
  flex: 1 1 260px;
}

.peer-cum-vs-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 0.65rem;
}

.peer-cum-vs-label {
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.peer-cum-vs-search {
  position: relative;
  flex: 1 1 260px;
  max-width: 320px;
}

.peer-cum-vs-search .fund-input {
  width: 100%;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

.peer-cum-vs-search .suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.peer-cum-vs-search .suggestions:empty {
  display: none;
}

.peer-cum-vs-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  border-radius: 999px;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
  cursor: pointer;
}
.peer-cum-vs-reset:hover { color: var(--text-primary); border-color: var(--border-hover); }

.peer-cum-legend {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  margin: 0 0 0.45rem;
}

.peer-cum-legend:empty { display: none; }

.peer-nav-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 0.55rem;
  margin: 0.55rem 0 0.7rem;
}

.peer-nav-summary:empty { display: none; }

.peer-nav-value {
  color: var(--text-primary);
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.peer-nav-change {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.peer-nav-change.positive { color: var(--peer-fund-line); }
.peer-nav-change.negative { color: var(--macro-down); }

.peer-nav-date {
  grid-column: 1 / -1;
  margin-top: 0.08rem;
  color: var(--text-dim);
  font-size: 0.7rem;
}

.peer-cum-legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.35rem;
  flex: 1 1 0;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 0.7rem;
}

.peer-cum-legend-line {
  width: 0.8rem;
  height: 3px;
  border-radius: 99px;
}

.peer-cum-legend-item strong {
  grid-column: 2;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.peer-cum-legend-cagr {
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.macro-trend-head { text-align: center; }

.macro-trend {
  text-align: center;
  padding-left: 1rem;
  padding-right: 1rem;
  border-left: 1px solid var(--border-subtle);
}

.macro-spark { display: block; overflow: visible; }

.macro-source {
  margin-top: 0.9rem;
  font-size: 0.78rem;
  line-height: 1.5;
}

/* --- Phone layout ---------------------------------------------------
   The table needs ~190px for the indicator name alone, which at 390px
   leaves under half the width for the months — every reading would cost
   a horizontal scroll. Below 640px the card list is shown instead and
   the table is hidden; above it, the reverse. Same data, same numbers,
   the shape that fits the screen. */
.macro-cards { display: none; }

.macro-card {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 0.85rem 0.95rem 0.95rem;
  background: var(--bg-card);
}

.macro-card + .macro-card { margin-top: 0.7rem; }

.macro-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.3;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* The unit rides with the name rather than taking a line of its own. */
.macro-card-unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
}

/* The trend line is the card's one piece of emphasis: it shows the shape
   of the series, which the value strip below cannot. It stretches to the
   card width so the shape is legible on a narrow screen. */
.macro-card-trend {
  margin-top: 0.6rem;
  height: 52px;
}

.macro-spark-lg {
  width: 100%;
  height: 100%;
  display: block;
}

/* The whole history, still shaded, as a strip that scrolls on its own. */
.macro-chips {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.8rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
}

.macro-chip {
  flex: 0 0 auto;
  min-width: 3.6rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.4rem;
  text-align: center;
}

.macro-chip-month {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.macro-chip-value {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}

.macro-chip.macro-best { border-color: rgba(52, 211, 153, 0.5); }
.macro-chip.macro-worst { border-color: rgba(251, 113, 133, 0.5); }

@media (max-width: 640px) {
  .macro-table-wrap { display: none; }
  .macro-cards { display: block; }
  /* The sparkline is the most compact way to show a trend, so on a phone
     it is kept, not dropped. */
  .macro-card .macro-spark { flex: 0 0 auto; }
  .macro-source { font-size: 0.72rem; }
}

/* Peer Comparison's "jump to section" tab bar — built by
   setupPeerComparisonMobileTabs() (see script.js) from the tab's own
   card headings, not static markup. Ported from the Android build;
   shown at every width per user request, not just narrow ones.
   Pinned to the top of the viewport on scroll (user request: "let me
   know where I am") — an opaque background keeps cards scrolling
   underneath from showing through, matching the existing
   .screener-sticky-col / .fmc-tl-label sticky convention elsewhere. */
/* Stacked single-column at every width (not just the <840px breakpoint
   .grid normally collapses at) — the tab bar's scroll-sync tracks
   "which card is nearest the top of the viewport," which only reads
   unambiguously when cards flow one after another in DOM/visual order,
   not side-by-side in two columns. */
#categoryTabPanel > .grid {
  grid-template-columns: 1fr;
}

#categoryTabPanel .peer-card-tabs {
  display: flex;
  gap: 1.7rem;
  width: 100%;
  margin: 0.15rem 0 0.75rem;
  padding: 0 0.35rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-card);
  backdrop-filter: blur(6px);
}

#categoryTabPanel .peer-card-tabs::-webkit-scrollbar {
  display: none;
}

#categoryTabPanel .peer-card-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0.65rem 0.05rem 0.8rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

#categoryTabPanel .peer-card-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}

#categoryTabPanel .peer-card-tab.active {
  color: var(--text-primary);
}

#categoryTabPanel .peer-card-tab.active::after {
  background: var(--accent);
}

#categoryTabPanel .peer-card-tab[hidden] {
  display: none !important;
}

#categoryTabPanel .peer-tab-card {
  display: block;
  scroll-margin-top: 0.75rem;
}

/* Compare Pro tab — fund-name buttons inside its comparison tables that
   jump into Peer Comparison via openPeerComparisonForCode(). Reset to
   look like an inline text link, not a boxy default button, since they
   sit inside table headers/cells alongside plain text. */
.comparo-fund-link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  white-space: normal;
}

.comparo-fund-link:hover,
.comparo-fund-link:focus-visible {
  text-decoration: underline;
}

/* Compare Pro's "Sector tree" holdings view — one Sector -> Top Holdings
   tree per fund, connector lines drawn with a plain border-left + a
   short ::before tick rather than literal box-drawing characters, so it
   reflows at any width instead of relying on monospace alignment. */
.comparo-tree-fund {
  margin-bottom: 1.5rem;
}

/* Side-by-side columns, one per compared fund — one column per row on
   narrow/mobile widths, matching this app's usual .grid breakpoint. */
.comparo-tree-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.comparo-tree-fund {
  margin-bottom: 0;
  min-width: 0;
}

.comparo-tree-fund h3 {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  overflow: hidden;
}

.comparo-tree-fund h3 .comparo-fund-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparo-tree-root-node {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  margin-top: 0.4rem;
  border-radius: 6px;
  background: var(--accent-bg-soft);
  font-weight: 700;
}

.comparo-tree-root,
.comparo-tree-leaves {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comparo-tree-root {
  position: relative;
  margin-top: 0;
  padding-top: 0.5rem;
}

.comparo-tree-root::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: -0.4rem;
  width: 1px;
  height: 0.9rem;
  background: var(--border-soft);
}

.comparo-tree-branch {
  position: relative;
  padding: 0 0 0.6rem 1.1rem;
  border-left: 1px solid var(--border-soft);
}

.comparo-tree-branch:last-child {
  border-left-color: transparent;
}

.comparo-tree-branch::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 0.8rem;
  height: 1px;
  background: var(--border-soft);
}

.comparo-tree-branch-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.comparo-tree-leaves {
  margin-top: 0.15rem;
  padding-left: 1.4rem;
}

.comparo-tree-leaf {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0 0.15rem 1.1rem;
  border-left: 1px solid var(--border-soft);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.comparo-tree-leaf:last-child {
  border-left-color: transparent;
}

.comparo-tree-leaf::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.8rem;
  height: 1px;
  background: var(--border-soft);
}

.comparo-tree-sector {
  font-weight: 600;
}

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

.comparo-tree-pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

/* Compare Pro's Cumulative Returns controls — range-preset buttons
   alongside explicit From/To date inputs (modeled on the mfiframes.
   mutualfundsindia.com factsheet page's own "NAV GRAPH" widget). */
.comparo-cum-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.comparo-cum-dates {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.comparo-cum-dates label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.comparo-cum-dates input[type="date"] {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  color-scheme: dark;
}

:root[data-theme="light"] .comparo-cum-dates input[type="date"] {
  color-scheme: light;
}

/* Overview strip below the main chart — a draggable shaded window over
   the full-history sparkline marks the zoomed range (see
   renderComparoCumNavigator in script.js for the drag interaction). */
.comparo-cum-nav {
  margin-top: 0.6rem;
}

#comparoCumNavSvg, #peerCumNavSvg {
  border-radius: 6px;
  background: var(--bg-panel);
}

/* Fund manager changes on the Peer Comparison navigator's axis. */
.cum-nav-manager-star {
  fill: var(--macro-down);
  stroke: var(--bg-panel);
  stroke-width: 0.8;
  cursor: pointer;
}

.cum-nav-manager-legend {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.cum-nav-manager-star--joined { fill: var(--macro-up); }

.cum-nav-legend-phone { display: none; }

/* The label column is pinned and opaque, so it takes the same shade. */
#fundManagerCard .fmc-tl-row.fmc-star-marked .fmc-tl-label {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-card));
  border-radius: 6px 0 0 6px;
  padding-left: 6px;
}

/* The managers a clicked star is about, in the Fund Details card. */
.fmc-tl-row.fmc-star-marked,
.fmc-plain-manager-chip.fmc-star-marked {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 6px;
}

@media (max-width: 600px) {
  .cum-nav-manager-legend {
    font-size: 0.66rem;
    line-height: 1.35;
  }
  .cum-nav-legend-wide { display: none; }
  .cum-nav-legend-phone { display: inline; }
}

.cum-nav-manager-legend-star--left { color: var(--macro-down); }
.cum-nav-manager-legend-star--joined { color: var(--macro-up); }

.comparo-nav-shade {
  fill: var(--bg-card);
  opacity: 0.75;
  pointer-events: none;
}

.comparo-nav-window {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
  stroke: var(--accent);
  stroke-width: 1;
  cursor: grab;
}

.comparo-nav-window:active {
  cursor: grabbing;
}

.comparo-nav-handle {
  fill: var(--accent);
  opacity: 0.9;
  cursor: ew-resize;
}

/* One-time visual "this is draggable" cue in place of a text caption —
   plays twice on the navigator's first render only (see
   _comparoNavAnimated in script.js), a glow pulse + slight grow on each
   handle, then settles back to its normal static look. */
@keyframes comparoNavPulse {
  0%, 100% { filter: none; transform: scaleX(1); }
  50% { filter: drop-shadow(0 0 5px var(--accent)); transform: scaleX(1.6); }
}

.comparo-nav-handle.comparo-nav-pulse {
  transform-box: fill-box;
  transform-origin: center;
  animation: comparoNavPulse 1s ease-in-out 2;
}

@media (prefers-reduced-motion: reduce) {
  .comparo-nav-handle.comparo-nav-pulse {
    animation: none;
  }
}

.comparo-subheading {
  margin: 1.25rem 0 0.6rem;
  font-size: 1rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

.comparo-sparkline-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.comparo-sparkline {
  display: block;
  flex-shrink: 0;
}

.comparo-sparkline-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Investor risk-profile questionnaire (openRiskProfileModal, script.js)
   — reuses the .fmc-modal shell; only the questions and result here. */
/* Opaque: --bg-card is translucent and the page text behind showed
   through the questions. */
.risk-profile-modal {
  max-width: 600px;
  max-height: 88vh;
  background: linear-gradient(var(--bg-card), var(--bg-card)), var(--bg-page);
}

.risk-profile-body {
  padding: 0.9rem 1.2rem 1.2rem;
}

.risk-intro {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.risk-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.risk-q {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.risk-q legend {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
  padding: 0;
  margin-bottom: 0.5rem;
  color: var(--text-body);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.risk-q-num {
  flex: none;
  min-width: 1.4rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
}

.risk-q-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.4rem;
  padding-left: 1.95rem;
}

.risk-q-option {
  display: flex;
  flex-direction: row; /* the global label rule stacks as a column */
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.risk-q-option:hover {
  border-color: var(--accent-border-hover);
}

.risk-q-option:has(input:checked) {
  border-color: var(--accent-strong);
  background: var(--accent-bg-soft);
  color: var(--text-body);
}

.risk-q-option input {
  margin: 0.15rem 0 0;
  accent-color: var(--accent-strong);
}

.risk-form-footer {
  position: sticky;
  bottom: -1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0 0.2rem;
  background: linear-gradient(var(--bg-card), var(--bg-card)), var(--bg-page);
  border-top: 1px solid var(--border-soft);
}

.risk-progress {
  color: var(--text-faint);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.risk-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.risk-error:empty {
  display: none;
}

.risk-result {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.risk-result-eyebrow {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.risk-result-category {
  margin: -0.4rem 0 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  text-wrap: balance;
}

.risk-result-score {
  margin: -0.4rem 0 0;
  color: var(--text-faint);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.risk-result-desc,
.risk-cap-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.risk-cap-note {
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent-strong);
  background: var(--accent-bg-soft);
  border-radius: 0 8px 8px 0;
  font-size: 0.84rem;
}

.risk-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.25rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
}

.risk-scale li {
  padding: 0.4rem 0.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: center;
}

.risk-scale li.is-current {
  border-color: var(--accent-strong);
  background: var(--accent-bg-medium);
  color: var(--text-primary);
  font-weight: 700;
}

.risk-meter-block {
  padding: 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--bg-panel);
}

.risk-meter-title {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.risk-meter {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.3rem;
  align-items: end;
}

.risk-meter-seg {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  opacity: 0.25;
}

.risk-meter-seg.is-suitable {
  opacity: 1;
}

/* Bars step up in height so the scale reads without color too. */
.risk-meter-bar {
  display: block;
  border-radius: 3px;
}

.risk-meter-seg:nth-child(1) .risk-meter-bar { height: 10px; }
.risk-meter-seg:nth-child(2) .risk-meter-bar { height: 14px; }
.risk-meter-seg:nth-child(3) .risk-meter-bar { height: 18px; }
.risk-meter-seg:nth-child(4) .risk-meter-bar { height: 22px; }
.risk-meter-seg:nth-child(5) .risk-meter-bar { height: 26px; }
.risk-meter-seg:nth-child(6) .risk-meter-bar { height: 30px; }

.risk-meter-seg.is-max .risk-meter-bar {
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent-strong);
}

.risk-meter-label {
  color: var(--text-faint);
  font-size: 0.64rem;
  line-height: 1.2;
  text-align: center;
}

.risk-meter-seg.is-max .risk-meter-label {
  color: var(--text-primary);
  font-weight: 700;
}

.risk-disclaimer {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.76rem;
  line-height: 1.45;
}

.risk-result-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 520px) {
  .risk-q-options { padding-left: 0; }
  .risk-scale { grid-template-columns: 1fr; }
  .risk-meter { gap: 0.2rem; }
  .risk-meter-label { font-size: 0.56rem; }
}

/* Above the floating chat button (z-index 500), which otherwise covers
   the "See my profile" button on phones. */
#riskProfileBackdrop {
  z-index: 600;
}

/* Quality pillars by holding (Peer Comparison) — 2026-10-15: a small
   matrix of touching square blocks, red (weak) to green (strong);
   names, weights and figures are in each block's hover title. */
.qp-table-wrap {
  margin-top: 0.3rem;
}
.qp-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: auto !important; /* the site-wide table rule is width: 100% */
  min-width: 0 !important;
}
.qp-table thead th {
  width: 12px;
  padding: 0 0 4px;
  vertical-align: bottom;
}
.qp-sort {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 12px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}
.qp-sort:hover,
.qp-sort:focus-visible {
  color: var(--text-primary);
}
.qp-table th,
.qp-table td {
  border: 0;
}
.qp-block {
  width: 12px;
  min-width: 12px;
  max-width: 12px;
  height: 12px;
  padding: 0 !important;
}
.qp-block--na {
  background: var(--border-soft);
  opacity: 0.35;
}
.qp-summary .qp-block {
  border-bottom: 4px solid var(--table-sticky-bg);
}
.qp-test-tag {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
}

/* Goal Planner tab (2026-10-16) */
.gp-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 860px) {
  .gp-grid { grid-template-columns: minmax(0, 1fr); }
}
.gp-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
/* In the Calculators tab (2026-11-06) the menu takes the left column, so
   the goal form sits above the plan with its fields side by side, and the
   plan's tables keep the full width. */
#strategyGoalPlanner .gp-grid {
  grid-template-columns: minmax(0, 1fr);
}
#strategyGoalPlanner .gp-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.85rem 1rem;
  align-items: end;
}
#strategyGoalPlanner .gp-form .gp-row {
  display: contents;
}
#strategyGoalPlanner .gp-form > .gp-profile,
#strategyGoalPlanner .gp-form > .auth-error,
#strategyGoalPlanner .gp-form > .gp-submit {
  grid-column: 1 / -1;
}
#strategyGoalPlanner .gp-form > .gp-submit {
  justify-self: start;
}
#strategyGoalPlanner .gp-form > .auth-error:empty {
  display: none;
}
.gp-form input[type="number"],
.gp-form select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}
.gp-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.gp-mode {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.5rem 0.75rem 0.65rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gp-mode legend {
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0 0.25rem;
}
.gp-radio {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.gp-link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
/* A button that reads as a link (the ETFs group's "open the ETFs tab"). */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.etf-group-more {
  margin-top: 0.75rem;
}
/* A NAV that does not move (daily-dividend liquid ETFs at ₹1,000). */
.leaderboard-nav-fixed {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.nav-fixed-note {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg-soft);
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.gp-submit {
  align-self: flex-start;
}
.gp-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.gp-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin: 0.4rem 0 0.6rem;
}
.gp-figure {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--bg-panel);
}
.gp-figure-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.gp-figure-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.gp-figure-note {
  font-size: 0.78rem;
  color: var(--text-dim);
}
/* Risk profile picker in "How to split it" (2026-11-05). */
.gp-profile-picker {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.2rem 0 0.9rem;
  min-width: 0;
}
.gp-profile-picker-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gp-profile-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.gp-profile-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border-tab);
  border-radius: 10px;
  background: var(--bg-panel-strong);
  color: var(--text-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.gp-profile-opt:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--text-body);
}
.gp-profile-opt:disabled {
  cursor: progress;
  opacity: 0.7;
}
.gp-profile-opt.active {
  background: var(--accent-bg-medium);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  opacity: 1;
}
.gp-profile-opt-name {
  font-size: 0.82rem;
  font-weight: 600;
}
.gp-profile-opt-sub {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.gp-profile-picker .helper-text {
  margin: 0;
}
.gp-profile-picker .auth-error {
  text-align: left;
}
.gp-profile-picker .auth-error:empty {
  display: none;
}
.gp-split {
  display: flex;
  height: 1.6rem;
  border-radius: 8px;
  overflow: hidden;
  margin: 0.3rem 0 0.8rem;
  font-size: 0.74rem;
  font-weight: 600;
}
.gp-split span {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text-primary);
}
.gp-split-equity { background: var(--accent-bg-medium); }
.gp-split-debt { background: var(--bg-panel-strong); }
.gp-table-wrap {
  overflow-x: auto;
}
.gp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  /* The site-wide table rule sets 720px, which on a phone pushed the
     split's Share/SIP and the glide path's Equity/Debt off screen. */
  min-width: 0;
}
/* The fund lists have seven columns and long names: they still scroll. */
.gp-fund-block .gp-table {
  min-width: 36rem;
}
.gp-roll-table .gp-roll-group {
  text-align: center;
  border-bottom: 1px solid var(--border-soft);
  white-space: normal;
}
.gp-roll-main {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.gp-roll-main.gp-roll-none {
  color: var(--text-dim);
  font-weight: 400;
}
.gp-roll-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.gp-table th,
.gp-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.gp-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.74rem;
}
.gp-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gp-h3 {
  font-size: 0.9rem;
  margin: 1.1rem 0 0.3rem;
}
.gp-fund-block {
  margin-top: 1rem;
}
.gp-fund-block h4 {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
}
.gp-fund-block .helper-text {
  margin: 0 0 0.3rem;
}
.gp-fund {
  color: var(--accent);
}
/* "How this plan is built" (restyled 2026-11-05, user's request). */
.gp-rules summary {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 1.6rem;
}
.gp-rules summary::-webkit-details-marker { display: none; }
.gp-rules summary::after {
  content: '';
  position: absolute;
  right: 0.3rem;
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}
.gp-rules[open] summary::after {
  transform: rotate(-135deg);
  top: 0.65rem;
}
.gp-rules-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.gp-rules-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.gp-rules-plain {
  margin: 0.6rem 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}
.gp-rules-steps {
  list-style: none;
  counter-reset: gp-rule;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.gp-rule {
  counter-increment: gp-rule;
  position: relative;
  padding-left: 2.4rem;
  min-width: 0;
}
.gp-rule::before {
  content: counter(gp-rule);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-bg-medium);
}
.gp-rule h4 {
  margin: 0.15rem 0 0.3rem;
  font-size: 0.92rem;
  color: var(--text-primary);
}
.gp-rule p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-body);
  max-width: 65ch;
}
.gp-rule-note {
  margin-top: 0.35rem !important;
  font-size: 0.78rem !important;
  color: var(--text-dim) !important;
}
.gp-limit {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.7rem;
}
.gp-limit-head,
.gp-fundrules-head {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.gp-limit-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.4rem, 1fr));
  gap: 0.35rem;
}
.gp-limit-chip {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-panel);
  min-width: 0;
}
.gp-limit-chip-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.25;
}
.gp-limit-chip-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
/* This plan's profile / years: outlined; the one that sets the equity: filled. */
.gp-limit-chip.is-current {
  border-color: var(--accent-strong);
}
.gp-limit-chip.is-binding {
  border-color: var(--accent-strong);
  background: var(--accent-bg-medium);
}
.gp-limit-chip.is-current .gp-limit-chip-value,
.gp-limit-chip.is-binding .gp-limit-chip-value,
.gp-limit-chip.is-binding .gp-limit-chip-label {
  color: var(--accent-strong);
}
.gp-fundrules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.8rem 1.2rem;
  margin-top: 0.3rem;
}
.gp-fundrules ul {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.gp-fundrule {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 0.65rem;
  border-left: 2px solid var(--border-soft);
}
.gp-fundrule.is-used {
  border-left-color: var(--accent-strong);
}
.gp-fundrule-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.gp-fundrule-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-bg-medium);
}
.gp-fundrule-when {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.gp-assume {
  width: auto;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.gp-assume th,
.gp-assume td {
  padding: 0.35rem 1.1rem 0.35rem 0;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.gp-assume thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.gp-assume tbody th {
  font-weight: 500;
  color: var(--text-muted);
}
.gp-assume td {
  font-weight: 700;
  color: var(--text-primary);
}
.gp-rules-disclaimer {
  margin: 1.2rem 0 0;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--border-soft);
  background: var(--bg-panel);
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
}

/* --- Chat feedback tab (chat admins only, 2026-10-17) --------------- */
.cf-card {
  max-width: 980px;
}

.cf-tabs,
.cf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.cf-tab,
.cf-chip {
  padding: 0.35rem 0.75rem;
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.cf-tab.is-active,
.cf-chip.is-active {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: var(--accent-bg-soft);
}

.cf-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.cf-item {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-card);
}

.cf-item summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  list-style: none;
}

.cf-item summary::-webkit-details-marker {
  display: none;
}

.cf-summary-q {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.cf-when {
  color: var(--text-faint);
  font-size: 0.74rem;
  white-space: nowrap;
}

.cf-status {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.cf-status--open { color: var(--macro-down); }
.cf-status--fixed { color: var(--macro-up); }
.cf-status--wont_fix { color: var(--text-faint); }

.cf-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0.8rem 0.8rem;
}

.cf-label {
  color: var(--text-faint);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cf-turn {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cf-turn--earlier {
  opacity: 0.75;
}

.cf-q {
  align-self: flex-end;
  max-width: 85%;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: var(--accent-bg-soft);
  color: var(--text-primary);
  font-size: 0.84rem;
}

.cf-a {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: var(--bg-panel-strong, var(--bg-input));
  color: var(--text-body);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 22rem;
  overflow: auto;
}

.cf-comment {
  font-size: 0.84rem;
  color: var(--text-body);
}

.cf-review,
.cf-test-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-soft);
}

.cf-review label,
.cf-test-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-faint);
  font-size: 0.76rem;
}

.cf-note,
.cf-test-form label:not(.cf-check) {
  flex: 1 1 18rem;
}

.cf-review select,
.cf-review textarea,
.cf-test-form textarea {
  padding: 0.4rem 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
}

.cf-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  flex-basis: 100%;
}

.cf-btn {
  padding: 0.45rem 0.9rem;
  background: var(--accent-strong);
  border: none;
  border-radius: 6px;
  color: var(--text-btn);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

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

.cf-review-status {
  color: var(--text-faint);
  font-size: 0.76rem;
}

.cf-regression {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cf-test-tag {
  color: var(--macro-up);
  font-size: 0.8rem;
}

.cf-test-tag--pending {
  color: var(--macro-neutral);
}

@media (max-width: 600px) {
  .cf-item summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .cf-when {
    grid-column: 2 / -1;
  }
}

/* --- Sign-in screen (all data needs a sign-in, 2026-10-17) ----------- */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  background: var(--bg-page);
}

/* display:flex above would otherwise override the hidden attribute. */
.auth-gate[hidden] {
  display: none;
}

body.auth-gated {
  overflow: hidden;
}

.auth-gate-card {
  width: min(26rem, 100%);
  padding: 2rem 1.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 18px 40px var(--shadow-tooltip);
}

.auth-gate-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display, inherit);
  font-size: 1.8rem;
  color: var(--text-primary);
}

.auth-gate-lede {
  margin: 0 0 0.9rem;
  color: var(--text-body);
}

.auth-gate-points {
  margin: 0 0 1.3rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-gate-google,
.auth-gate-primary,
.auth-gate-secondary {
  display: block;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.auth-gate-google,
.auth-gate-primary {
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  color: var(--text-btn);
}

.auth-gate-secondary {
  background: none;
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
}

.auth-gate-or {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.auth-gate-or::before,
.auth-gate-or::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-soft);
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth-gate-form input {
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
}

.auth-gate-actions {
  display: flex;
  gap: 0.5rem;
}

/* Sign-up extras, the forgot-password link and hints on the sign-in screen. */
.auth-gate-form[hidden],
.auth-gate-signup-fields[hidden] {
  display: none;
}

.auth-gate-signup-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.auth-gate-hint {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-gate-check {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--text-body);
  font-size: 0.84rem;
  line-height: 1.4;
}

.auth-gate-form .auth-gate-check input {
  padding: 0;
  margin: 0.15rem 0 0;
  flex: none;
}

.auth-gate-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.auth-gate-link:hover {
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.auth-gate-note a,
.auth-gate-check a {
  color: var(--accent-strong);
}

/* A confirmation shown where errors usually go ("a reset link is on its way"). */
.auth-error.auth-note {
  color: var(--text-body);
}

.auth-gate-note {
  margin: 1.1rem 0 0;
  color: var(--text-faint);
  font-size: 0.76rem;
  text-align: center;
}

/* --- Market answer card ("is it a good time to invest?", 2026-10-18) -- */
.fund-chat-market-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fund-chat-market-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}

.fund-chat-market-row-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.fund-chat-market-row-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8rem;
  text-align: right;
}

.fund-chat-market-row--stacked .fund-chat-market-row-top {
  flex-direction: column;
  gap: 0.1rem;
}

.fund-chat-market-row--stacked .fund-chat-market-row-value {
  font-weight: 400;
  text-align: left;
  line-height: 1.4;
  color: var(--text-muted);
}

.fund-chat-market-row-detail {
  color: var(--text-faint);
  font-size: 0.74rem;
  line-height: 1.35;
}

.fund-chat-market-subhead {
  margin: 0.55rem 0 0.3rem;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.fund-chat-market-lede {
  margin-top: 0;
}

.fund-chat-market-note,
.fund-chat-market-period {
  display: block;
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 400;
}

.fund-chat-horizon-table {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.fund-chat-horizon-line {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(4, minmax(0, 1fr));
  gap: 0.3rem;
  padding: 0.15rem 0.3rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-body);
}

.fund-chat-horizon-line span:not(:first-child) {
  text-align: right;
}

.fund-chat-horizon-line--head {
  color: var(--text-faint);
  font-size: 0.68rem;
  font-weight: 600;
}

.fund-chat-horizon-line--goal {
  background: color-mix(in oklch, var(--accent-strong) 12%, transparent);
  font-weight: 700;
  color: var(--text-primary);
}

.fund-chat-market-closing {
  margin: 0.7rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-soft);
  color: var(--text-body);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* The invite code, above Continue with Google in "Create account". */
.auth-gate-invite {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.auth-gate-invite[hidden] {
  display: none;
}

.auth-gate-invite input {
  padding: 0.6rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
}

/* A typed code reads like one (K7QM-4XPA); the placeholder stays plain. */
.auth-gate-invite input:not(:placeholder-shown) {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Google sign-in is hidden where it can't finish (the tunnel address). */
.auth-gate-google[hidden],
.auth-gate-or[hidden] {
  display: none;
}

/* Fund comparison card: three value columns (2026-10-19). */
.fund-chat-peer-line--cols3 {
  grid-template-columns: minmax(0, 1fr) 3.8rem 3.8rem 3.8rem;
}

/* --- ETFs tab (2026-10-26) ------------------------------------------- */
:root { --etf-wide: #fbbf24; }
:root[data-theme="light"] { --etf-wide: #b45309; }
.etf-head h2 { margin-bottom: 0.25rem; }
.etf-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.etf-result-count { margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* ETF Screener filters (2026-11-07): the Screener's sections. Closed
   sections and the idle "Reset all" are hidden by the attribute (their
   own display rules would otherwise win). The range section grows with
   its sliders instead of scrolling inside the 200px list box. */
.etf-filter-card [hidden] { display: none !important; }
#etfRangeOptions,
#etfTypeOptions { max-height: none; overflow: visible; padding-right: 0; }
#etfRangeOptions .screener-range-group-label:first-child { margin-top: 0.2rem; }
.etf-main { min-width: 0; }
.etf-search {
  flex: 1 1 16rem;
  max-width: 22rem;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}
.etf-table-wrap { overflow-x: auto; }
.etf-table { width: 100%; }
.etf-table th[data-etf-sort] { cursor: pointer; white-space: nowrap; user-select: none; }
.etf-table th.etf-sorted { color: var(--accent); }
.etf-table th.etf-sorted::after { content: " ↕"; font-size: 0.7em; opacity: 0.7; }
.etf-table th[aria-sort="ascending"]::after { content: " ↑"; }
.etf-table th[aria-sort="descending"]::after { content: " ↓"; }
.etf-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.etf-table tbody tr { cursor: pointer; }
.etf-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.etf-table tbody tr.etf-selected { box-shadow: inset 3px 0 0 var(--accent); background-color: var(--accent-bg-soft); }
.etf-name-cell { min-width: 14rem; }
.etf-name { display: block; color: var(--text-primary); }
.etf-sub { display: inline-block; color: var(--text-faint); font-size: 0.72rem; letter-spacing: 0.02em; }
.etf-name-cell .etf-sub,
.etf-type-cell .etf-sub { display: block; }
.etf-type-cell { white-space: nowrap; }
.etf-na { color: var(--text-faint); }
.etf-premium-wide { color: var(--etf-wide); font-weight: 600; }
.etf-empty { text-align: center; color: var(--text-muted); padding: 1.5rem; }
.etf-notes { margin-top: 0.75rem; max-width: 70ch; }

.etf-detail-card { margin-top: 1rem; }
.etf-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.etf-detail-head h2 { margin-bottom: 0.2rem; text-wrap: balance; }
.etf-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.etf-close:hover { color: var(--text-primary); border-color: var(--border-hover); }
.etf-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin: 0.75rem 0 1.25rem;
}
.etf-fact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-panel);
}
.etf-fact-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.etf-fact-value { font-size: 1.05rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.etf-fact-note { font-size: 0.72rem; color: var(--text-muted); }
.etf-holdings h3 { font-size: 0.9rem; margin: 0; }
/* Holdings sunburst in the ETF detail (2026-11-07): heading and PNG/CSV
   buttons on one row above the chart. */
.etf-breakdown-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}
.etf-breakdown-head .sunburst-toolbar { position: static; }
@media (max-width: 720px) {
  .etf-search { max-width: none; }
}
/* The ETF name stays in view while the table scrolls sideways (phones),
   as on the Screener. */
.etf-table th:first-child,
.etf-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--table-sticky-bg);
}
.etf-table thead th:first-child { z-index: 3; }
.etf-table tbody tr:hover td:first-child { background: var(--table-sticky-bg-hover); }
.etf-table tbody tr.etf-selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 720px) {
  .etf-name-cell { min-width: 9.5rem; max-width: 11rem; white-space: normal; }
}

/* ETFs in Peer Comparison (2026-10-27) */
.suggestion-etf-tag,
.tag-etf {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  white-space: nowrap;
  vertical-align: 1px;
}
.etf-open-peer {
  margin-top: 0.5rem;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.etf-open-peer:hover { background: var(--bg-panel); }
.index-own-valuation {
  margin: 0.6rem 0 0;
  font-size: 0.86rem;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}
.index-own-valuation-label {
  font-weight: 600;
  margin-right: 0.35rem;
}

/* EPS chart headline: earnings growth of today's holdings (2026-10-27) */
.eps-growth-summary {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: var(--text-body);
}
.etf-sub-inline { font-size: 0.72rem; color: var(--text-faint); }
.etf-factsheet-line { margin-top: 0.15rem; }

/* ---- My profile, watchlist, saved plans, subscriber-only cards (2026-11-12) ---- */
.profile-modal {
  max-width: 600px;
  max-height: 88vh;
}

.profile-body {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow-x: hidden;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-soft);
}

.profile-section:first-child {
  border-top: none;
  padding-top: 0.3rem;
}

.profile-section h4 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.profile-section .helper-text {
  margin: 0;
}

.profile-section > .range-btn,
.profile-section > .theme-toggle {
  align-self: flex-start;
}

.profile-facts {
  margin: 0;
  display: grid;
  gap: 0.3rem;
}

.profile-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.6rem;
  font-size: 0.84rem;
}

.profile-row dt {
  color: var(--text-faint);
}

.profile-row dd {
  margin: 0;
  color: var(--text-body);
  overflow-wrap: anywhere;
}

.profile-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.profile-form input,
.profile-form select,
.gp-save-bar input {
  flex: 1 1 11rem;
  min-width: 0;
  padding: 0.45rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.84rem;
}

.profile-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-error);
}

.profile-note:empty {
  display: none;
}

.profile-note.profile-note-ok,
.profile-inline .profile-note {
  color: var(--text-body);
}

.profile-inline,
.peer-watch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.peer-watch-row {
  margin-top: 0.6rem;
}

.profile-inline .profile-note,
.peer-watch-row .profile-note {
  flex-basis: auto;
}

.profile-list-row,
.gp-saved-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.7rem;
  padding: 0.3rem 0;
  font-size: 0.84rem;
}

.profile-list-row .gp-link-btn,
.gp-saved-row .gp-link-btn {
  text-align: left;
}

.gp-saved-meta {
  color: var(--text-faint);
  font-size: 0.78rem;
  flex: 1 1 10rem;
  min-width: 0;
}

.gp-saved-remove {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
}

.gp-saved-remove:hover {
  color: var(--text-error);
  transform: none;
  box-shadow: none;
}

/* Admin: invite codes. */
.profile-invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.profile-invite-row.is-withdrawn .profile-invite-code {
  color: var(--text-faint);
  text-decoration: line-through;
}

.profile-invite-actions {
  display: inline-flex;
  gap: 0.8rem;
  margin-left: auto;
}

.profile-invite-actions .gp-saved-remove {
  margin-left: 0;
}

.profile-danger h4 {
  color: var(--text-error);
}

.range-btn.profile-danger-btn {
  color: var(--text-error);
  border-color: var(--text-error) !important;
}

.gp-saved:empty {
  display: none;
}

.gp-saved {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}

.gp-saved-title {
  margin: 0 0 0.2rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.gp-save-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.gp-save-note {
  font-size: 0.78rem;
  color: var(--text-body);
}

/* A card an admin has locked, as a non-subscriber sees it. */
.feature-locked {
  padding: 1.1rem 1rem;
  border: 1px dashed var(--border-tab);
  border-radius: 10px;
  text-align: center;
}

.feature-locked-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.feature-locked .helper-text {
  margin: 0;
}

/* Admin's tick box in a lockable card's heading. */
.feature-lock-toggle {
  display: inline-flex;
  flex-direction: row;
  font-family: system-ui, sans-serif;
  letter-spacing: 0;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.7rem;
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-faint);
  vertical-align: middle;
  cursor: pointer;
}

.feature-lock-toggle input {
  margin: 0;
}

/* Server sync tab (admins). */
.server-sync-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.server-sync-head h2 { margin: 0; }
.server-sync-scroll { overflow-x: auto; }
table.server-sync-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 0.86rem; margin: 0.5rem 0; }
.server-sync-table th, .server-sync-table td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; font-variant-numeric: tabular-nums; }
.server-sync-table th { color: var(--text-muted); font-weight: 600; }
.server-sync-group td { font-weight: 700; color: var(--text-muted); font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; padding-top: 0.8rem; }
.server-sync-count { display: block; color: var(--text-faint); font-size: 0.76rem; }
.server-sync-pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.sync-same { background: color-mix(in srgb, var(--macro-up) 16%, transparent); color: var(--macro-up); }
.sync-ahead { background: color-mix(in srgb, var(--macro-down) 16%, transparent); color: var(--macro-down); }
.sync-behind { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.server-sync-note, .server-sync-summary { margin: 0.6rem 0; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--bg-panel); font-size: 0.9rem; }
.server-sync-h3 { margin: 1.2rem 0 0.2rem; font-size: 1rem; }
.server-sync-files { margin: 0.5rem 0; }
.server-sync-files summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }

/* Compare Pro: text and the Risk Meter at the size the other tabs use
   (user, 2026-11-13: "font size is big compared to other tabs"). Table
   cells and the holdings tree had the browser's 16px default. */
#compareproTabPanel td { font-size: 0.85rem; }
#compareproTabPanel .comparo-tree-root-node,
#compareproTabPanel .comparo-tree-branch-head { font-size: 0.85rem; }
#compareproTabPanel .comparo-tree-leaf { font-size: 0.8rem; }
#compareproTabPanel .comparo-tree-fund h3 { font-size: 0.92rem; }
#compareproTabPanel .controls-card label > span { font-size: 0.85rem; }

/* Up to four gauges on one row, each under a short fund name that is cut
   with "…" when it does not fit (the full name shows on hover). */
.risk-meter-fund-row--compact { gap: 0.8rem; }
.risk-meter-fund-row--compact .risk-gauge-block { min-width: 0; width: 10.5rem; }
.risk-meter-fund-row--compact .risk-gauge-svg { width: 150px; }
.risk-meter-fund-row--compact .risk-gauge-fund-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: -0.2rem;
}
.risk-meter-fund-row--compact .risk-fit { font-size: 0.68rem; white-space: normal; text-align: center; }

/* Compare Pro: Portfolio Overlap matrix (2026-11-14). */
.comparo-overlap-scroll { overflow-x: auto; margin: 0.6rem 0; }
/* At least 540px wide: on a phone the grid scrolls sideways inside its
   box rather than breaking fund names mid-word. */
table.comparo-overlap-table { width: 100%; min-width: 540px; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.comparo-overlap-table th { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); text-align: center; vertical-align: bottom; padding: 0.3rem; overflow-wrap: break-word; text-transform: none; letter-spacing: normal; }
.comparo-overlap-table th[scope="row"] { text-align: left; vertical-align: middle; width: 22%; }
.comparo-overlap-table td { text-align: center; vertical-align: middle; padding: 0.45rem 0.3rem; border-radius: 8px; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.comparo-overlap-cell { background: color-mix(in srgb, var(--accent) var(--overlap), var(--bg-panel)); }
.comparo-overlap-self { background: var(--bg-panel); color: var(--text-faint); font-size: 0.74rem !important; line-height: 1.35; }
.comparo-overlap-vals { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; font-weight: 700; color: var(--text-primary); }
.comparo-overlap-main { font-size: 1rem; }
.comparo-overlap-count { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-top: 0.2rem; }
.comparo-overlap-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-right: 0.3rem; vertical-align: 0.05rem; flex-shrink: 0; }
.comparo-overlap-details { margin-top: 0.4rem; }
.comparo-overlap-details summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.comparo-overlap-pair { margin: 0.7rem 0; }
.comparo-overlap-pair-head { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.3rem; }
.comparo-overlap-pair-head .comparo-overlap-count { display: inline; margin-left: 0.4rem; }
table.comparo-overlap-common { width: 100%; min-width: 0; border-collapse: collapse; font-size: 0.8rem; }
.comparo-overlap-common th, .comparo-overlap-common td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border-soft); text-align: right; font-variant-numeric: tabular-nums; }
.comparo-overlap-common th:first-child, .comparo-overlap-common td:first-child { text-align: left; }

/* Compare Pro: risk-adjusted table inside Return & Risk Ranking. */
.comparo-rr-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.comparo-rr-title { margin: 0; font-size: 0.95rem; }
.comparo-rr-periods { display: flex; gap: 0.3rem; }
#comparoRiskAdjusted { position: relative; }

