/* ------------------------------------------------------------------
   Cellar.Screen — CAN SLIM dashboard
   Concept: A dim-room trading terminal. Cool slate surfaces, mint
   accent for the "go" signal, amber for caution, no decoration.
------------------------------------------------------------------ */

:root,
[data-theme='light'] {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e8ebee;
  --border: #dde1e5;
  --border-strong: #c8cdd2;
  --text: #0d1216;
  --text-muted: #5a6470;
  --text-faint: #97a0aa;
  --accent: #0a8f6c;
  --accent-soft: #d6efe5;
  --warn: #b6700f;
  --warn-soft: #f3e3c5;
  --danger: #c0394a;
  --danger-soft: #f3d3d8;
  --pos: #097852;
  --neg: #b13242;
  --grid: rgba(15, 23, 30, 0.06);
  --shadow-sm: 0 1px 2px rgba(8, 14, 22, 0.04);
  --shadow-md: 0 6px 22px -10px rgba(8, 14, 22, 0.18);
}

[data-theme='dark'] {
  --bg: #0a0d10;
  --surface: #11151a;
  --surface-2: #161b21;
  --surface-3: #1d2329;
  --border: #232a31;
  --border-strong: #2f3942;
  --text: #e6ebef;
  --text-muted: #8d97a3;
  --text-faint: #5a6470;
  --accent: #2dd4a4;
  --accent-soft: rgba(45, 212, 164, 0.14);
  --warn: #f1b34b;
  --warn-soft: rgba(241, 179, 75, 0.16);
  --danger: #ef6f7d;
  --danger-soft: rgba(239, 111, 125, 0.16);
  --pos: #2dd4a4;
  --neg: #ef6f7d;
  --grid: rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 18px 40px -22px rgba(0, 0, 0, 0.7);
}

:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.18vw, 0.825rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.2vw, 0.95rem);
  --text-base: 1rem;
  --text-md: clamp(1.05rem, 1rem + 0.25vw, 1.18rem);
  --text-lg: clamp(1.25rem, 1.05rem + 0.65vw, 1.55rem);
  --text-xl: clamp(1.65rem, 1.2rem + 1.4vw, 2.35rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-body: 'Satoshi', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  font-feature-settings: 'ss01' on, 'cv11' on;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
}

input,
select {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

.tabular {
  font-variant-numeric: tabular-nums lining-nums;
  font-family: var(--font-mono);
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
}

.logo {
  width: 28px;
  height: 28px;
  color: var(--text);
}

.brand-text {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: var(--text-sm);
}

.brand-mark {
  color: var(--accent);
}

.brand-sub {
  margin-left: var(--space-2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  vertical-align: middle;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.meta-pill {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.meta-pill.spy.pos {
  color: var(--pos);
  border-color: color-mix(in oklab, var(--pos) 35%, var(--border));
}
.meta-pill.spy.neg {
  color: var(--neg);
  border-color: color-mix(in oklab, var(--neg) 35%, var(--border));
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 160ms ease;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------------- Main ---------------- */
.main {
  max-width: 1480px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

/* ---------------- Hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--space-10);
  align-items: end;
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-8);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.hero h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  text-wrap: balance;
  margin-bottom: var(--space-4);
  max-width: 18ch;
}

.dek {
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 56ch;
}

.hero-criteria {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.criterion {
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
}
.criterion:last-child {
  border-right: 0;
}

.c-letter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
}

.c-name {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
}
.c-rule {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .hero-criteria {
    grid-template-columns: repeat(2, 1fr);
  }
  .criterion {
    border-bottom: 1px solid var(--border);
  }
  .criterion:nth-child(odd) {
    border-right: 1px solid var(--border);
  }
  .criterion:nth-child(even) {
    border-right: 0;
  }
  .criterion:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  /* Only span both columns when the criterion is the orphan on an odd-count grid */
  .criterion:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 0;
  }
  /* For even counts (e.g. momentum with 4), undo the previous "last-child spans 2" rule */
  .criterion:last-child:nth-child(even) {
    grid-column: auto;
    border-right: 0;
    border-bottom: 0;
  }
}

/* ---------------- KPI row ---------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: border-color 160ms ease;
}
.kpi:hover {
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.kpi-value.accent {
  color: var(--accent);
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------------- Filters ---------------- */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.filter-group label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.filter-group select,
.filter-group input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
  transition: border-color 160ms ease;
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 999px);
  background: var(--surface-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: 160ms ease;
  user-select: none;
}
.toggle input {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
  margin: 0;
  transition: 160ms ease;
}
.toggle input:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.toggle:has(input:checked) {
  color: var(--text);
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  background: color-mix(in oklab, var(--accent-soft) 80%, var(--surface-2));
}

.reset {
  margin-left: auto;
  padding: 6px 12px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.reset:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------------- Table ---------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.table-head h2 {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-full, 999px);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.export-btn {
  padding: 8px 14px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.table-scroll {
  max-height: calc(100dvh - 160px);
  overflow: auto;
  overscroll-behavior: contain;
}

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

thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--border);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 160ms ease;
}
th:hover {
  color: var(--text);
}
th.num {
  text-align: right;
}
th[data-sort].active {
  color: var(--accent);
}
th[data-sort].active::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  margin-left: 6px;
}
th[data-sort].active.asc::after {
  border-bottom: 5px solid var(--accent);
}
th[data-sort].active.desc::after {
  border-top: 5px solid var(--accent);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
tbody tr:hover {
  background: var(--surface-2);
}
tbody tr:last-child {
  border-bottom: 0;
}

td {
  padding: 12px 14px;
  font-size: var(--text-sm);
  vertical-align: middle;
  white-space: nowrap;
}
td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ticker {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.ticker-sym {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.ticker-idx {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  background: var(--surface);
  text-transform: uppercase;
}

.company-name {
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* Yahoo Finance ticker + company links */
.ticker-link,
.company-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border-radius: 3px;
  transition: color 140ms ease, background-color 140ms ease;
}
.ticker-link:hover,
.ticker-link:focus-visible {
  color: var(--accent);
  outline: none;
}
.ticker-link:hover .ticker-sym,
.ticker-link:focus-visible .ticker-sym {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.company-link:hover .company-name,
.company-link:focus-visible .company-name {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.canslim-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
}
.canslim-dots {
  display: inline-flex;
  gap: 3px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 200ms ease;
}
.dot.on {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.dot.eps.on {
  background: var(--accent);
}
.dot.sales.on {
  background: var(--accent);
}
.dot.roe.on {
  background: var(--accent);
}
.dot.high.on {
  background: var(--accent);
}
.dot.rs.on {
  background: var(--accent);
}

.canslim-count {
  color: var(--text);
  font-weight: 600;
  font-size: 0.78rem;
}

.pos {
  color: var(--pos);
}
.neg {
  color: var(--neg);
}
.muted {
  color: var(--text-faint);
}

.rs-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.rs-bar {
  position: relative;
  width: 36px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.rs-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 3px;
}
.rs-bar.weak .rs-bar-fill {
  background: var(--text-faint);
}
.rs-bar.mid .rs-bar-fill {
  background: var(--warn);
}
.rs-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 26px;
}

.spark-col {
  width: 110px;
}
.spark {
  display: block;
  width: 96px;
  height: 28px;
}
.spark path.area {
  fill: var(--accent);
  fill-opacity: 0.12;
}
.spark path.line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.spark.neg path.area {
  fill: var(--neg);
  fill-opacity: 0.1;
}
.spark.neg path.line {
  stroke: var(--neg);
}

.empty {
  padding: var(--space-8);
  text-align: center;
  color: var(--text-muted);
}
.empty.hidden {
  display: none;
}
.link {
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.legend {
  margin-top: var(--space-8);
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.legend h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.legend ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.legend li {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}
.legend li strong {
  color: var(--text);
}
.footer-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .hide-md {
    display: none;
  }
  .table-head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .main {
    padding: var(--space-5) var(--space-3) var(--space-8);
  }
  /* Hero h1 a touch smaller */
  .hero .lede {
    font-size: 1.85rem;
    line-height: 1.1;
  }
  /* KPI grid: clean 2-col, expand last orphan to full width */
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }
  .kpis .kpi {
    padding: var(--space-3);
  }
  .kpis .kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  /* Filters: comfortable single column with the filter chips wrapping cleanly */
  .filters {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  /* Tab bar: extra padding so the last tab isn't flush against edge */
  .tabs {
    padding-right: var(--space-6);
  }
  /* Tables: visible scroll affordance + sticky first column for context */
  .table-scroll {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: inset -12px 0 12px -12px rgba(0,0,0,0.18);
  }
  /* Table header gets a subtle hint that it scrolls horizontally */
  .table-head h2::after {
    content: ' →';
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.75em;
    margin-left: 6px;
    opacity: 0.6;
  }
  /* Footer: stack lines, keep readable */
  .site-footer, footer {
    text-align: center;
    font-size: 11px;
  }
  /* Stacked topbar: brand row on top, meta row below */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }
  .topbar > .brand {
    width: 100%;
    justify-content: flex-start;
    gap: var(--space-2);
  }
  .topbar-meta {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .topbar-meta::-webkit-scrollbar { display: none; }
  .topbar-meta .meta-pill {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 3px 8px;
  }
  .topbar-meta .theme-toggle {
    margin-left: auto;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
  }
}

/* ============================================================
   The Lehman Screener — multi-tab additions
   ============================================================ */

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-4) var(--space-3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  margin-bottom: -1px;
  position: relative;
}
.tab .tab-label {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab .tab-sub {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 400;
}
.tab:hover {
  color: var(--text);
}
.tab:hover .tab-sub {
  color: var(--text-muted);
}
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab.active .tab-label {
  color: var(--text);
}
.tab.active .tab-sub {
  color: var(--accent);
}
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 4px;
}

.pane.hidden {
  display: none;
}

/* ---------- Filings cell (EDGAR links) ---------- */
.filings-col {
  width: 110px;
  min-width: 110px;
}
.filings-cell {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}
.filing-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.12s ease;
  line-height: 1.2;
}
.filing-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.filing-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Momentum: MA stack indicator ---------- */
.ma-stack {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--font-mono);
}
.ma-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px;
  letter-spacing: 0.02em;
}
.ma-dot.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.ma-dot.off {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
.ma-dot.na {
  opacity: 0.5;
}

/* ---------- accent-num (highlighted numeric, e.g. P/E) ---------- */
.accent-num {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Value/momentum tables refinements ---------- */
#value-table td, #momentum-table td {
  vertical-align: middle;
}

/* ---------- Global footer (below all panes) ---------- */
.footer-meta.global-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: var(--text-xs);
  text-align: center;
}

/* ---------- Brand-mark spacing tweak (since name now has space) ---------- */
.brand-mark {
  display: inline-block;
  width: 0;
}

/* Mobile: keep tabs scrollable, hide filings sub-text on tightest widths */
@media (max-width: 720px) {
  .tabs {
    padding: 0 var(--space-3);
  }
  .tab {
    padding: var(--space-2) var(--space-3);
  }
  .filings-col {
    width: auto;
    min-width: 88px;
  }
  .filing-link {
    padding: 2px 5px;
    font-size: 10px;
  }
}

/* ============================================================
   JLL logo + brand title spacing + Catch the Wave tag
   ============================================================ */
.logo-jll {
  width: 56px;
  height: 32px;
  flex-shrink: 0;
}
.logo-jll .logo-text {
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 22px;
  fill: var(--text);
  letter-spacing: 0.06em;
}
[data-theme='dark'] .logo-jll .logo-text {
  fill: var(--text);
}

/* Brand title with explicit gap between "The Lehman" and "Screener" */
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-title {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.005em;
  color: var(--text);
}
.brand-title .brand-gap {
  display: inline-block;
  width: 0.55em;
}
.brand-title .brand-name,
.brand-title .brand-screener {
  white-space: nowrap;
}

/* Tagline under title */
.brand-tag {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}

/* Sub-line (active screen indicator) sits below the tag */
.brand-text .brand-sub {
  margin-top: 1px;
}

@media (max-width: 720px) {
  .logo-jll {
    width: 40px;
    height: 24px;
  }
  .logo-jll .logo-text {
    font-size: 17px;
  }
  .brand-text {
    min-width: 0;
    flex: 1 1 auto;
  }
  .brand-title {
    font-size: 15px;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .brand-title .brand-gap {
    width: 0.3em;
  }
  .brand-tag {
    font-size: 10px;
    letter-spacing: 0.08em;
    margin-top: 1px;
  }
  /* Hide the duplicate "CAN SLIM · Value · Momentum" chip on mobile
     — the tab bar directly below already conveys this. */
  .brand-text .brand-sub {
    display: none;
  }
}
