/* Shared UI components — every screen builds from these. Screen-specific styles live in per-portal css files.
   Consistency rules:
   - Color: white-first, structure is neutral. Green (--accent) only for primary buttons, active/selected state,
     logo and progress; green text/links/icons/focus use --accent-text. Never tint whole sections green.
     Green/orange/red only for real status, shown as a 6px dot inside a neutral badge. No tinted fills.
   - Shape: 6px radius for small inline labels (badge, tag, counter, segmented item); 8px for controls
     (button, input, chip, segmented control); 12px for containers (card, drawer, dropzone). Full pills only for
     progress bars and switches. Numbered markers are one 24px outlined circle.
   - Icons: only in icon-only buttons, inputs, nav and functional controls. No icons in eyebrows, stat labels,
     meta rows, badges, tags or text buttons.
   - Weights: 400 / 500 / 600 only. Avatars and icon boxes are monochrome, except the verification ring.
   - Verification tiers have their own scale (slate → blue → amber, tokens --v1..--v3), used only on verify badges
     and the ring around a verified candidate's avatar. */

/* Page header */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--fg-3); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.page-h h1 { font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.page-h .sub { color: var(--fg-2); margin-top: 5px; max-width: 72ch; }
.page-h .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); min-width: 0; }
.row { display: flex; align-items: center; gap: var(--gap, 12px); min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.between { justify-content: space-between; }
.grid { display: grid; gap: var(--gap, 16px); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g-side { grid-template-columns: 256px minmax(0, 1fr); align-items: start; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--fg-3); }
.soft { color: var(--fg-2); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); color: var(--line); border: 0; margin: 0; }
.section-title { font-size: 13px; font-weight: 600; color: var(--fg-2); }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .g-3, .g-side { grid-template-columns: minmax(0, 1fr); } }
/* Filter sidebars stay pinned under the top navbar while the results scroll; scroll inside if taller than the viewport */
.filter-panel { position: sticky; top: calc(var(--proto-h) + 16px); align-self: start; max-height: calc(100vh - var(--proto-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 900px) { .filter-panel { position: static; max-height: none; overflow: visible; } }
@media (max-width: 640px) { .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); } }

/* Card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card-b { padding: 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card.flat { background: var(--surface-2); }
/* Peer cards in a grid row: body fills the card, .push-end sticks to the bottom so closing actions line up */
.card.fill { display: flex; flex-direction: column; }
.card.fill > .card-b { flex: 1; display: flex; flex-direction: column; }
.card.fill .push-end { margin-top: auto; }
.card.hover { transition: border-color .15s var(--ease); }
.card.hover:hover { border-color: var(--line-strong); }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-soft { background: var(--surface); border-color: var(--line); color: var(--fg); }
.btn-soft:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn-block { width: 100%; }

/* Badges, tags, verification */
/* One badge: outlined, neutral text. Tone only colors the dot (auto-added for ok/warn/danger). */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--line); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.badge .dot { background: var(--fg-3); }
.badge-ok:not(:has(.dot))::before, .badge-warn:not(:has(.dot))::before, .badge-danger:not(:has(.dot))::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge-ok .dot, .badge-ok::before { background: var(--ok); }
.badge-warn .dot, .badge-warn::before { background: var(--warn); }
.badge-danger .dot, .badge-danger::before { background: var(--danger); }
.badge-info .dot, .badge-accent .dot { background: var(--info); }
.vbadge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 6px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.vbadge.v1 { --v: var(--v1); color: var(--v1-text); border-color: var(--v1-line); background: var(--v1-soft); }
.vbadge.v2 { --v: var(--v2); color: var(--v2-text); border-color: var(--v2-line); background: var(--v2-soft); }
.vbadge.v3 { --v: var(--v3); color: var(--v3-text); border-color: var(--v3-line); background: var(--v3-soft); }
.vbadge .ic { color: var(--v); }
.stack > .badge, .stack > .vbadge { align-self: flex-start; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--sunken); font-size: 12.5px; color: var(--fg-2); white-space: nowrap; }

/* Chips (toggle filters) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); transition: border-color .15s var(--ease), background .15s var(--ease); background: var(--surface); color: var(--fg-2); font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--line-strong); color: var(--fg); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 500; }

/* Avatar */
.avatar { --av-size: 36px; width: var(--av-size); height: var(--av-size); border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 600; font-size: calc(var(--av-size) * .36); letter-spacing: -.02em; background: var(--sunken); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--line); }
.avatar-sm { --av-size: 28px; }
/* Verified candidate: tier-colored ring; lg/xl also get a corner tier mark */
.avatar.has-v { --ring: 2px; position: relative; box-shadow: 0 0 0 2px var(--surface), 0 0 0 calc(2px + var(--ring)) var(--v); }
.avatar.has-v.v1 { --v: var(--v1); } .avatar.has-v.v2 { --v: var(--v2); } .avatar.has-v.v3 { --v: var(--v3); }
.avatar-sm.has-v { --ring: 1.5px; }
.avatar-lg.has-v, .avatar-xl.has-v { --ring: 3px; }
.av-v { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--v); color: var(--accent-fg); box-shadow: 0 0 0 2px var(--surface); }
.avatar-xl .av-v { width: 26px; height: 26px; right: -2px; bottom: -2px; }
.avatar-lg { --av-size: 56px; }
.avatar-xl { --av-size: 84px; }
.org { --org-size: 36px; width: var(--org-size); height: var(--org-size); border-radius: var(--r); display: inline-grid; place-items: center; flex: none; background: var(--sunken); border: 1px solid var(--line); color: var(--fg-2); font-size: calc(var(--org-size) * .34); font-weight: 600; letter-spacing: -.02em; }
.org-sm { --org-size: 28px; border-radius: var(--r-sm); }
.org-lg { --org-size: 44px; }
.avatars { display: flex; }
.avatars .avatar { border: 2px solid var(--surface); }
.avatars .avatar + .avatar { margin-left: -9px; }

/* Stat tiles */
.stat { padding: 16px 18px; }
.stat .label { font-size: 12.5px; color: var(--fg-3); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.stat .delta { font-size: 12px; margin-top: 3px; color: var(--fg-3); }
.up { color: var(--ok); }
.down { color: var(--danger); }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--fg-3); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
/* Empty / not-applicable cell: one quiet placeholder everywhere */
.empty-cell { color: var(--fg-3); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--fg); }
.label .opt { font-weight: 400; color: var(--fg-3); }
.hint { font-size: 12.5px; color: var(--fg-3); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--fg); font: inherit; font-size: 14px; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--fg-3); min-width: 0; }
.input-group input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 14px; color: var(--fg); }
.input-group .suffix { font-size: 12.5px; color: var(--fg-3); white-space: nowrap; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r); background: var(--sunken); }
.seg > button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fg-2); white-space: nowrap; }
.seg > button.is-active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px var(--shadow-c); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.switch { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(14px); }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* Option cards & icon boxes */
.option { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.option:hover { border-color: var(--line-strong); }
.option.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.icon-box { width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; flex: none; background: var(--surface); color: var(--fg-2); border: 1px solid var(--line); }
.icon-box.sm { width: 32px; height: 32px; border-radius: 8px; }

/* Tabs — do not nest [data-tabs] containers */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { border: 0; background: transparent; padding: 10px 12px; font-size: 13.5px; font-weight: 500; color: var(--fg-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; background: var(--sunken); border-radius: 6px; padding: 1px 7px; color: var(--fg-2); }

/* Progress, pipeline, score ring */
.progress { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.progress.gold > span { background: var(--accent); }
.progress.warn > span { background: var(--warn); }
.pipe { display: inline-flex; gap: 3px; }
.pipe i { width: 16px; height: 5px; border-radius: 3px; background: var(--line); }
.pipe i.on { background: var(--accent); }
.score { display: inline-flex; align-items: baseline; gap: 1px; flex: none; font-size: 15px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.score small { font-size: .7em; font-weight: 500; color: var(--fg-3); }
.score.lg { font-size: 28px; letter-spacing: -.03em; }

/* Wizard steps */
.steps { display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; gap: 0; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-3); white-space: nowrap; flex: none; }
.step + .step::before { content: ""; width: 32px; height: 1.5px; background: var(--line-strong); margin: 0 10px; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: var(--fg-2); font-size: 12px; font-weight: 600; flex: none; background: var(--surface); }
.step.is-done .n { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.step.is-current { color: var(--fg); font-weight: 600; }
.step.is-current .n { border-color: var(--accent); color: var(--accent-text); }

/* Lists, key-value */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--fg-3); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--fg-3); font-size: 12.5px; }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }

/* Notes — one neutral callout; tone only colors the icon */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--fg-2); }
.note .ic { margin-top: 1px; color: var(--fg-3); }
.note-warn .ic { color: var(--warn); }
.note-danger .ic { color: var(--danger); }
.note-ok .ic { color: var(--ok); }

/* Timeline */
.timeline { position: relative; display: flex; flex-direction: column; gap: 16px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-item.is-done::before { background: var(--accent); border-color: var(--accent); }
.tl-item.is-current::before { border-color: var(--accent); }

/* Hidden / masked information (privacy before unlock) */
.mask { background: var(--line); color: transparent; border-radius: 4px; user-select: none; }
.lock-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--fg-3); }

/* Filters panel */
.filters { display: flex; flex-direction: column; gap: 20px; }
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-group h4 { font-size: 13px; color: var(--fg); font-weight: 600; letter-spacing: 0; }

/* Row status + action (TH.sa): two fixed columns so badges and buttons line up row to row in any list.
   One kind of action button (outlined .btn-sm); secondary actions go in the row text as .text-btn. */
.sa { display: grid; grid-template-columns: 148px 132px; align-items: center; column-gap: 12px; flex: none; }
.sa.compact { grid-template-columns: 148px; }
.sa.is-score { grid-template-columns: 48px 132px; }
.sa.is-score .sa-s { text-align: right; }
.sa-a .btn { width: 100%; }
.text-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.text-btn.small { font-size: 12.5px; font-weight: 500; }
@media (max-width: 640px) {
  .sa, .sa.is-score, .sa.compact { grid-template-columns: auto auto; justify-content: start; }
  .sa.is-score .sa-s { text-align: left; }
  .sa-a .btn { width: auto; }
}

/* Modal & toast */
.modal-backdrop { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 80; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg); }
.toast { position: fixed; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 90; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }

/* ---------- Icon discipline (see rules at top) ---------- */
.eyebrow .ic, .stat .label .ic, .meta .ic, .badge .ic, .tag .ic, .section-title .ic,
.card-h h2 .ic, .card-h h3 .ic, .btn:not(.btn-icon) > .ic, .list-item > .icon-box, .kv .ic { display: none; }
.meta { gap: 4px 0; margin-left: -20px; clip-path: inset(-6px -6px -6px 20px); }
.meta > span::before { content: "•"; display: inline-block; width: 20px; margin-right: -5px; text-align: center; color: var(--line-strong); }
.rating { font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.rating small { font-weight: 400; color: var(--fg-3); }
