/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fcfcfb;
  --raised: #ffffff;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #8a8984;
  --border: #e7e6e2;
  --grid: #efeeea;
  --hover: #f4f3f0;
  --good: #0a8a0a;
  --bad: #d03b3b;
  --accent: #0b0b0b;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  /* series palette (fixed order, validated for color-vision deficiency) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0e;
    --surface: #1a1a19;
    --raised: #1f1f1e;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --border: #2c2c2a;
    --grid: #262624;
    --hover: #252523;
    --good: #0ca30c;
    --bad: #e66767;
    --accent: #ffffff;
    --accent-ink: #0b0b0b;
    --shadow: none;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
html, body { overflow-x: hidden; } /* last-resort guard against sideways scroll on phones */
.chart-card { min-width: 0; }
.chart-svg { max-width: 100%; }

/* ---------- Header + search ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand svg { width: 22px; height: 22px; fill: none; stroke: var(--good); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8984' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center / 16px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--text-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 8%, transparent); }
#results {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
}
#results li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
#results li b { min-width: 56px; }
#results li span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results li[aria-selected="true"], #results li:hover { background: var(--hover); }

/* ---------- Landing ---------- */
/* On the landing page the header dissolves so the search sits under the headline. */
.intro, .suggest { display: none; }
body.landing .top { display: contents; }
body.landing .brand { order: 1; align-self: flex-start; padding: 16px 24px; }
body.landing .intro { order: 2; display: block; text-align: center; padding: 11vh 24px 0; }
body.landing .search { order: 3; flex: none; align-self: center; width: min(560px, calc(100% - 32px)); max-width: none; margin: 32px 0 0; }
body.landing .search input { height: 54px; font-size: 17px; padding-left: 46px; background-position: 17px center; background-size: 18px; box-shadow: var(--shadow); }
body.landing .suggest { order: 4; display: flex; }
body.landing .status { order: 5; }
body.landing footer { order: 9; }
.intro h1, .intro p.intro-title { font-size: clamp(30px, 5vw, 48px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 14px; }
.intro p { color: var(--text-2); margin: 0; font-size: 17px; }
/* On a company page the Worker turns the tagline into a <p class="intro-title"> so the page's one
   <h1> is the company's name (#co-head). Same look as the h1, for someone who then goes Home. */
.intro p.intro-title { color: var(--text); font-weight: 700; }
/* The company's name while its chart loads, or when it can't (src/pages.js → companyHeading). */
.co-head { width: 100%; max-width: 1200px; margin: 28px auto 0; padding: 0 28px; text-align: center; }
.co-head h1 { font-size: clamp(22px, 3.2vw, 30px); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
/* .co-summary pulls itself 8px up to sit under the chart card; with no card above it (chart not
   loaded) that would run it into the heading. */
.co-head:not([hidden]) ~ .co-summary { margin-top: 16px; }
.suggest { margin: 18px 16px 0; gap: 8px; justify-content: center; flex-wrap: wrap; }
.suggest a {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 13px;
}
.suggest a:hover { color: var(--text); border-color: var(--text-2); }

/* ---------- Status ---------- */
.status { text-align: center; color: var(--text-2); margin: 24px 16px; }
.status.error { color: var(--bad); }

/* ---------- Main layout ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.company { display: flex; align-items: center; gap: 10px; }
.company h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--text-2); }
.pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--hover); }
/* Share button: sits at the right end of the company header. */
.share-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.share-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.hero { margin: 6px 0 12px; }
.hero-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.hero-label i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.hero-value { font-size: clamp(28px, 4vw, 38px); font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero-change { font-size: 14px; font-weight: 600; min-height: 20px; font-variant-numeric: tabular-nums; }
.hero-change.up { color: var(--good); }
.hero-change.down { color: var(--bad); }

.subhead { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 4px; }

/* ---------- Chart ---------- */
.chart { position: relative; width: 100%; }
.chart-svg { display: block; overflow: visible; touch-action: pan-y; }
.chart-grid line { stroke: var(--grid); stroke-width: 1; }
.chart-grid line.zero { stroke: var(--muted); }
.chart-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-label { fill: var(--text-2); font-size: 12px; font-weight: 500; }
.chart-empty { fill: var(--muted); font-size: 14px; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
/* A calculated point (public/marks.js): a ring in the line's colour instead of a filled dot. */
.chart-dot-hollow { fill: var(--surface); stroke-width: 2; }
/* A period the company reported where a line has no number (public/gaps.js): dotted line + shaded flag. */
.chart-line-gap { stroke-dasharray: 0.1 6; opacity: 0.85; }
/* Calculated, not filed: long dashes — plainly not the round dots of a missing period above. */
.chart-line-calc { stroke-dasharray: 7 5; stroke-linecap: butt; }
.chart-gap { fill: var(--muted); opacity: 0.1; }
.chart-gap-dot { stroke: var(--surface); stroke-width: 1.5; }
.chart-gap-label { fill: var(--muted); font-size: 10.5px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hover-dot { stroke: var(--surface); stroke-width: 2; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  min-width: 180px;
  z-index: 5;
}
.tip-date { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; padding: 1px 0; }
.tip-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip-row span { color: var(--text-2); flex: 1; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-tag { font-style: normal; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
/* Note under the charts: which numbers are ours, not the filing's (public/marks.js). */
.calc-note { font-size: 12px; color: var(--muted); margin: 10px 4px 0; line-height: 1.45; }
.calc-note p { margin: 0 0 4px; }
/* The key: a sample of each kind of line, then one word. */
.calc-note .key { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; white-space: nowrap; }
.calc-note .key svg { width: 26px; height: 8px; flex: none; }
.calc-note .key line { stroke: var(--text-2); stroke-width: 2; }
.calc-note .key .k-calc { stroke-dasharray: 7 5; }
.calc-note .key .k-gap { stroke-dasharray: 0.1 6; stroke-linecap: round; }
.calc-note a, .table-notes a { color: inherit; text-underline-offset: 2px; }
.calc-note a { white-space: nowrap; }
.calc-note a:hover, .table-notes a:hover { color: var(--text); }
#table td.calc { font-style: italic; }
.table-notes { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* ---------- Controls ---------- */
.controls { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--hover); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-quiet { background: transparent; }
.seg-quiet button[aria-pressed="true"] { background: var(--hover); color: var(--text); }

/* Dual range slider */
.range { margin-top: 8px; }
.dual { position: relative; height: 24px; }
.dual-track { position: absolute; left: 9px; right: 9px; top: 10px; height: 4px; border-radius: 4px; background: var(--grid); }
.dual-fill { position: absolute; top: 0; bottom: 0; background: var(--text); border-radius: 4px; }
.dual input {
  position: absolute; inset: 0; width: 100%; margin: 0;
  background: none; pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.dual input::-webkit-slider-runnable-track { background: none; height: 24px; }
.dual input::-moz-range-track { background: none; }
.dual input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; cursor: grab;
  width: 18px; height: 18px; margin-top: 3px; border-radius: 50%;
  background: var(--raised); border: 2px solid var(--text); box-shadow: var(--shadow);
}
.dual input::-moz-range-thumb {
  pointer-events: auto; cursor: grab;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--raised); border: 2px solid var(--text);
}
.dual input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 15%, transparent); }
.dual input:disabled { opacity: .4; }
.range-labels { position: relative; height: 18px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.range-labels span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; font-weight: 600; }

/* Data table */
.table-wrap { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.table-wrap summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
#table { overflow-x: auto; margin-top: 10px; }
#table table { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#table th, #table td { padding: 6px 12px 6px 0; text-align: right; border-bottom: 1px solid var(--grid); }
#table th:first-child { text-align: left; }
#table thead th { color: var(--muted); font-weight: 600; }
#table tbody th { font-weight: 500; color: var(--text-2); }
.muted { color: var(--muted); }

/* ---------- Metric checkboxes ---------- */
.metrics { padding: 14px; position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; }
.metrics .group { margin: 0 0 6px; }
/* One heading per chart, same words and order as the chart titles; its groups sit under it. */
.metrics .section-head {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-2); padding: 12px 8px 2px; margin-top: 6px; border-top: 1px solid var(--border);
}
.metrics .group-top { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--border); }
.metrics .group-top > summary { font-size: 12px; color: var(--text-2); }
.metrics details.group-top:first-of-type { border-top: 0; margin-top: 0; } /* the list starts with one */
.metrics summary {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 8px 8px 4px; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.metrics summary::-webkit-details-marker { display: none; }
.metrics summary::after { content: "▾"; font-size: 12px; transition: transform .15s; }
.metrics .group:not([open]) summary::after { transform: rotate(-90deg); }
.metric {
  --c: transparent;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.metric:hover { background: var(--hover); }
.metric input { position: absolute; opacity: 0; pointer-events: none; }
.metric .box {
  width: 16px; height: 16px; border-radius: 5px; flex: none;
  border: 1.5px solid var(--muted);
  background: var(--c);
  display: grid; place-items: center;
  transition: background .12s, border-color .12s;
}
.metric input:checked + .box { border-color: var(--c); }
.metric input:checked + .box::after {
  content: ""; width: 8px; height: 4px; margin-top: -2px;
  border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg);
}
.metric input:focus-visible + .box { outline: 2px solid var(--text); outline-offset: 2px; }
.metric input:disabled ~ * { opacity: .45; }
.metric input:disabled { cursor: not-allowed; }
.metric .name { flex: 1; }
.metric .val { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.metric.empty .name { color: var(--muted); }
.note { font-size: 12px; color: var(--text-2); margin: 4px 8px 8px; }
/* Data-source credit under price charts and screener results (IEX terms require it wherever prices show). */
.data-credit { font-size: 12px; line-height: 1.45; color: var(--text-2); margin: 12px 4px 0; }
/* The server-written line of latest numbers under the chart (src/pages.js → companySummary). */
.co-summary { width: 100%; max-width: 1200px; margin: -8px auto 8px; padding: 0 28px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
/* The links to the company's topic pages (src/topics.js → topicNavHtml) and to others in its industry
   (src/pages.js → peerNavHtml), each on its own line under the numbers. */
.co-summary .co-topics, .co-summary .co-peers { display: block; margin-top: 4px; }
.co-summary .co-topics a, .co-summary .co-peers a { color: var(--text-2); }
.data-credit a { color: inherit; text-decoration: underline; }

footer { margin-top: auto; padding: 24px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Key stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  border: 1px solid var(--border); background: transparent; border-radius: 10px;
  padding: 8px 10px; cursor: pointer; min-width: 0;
}
.stat:hover { border-color: var(--text-2); }
.stat[aria-pressed="true"] { border-color: var(--text); }
.stat-label { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stat-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Chips (selected metrics) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 4px 8px 4px 10px; font-size: 12px; color: var(--text-2); cursor: pointer;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip b { color: var(--muted); font-weight: 400; font-size: 14px; line-height: 1; }
.chip:hover { border-color: var(--text-2); color: var(--text); }
.chip-add {
  display: none; font-weight: 700; padding: 6px 14px;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.chip-add:hover { color: var(--accent-ink); }
.chip-pro { border-style: dashed; color: var(--text-2); font-weight: 600; }
.chip-nodata em { font-style: normal; color: var(--muted); } /* a ticked line with nothing in the years shown */
.chip-pro:hover { border-style: solid; }
/* Every chart keeps its title: the charts sit in a fixed order now, so the top one is not always the headline's. */
.sheet-head { display: none; }

/* ---------- The screener card (owner, Oct 10 2026) ---------- */
/* One line, the look of the /screens list pages' closed card (legal.css → .screener-upsell). A link to the screener:
   Pro goes straight in; Free opens the preview dialog (public/app.js → initScreenerPromo). Words: public/screener-example.js. */
.scr-promo {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius);
  color: var(--text); font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none;
}
.scr-promo:hover { border-color: var(--text-2); }
.scr-promo .pro-tag { flex: none; }
.scr-promo-go { margin-left: auto; color: var(--muted); }
/* Company page, wide screen: top of the right-hand column, Metrics under it. Row 2 is 1fr so the chart
   (spanning both rows) grows that row, never the card's. Phone: back to one column (below). */
#view { grid-template-rows: auto 1fr; }
#view > .chart-card { grid-column: 1; grid-row: 1 / span 2; }
#view > .scr-promo { grid-column: 2; grid-row: 1; }
#view > .metrics { grid-column: 2; grid-row: 2; }
/* Home page: under the example tickers (only there — the header's own pieces are reordered on the landing page). */
.scr-promo-home { display: none; }
/* Sized to its words, not the search box's width, so it reads as a side offer rather than a second search field. */
body.landing .scr-promo-home { order: 4; display: flex; align-self: center; max-width: calc(100% - 32px); margin: 36px 0 0; }
body.landing .scr-promo-home .scr-promo-go { margin-left: 4px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  /* minmax(0, 1fr): never let wide content stretch the column past the screen */
  main { grid-template-columns: minmax(0, 1fr); padding: 0 12px; margin-top: 12px; }
  /* one column: chart, then the screener card (Metrics is the full-screen sheet) */
  #view { grid-template-rows: none; }
  #view > .chart-card, #view > .scr-promo, #view > .metrics { grid-column: auto; grid-row: auto; }
  /* metric list becomes a full-screen sheet opened from the "+ Metrics" chip */
  .metrics {
    position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; border: 0;
    overflow-y: auto; padding: 0 16px 32px;
    transform: translateY(100%); transition: transform .22s ease; visibility: hidden;
  }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .metrics { transform: none; visibility: visible; }
  .sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 1; padding: 14px 0 10px; margin-bottom: 4px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .sheet-head b { font-size: 16px; }
  .sheet-done {
    border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 700;
    background: var(--accent); color: var(--accent-ink); cursor: pointer;
  }
  .metric { padding: 10px 8px; } /* bigger touch targets */
  .chip-add { display: inline-flex; }
  .chip { padding-top: 6px; padding-bottom: 6px; }
  /* iPhone zooms the page when a focused input's text is under 16px, and stays zoomed */
  .search input, body.landing .search input { font-size: 16px; }
  .top { padding: 12px 16px; }
  .card { padding: 16px; }
}
@media (max-width: 480px) {
  .controls { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  #presets { margin-left: auto; } /* if the row wraps, ranges stay right-aligned */
  .seg button { padding: 6px 9px; font-size: 13px; }
  .brand { font-size: 0; gap: 0; }
  .brand svg { width: 26px; height: 26px; }
}

/* ======================================================================
   Accounts, Pro, screener (Sep 2026)
   ====================================================================== */

/* ---------- Header nav + account ---------- */
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--text-2); text-decoration: none; white-space: nowrap;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--text); background: var(--hover); }
.nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.acct {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 6px 14px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; max-width: 220px;
}
.acct:hover { border-color: var(--text-2); }
.acct-email { overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 500; }
body.landing .nav { order: 1; position: absolute; top: 12px; right: 16px; }

/* ---------- PRO / FREE tags + locked controls ---------- */
.pro-tag, .free-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em;
  padding: 2px 6px; border-radius: 5px; line-height: 1.3; vertical-align: middle;
}
.pro-tag { background: var(--good); color: #fff; }
.free-tag { background: var(--hover); color: var(--text-2); }
.pro-tag-lg { font-size: 12px; padding: 3px 8px; }

.metric.locked { cursor: pointer; }
.metric.locked .name { color: var(--muted); }
.metric.locked .box { border-style: dashed; }
.metric input:disabled ~ .val .pro-tag { opacity: 1; }
.metric.locked input:disabled ~ * { opacity: 1; }
.stat.locked .stat-value { display: flex; align-items: center; min-height: 24px; }
.seg button.locked, .btn.locked { color: var(--muted); }
.seg button.locked::after, .btn.locked::after {
  content: "PRO"; margin-left: 6px; font-size: 9px; font-weight: 800; letter-spacing: .06em;
  padding: 1px 4px; border-radius: 4px; background: var(--good); color: #fff; vertical-align: 1px;
}
.metrics summary > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: var(--raised); color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--text-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { border-color: var(--accent); opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.table-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ---------- Dialog ---------- */
.dlg {
  width: min(440px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: 18px;
  background: var(--raised); color: var(--text); padding: 26px 24px 22px; box-shadow: var(--shadow);
}
/* Price upsell preview: made-up data, always labeled EXAMPLE (see example.js) */
.example-note {
  margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; font-size: 12px;
  background: var(--hover); color: var(--text-2);
}
.example-chart { position: relative; }
.example-chart .subhead { margin-top: 12px; }
.example-chart::after {
  content: "EXAMPLE"; position: absolute; top: 34px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted);
  border: 1px dashed var(--muted); border-radius: 6px; padding: 2px 8px; pointer-events: none;
}
.example-cta { margin-top: 16px; width: 100%; }
/* Screener preview (public/screener-example.js): the example rows aren't links, unlike the screener's own. */
.example-table .scr-results tbody tr { cursor: default; }
.example-table .scr-results tbody tr:hover { background: none; }
.example-table .subhead { margin-top: 12px; }
.example-actions { margin-top: 16px; }
/* Phone: the example's tickers are enough — the made-up names pushed the last column out of view. */
@media (max-width: 480px) { .example-table .scr-results tbody th span { display: none; } }
.dlg::backdrop { background: rgb(0 0 0 / 0.45); backdrop-filter: blur(2px); }
.dlg-x { position: absolute; top: 10px; right: 10px; margin: 0; }
.dlg-x button {
  border: 0; background: transparent; font-size: 22px; line-height: 1; width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; color: var(--muted);
}
.dlg-x button:hover { background: var(--hover); color: var(--text); }
.dlg h3 { margin: 8px 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.dlg-lead { color: var(--text-2); margin: 6px 0 14px; }
.dlg-reason { margin: 4px 0 10px; font-weight: 600; }
/* The free-trial line in the upgrade dialog (plans.js → TRIAL_NOTE) */
.dlg-trial {
  margin: 0 0 14px; padding: 8px 10px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--text);
}
.dlg-features { margin: 8px 0 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.dlg-features li { padding-left: 24px; position: relative; font-size: 14px; }
.dlg-features li::before {
  content: ""; position: absolute; left: 2px; top: 5px; width: 10px; height: 5px;
  border: 2px solid var(--good); border-top: 0; border-right: 0; transform: rotate(-45deg);
}
.dlg-features .soon { margin-left: 6px; font-size: 11px; color: var(--muted); font-weight: 600; }
.dlg-form { display: grid; gap: 10px; }
.dlg-form input {
  height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); font-size: 16px; outline: none;
}
.dlg-form input:focus { border-color: var(--text-2); }
.dlg-msg { margin: 8px 0 0; font-size: 13px; color: var(--text-2); min-height: 18px; }
.dlg-msg.error { color: var(--bad); }
.dlg-fine { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.dlg-plan { display: flex; align-items: center; gap: 6px; margin: 0 0 16px; font-weight: 600; }
.dlg-plan small { color: var(--muted); font-weight: 500; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.plan { flex-direction: column; gap: 2px; border-radius: 14px; padding: 12px; }
.btn.plan small { font-weight: 600; font-size: 12px; opacity: .8; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ---------- Screener ---------- */
main.screener { display: block; max-width: 1000px; }
.scr-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.scr-head p { margin: 4px 0 0; font-size: 13px; }
.scr-gate {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 16px 0 4px; padding: 14px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--good) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 30%, transparent);
}
.scr-gate p { margin: 0; flex: 1 1 260px; font-size: 14px; color: var(--text-2); }
.scr-presets { margin: 16px 0 6px; }
.scr-filters { display: grid; gap: 8px; margin: 10px 0; }
.flt { display: grid; grid-template-columns: minmax(0, 1fr) 64px 150px 34px; gap: 8px; align-items: center; }
.flt select, .scr-sort select, .flt-val {
  height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--raised);
  color: var(--text); font: inherit; font-size: 14px; padding: 0 10px; min-width: 0;
}
.flt-op { text-align: center; font-weight: 700; }
.flt-val { display: flex; align-items: center; gap: 6px; padding-right: 10px; }
.flt-val input { border: 0; outline: 0; background: transparent; width: 100%; height: 100%; font-size: 15px; min-width: 0; }
.flt-val span { color: var(--muted); font-size: 13px; }
.flt-val.bad { border-color: var(--bad); }
.flt-val:focus-within { border-color: var(--text-2); }
.flt-del {
  border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
}
.flt-del:hover { background: var(--hover); color: var(--text); }
.scr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.scr-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-left: auto; }
.scr-sort select { height: 36px; }
.scr-count { font-size: 13px; color: var(--text-2); margin: 16px 0 6px; min-height: 18px; }
.scr-results { overflow-x: auto; }
.scr-results table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.scr-results th, .scr-results td { padding: 9px 12px 9px 0; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.scr-results thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.scr-results th:first-child { text-align: left; }
.scr-results tbody th { font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.scr-results tbody th b { display: inline-block; min-width: 58px; }
.scr-results tbody th span { color: var(--text-2); }
.scr-results tbody tr { cursor: pointer; }
.scr-results tbody tr:hover, .scr-results tbody tr:focus-visible { background: var(--hover); outline: none; }
.scr-empty { padding: 24px 0; text-align: center; }

/* ---------- Follow + watchlist (Oct 14 2026 — public/watchlist.js) ---------- */
/* ☆ Follow sits before Share at the right end of the company header; Share keeps its place when Follow is hidden. */
.follow-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.follow-btn:not([hidden]) + .share-btn { margin-left: 0; }
.follow-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.follow-btn.on svg { fill: var(--s4); stroke: var(--s4); }
.wl-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 14px 0 4px; }
.wl-bar:not(:has(> :not([hidden]))) { display: none; }
.wl-emails { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.wl-emails input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.wl-out { margin: 16px 0 4px; }
.wl-out p { margin: 0 0 12px; font-size: 14px; color: var(--text-2); }
.wl-stop { flex-direction: column; align-items: flex-start; gap: 10px; }
/* .scr-gate's lines grow sideways (flex: 1 1 260px); in this column that would grow them down. */
.wl-stop p { flex: none; margin: 0; font-size: 14px; color: var(--text-2); }
.wl-stop p:empty { display: none; }
#wl-tools { margin-top: 8px; }
#wl-count:empty { display: none; }
/* Two tiles a row on a desktop, not three: the picture is the 1200×630 link-preview card, drawn to be seen about
   this wide (as in an X post) — at a third of the page its labels shrank to ~5 px and read as blurry (owner, Oct 15). */
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.wl-tile {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: 12px; background: var(--raised);
}
.wl-pic { display: block; background: #fff; } /* the card pictures are drawn on white (scripts/card.js) */
.wl-pic img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; }
.wl-info { display: grid; gap: 2px; padding: 10px 12px 12px; min-width: 0; }
.wl-name { color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 30px; }
a.wl-name:hover span { color: var(--text); }
.wl-name span { color: var(--text-2); }
.wl-info small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wl-x {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--raised); color: var(--text-2);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.wl-x:hover { color: var(--text); border-color: var(--text-2); }
.wl-pic + .wl-info .wl-name { padding-right: 0; } /* the × sits on the picture, not the name */
.wl-paused { border-style: dashed; }
.wl-paused .wl-pic img { opacity: .45; }
.wl-paused-note {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 0;
  border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; text-align: left;
}
.wl-gone .wl-name { white-space: normal; }

@media (max-width: 860px) {
  .acct-email { display: none; }
  .nav a { padding: 7px 8px; }
}
@media (max-width: 600px) {
  .flt { grid-template-columns: 64px minmax(0, 1fr) 34px; }
  .flt-field { grid-column: 1 / -1; }
  .flt-op { grid-column: 1; grid-row: 2; }
  .flt-val { grid-column: 2; grid-row: 2; }
  .flt-del { grid-column: 3; grid-row: 2; }
  .flt + .flt { border-top: 1px solid var(--grid); padding-top: 8px; }
  .scr-sort { margin-left: 0; }
  .scr-results tbody th { max-width: 150px; }
  .plans { grid-template-columns: 1fr; }
  .wl-grid { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 10px; }
}
@media (max-width: 480px) {
  /* Company header on a small phone: Follow and Share as icons, so the company's name keeps the room. */
  .follow-btn span, .share-btn span { display: none; }
  .follow-btn, .share-btn { padding: 6px 10px; }
  .nav a span { display: none; }
  .nav a { padding: 9px; }
  body.landing .nav a span { display: inline; }
  /* …but the Watchlist link is its star alone (Oct 15 2026): with three items the labelled header ran into the logo
     on an iPhone (owner's screenshot). Screener keeps its label, as before the watchlist. */
  body.landing #nav-watchlist span { display: none; }
  .acct { padding: 6px 11px; font-size: 13px; }
  .top { gap: 8px; }
}
