/* Compound screener. Uses the site's tokens (web.css :root), so it follows the
   same palette, type and focus ring as the rest of Resources. */

.sc { --sc-short: var(--teal); --sc-flag: var(--amber); --sc-out: var(--danger);
  --sc-short-tint: #e3f6f6; --sc-flag-tint: var(--warn-tint); --sc-out-tint: #fdeceb; }

.sc-hero { padding-bottom: 28px; }
.sc-noscript { padding: 14px 18px; border-radius: var(--r); background: var(--warn-tint); color: var(--warn); font-weight: 600; }

.sc-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.sc-rail, .sc-stage, .sc-results { display: grid; gap: 20px; min-width: 0; }
.sc-rail > *, .sc-stage > *, .sc-results > * { min-width: 0; }
.sc [hidden] { display: none !important; }   /* class display rules (buttons, grids) must not beat the hidden attribute */

/* ---------- cards ---------- */
.sc-card { padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(11,27,63,.04); min-width: 0; }
.sc-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sc-card-head h2 { margin: 0; font-size: 1.2rem; line-height: 1.25; }
.sc-card-head-split { justify-content: space-between; align-items: flex-start; }
.sc-card-head-split > div { min-width: 0; }
.sc-card-head-split .sc-help { margin-top: 4px; }
.sc-step { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand-ink); font-weight: 750; font-size: .85rem; }
.sc-help { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.sc-fine { margin: 16px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.55; max-width: 76ch; }

/* ---------- segmented controls ---------- */
.sc-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--wash-2); margin-bottom: 14px; }
.sc-seg button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: .88rem; font-weight: 650;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.sc-seg button:hover { color: var(--ink); }
.sc-seg button[aria-selected="true"], .sc-seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand-ink);
  box-shadow: 0 1px 3px rgba(11,27,63,.14); }
.sc-seg svg { width: 16px; height: 16px; }
.sc-seg b { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--wash-2); color: var(--ink-2); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-seg button[aria-pressed="true"] b { background: var(--brand-tint); color: var(--brand-ink); }
.sc-seg-sm { margin-bottom: 0; flex-wrap: wrap; }
.sc-seg-sm button { flex: 0 0 auto; min-height: 34px; font-size: .84rem; }

/* ---------- inputs ---------- */
.sc textarea, .sc input[type="text"], .sc input[type="email"], .sc input[type="number"], .sc input[type="search"], .sc select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
  font: inherit; font-size: .94rem; color: var(--ink); }
.sc textarea { font-family: Consolas, Menlo, monospace; font-size: .84rem; line-height: 1.55; resize: vertical; min-height: 150px; }
.sc textarea:focus, .sc input:focus-visible, .sc select:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.sc button:focus-visible, .sc-drop:focus-within, .sc-table-wrap:focus-visible { outline: none; box-shadow: var(--focus); }
.sc-drop { display: grid; justify-items: center; gap: 4px; padding: 26px 16px; border: 1.5px dashed var(--line-2); border-radius: 14px;
  background: var(--wash); text-align: center; cursor: pointer; color: var(--ink-2); font-size: .9rem; }
.sc-drop svg { width: 26px; height: 26px; color: var(--brand); margin-bottom: 4px; }
.sc-drop span { color: var(--muted); font-size: var(--fs-xs); }
.sc-drop code { font-size: .8rem; background: var(--wash-2); padding: 1px 5px; border-radius: 5px; }
.sc-drop:hover, .sc-drop[data-over] { border-color: var(--brand); background: var(--brand-soft); }

.sc-read { min-height: 1.4em; margin: 12px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.sc-read[data-state="ok"] { color: var(--success); font-weight: 600; }
.sc-read[data-state="bad"] { color: var(--danger); font-weight: 600; }
.sc-read[data-state="busy"] { color: var(--brand-ink); }

.sc-examples { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.sc-examples-title { margin: 0 0 10px; font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.sc-examples-list { display: grid; gap: 8px; }
.sc-examples-list button { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font: inherit; cursor: pointer; text-align: left; }
.sc-examples-list button:hover { border-color: var(--brand); background: var(--brand-soft); }
.sc-examples-list strong { font-size: .88rem; color: var(--ink); }
.sc-examples-list span { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* ---------- limits ---------- */
.sc-profiles { display: flex; flex-wrap: wrap; gap: 7px; }
.sc-profiles label { position: relative; }
.sc-profiles input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sc-profiles span { display: block; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-size: .84rem; font-weight: 650; color: var(--ink-2); }
.sc-profiles input:hover + span { border-color: var(--ink-2); }
.sc-profiles input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.sc-profiles input:focus-visible + span { box-shadow: var(--focus); }

.sc-limits { width: 100%; margin-top: 14px; border-collapse: collapse; }
.sc-limits th, .sc-limits td { padding: 5px 0; text-align: left; vertical-align: middle; }
.sc-limits thead th { font-size: .75rem; font-weight: 650; color: var(--muted); padding-bottom: 6px; }
.sc-limits tbody th { font-size: .88rem; font-weight: 600; color: var(--ink-2); padding-right: 10px; }
.sc-limits tbody th small { color: var(--muted); font-weight: 500; }
.sc-limits td { width: 28%; padding-left: 8px; }
.sc-limits input { padding: 7px 9px; font-size: .9rem; font-variant-numeric: tabular-nums; }

.sc-options { display: grid; gap: 14px; margin: 18px 0; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.sc-field { display: grid; gap: 6px; min-width: 0; }
.sc-field > span { font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.sc-field small, .sc-check small { color: var(--muted); font-weight: 500; }
.sc-check { display: flex; align-items: flex-start; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.sc-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.sc-check small { display: block; font-size: .78rem; }
.sc-run { width: 100%; justify-content: center; gap: 8px; }
.sc-run svg { width: 16px; height: 16px; }
.sc-run-help { text-align: center; }

/* ---------- empty state ---------- */
.sc-empty { padding: 44px 36px; border-radius: 18px; border: 1.5px dashed var(--line-2); background: var(--wash); }
.sc-empty h2 { margin: 22px 0 8px; font-size: 1.3rem; }
.sc-empty p { margin: 0 0 20px; max-width: 58ch; color: var(--ink-2); }
.sc-ghost { display: grid; gap: 8px; max-width: 520px; }
.sc-ghost-row { display: grid; grid-template-columns: 1fr; justify-items: center; }
.sc-ghost-row span { display: none; }
.sc-ghost-row i { display: block; width: var(--w); height: 34px; border-radius: 4px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 10px 100%);
  background: linear-gradient(90deg, var(--wash-2), #e1e8f3, var(--wash-2)); }

/* ---------- the funnel ---------- */
.sc-summary { margin: 0 0 0 auto; font-size: .88rem; color: var(--ink-2); }
.sc-summary strong { color: var(--ink); }
.sc-funnel { display: grid; gap: 6px; }
.sc-frow { display: grid; grid-template-columns: 168px minmax(0, 1fr) 150px; align-items: center; gap: 16px; }
.sc-flabel strong { display: block; font-size: .92rem; line-height: 1.25; }
.sc-flabel span { display: block; margin-top: 2px; font-size: .78rem; color: var(--muted); line-height: 1.35; }
.sc-ftrack { display: flex; justify-content: center; }
.sc-fbar { --c1: var(--brand); --c2: var(--brand-ink); width: 0; min-width: 0; height: 56px; display: grid; place-items: center;
  color: #fff; font-weight: 750; font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
  background: linear-gradient(180deg, var(--c1), var(--c2)); clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 14px 100%);
  transition: width .75s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
.sc-fbar[data-ready] { width: var(--w); }
.sc-frow:nth-child(2) .sc-fbar { --c1: #0e9fa2; --c2: #0a7f82; }
.sc-frow:nth-child(3) .sc-fbar { --c1: #12a77a; --c2: #0f6e4d; }
.sc-fnote { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.sc-fnote b { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-fnote .is-zero { color: var(--muted); }

/* ---------- scatter ---------- */
.sc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.sc-legend li { display: inline-flex; align-items: center; gap: 7px; }
.sc-legend i { width: 11px; height: 11px; border-radius: 50%; background: var(--sc-short); }
.sc-legend i[data-v="flagged"] { background: var(--sc-flag); }
.sc-legend i[data-v="outside"] { background: var(--sc-out); }
.sc-plot { position: relative; }
.sc-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.sc-plot .grid { stroke: var(--line-soft); }
.sc-plot .axis { stroke: var(--line-2); }
.sc-plot .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sc-plot .axis-title { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.sc-plot .zone { fill: rgba(14,159,162,.09); stroke: var(--teal); stroke-width: 1.2; stroke-dasharray: 5 4; }
.sc-plot circle.dot { stroke: #fff; stroke-width: 1.6; cursor: pointer; transition: r .12s; }
.sc-plot circle.dot[data-v="shortlist"] { fill: var(--sc-short); }
.sc-plot circle.dot[data-v="flagged"] { fill: var(--sc-flag); }
.sc-plot circle.dot[data-v="outside"] { fill: var(--sc-out); opacity: .8; }
.sc-plot circle.dot:hover, .sc-plot circle.dot:focus { r: 8; outline: none; }
.sc-plot circle.dot[data-dim] { opacity: .15; }
.sc-tip { position: absolute; z-index: 3; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); padding: 7px 10px; border-radius: 9px;
  background: var(--night); color: #fff; font-size: .78rem; line-height: 1.4; white-space: nowrap; box-shadow: 0 8px 22px rgba(11,27,63,.25); }
.sc-tip b { display: block; font-size: .82rem; }

/* ---------- table ---------- */
.sc-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-actions svg { width: 15px; height: 15px; }
.sc-search { position: relative; flex: 1 1 220px; max-width: 320px; }
.sc-search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--muted); pointer-events: none; }
.sc-search input { padding-left: 34px; }
.sc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.sc-table { width: 100%; min-width: 880px; border-collapse: collapse; font-size: .88rem; }
.sc-table thead th { position: sticky; top: 0; padding: 10px 10px; background: var(--wash); border-bottom: 1px solid var(--line); text-align: left;
  font-size: .76rem; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.sc-table thead button { all: unset; cursor: pointer; font: inherit; color: inherit; }
.sc-table thead button:hover { color: var(--brand-ink); }
.sc-table thead button:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.sc-table thead th[aria-sort="ascending"] button::after { content: " ▲"; font-size: .65rem; }
.sc-table thead th[aria-sort="descending"] button::after { content: " ▼"; font-size: .65rem; }
.sc-table tbody tr.sc-row { border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.sc-table tbody tr.sc-row:hover { background: var(--brand-soft); }
.sc-table tbody tr.sc-row[data-open] { background: var(--brand-soft); border-bottom-color: transparent; }
.sc-table td { padding: 8px 10px; vertical-align: middle; }
.sc-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.sc-col-sel { width: 40px; text-align: center !important; }
.sc-col-sel input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.sc-col-struct { width: 112px; }
.sc-thumb { display: block; width: 100px; height: 68px; border-radius: 8px; background: #fff; border: 1px solid var(--line-soft); overflow: hidden; }
.sc-thumb svg { display: block; width: 100%; height: 100%; }
.sc-name { min-width: 170px; max-width: 280px; }
.sc-name strong { display: block; font-size: .9rem; line-height: 1.3; overflow-wrap: anywhere; }
.sc-toggle { all: unset; cursor: pointer; font-weight: 700; color: var(--ink); }
.sc-toggle:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.sc-toggle:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.sc-name code { display: block; margin-top: 2px; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .74rem; color: var(--muted); }
.sc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sc-chip { padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 650; background: var(--sc-flag-tint); color: var(--warn); }
.sc-chip[data-level="note"] { background: var(--wash-2); color: var(--ink-2); }
.sc-val[data-fail] { color: var(--danger); font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
.sc-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.sc-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sc-badge[data-v="shortlist"] { background: var(--sc-short-tint); color: var(--teal-deep); }
.sc-badge[data-v="flagged"] { background: var(--sc-flag-tint); color: var(--warn); }
.sc-badge[data-v="outside"] { background: var(--sc-out-tint); color: #9b1c1c; }
.sc-table tr.sc-detail td { padding: 0 10px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--line-soft); }
.sc-detail-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 4px; }
.sc-detail-struct { width: 280px; height: 200px; border-radius: 12px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.sc-detail-struct svg { display: block; width: 100%; height: 100%; }
.sc-detail h3 { margin: 0 0 8px; font-size: .86rem; }
.sc-crit { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; margin: 0 0 14px; padding: 0; list-style: none; font-size: .84rem; }
.sc-crit li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line-2); }
.sc-crit li span { min-width: 0; }
.sc-crit em { font-style: normal; color: var(--success); font-weight: 700; }
.sc-crit li[data-fail] em { color: var(--danger); }
.sc-why { margin: 0 0 6px; padding: 0; list-style: none; font-size: .84rem; color: var(--ink-2); line-height: 1.5; }
.sc-why strong { color: var(--ink); }
.sc-more { display: flex; justify-content: center; margin-top: 14px; }
.sc-none td { padding: 34px 10px; text-align: center; color: var(--muted); }

/* ---------- prediction request ---------- */
.sc-predict-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
.sc-predict-copy p:first-child { margin-top: 0; color: var(--ink-2); max-width: 54ch; }
.sc-picked { margin: 18px 0 4px; padding: 16px; border-radius: 14px; background: var(--wash); border: 1px solid var(--line-soft); }
.sc-picked-count { margin: 0; font-size: 1rem; }
.sc-picked-count strong { font-size: 1.8rem; font-weight: 750; font-variant-numeric: tabular-nums; margin-right: 4px; color: var(--brand-ink); }
.sc-picked .w-btn { margin-top: 12px; }
.sc-picked .w-btn svg { width: 15px; height: 15px; }
.sc-picked .w-btn:disabled, .sc-form .w-btn:disabled { opacity: .5; cursor: not-allowed; }
.sc-form { display: grid; gap: 14px; }
.sc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sc-form .w-btn { justify-self: start; gap: 8px; }
.sc-form .w-btn svg { width: 16px; height: 16px; }
.sc-form textarea { font-family: inherit; font-size: .92rem; min-height: 0; }
.sc-form-msg { margin: 0; min-height: 1.4em; font-size: .88rem; font-weight: 600; }
.sc-form-msg[data-state="ok"] { color: var(--success); }
.sc-form-msg[data-state="bad"] { color: var(--danger); }
.sc-form[data-sent] > :not(.sc-form-msg) { display: none; }
.sc-form[data-sent] .sc-form-msg { padding: 18px; border-radius: 14px; background: var(--sc-short-tint); font-size: .95rem; line-height: 1.55; }

/* ---------- smaller screens ---------- */
@media (max-width: 1060px) {
  .sc-layout { grid-template-columns: 1fr; }
  .sc-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 820px) {
  .sc-rail { grid-template-columns: 1fr; }
  .sc-predict-grid { grid-template-columns: 1fr; }
  .sc-frow { grid-template-columns: 1fr; gap: 6px; padding: 8px 0; }
  .sc-fnote { order: 3; }
  .sc-detail-grid { grid-template-columns: 1fr; }
  .sc-detail-struct { width: 100%; max-width: 320px; }
  .sc-card { padding: 18px; }
  .sc-empty { padding: 30px 22px; }
}
@media (max-width: 520px) {
  .sc-form-row { grid-template-columns: 1fr; }
  .sc-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sc-fbar { transition: none; }
  .sc-plot circle.dot { transition: none; }
}
