/* Extracted from the private app's styles.css (tokens, base, screener).
   Regenerate with the same filter rather than hand-syncing. */
:root {
  /* Surfaces */
  --bg:           #EFE7D8;     /* warm cream — page bg */
  --bg-elev-1:    #FFFFFF;     /* white card */
  --bg-elev-2:    #E5DDC9;     /* secondary surface (hovers, alt rows) */
  --bg-elev-3:    #D3C2CD;     /* Lilac Grey — profile-head feature card */
  --border:       #C9C0AB;
  --border-soft:  #DDD5C2;
  --border-strong:#2B2B23;     /* Night Forest — strong outlines on inputs / chips */

  /* Text */
  --text:         #2B2B23;     /* Night Forest body text */
  --text-muted:   #7A7263;     /* warm muted */
  --text-strong:  #1A1A18;

  /* Brand colours — straight from the mood board */
  --c-cream:        #EFE7D8;
  --c-night-forest: #2B2B23;
  --c-lilac:        #FFFFFF;
  --c-good-surf:    #92A2A6;
  --c-pink:         #F8CABA;   /* Brink of Pink */
  --c-pea:          #6777B6;   /* Pea Flower — primary brand action */
  --c-butter:       #EFCE7B;
  --c-orange:       #E1903E;   /* Florida Oranges */
  --c-poppy:        #D8560E;
  --c-spring:       #197114;   /* Spring Leaves — deep olive up-green (darkened from #849E15 for better contrast on cream bg) */
  --c-pistachio:    #CBD183;
  --c-gold:         #B28622;   /* Gold Velvet */
  --c-berry:        #D17089;   /* Dusty Berry */

  /* Semantic-role tokens — re-pointed at the new palette via var(). */
  --c-sage:         var(--c-lilac);   /* feature panel (profile-head): Lilac Grey */
  --c-sage-soft:    #E1D4DA;          /* lighter lilac */
  --c-sage-deep:    var(--c-spring);  /* up / positive */
  --c-yellow:       var(--c-butter);
  --c-yellow-soft:  #F8E0AA;
  --c-black:        var(--c-pea);     /* primary button + bottom-nav surface */
  --c-coral:        var(--c-poppy);   /* down / negative / error */
  --c-price-line:   var(--c-pea);     /* price chart line */

  /* Semantic roles */
  --accent:       var(--c-black);     /* primary buttons + chart bars */
  --accent-fg:    #FFFFFF;
  --danger:       var(--c-coral);
  --success:      var(--c-sage-deep);

  /* Typography. Archivo Black for heavy display headings, Inter for body.
     Both load from Google Fonts (see base.html). System fallbacks keep the
     site usable if the network blocks Google. */
  --font-display: "Archivo Black", "Inter", -apple-system, BlinkMacSystemFont,
                  "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
                  "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo,
                  Consolas, monospace;
  --fs-base:      16px;
  --fs-sm:        14px;
  --fs-lg:        18px;
  --fs-xl:        22px;
  --fs-h1:        28px;
  --fs-display:   42px;

  /* Spacing scale (multiples of 4px) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* Geometry */
  --radius:       16px;
  --radius-sm:    10px;
  --radius-lg:    24px;
  --radius-pill:  999px;
  --max-w:        760px;
  --max-w-wide:   1400px;

  /* Shadows — much subtler than the dark theme to suit the cream background. */
  --shadow-1:     0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-2:     0 2px 4px rgba(0,0,0,0.06), 0 12px 28px rgba(0,0,0,0.08);

  /* Animation */
  --t-fast: 120ms;
  --t-med:  220ms;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";  /* Inter alternates, harmless if absent */
  /* Stop iOS Safari from auto-zooming when an input gets focus.
     Inputs must be at least 16px font-size for this to work. */
  -webkit-text-size-adjust: 100%;
}
h1 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-weight: 400;     /* Archivo Black is already extra-bold */
  line-height: 1.0;
  color: var(--text-strong);
}
h2,
h3 {
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--text-strong);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input,
button {
  font-size: 16px;     /* see iOS auto-zoom note above */
}
.muted { color: var(--text-muted); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--bg-elev-1);
  color: var(--text);
  font-weight: 500;
  /* Keep button text on a single line — "Add asset" was breaking across
     two lines when squeezed inside a narrow grid track. */
  white-space: nowrap;
  /* `<a class="btn">` shouldn't underline — base `a:hover` rule does. */
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  min-height: 44px;          /* iOS recommended tap target */
}
.btn:hover { background: var(--bg-elev-2); border-color: var(--border); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 92%, #000);
  border-color: color-mix(in srgb, var(--accent) 92%, #000);
  color: var(--accent-fg);
}
[data-theme="dark"] .btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 92%, #fff);
  border-color: color-mix(in srgb, var(--accent) 92%, #fff);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.app-header-actions-list .btn {
  padding: var(--sp-2) var(--sp-3);
  font-size: 14px;
  min-height: 36px;
  white-space: nowrap;
}
.app-header-actions-list .btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-strong);
  font-weight: 500;
}
.app-header-actions-list .btn-ghost:hover {
  background: transparent;          /* no chip on hover */
  color: var(--text-muted);          /* just dim the text */
}
.app-header-actions-list .btn {
  width: 100%;
  justify-content: flex-start;
  padding: var(--sp-3) var(--sp-4);
  min-height: 44px;
  font-size: var(--fs-base);
}
body.privacy-mode .progress-readout {
  filter: blur(8px);
}
[data-theme="dark"] .filter-active.filter-neutral {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--text);
}
[data-theme="dark"] .filter-active.filter-neutral .filter-check {
  border-color: var(--text);
}
[data-theme="dark"] .filter-active.filter-neutral.on .filter-check {
  background: var(--text);
}
[data-theme="dark"] .filter-active.filter-neutral.on .filter-check::after {
  border-color: var(--bg);
}
[data-theme="dark"] .filter-active.filter-sort {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--text);
}
.profile-head .muted { color: var(--text-muted); }
[data-theme="dark"] .price-canvas-wrap { background: var(--bg-elev-2); }
.stat-delta.muted { color: var(--text-muted); }
.btn.btn-xs {
  font-size: 11px;
  padding: 3px 8px;
  letter-spacing: 0.02em;
}
.btn.danger {
  /* Visually subtle until hover; hard "no going back" colour on hover so
     users get a beat to reconsider before clicking through. */
  color: var(--c-poppy, #D8560E);
}
.btn.danger:hover {
  background: var(--c-poppy, #D8560E);
  color: #fff;
}
@media (min-width: 768px) {
:root { --fs-base: 16px; }
}
[data-theme="dark"] {
  /* Surfaces — Night Forest base, slightly lifted card surfaces. */
  --bg:           #161610;        /* Night Forest */
  --bg-elev-1:    #3A3A30;        /* card */
  --bg-elev-2:    #45453A;        /* secondary surface */
  --bg-elev-3:    #6A5C68;        /* darker lilac for profile-head card */
  --border-strong:#E5DDC9;        /* cream outlines on inputs / chips */

  /* Text */
  --text:         #E5DDC9;        /* warm cream on dark */
  --text-muted:   #B0A98F;
  --text-strong:  #FFFFFF;
  --border:       rgba(255,255,255,0.10);

  /* Brand colours — lifted variants of the mood-board hues for dark surfaces */
  --c-cream:        #3A3A30;
  --c-night-forest: #2B2B23;
  --c-lilac:        #B5A3B0;
  --c-good-surf:    #B0BEC1;
  --c-pink:         #C9967F;       /* dustier pink for dark */
  --c-pea:          #8E9DD0;       /* lifted Pea Flower */
  --c-butter:       #D4B05A;       /* slightly desaturated butter */
  --c-orange:       #E8A04E;
  --c-poppy:        #E8742C;       /* slightly less aggressive on dark */
  --c-spring:       #A8BD3F;       /* lifted olive for visibility */
  --c-pistachio:    #B7BD66;
  --c-gold:         #C49A38;
  --c-berry:        #D88298;

  /* Semantic-role tokens — same names, dark-tuned values. */
  --c-sage:         var(--c-pink);
  --c-sage-soft:    #5A4642;
  --c-sage-deep:    var(--c-spring);
  --c-yellow:       var(--c-butter);
  --c-yellow-soft:  #5C4A1F;
  --c-black:        var(--c-pea);   /* primary button = lifted Pea Flower */
  --c-coral:        var(--c-poppy);
  --c-price-line:   var(--c-pea);

  /* Semantic roles */
  --accent:         var(--c-black);
  --accent-fg:      #FFFFFF;
  --danger:         var(--c-coral);
  --success:        var(--c-sage-deep);

  /* Shadows — slightly more pronounced on dark */
  --shadow-1:     0 1px 2px rgba(0,0,0,0.30), 0 6px 18px rgba(0,0,0,0.35);
  --shadow-2:     0 2px 4px rgba(0,0,0,0.40), 0 14px 32px rgba(0,0,0,0.45);
}
[data-theme="dark"] .auth-error {
  background: color-mix(in srgb, var(--danger) 22%, var(--bg-elev-1));
}
[data-theme="dark"] .app-header-icon-btn:hover,
[data-theme="dark"] .app-header-menu-toggle:hover {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .btn-ghost:hover { background: rgba(255,255,255,0.06); }
body:not(.portfolio-tax-enabled) .portfolio-main { max-width: 1870px; }
.portfolio-table tfoot .portfolio-totals .col-unrealised-return.muted,
.portfolio-table tfoot .portfolio-totals .col-total-return.muted { color: var(--text-muted); }
body:not(.portfolio-tax-enabled) .portfolio-closed-divider,
body:not(.portfolio-tax-enabled) .portfolio-row-closed,
body:not(.portfolio-tax-enabled) .portfolio-table tfoot .portfolio-totals-tr,
body:not(.portfolio-tax-enabled) .portfolio-table tfoot .portfolio-totals-alltime {
  display: none !important;
}
.history-hint.muted { color: var(--text-muted); }
.history-popover-amount.muted { color: var(--text-muted); }
body.privacy-mode .history-hint,
body.privacy-mode .history-popover { filter: blur(8px); }
body.privacy-mode .history-hint { pointer-events: none; }
.portfolio-table .col-unrealised-return.muted,
.portfolio-table .col-total-return.muted { color: var(--text-muted); }
@media (min-width: 1100px) {
body.portfolio-tax-enabled .portfolio-table .col-realised-return,
body.portfolio-tax-enabled .portfolio-table .col-avg-cost,
body.portfolio-tax-enabled .portfolio-table .col-total-return {
    display: table-cell;
  }
}
.portfolio-table .col-today.muted { color: var(--text-muted); }
body.portfolio-loading .portfolio-summary {
  opacity: 0.65;
  transition: opacity 120ms ease-out;
}
@media (max-width: 1099px) {
.wealth-form .admin-user-form-actions .btn {
    /* Equal-share row: when only Add asset is shown (default state)
       it becomes a comfortable full-width primary button; when Cancel
       is revealed (edit mode) the two sit side-by-side at 50% each.
       min-width: 0 lets them shrink below their content's intrinsic
       width on very narrow cards. */
    flex: 1 1 0;
    min-width: 0;
  }
}
.wealth-item-actions .btn {
  min-height: 0;
  padding: 2px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.wealth-item-actions .btn:hover {
  background: transparent;
  border-color: transparent;
  color: var(--text-strong);
}
.wealth-item-actions .btn.danger {
  color: color-mix(in srgb, var(--c-poppy, #D8560E) 70%, var(--text-muted));
}
.wealth-item-actions .btn.danger:hover {
  background: transparent;
  color: var(--c-poppy, #D8560E);
}
body.privacy-mode .portfolio-total,
body.privacy-mode .portfolio-daily-change,
body.privacy-mode .portfolio-value,
body.privacy-mode .portfolio-shares,
body.privacy-mode .portfolio-cost-basis,
body.privacy-mode .portfolio-realised-return,
/* Today + Unrealised + Total return cells in both body and footer
   (dropping the tbody qualifier picks up tfoot too — thead has <th> not
   <td> so the :not(.muted) on td is the right exclusion to keep headers
   sharp). */
body.privacy-mode .portfolio-table td.col-today:not(.muted),
body.privacy-mode .portfolio-table td.col-unrealised-return:not(.muted),
body.privacy-mode .portfolio-table td.col-total-return:not(.muted) {
  filter: blur(8px);
}
body.privacy-mode .portfolio-shares,
body.privacy-mode .portfolio-cost-basis,
body.privacy-mode .portfolio-realised-return { pointer-events: none; }
body:has(.bottom-nav) .app-main {
  padding-bottom: calc(var(--sp-7) + var(--sp-4) + env(safe-area-inset-bottom));
}
@media (hover: none) {
.btn:hover {
    background: var(--bg-elev-1);
    border-color: transparent;
  }
.btn-ghost:hover {
    color: var(--text-muted);
    background: transparent;
  }
.app-header-actions-list .btn-ghost:hover {
    background: transparent;
    color: var(--text-strong);
  }
.btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
  }
[data-theme="dark"] .app-header-menu-toggle:hover { background: transparent; }
[data-theme="dark"] .btn-ghost:hover { background: transparent; }
[data-theme="dark"] .price-range-toggles button:hover { background: var(--bg-elev-2); }
a:hover { text-decoration: none; }
}
body.has-banner {
  /* Shift every page's content down by the banner's height so the
     fixed banner doesn't cover the header or first row of content. */
  padding-top: var(--banner-height, 2.5rem);
}
body.has-banner .app-progress {
  top: var(--banner-height, 2.5rem);
}
[data-theme="dark"] .app-progress { background: var(--c-butter); }
.etf-table td.muted {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 768px) {
.etf-table td.muted { max-width: none; white-space: normal; }
}
.compare-pill-group {
  display: inline-flex;
  background: var(--bg-elev-1);
  border-radius: var(--radius);
  padding: 4px;
  gap: 2px;
}
.compare-pill-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font: 600 13px/1 var(--font-sans);
  padding: 8px 14px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.12s, color 0.12s;
}
.compare-pill-btn:hover { color: var(--text-strong); }
.compare-pill-btn.is-active {
  background: var(--bg-elev-2);
  color: var(--text-strong);
}
.compare-pill-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.compare-shade-g3 { background: color-mix(in srgb, var(--c-spring) 28%, transparent); }
.compare-shade-g2 { background: color-mix(in srgb, var(--c-spring) 18%, transparent); }
.compare-shade-g1 { background: color-mix(in srgb, var(--c-spring) 10%, transparent); }
.compare-shade-r1 { background: color-mix(in srgb, var(--danger)  12%, transparent); }
.compare-shade-r2 { background: color-mix(in srgb, var(--danger)  26%, transparent); }
body.has-overflow-subnav .page-subnav {
  display: none !important;
}
@media (min-width: 769px) {
body.has-overflow-subnav .app-header-menu-toggle {
    display: inline-flex !important;
  }
body.has-overflow-subnav .app-header-actions[data-menu-open="true"] .app-header-actions-list {
    display: flex !important;
  }
}
.screener-main {
  /* Wide, so zooming out shows more of the table's columns, but capped so
     ultrawide screens don't stretch it edge to edge. */
  max-width: 2500px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: calc(100vh - 200px);
}
.screener-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
@media (max-width: 768px) {
.screener-controls { gap: var(--sp-2); }
}
.screener-status { font-size: var(--fs-sm); min-height: 1.2em; }
.screener-status:empty { visibility: hidden; }
.screener-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 8px 0 14px 0;
  font-size: var(--fs-sm);
}
.screener-filters:empty { display: none; }
.screener-filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 2px;
}
.screener-sector-caret {
  font-size: 10px;
  opacity: 0.6;
  margin-left: 2px;
}
.screener-sector-clear {
  font-size: 11px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.screener-sector-clear:not(:disabled):hover { color: var(--text); background: var(--bg-elev-2); }
.screener-sector-clear:disabled { opacity: 0.4; cursor: default; }
.screener-sector-chip-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.screener-sector-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.screener-sector-chip:hover { background: var(--bg-elev-2); }
.screener-sector-chip input { margin: 0; accent-color: var(--accent, var(--text)); }
.screener-sector-chip-name { flex: 1; }
.screener-sector-chip-count {
  font-size: 11px;
  opacity: 0.55;
  font-weight: 600;
}
.screener-sector-chip.is-checked { background: var(--bg-elev-2); }
.screener-sector-chip.is-checked .screener-sector-chip-name { font-weight: 600; }
.screener-clear-filters-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 4px 12px;
  font-size: 12px;
  background: var(--accent, var(--text));
  color: var(--bg);
  border: 1px solid var(--accent, var(--text));
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.screener-clear-filters-btn:hover { filter: brightness(0.92); }
.screener-empty {
  padding: var(--sp-6);
  text-align: center;
  background: var(--bg-elev-1);
  border-radius: var(--radius);
}
.screener-td-similarity,
.screener-th[data-sort="similarity"] {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
}
.screener-th-remove,
.screener-td-remove {
  width: 72px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}
.screener-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .12s, color .12s, background .12s;
}
.screener-tr:hover .screener-remove-btn { opacity: 0.7; }
.screener-remove-btn:hover {
  opacity: 1 !important;
  color: var(--danger, #c0392b);
  background: var(--bg-elev-2);
}
.screener-remove-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.screener-remove-btn:disabled {
  cursor: wait;
  opacity: 0.3 !important;
}
.screener-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  background: var(--bg-elev-1);
}
.screener-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.screener-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-elev-1);
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid color-mix(in srgb, var(--text-strong) 10%, transparent);
  white-space: nowrap;
}
.screener-table thead th.screener-th-metric { text-align: center; }
.screener-table thead th.is-sorted { color: var(--text-strong); }
.screener-table thead th:hover { color: var(--text-strong); }
.screener-table thead th[data-sort="score"] {
  text-align: center;
  background: var(--bg-elev-2);
}
.screener-td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid color-mix(in srgb, var(--text-strong) 3%, transparent);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.screener-td-metric { text-align: center; }
.screener-td-ticker { font-family: var(--font-display); font-weight: 700; }
.screener-td-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screener-td-sector { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screener-td-score {
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}
.screener-tr {
  cursor: pointer;
  transition: background 0.08s;
}
.screener-tr:hover .screener-td:not([class*="compare-shade-"]) {
  background: color-mix(in srgb, var(--text-strong) 3%, transparent);
}
@media (max-width: 600px) {
.screener-table { font-size: 12px; }
.screener-td,
.screener-table thead th {
    padding: var(--sp-2);
  }
.screener-td-name,
.screener-table thead th[data-sort="name"],
.screener-td-sector,
.screener-table thead th[data-sort="sector"] {
    display: none;
  }
}
.portfolio-pmp-fy-table tbody td.muted { color: var(--muted, #888); }
.trajectory-source-pills .compare-pill-btn { padding: 6px 10px; font-size: 12px; }
html.macro-wall-open,
html.macro-wall-open body { overflow: hidden; }
.screener-metric-list { display: flex; flex-direction: column; gap: 4px; }
.screener-metric-row {
  display: grid;
  grid-template-columns: 1fr 72px 72px 26px;
  gap: 6px;
  align-items: center;
  font-size: 12.5px;
}
.screener-metric-row.is-active .screener-metric-name { font-weight: 700; color: var(--text-strong); }
.screener-metric-row input {
  width: 100%;
  padding: 4px 6px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.screener-metric-unit { color: var(--text-muted); font-size: 11px; }
.screener-range-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elev-1);
  color: var(--text-strong);
}
.screener-range-chip button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 4px;
}
.screener-range-chip button:hover { color: var(--text-strong); }
.assets-basis-switch .compare-pill-btn { font-size: 11px; padding: 4px 10px; }
.screener-td-gap-flags { font-size: var(--fs-xs, 12px); white-space: nowrap; }
.screener-td-label { white-space: nowrap; }
.screener-controls { justify-content: flex-start; }
.screener-universe { position: relative; }
.screener-universe-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text-strong);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.screener-universe-btn:hover { border-color: var(--text-muted); }
.screener-universe-name { font-weight: 600; }
.screener-universe-count { color: var(--text-muted); }
.screener-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 280px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.screener-menu[hidden] { display: none; }
.screener-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.screener-menu-item:hover { background: var(--bg-elev-2); }
.screener-menu-item.is-active .screener-menu-name { font-weight: 600; color: var(--text-strong); }
.screener-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.screener-menu-meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.screener-menu-delete { color: var(--text-muted); padding: 0 4px; font-size: 15px; line-height: 1; }
.screener-menu-delete:hover { color: var(--danger); }
.screener-menu-label {
  margin: 8px 10px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.screener-filters[hidden] { display: none; }
.screener-filters:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(220px, 1fr) minmax(320px, 1.4fr);
  gap: 20px;
  align-items: start;
  margin: 0;
  padding: 14px 16px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
@media (max-width: 900px) {
.screener-filters:not([hidden]) { grid-template-columns: 1fr; }
}
.screener-panel-section { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.screener-panel-head { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.screener-panel-metrics .screener-metric-list { max-height: 360px; overflow-y: auto; }
.screener-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.screener-chips:empty { display: none; }
.screener-chips-count { font-size: 12.5px; margin-left: 6px; }
.screener-clear-all { margin-left: auto; }
.screener-views {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.screener-views:empty { display: none; }
.screener-view-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.screener-view-tab {
  padding: 5px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.screener-view-tab:hover { color: var(--text); }
.screener-view-tab.is-active { color: var(--text-strong); background: var(--bg-elev-1); border-color: var(--border); font-weight: 600; }
.screener-panel-compare { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 10px; }
.screener-compare-rule { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-strong); }
.screener-compare-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.screener-compare-form select,
.screener-compare-form input {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.screener-compare-form input { width: 70px; font-family: var(--font-mono); }
.screener-compare-note { font-size: 12px; margin: 0; }
.screener-table .screener-key-col { font-weight: 700; }
.screener-table .screener-key-start { border-left: 2px solid var(--text-strong); }
.screener-table .screener-key-end { border-right: 2px solid var(--text-strong); }
.screener-table thead .screener-key-col { color: var(--text-strong); }
.screener-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  cursor: help;
  vertical-align: 1px;
}
.screener-help:hover,
.screener-help:focus { color: var(--text-strong); border-color: var(--text-strong); outline: none; }
.screener-help-pop {
  display: none;
  position: fixed;
  z-index: 70;
  width: 320px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  white-space: normal;
  color: var(--text);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.screener-help-pop h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--text-strong); }
.screener-help-pop p { margin: 0 0 8px; }
.screener-help-pop ul { margin: 0 0 8px; padding-left: 18px; }
.screener-help-pop li { margin-bottom: 4px; }
.screener-help-pop strong { color: var(--text-strong); }
.screener-help-pop .screener-help-scale { padding: 8px 10px; background: var(--bg-elev-2); border-radius: 8px; }
.screener-help-pop .screener-help-warn { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.screener-help-dialog {
  display: none;
  position: fixed;
  z-index: 80;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 20px 22px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.screener-help-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.screener-help-close:hover { color: var(--text-strong); background: var(--bg-elev-2); }
.screener-help-dialog h4 { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--text-strong); }
.screener-help-dialog p { margin: 0 0 10px; }
.screener-help-dialog strong { color: var(--text-strong); }
.screener-help-dialog .screener-help-scale { padding: 10px 12px; background: var(--bg-elev-2); border-radius: 8px; }
.screener-help-dialog .screener-help-warn { margin: 0; color: var(--text-muted); font-size: 12.5px; }
.screener-help-table { width: 100%; margin: 4px 0 12px; border-collapse: collapse; font-size: 12.5px; }
.screener-help-table th {
  padding: 4px 8px 6px 0;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.screener-help-table td { padding: 5px 8px 5px 0; vertical-align: top; border-bottom: 1px solid var(--border); }
.screener-help-table td:first-child { font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.screener-help-table td:nth-child(2) { color: var(--success, var(--text)); }
.screener-help-table td:nth-child(3) { color: var(--danger, var(--text)); }
.screener-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.screener-quick:empty { display: none; }
.screener-dd { position: relative; }
.screener-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}
.screener-dd-menu[hidden] { display: none; }
.screener-adv-btn { margin-left: auto; }
.screener-filters:not([hidden]) { grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr); }
.screener-panel-compare { grid-column: auto; border-top: none; padding-top: 0; }
@media (max-width: 900px) {
.screener-panel-compare { border-top: 1px solid var(--border); padding-top: 10px; }
}
.screener-td-country { white-space: nowrap; }
.screener-main { --scr-mono: var(--font-mono); --scr-hair: color-mix(in srgb, var(--text-strong) 14%, transparent); }
.screener-universe-btn {
  padding: 6px 12px;
  font-family: var(--scr-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-color: var(--scr-hair);
}
.screener-universe-name { font-weight: 700; }
.screener-status { font-family: var(--scr-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.screener-rescan.compare-pill-btn {
  font-family: var(--scr-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--scr-hair);
}
.screener-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--scr-hair);
  border-bottom: 1px solid var(--scr-hair);
}
.screener-stats:empty { display: none; }
.screener-stat { padding: 14px 18px 12px; }
.screener-stat + .screener-stat { border-left: 1px solid var(--scr-hair); }
.screener-stat-value {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
.screener-stat-value.is-up { color: var(--success); }
.screener-stat-value.is-down { color: var(--danger); }
.screener-stat-label {
  margin-top: 6px;
  font-family: var(--scr-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
@media (max-width: 700px) {
.screener-stat { padding: 12px 10px 10px; }
}
.screener-views { border-bottom: none; padding-bottom: 0; }
.screener-view-tab {
  font-family: var(--scr-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
}
.screener-view-tab.is-active { background: transparent; border-color: var(--text-strong); font-weight: 700; }
.screener-quick {
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--scr-hair);
  border-radius: 8px;
  background: var(--bg-elev-1);
}
.screener-seg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font: inherit;
  font-family: var(--scr-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-strong);
  background: transparent;
  border: none;
  border-right: 1px solid var(--scr-hair);
  border-radius: 0;
}
.screener-dd .screener-seg { height: 100%; }
.screener-dd { border-right: 1px solid var(--scr-hair); }
.screener-dd .screener-seg { border-right: none; }
.screener-seg-btn { cursor: pointer; }
.screener-seg-btn:hover { background: var(--bg-elev-2); }
.screener-seg-btn.is-active { background: color-mix(in srgb, var(--text-strong) 6%, transparent); }
.screener-seg-label { color: var(--text-muted); }
.screener-seg-opts { display: inline-flex; gap: 2px; }
.screener-seg-opt {
  padding: 2px 7px;
  font: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.screener-seg-opt:hover { color: var(--text-strong); }
.screener-seg-opt.is-active { color: var(--text-strong); border-color: var(--text-strong); font-weight: 700; }
.screener-adv-btn { margin-left: auto; border-right: none; }
@media (max-width: 700px) {
.screener-seg,
.screener-dd { border-right: none; border-bottom: 1px solid var(--scr-hair); width: 100%; }
.screener-adv-btn { margin-left: 0; }
}
.screener-range-chip {
  font-family: var(--scr-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: transparent;
  border-color: var(--text-strong);
}
.screener-chips-count,
.screener-clear-all {
  font-family: var(--scr-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.screener-table-wrap { background: transparent; border: 1px solid var(--scr-hair); border-radius: 8px; }
.screener-table thead th {
  font-family: var(--scr-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  background: var(--bg);
  border-bottom: 1px solid var(--scr-hair);
}
.screener-table thead th[data-sort="score"] { background: var(--bg); }
.screener-td { border-bottom: 1px solid color-mix(in srgb, var(--text-strong) 7%, transparent); padding-top: 10px; padding-bottom: 10px; }
.screener-td-metric { font-family: var(--scr-mono); font-size: 12.5px; }
.screener-table .screener-td-metric.compare-shade-g3,
.screener-table .screener-td-metric.compare-shade-g2,
.screener-table .screener-td-metric.compare-shade-g1,
.screener-table .screener-td-metric.compare-shade-r1,
.screener-table .screener-td-metric.compare-shade-r2 { background: none; }
.screener-table .screener-td-metric.compare-shade-g3,
.screener-table .screener-td-metric.compare-shade-g2 { color: var(--success); }
.screener-table .screener-td-metric.compare-shade-g1 { color: color-mix(in srgb, var(--success) 65%, var(--text)); }
.screener-table .screener-td-metric.compare-shade-r1 { color: color-mix(in srgb, var(--danger) 70%, var(--text)); }
.screener-table .screener-td-metric.compare-shade-r2 { color: var(--danger); }
.screener-td-country { font-family: var(--scr-mono); font-size: 11.5px; letter-spacing: 0.06em; color: var(--text-muted); }
.screener-table .screener-key-col { background: color-mix(in srgb, var(--text-strong) 3%, transparent); }
.screener-table .screener-key-start { border-left: 1px solid var(--scr-hair); }
.screener-table .screener-key-end { border-right: 1px solid var(--scr-hair); }
.screener-td-score { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.screener-td-score.is-up { color: var(--success); }
.screener-td-score.is-down { color: var(--danger); }
.screener-gap { display: inline-flex; align-items: center; gap: 8px; min-width: 96px; }
.screener-gap-num { font-family: var(--font-sans); font-size: 15px; font-weight: 700; min-width: 22px; text-align: right; }
.screener-gap-bar { flex: 1; height: 4px; background: var(--scr-hair); border-radius: 2px; overflow: hidden; }
.screener-gap-bar span { display: block; height: 100%; border-radius: 2px; }
.screener-gap.is-up .screener-gap-num { color: var(--success); }
.screener-gap.is-up .screener-gap-bar span { background: var(--success); }
.screener-gap.is-down .screener-gap-num { color: var(--text-muted); }
.screener-gap.is-down .screener-gap-bar span { background: var(--text-muted); }
.screener-tag {
  display: inline-block;
  max-width: 190px;
  padding: 2px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  font-family: var(--scr-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-strong);
  border: 1px solid var(--scr-hair);
  border-radius: 999px;
}
.screener-tag-more { font-family: var(--scr-mono); font-size: 10.5px; color: var(--text-muted); }
.screener-warn { font-family: var(--scr-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--c-gold); }
.screener-td-gap-flags { white-space: nowrap; }
.screener-intro { margin-top: -22px; }
.screener-intro-note { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.screener-subtitle {
  margin: 0;
  text-align: left;
  font-family: var(--font-sans);
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-strong);
}
.screener-blank { color: var(--text-muted); cursor: help; border-bottom: 1px dotted var(--text-muted); padding: 0 3px; }
.screener-td-gap-flags { white-space: normal; min-width: 180px; max-width: 240px; }
.screener-warn { display: block; margin: 2px 0; text-transform: none; letter-spacing: normal; }
.screener-warn + .screener-warn { margin-top: 6px; }
.screener-warn-name { display: block; font-family: var(--scr-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; }
.screener-warn-detail { display: block; padding-left: 12px; font-family: var(--font-sans); font-size: 12px; line-height: 1.35; color: var(--text-muted); }
.screener-gap-1y {
  padding: 0 4px;
  font-family: var(--scr-mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 1px solid var(--scr-hair);
  border-radius: 3px;
  cursor: help;
}

