/* Scatter + Sector Charts tabs (scatter.js). Moved from the pa-tracker
   2026-11-14: its design tokens are mapped onto the screener's here, and every
   rule is scoped under .sc-scope so nothing leaks into the other tabs. */
.sc-scope {
  --surface: var(--panel);
  --border: var(--sep);
  --text-2: var(--muted);
  --accent: var(--navy);
  --font-num: var(--mono);
  --font-ui: inherit;
  --pos-bg: rgba(14, 124, 74, 0.08);
  --neg-bg: rgba(192, 57, 43, 0.08);
  padding: 10px 14px 16px;
}
.sc-scope button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
.sc-scope .table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--border); }
.sc-scope table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.sc-scope th, .sc-scope td { padding: 0 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; background: var(--surface); }
.sc-scope thead th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); font-weight: 600; }
/* ============================== Scatter + Charts (scatter.js) ============================== */
.sc-scope .sc-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.sc-scope .sc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sc-scope .sc-row-2 { gap: 6px 16px; font-size: 12px; color: var(--text-2); }
.sc-scope .sc-toggle, .sc-scope .sc-select { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sc-scope .sc-toggle input { accent-color: var(--accent); margin: 0; }
.sc-scope .sc-select select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); padding: 3px 6px;
}
.sc-scope .sc-clear {
  border: 1px solid var(--border); background: var(--surface); color: var(--neg);
  padding: 7px 14px; font-weight: 600;
}
.sc-scope .sc-clear:hover { border-color: var(--neg); background: var(--neg-bg); }
.sc-scope /* multi-select */
.ms { position: relative; }
.sc-scope .ms-btn {
  display: inline-flex; align-items: baseline; gap: 6px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--border); padding: 7px 10px;
}
.sc-scope .ms.open .ms-btn, .sc-scope .ms-btn:hover { border-color: var(--accent); }
.sc-scope .ms-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.sc-scope .ms-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--accent); }
.sc-scope .ms-value.muted { font-weight: 400; color: var(--text-2); }
.sc-scope .ms-caret { color: var(--text-2); font-size: 10px; }
.sc-scope .ms-panel {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0;
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(26, 34, 51, 0.12);
  padding: 8px;
}
.sc-scope .ms-search {
  width: 100%; font: inherit; color: var(--text); padding: 6px 8px; margin-bottom: 6px;
  border: 1px solid var(--border); outline: none;
}
.sc-scope .ms-search:focus { border-color: var(--accent); }
.sc-scope .ms-tools { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.sc-scope .ms-link { color: var(--accent); font-size: 12px; text-decoration: underline; }
.sc-scope .ms-list { max-height: 360px; overflow: auto; }
.sc-scope .ms-group + .ms-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.sc-scope .ms-ghead { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-weight: 600; color: var(--accent); cursor: pointer; }
.sc-scope .ms-item { display: flex; align-items: center; gap: 8px; padding: 4px; cursor: pointer; }
.sc-scope .ms-item.indent { padding-left: 26px; }
.sc-scope .ms-item:hover, .sc-scope .ms-ghead:hover { background: var(--bg); }
.sc-scope .ms-item input, .sc-scope .ms-ghead input { accent-color: var(--accent); margin: 0; flex: none; }
.sc-scope .ms-sub { margin-left: auto; padding-left: 8px; color: var(--text-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
@media (max-width: 520px) {
.sc-scope .ms { flex: 1 1 100%; }
.sc-scope .ms-btn { width: 100%; max-width: none; }
.sc-scope .ms-panel { width: 100%; }
}
.sc-scope /* results */
.sc-info { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.sc-scope .sc-empty { color: var(--text-2); padding: 18px 0; }
.sc-scope .sc-stack { display: flex; flex-direction: column; gap: 14px; }
.sc-scope .sc-card { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; max-width: 1140px; }
.sc-scope .sc-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 6px; }
.sc-scope .sc-card-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--accent); }
.sc-scope .sc-stats { font-family: var(--font-num); font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sc-scope .sc-weak { color: var(--neg); font-family: var(--font-ui); }
.sc-scope .sc-plot { position: relative; width: 100%; }
.sc-scope .sc-svg { display: block; max-width: 100%; height: auto; }
.sc-scope .sc-grid { stroke: var(--border); stroke-width: 1; }
.sc-scope .sc-zero { stroke: #B8C0CC; stroke-width: 1; }
.sc-scope .sc-axis { fill: var(--text-2); font-size: 11px; font-family: var(--font-num); }
.sc-scope .sc-axis-title { fill: var(--text-2); font-size: 11px; }
.sc-scope .sc-fit { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0.75; }
.sc-scope .sc-median { stroke: #8A94A6; stroke-width: 1; stroke-dasharray: 4 4; }
.sc-scope .sc-median.strong { stroke: #D9822B; stroke-width: 2; stroke-dasharray: 6 4; }
.sc-scope .sc-median-lbl { fill: #B5651D; font-size: 11px; font-weight: 600; }
.sc-scope .sc-diag { fill: none; stroke: #D9822B; stroke-width: 1.5; stroke-dasharray: 6 4; }
.sc-scope .sc-diag-lbl { fill: #B5651D; font-size: 11px; }
.sc-scope .sc-quad { fill: #A3ACBA; font-size: 11px; font-style: italic; }
.sc-scope .sc-dot { fill: #8A94A6; fill-opacity: 0.55; stroke: #6B7587; stroke-width: 1; cursor: pointer; }
.sc-scope .sc-dot.held { fill: var(--accent); fill-opacity: 0.9; stroke: var(--surface); stroke-width: 1.5; }
.sc-scope .sc-dot.hl { fill: #D9822B; fill-opacity: 1; stroke: #8A4A0F; stroke-width: 2; }
.sc-scope .sc-dot:hover { stroke: var(--text); stroke-width: 2; }
.sc-scope .sc-lbl { fill: var(--text-2); font-size: 10px; pointer-events: none; }
.sc-scope .sc-lbl.held { fill: var(--accent); font-weight: 600; }
.sc-scope .sc-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 160px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(26, 34, 51, 0.12); padding: 8px 10px; font-size: 12px;
}
.sc-scope .sc-tip-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.sc-scope .sc-tip-row { display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.sc-scope .sc-tip-lbl { color: var(--text-2); font-family: var(--font-ui); }
.sc-scope .sc-note { font-size: 11px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.sc-scope .sc-foot { font-size: 11px; color: var(--text-2); margin: 14px 0 4px; max-width: 1140px; line-height: 1.5; }
.sc-scope /* bars */
.sc-bar { fill: #A3ACBA; }
.sc-scope .sc-bar.neg { fill: #D49A93; }
.sc-scope .sc-bar-row.held .sc-bar { fill: var(--accent); }
.sc-scope .sc-bar-row.hl .sc-bar { fill: #D9822B; }
.sc-scope .sc-bar-hit { fill: transparent; }
.sc-scope .sc-bar-row:hover .sc-bar-hit { fill: var(--bg); }
.sc-scope .sc-bar-row { cursor: pointer; }
.sc-scope .sc-bar-name { fill: var(--text); font-size: 11px; }
.sc-scope .sc-bar-row.held .sc-bar-name { fill: var(--accent); font-weight: 600; }
.sc-scope .sc-bar-val { fill: var(--text-2); font-size: 11px; font-family: var(--font-num); }
.sc-scope .sc-clip-mark { fill: var(--surface); stroke: #6B7587; stroke-width: 1; }
.sc-scope /* residual ranking */
.sc-rank { margin-top: 10px; }
.sc-scope .sc-rank-head { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.sc-scope .sc-rank .table-wrap { max-height: 420px; }
.sc-scope .sc-table td, .sc-scope .sc-table th { height: 28px; font-size: 12px; }
.sc-scope .sc-table td.num, .sc-scope .sc-table th.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.sc-scope .sc-table td.muted { color: var(--text-2); }
.sc-scope .sc-table td.pos { color: var(--pos); }
.sc-scope .sc-table td.neg { color: var(--neg); }
.sc-scope .sc-table tr.held td:nth-child(2) { color: var(--accent); font-weight: 600; }
.sc-scope .sc-table tr.hl td { background: #FCEBD9; }
.sc-scope .sc-table tbody tr { cursor: pointer; }
.sc-scope .sc-table tr.sc-gap td { color: var(--text-2); text-align: center; height: 20px; }
.sc-scope .sc-more { margin-top: 6px; color: var(--accent); font-size: 12px; text-decoration: underline; }
.sc-scope .ms-item[hidden], .sc-scope .ms-group[hidden], .sc-scope .ms-panel[hidden], .sc-scope .sc-tip[hidden] { display: none; }
.sc-scope .sc-r2pill { display: inline-flex; align-items: baseline; gap: 2px; margin-left: 10px; padding: 2px 8px;
  border: 1px solid currentColor; font-size: 12px; font-weight: 400; vertical-align: 1px; }
.sc-scope .sc-r2pill strong { font-family: var(--font-num); font-weight: 700; }
.sc-scope .sc-r2pill.strong { color: var(--pos); background: var(--pos-bg); }
.sc-scope .sc-r2pill.moderate { color: #B5651D; background: #FCEBD9; }
.sc-scope .sc-r2pill.weak { color: var(--neg); background: var(--neg-bg); }
.sc-scope .sc-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.sc-scope .sc-presets { gap: 6px; font-size: 12px; }
.sc-scope .sc-presets-lbl { color: var(--text-2); margin-right: 2px; }
.sc-scope .sc-preset { border: 1px solid var(--border); background: var(--surface); padding: 4px 10px; color: var(--accent); font-weight: 600; border-radius: 12px; }
.sc-scope .sc-preset:hover { border-color: var(--accent); background: #EEF2F7; }

/* ---------- Screens tab ---------- */
.sc-scope .scr-seg { display: inline-flex; border: 1px solid var(--border); background: var(--surface); }
.sc-scope .scr-seg button { padding: 7px 14px; font-weight: 600; color: var(--text-2); border-right: 1px solid var(--border); }
.sc-scope .scr-seg button:last-child { border-right: none; }
.sc-scope .scr-seg button.active { background: var(--accent); color: #fff; }
.sc-scope .scr-search { font: inherit; color: var(--text); padding: 6px 9px; border: 1px solid var(--border); background: var(--surface); width: 170px; outline: none; }
.sc-scope .scr-search:focus { border-color: var(--accent); }
.sc-scope .scr-note { margin: 2px 0 8px; max-width: 980px; }
.sc-scope .scr-wrap { max-height: calc(100vh - 250px); max-width: 1240px; }
.sc-scope .scr-table thead th { position: sticky; top: 0; z-index: 3; background: #F1F4F7; height: 30px; }
.sc-scope .scr-sortable { cursor: pointer; user-select: none; }
.sc-scope .scr-sortable:hover { color: var(--accent); }
.sc-scope .scr-sortable.desc::after { content: " ▾"; }
.sc-scope .scr-sortable.asc::after { content: " ▴"; }
.sc-scope .scr-table td.scr-name { cursor: pointer; font-weight: 600; color: var(--text); }
.sc-scope .scr-table td.scr-name:hover { text-decoration: underline; }
.sc-scope .scr-table tr.held td.scr-name { color: var(--accent); }
.sc-scope .scr-table tbody tr { cursor: default; }
.sc-scope .scr-table td.scr-sorted { background: #F6F8FB; font-weight: 700; }
.sc-scope .scr-range-cell { padding-top: 0; padding-bottom: 0; }
.sc-scope .scr-range { display: block; }
.sc-scope .scr-range-line { stroke: #B8C0CC; stroke-width: 3; stroke-linecap: round; }
.sc-scope .scr-range-med { stroke: #5B6678; stroke-width: 2; }
.sc-scope .scr-range-dot { stroke: #fff; stroke-width: 1.5; }
.sc-scope .scr-range-dot.cheap { fill: var(--pos); }
.sc-scope .scr-range-dot.rich { fill: var(--neg); }
.sc-scope .scr-breadth-wrap { margin: 0 0 8px; }
.sc-scope .scr-breadth-lbl { font-size: 11px; color: var(--text-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.sc-scope .scr-breadth { display: flex; flex-wrap: wrap; gap: 5px; }
.sc-scope .scr-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 9px; border: 1px solid var(--border); background: var(--surface); font-size: 11px; border-radius: 11px; }
.sc-scope .scr-chip:hover { border-color: var(--accent); }
.sc-scope .scr-chip strong { font-family: var(--font-num); }
.sc-scope .scr-chip.pos strong { color: var(--pos); }
.sc-scope .scr-chip.neg strong { color: var(--neg); }
.sc-scope .scr-chip-name { color: var(--text-2); }
@media (max-width: 900px) { .sc-scope .scr-wrap { max-height: none; } }
