/* CompScope for investors. Roomier and friendlier than the institutional app, same brand blue
   and diamond mark. Chart colors are the dataviz reference palette: the blue ramp for the peer
   group, categorical slot 2 (orange) for the company itself. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f5;
  --border: #e3e6eb;
  --border-strong: #c9cfd7;
  /* Form field outlines: WCAG 1.4.11 needs 3:1 against what is on either side of them. #80868f is
     3.67:1 on --surface, 3.45:1 on --surface-2 and 3.39:1 on --bg (--border-strong is 1.57:1). */
  --field-border: #80868f;
  --text: #101418;
  --text-2: #464d58;
  --muted: #5f6672;
  --brand: #2a78d6;
  --accent: #1c5cab;
  --accent-hover: #184f95;
  --accent-ink: #ffffff;
  --accent-soft: #e8f1fc;
  --focus: #1c5cab;
  --chip: #eef1f5;
  --peer-band: #86b6ef;
  --peer-median: #104281;
  --company: #eb6834;
  --track: #e1e0d9;
  --meter-track: #cde2fb;
  --meter-fill: #2a78d6;
  --good: #0ca30c;
  --critical: #d03b3b;
  --critical-bg: #fdeeee;
  --critical-ink: #9b1c1c;
  --danger-btn: #c03535;
  --warning-bg: #fff6e0;
  --warning-ink: #6b4a00;
  --shadow: 0 1px 2px rgba(16, 20, 24, .05), 0 4px 16px rgba(16, 20, 24, .06);
  --pop-shadow: 0 12px 32px rgba(16, 20, 24, .16);
  --radius: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1012;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2a2a27;
    --border: #33332f;
    --border-strong: #4a4a44;
    --field-border: #7a7a72;   /* 4.03:1 on --surface, 3.68:1 on --surface-2, 4.40:1 on --bg */
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a3a29a;
    --brand: #3987e5;
    --accent: #5598e7;
    --accent-hover: #6da7ec;
    --accent-ink: #08111f;
    --accent-soft: #16263b;
    --focus: #86b6ef;
    --chip: #2a2a27;
    --peer-band: #184f95;
    --peer-median: #cde2fb;
    --company: #d95926;
    --track: #383835;
    --meter-track: #0d366b;
    --meter-fill: #3987e5;
    --critical: #e66767;
    --critical-bg: #3a1d1d;
    --critical-ink: #f3b8b8;
    --warning-bg: #3a2f12;
    --warning-ink: #f5d58a;
    --shadow: none;
    --pop-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012; --surface: #1a1a19; --surface-2: #222220; --surface-3: #2a2a27; --border: #33332f;
  --border-strong: #4a4a44; --field-border: #7a7a72; --text: #f0efec; --text-2: #c3c2b7; --muted: #a3a29a; --brand: #3987e5;
  --accent: #5598e7; --accent-hover: #6da7ec; --accent-ink: #08111f; --accent-soft: #16263b; --focus: #86b6ef;
  --chip: #2a2a27; --peer-band: #184f95; --peer-median: #cde2fb; --company: #d95926; --track: #383835;
  --meter-track: #0d366b; --meter-fill: #3987e5; --critical: #e66767; --critical-bg: #3a1d1d;
  --critical-ink: #f3b8b8; --warning-bg: #3a2f12; --warning-ink: #f5d58a; --shadow: none;
  --pop-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

/* -------------------------------------------------------------- header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 60px; flex-wrap: wrap; }
.brand-wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; min-width: 0; }
.ws { display: inline-flex; align-items: baseline; gap: 6px; margin: 0; min-width: 0; font-size: 13px; color: var(--text-2); }
.ws-label { color: var(--muted); }
.ws-name { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.logo { color: var(--brand); }
.tag { font-weight: 500; font-size: 14px; color: var(--muted); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 8px 14px; border-radius: 999px; color: var(--text-2); font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; }
.tabs a:hover { background: var(--surface-3); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) {
  .topbar { position: static; }
  .topbar-inner { padding-top: 10px; padding-bottom: 10px; }
  .tabs { width: 100%; order: 3; }
  .tabs a { flex: 1; text-align: center; padding: 8px 4px; font-size: 14px; }
}

/* ------------------------------------------------------------- account */
.acct { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.plan-badge {
  padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.usage { display: grid; gap: 4px; min-width: 112px; font-size: 12px; color: var(--text-2); }
.usage-text { white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-track { display: block; height: 6px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.usage-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--meter-fill); }
.usage.full .usage-text { color: var(--critical-ink); font-weight: 600; }
.usage.full .usage-fill { background: var(--critical); }
.acct-menu { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer;
}
.acct-btn:hover, .acct-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.acct-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; max-width: calc(100vw - 32px);
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--pop-shadow);
}
.acct-who { display: grid; gap: 2px; margin: 0; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.acct-email { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.acct-email:empty { display: none; }
.acct-links { list-style: none; margin: 6px 0 0; padding: 0; }
.acct-links a, .acct-links button {
  display: block; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 15px; color: var(--text); text-align: left; text-decoration: none; cursor: pointer;
}
.acct-links a:hover, .acct-links button:hover { background: var(--surface-3); }
.acct-links button:disabled { opacity: .55; cursor: progress; }
.acct-msg { margin: 0; padding: 0 10px; font-size: 13px; color: var(--muted); }
.acct-msg:empty { display: none; }
.acct-msg.error { padding-bottom: 8px; color: var(--critical-ink); }
@media (max-width: 640px) {
  .acct { order: 2; }
  .usage { min-width: 96px; }
}

/* A plan limit: what the plan does not include and the way forward (owners: the plans; members: ask). */
.upgrade {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  /* main.wrap has no top padding, so the bottom margin keeps the prompt off the first card. */
  margin: 12px 0 16px; padding: 16px 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft);
}
.upgrade-body { flex: 1 1 320px; min-width: 0; }
.upgrade h2 { font-size: 17px; }
.upgrade p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; max-width: 70ch; }
.upgrade-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upgrade-ask { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.save-upgrade:empty { display: none; }
.glance-upgrade { margin-top: 12px; }

.provline { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.provline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.provline.down .dot { background: var(--critical); }
.banner { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--warning-bg); color: var(--warning-ink); font-size: 14px; }

main { flex: 1 0 auto; width: 100%; padding: 16px 0 48px; }
main:focus { outline: none; }
.view { display: grid; gap: 16px; }

/* --------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; box-shadow: var(--shadow); min-width: 0; scroll-margin-top: 16px; }
@media (min-width: 641px) { .card, .results { scroll-margin-top: 76px; } }   /* clears the sticky header */
@media (min-width: 560px) { .card { padding: 24px; } }
@media (min-width: 720px) { .card { padding: 24px 28px; } }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 20px; line-height: 1.25; margin: 0; }
h3 { font-size: 16px; line-height: 1.3; margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.intro { color: var(--text-2); margin: 8px 0 20px; max-width: 64ch; }
.sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); max-width: 70ch; }
.results { display: grid; gap: 16px; }
.results:empty { display: none; }

/* -------------------------------------------------------------- controls */
.search label, .opts label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.combo { position: relative; }
input[type="search"], input[type="text"], input[type="number"], select {
  font: inherit; color: var(--text); background: var(--surface); width: 100%; min-height: 48px;
  border: 1px solid var(--field-border); border-radius: 12px; padding: 10px 14px;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input::placeholder { color: var(--muted); }

.options {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--pop-shadow);
}
.opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.opt:hover, .opt[aria-selected="true"] { background: var(--accent-soft); }
.opt-name { font-weight: 600; overflow-wrap: anywhere; }
.opt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.opt-msg { padding: 10px 12px; font-size: 14px; color: var(--muted); }

.btn {
  font: inherit; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-align: center;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--danger-btn); border-color: var(--danger-btn); color: #ffffff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
a.btn { text-decoration: none; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
/* Busy, but still focusable: extensions mark a running button aria-disabled, because disabling it
   would drop keyboard focus to <body>. */
.btn[aria-disabled="true"] { opacity: .55; cursor: progress; }
.link-btn { font: inherit; font-weight: 600; background: none; border: 0; padding: 6px 0; color: var(--accent); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.actions .save-state { margin: 0; }

.ticker {
  display: inline-block; padding: 2px 7px; border-radius: 6px; background: var(--chip); color: var(--text-2);
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; white-space: nowrap;
}
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.sep { color: var(--border-strong); }
@media (max-width: 420px) { .meta { gap: 2px 10px; } .meta .sep { display: none; } }   /* wrapped lines would end in a dangling dot */
.note, .save-state { margin: 8px 0 0; min-height: 1.5em; font-size: 14px; color: var(--text-2); }
.note.error, .save-state.error { color: var(--critical-ink); }
.empty { margin: 16px 0 0; padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 12px; }

/* ------------------------------------------------------------- holdings */
.holdings { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.holding {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "tk name sh rm";
  align-items: center; gap: 8px 12px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
.holding > .ticker { grid-area: tk; }
.holding-name { grid-area: name; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.shares { grid-area: sh; display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
.shares-input { width: 120px; min-height: 40px !important; padding: 6px 10px !important; }
.holding .icon-btn {
  grid-area: rm; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font-size: 15px; cursor: pointer;
}
.holding .icon-btn:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 560px) {
  .holding { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tk name rm" "sh sh sh"; }
  .shares-input { width: 100%; }
  .shares { width: 100%; }
}

/* ------------------------------------------------------------- progress */
.progress-track { height: 8px; margin: 16px 0 10px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.progress-track .fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--meter-fill); transition: width .3s ease; }
.progress-count { margin: 0; font-weight: 600; }
.progress-now { margin: 2px 0 0; min-height: 1.5em; font-size: 14px; color: var(--text-2); }
.hint { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.hint .link-btn { padding: 0; }

.glance { list-style: none; margin: 12px 0 0; padding: 0; }
.glance-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 2px 16px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--border); }
.glance-row:first-child { border-top: 0; }
.glance-row .link-btn { padding: 0; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.glance-name { overflow-wrap: anywhere; }
.glance-text { font-size: 14px; color: var(--text-2); }
.glance-row.state-error .glance-text { color: var(--critical-ink); }
@media (max-width: 560px) { .glance-row { grid-template-columns: minmax(0, 1fr); } }

.pending { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 0; color: var(--text-2); }
.elapsed { color: var(--muted); font-variant-numeric: tabular-nums; }
.slow-note { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.spinner {
  flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--meter-track); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .progress-track .fill { transition: none; }
}

.error-box { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--critical-bg); color: var(--critical-ink); }
.error-box p { margin: 0; }
.error-box .detail { margin-top: 4px; font-size: 13px; }
.error-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--critical); color: var(--surface); font-weight: 700; font-size: 14px; }

/* -------------------------------------------------------------- results */
.result-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.result-head h2 { font-size: 22px; }
.owned { margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--text-2); }
.headline { margin: 16px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); font-size: 17px; font-weight: 600; }

.tip-btn {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--text-2);
  font: 700 12px/1 system-ui, sans-serif; cursor: pointer; vertical-align: middle;
}
.tip-btn::before { content: ""; position: absolute; inset: -6px; }
.tip-btn:hover, .tip-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.popover {
  position: fixed; z-index: 50; width: max-content; max-width: min(320px, calc(100vw - 32px)); padding: 12px 14px;
  border-radius: 12px; background: var(--text); color: var(--surface); font-size: 14px; line-height: 1.45; box-shadow: var(--pop-shadow);
}
.popover:not(.open) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }

/* Valuation chart */
.valuation { margin: 20px 0 0; padding: 16px; border: 1px solid var(--border); border-radius: 14px; }
.valuation figcaption { margin-bottom: 4px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 4px; padding: 0; font-size: 13px; color: var(--text-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; }
.key-band { width: 18px; height: 10px; border-radius: 3px; background: var(--peer-band); }
.key-median { width: 2px; height: 14px; border-radius: 1px; background: var(--peer-median); }
.key-company { width: 12px; height: 12px; border-radius: 50%; background: var(--company); }
.vrow {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 15.5rem; gap: 4px 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--track);
}
.vrow:first-child { border-top: 0; }
.vname { display: flex; flex-direction: column; }
.vlabel { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.vplain { font-size: 12.5px; color: var(--muted); }
.vplot-wrap { min-width: 0; padding: 0 8px; }
.vplot { display: block; overflow: visible; }
.vplot .track { stroke: var(--track); stroke-width: 1; }
.vplot .band { fill: var(--peer-band); }
.vplot .median { stroke: var(--peer-median); stroke-width: 2; stroke-linecap: round; }
.vplot .company { fill: var(--company); stroke: var(--surface); stroke-width: 2; }
.vplot .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.vplot .tick.end { text-anchor: end; }
.vtext p { margin: 0; }
.vmain { font-size: 14px; color: var(--text-2); }
.vmain strong { font-size: 15px; color: var(--text); }
.vsub { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) {
  .vrow { grid-template-columns: minmax(0, 1fr); }
  .vplot-wrap { padding: 4px 8px 0; }
}
.chart-tip {
  position: fixed; z-index: 40; pointer-events: none; display: grid; gap: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--pop-shadow); font-size: 13px;
}
.ct-row { display: flex; align-items: center; gap: 8px; }
.ct-row strong { font-variant-numeric: tabular-nums; }
.ct-row span:last-child { color: var(--text-2); }
.ct-key { flex: none; width: 12px; height: 3px; border-radius: 2px; }
.ct-key.company { background: var(--company); }
.ct-key.median { background: var(--peer-median); }
.ct-key.band { background: var(--peer-band); }

/* Similar companies */
.peers { margin-top: 24px; }
.keynums-help { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.peer-list { list-style: none; display: grid; gap: 10px; margin: 12px 0 0; padding: 0; }
.peer { min-width: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.peer-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.rank {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 700; color: var(--text-2);
}
.peer-id h4 { margin: 0; font-size: 16px; line-height: 1.3; }
.score { min-width: 84px; text-align: right; }
.score-num { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.1; }
.score-of { font-size: 12px; font-weight: 500; color: var(--muted); }
.meter { display: block; width: 84px; height: 6px; margin: 6px 0 0 auto; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--meter-fill); }
.why { margin: 10px 0 0; font-size: 14px; color: var(--text-2); }
.why-label { font-weight: 600; color: var(--text); }
.keynums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
.kn { min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.kn dt { font-size: 12px; color: var(--muted); }
.kn dd { margin: 0; }
.kn-peer { font-weight: 700; font-variant-numeric: tabular-nums; }
.kn-target { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.find { margin-top: 8px; font-size: 14px; }
.more { margin-top: 8px; }
/* Badges the peerBadge extensions add (ext/README.md). */
.peer-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.peer-badge { padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--text-2); font-size: 12px; line-height: 1.5; }
@media (max-width: 420px) {
  .peer { padding: 12px; }
  .peer-top { gap: 10px; }
  .score { min-width: 64px; }
  .meter { width: 64px; }
  .keynums { grid-template-columns: minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .kn { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; }
  .kn:first-child { border-top: 0; }
  .kn dt { grid-row: span 2; align-self: center; }
  .kn dd { text-align: right; }
}

.notes { display: grid; gap: 8px; margin-top: 16px; }
.notes details { font-size: 14px; color: var(--text-2); }
.notes summary { cursor: pointer; font-weight: 600; }
.notes ul { margin: 8px 0 0; padding-left: 20px; }
/* What resultCard extensions add, above the card's footer (ext/README.md). */
.ext-slot { display: grid; gap: 12px; min-width: 0; margin-top: 16px; }
.result-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.provenance { flex: 1 1 240px; margin: 0; font-size: 13px; color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.result-actions:has(.save.open) { flex-basis: 100%; }
.save.open { flex: 1 1 100%; }
.save-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.save-form input { flex: 1 1 220px; width: auto; max-width: 420px; min-height: 44px; }
.save-msg:empty { display: none; }
.save-msg, .saved-ok { margin: 0; font-size: 14px; color: var(--text-2); }

/* ------------------------------------------------------------- look-up */
.opts { margin-top: 16px; }
.opts select { width: auto; min-width: 220px; max-width: 100%; }

/* --------------------------------------------------------------- saved */
.sets { list-style: none; display: grid; gap: 8px; margin: 8px 0 0; padding: 0; }
.set { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.set-info { display: flex; flex-direction: column; min-width: 0; }
.set-info strong { overflow-wrap: anywhere; }
.set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.confirm { font-size: 14px; font-weight: 600; }
.set-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); }
.set-banner p { margin: 0; }
.set-banner-text { flex: 1 1 280px; min-width: 0; }
.set-banner .sub { color: var(--text-2); max-width: 72ch; }

/* -------------------------------------------------------------- footer */
.footer { padding: 20px 0 28px; border-top: 1px solid var(--border); background: var(--surface); }
.footer p { margin: 0 0 8px; max-width: 90ch; font-size: 13px; color: var(--muted); }
.disclaimer strong { color: var(--text); }

/* -------------------------------------------------------------- dialog */
.welcome {
  width: min(560px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: var(--pop-shadow);
}
.welcome::backdrop { background: rgba(10, 14, 20, .55); }
.welcome form { padding: 24px; }
.welcome h2 { margin: 0 0 12px; font-size: 22px; }
.welcome p { margin: 0 0 12px; color: var(--text-2); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--warning-bg); }
.callout p { margin: 0; color: var(--warning-ink); font-size: 14px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
#keyText p { margin: 0 0 12px; color: var(--text-2); overflow-wrap: anywhere; }
