/* ==========================================================================
   Smart CV design system

   Three surfaces, one accent, a 4px spacing scale. Flat throughout: no
   gradients, no shadows except focus rings. Every colour is a variable so
   dark mode is one media query rather than a second stylesheet.
   ========================================================================== */

:root {
    --surface-0: #f7f7f5;   /* page */
    --surface-1: #ffffff;   /* card */
    --surface-2: #ffffff;   /* top bar */
    --surface-sunken: #f1efe8;

    --text: #1c1c1a;
    --text-2: #5f5e5a;
    --text-3: #888780;

    --border: rgba(0, 0, 0, 0.10);
    --border-strong: rgba(0, 0, 0, 0.18);

    --accent: #185fa5;
    --accent-bg: #e6f1fb;
    --accent-text: #0c447c;

    --success: #3b6d11;
    --success-bg: #eaf3de;
    --warning: #854f0b;
    --warning-bg: #faeeda;
    --danger: #a32d2d;
    --danger-bg: #fcebeb;

    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar: 236px;
    --topbar: 48px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --surface-0: #1a1a18;
        --surface-1: #232321;
        --surface-2: #232321;
        --surface-sunken: #2c2c2a;
        --text: #f0efe9;
        --text-2: #b4b2a9;
        --text-3: #888780;
        --border: rgba(255, 255, 255, 0.11);
        --border-strong: rgba(255, 255, 255, 0.20);
        --accent: #85b7eb;
        --accent-bg: #0c447c;
        --accent-text: #b5d4f4;
        --success: #c0dd97;  --success-bg: #27500a;
        --warning: #fac775;  --warning-bg: #633806;
        --danger:  #f7c1c1;  --danger-bg:  #791f1f;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--surface-0);
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 19px; font-weight: 500; margin: 0; }
h2 { font-size: 16px; font-weight: 500; margin: 0; }
p  { margin: 0; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 12px;
       background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; }

/* Utilities ------------------------------------------------------------- */
.sub      { font-size: 13px; color: var(--text-2); }
.meta     { font-size: 12px; color: var(--text-2); }
.muted    { color: var(--text-3); }
.warn     { color: var(--warning); }
.bad      { color: var(--danger); }
.good     { color: var(--success); }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.stack-sm > * + * { margin-top: var(--s2); }
.spacer   { flex: 1; }

/* Shell ----------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    padding: var(--s3) var(--s2);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: var(--s2);
         padding: var(--s1) var(--s3) var(--s3); font-weight: 500; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-bg);
              color: var(--accent-text); display: flex; align-items: center;
              justify-content: center; font-size: 12px; }

.nav-section { font-size: 11px; color: var(--text-3); letter-spacing: .04em;
               padding: 0 var(--s3); margin: var(--s4) 0 var(--s1); }
.nav { display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s3);
       border-radius: var(--radius); font-size: 13px; color: var(--text-2);
       text-decoration: none; transition: background .12s; }
.nav:hover { background: var(--surface-sunken); text-decoration: none; }
.nav.on { background: var(--surface-sunken); color: var(--text); font-weight: 500; }
.nav-icon { width: 16px; text-align: center; flex-shrink: 0; opacity: .8; }

.userbox { border-top: 1px solid var(--border); padding-top: var(--s3); margin-top: var(--s3);
           display: flex; align-items: center; gap: var(--s2); }
.linkbtn { background: none; border: none; padding: 0; font: inherit; font-size: 12px;
           color: var(--text-2); cursor: pointer; }
.linkbtn:hover { color: var(--text); }

/* Top bar and breadcrumb ------------------------------------------------ */
.topbar { height: var(--topbar); display: flex; align-items: center;
          justify-content: space-between; padding: 0 var(--s5);
          background: var(--surface-2); border-bottom: 1px solid var(--border);
          position: sticky; top: 0; z-index: 10; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumb-sep { color: var(--text-3); }
.crumb-current { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: var(--s3); }
.quickfind { width: 260px; }
.quickfind input { height: 30px; padding: 0 11px 0 30px; font-size: 13px; }
.quickfind .ico { top: 6px; }

/* Fills the viewport. Wide monitors get more columns rather than more margin;
   the grids below are all auto-fit, so the extra width becomes content. */
.content { padding: var(--s5) var(--s6); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
             gap: var(--s4); margin-bottom: var(--s4); }
.page-head .sub { margin-top: 2px; }

/* Controls -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--s3);
       border: 1px solid var(--border-strong); border-radius: var(--radius);
       background: var(--surface-1); color: var(--text); font: inherit; font-size: 13px;
       cursor: pointer; text-decoration: none; transition: background .12s; }
.btn:hover { background: var(--surface-sunken); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: rgba(163, 45, 45, 0.35); }
.btn.danger:hover { background: var(--danger-bg); }
.spacer-form { margin-left: auto; }
.btn.on { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.btn.sm { height: 27px; font-size: 12px; padding: 0 10px; }
.btn.full { width: 100%; justify-content: center; }

/* Matched by exclusion, not by listing types.
 *
 * `input[type=text]` does not match `<input name="Host" />` — an input with no
 * type attribute defaults to text in behaviour but has no attribute to match
 * on. Nine fields across Settings, Users and the search editor were therefore
 * rendering at the browser's default width beside styled ones, which is why the
 * Users form had a wide Email between two narrow boxes.
 *
 * Excluding the handful that must not be full-width is shorter than listing the
 * dozen that should be, and it cannot go stale when a new type is used. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]),
textarea, select {
    width: 100%; padding: 8px 11px; font: inherit; font-size: 13.5px;
    color: var(--text); background: var(--surface-1);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
textarea { resize: vertical; line-height: 1.6; }
label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: var(--s1); }

.field-icon { position: relative; }
.field-icon input { padding-left: 32px; }
.field-icon .ico { position: absolute; left: 10px; top: 8px; color: var(--text-3); font-size: 14px; }

/* Cards and metrics ----------------------------------------------------- */
.card { background: var(--surface-1); border: 1px solid var(--border);
        border-radius: var(--radius-lg); padding: var(--s4) var(--s4); margin-bottom: var(--s3); }
.card-head { display: flex; align-items: baseline; justify-content: space-between;
             gap: var(--s3); margin-bottom: var(--s3); }
.card-title { font-size: 14px; font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
        gap: var(--s3); margin-bottom: var(--s4); }
.kpi { display: block; background: var(--surface-1); border: 1px solid var(--border);
       border-radius: var(--radius-lg); padding: var(--s3) var(--s4);
       color: inherit; text-decoration: none; transition: border-color .12s, background .12s; }
a.kpi:hover { border-color: var(--border-strong); background: var(--surface-sunken);
              text-decoration: none; }
.kpi.attention { border-color: var(--warning); }
.kpi-label { font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.kpi-value { font-size: 23px; font-weight: 500; line-height: 1.2; }
.kpi-delta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* Dashboard: range selector, skill list, activity feed --------------------- */
.range { display: flex; gap: 2px; background: var(--surface-sunken);
         border-radius: var(--radius); padding: 2px; }
.range-btn { border: none; background: transparent; font: inherit; font-size: 12px;
             padding: 4px 10px; border-radius: 6px; color: var(--text-2); cursor: pointer; }
.range-btn:hover { color: var(--text); }
.range-btn.on { background: var(--surface-1); color: var(--text); }

/* A list rather than a bar chart: the reason to look at this is to decide
   whether to search for one of them, so every row is a link. */
.skill-list { display: flex; flex-direction: column; }
.skill-row { display: flex; align-items: center; gap: var(--s3); padding: 7px var(--s2);
             border-radius: var(--radius); color: inherit; text-decoration: none; }
.skill-row:hover { background: var(--surface-sunken); text-decoration: none; }
.skill-name { font-size: 13px; width: 130px; flex-shrink: 0; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
.skill-bar { flex: 1; height: 5px; background: var(--surface-sunken);
             border-radius: 3px; overflow: hidden; }
.skill-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.skill-count { font-size: 12px; color: var(--text-2); width: 32px; text-align: right;
               font-variant-numeric: tabular-nums; }

.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: flex-start; gap: var(--s3); padding: 9px 0;
            border-top: 1px solid var(--border); }
.feed-row:first-child { border-top: none; padding-top: 0; }
.feed-icon { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
             display: flex; align-items: center; justify-content: center; font-size: 11px;
             background: var(--surface-sunken); color: var(--text-2); }
.feed-icon.good { background: var(--success-bg); color: var(--success); }
.feed-icon.warn { background: var(--warning-bg); color: var(--warning); }
.feed-icon.bad  { background: var(--danger-bg);  color: var(--danger); }
.feed-subject { font-size: 13px; }

/* Badges ---------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
         padding: 2px 8px; border-radius: var(--radius); background: var(--surface-sunken);
         color: var(--text-2); white-space: nowrap; }
.badge.ok   { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.bad  { background: var(--danger-bg);  color: var(--danger); }
.badge.info { background: var(--accent-bg);  color: var(--accent-text); }
.badge-count { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: var(--radius);
               background: var(--warning-bg); color: var(--warning); }

/* Rows: the dense list pattern ------------------------------------------ */
.list { background: var(--surface-1); border: 1px solid var(--border);
        border-radius: var(--radius-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
       border-bottom: 1px solid var(--border); transition: background .12s; }
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-sunken); }
.row:hover .row-actions { opacity: 1; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; }
.row-actions { opacity: 0; display: flex; gap: var(--s2); transition: opacity .12s; }
.row.dimmed { opacity: .6; }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
          display: flex; align-items: center; justify-content: center;
          font-size: 11.5px; background: var(--surface-sunken); color: var(--text-2); }
.avatar.accent { background: var(--accent-bg); color: var(--accent-text); }

/* Tables ---------------------------------------------------------------- */
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--text-3);
           letter-spacing: .03em; padding: var(--s2) var(--s3);
           border-bottom: 1px solid var(--border); }
.grid td { padding: var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--surface-sunken); }
.kv { font-size: 13px; width: 100%; }
.kv td { padding: 5px 0; vertical-align: top; }
.kv td:first-child { color: var(--text-2); width: 150px; }

/* Empty states ---------------------------------------------------------- */
.empty { background: var(--surface-1); border: 1px solid var(--border);
         border-radius: var(--radius-lg); padding: var(--s5); }
.empty-title { font-size: 15px; margin-bottom: 2px; }
.steps { margin-top: var(--s3); }
.step { display: flex; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); }
.step-num { width: 21px; height: 21px; border-radius: 50%; flex-shrink: 0;
            background: var(--accent-bg); color: var(--accent-text); font-size: 11px;
            display: flex; align-items: center; justify-content: center; }

/* Upload ---------------------------------------------------------------- */
.dropzone { display: block; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
            padding: var(--s5) var(--s4); text-align: center; background: var(--surface-1);
            cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.dz-title { font-size: 14.5px; margin-bottom: 2px; }
.progress { height: 3px; background: var(--surface-sunken); border-radius: 2px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }

/* Search results -------------------------------------------------------- */
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: var(--radius);
        background: var(--accent-bg); color: var(--accent-text); }
.chip.soft { background: var(--surface-sunken); color: var(--text-2); }
.chip.lang { background: #eeedfe; color: #3c3489; }
.chip.place { background: #e1f5ee; color: #085041; }
.chip.worked { background: #faece7; color: #993c1d; }
.chip.edu { background: #fbeaf0; color: #993556; }
.chip.exclude { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; }
.chip.filter { cursor: pointer; background: var(--surface-sunken); color: var(--text-2);
               border: 1px solid transparent; }
.chip.filter.on { background: var(--accent-bg); color: var(--accent-text); }

.ccard { background: var(--surface-1); border: 1px solid var(--border);
         border-radius: var(--radius-lg); padding: var(--s4); margin-bottom: var(--s3); }
.ccard.top { border: 2px solid var(--accent); padding: 15px; }
.ccard-head { display: flex; align-items: center; gap: var(--s3); }
.score { text-align: right; flex-shrink: 0; }
.score-num { font-size: 21px; font-weight: 500; line-height: 1.1; }
.score-label { font-size: 11px; color: var(--text-3); }
/* Six components on every card. Tight enough that a wall of them stays
   scannable, and each carries its number so nothing needs a hover to read. */
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
        gap: var(--s2) var(--s3); margin: var(--s3) 0 var(--s2); }
.bar-item { min-width: 0; }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.bar-label { font-size: 11px; color: var(--text-2); white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; }
.bar-value { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-value.zero { color: var(--warning); }
.bar-item.na { opacity: .45; }
.bar-item.na .bar { background: transparent; border-top: 1px dashed var(--border-strong); height: 0; }
.bar { height: 4px; background: var(--surface-sunken); border-radius: 2px;
       overflow: hidden; margin-top: 3px; }
.bar > div { height: 100%; border-radius: 2px; }
.fill-high { background: var(--success); }
.fill-mid  { background: #ef9f27; }
.fill-low  { background: #d85a30; }
/* A zero-width bar shows nothing, so the track itself carries the signal. Done
   with a class rather than :has(), which is recent enough to be worth avoiding
   for something load-bearing. */
.bar.empty { background: var(--danger-bg); }
.fill-none { background: transparent; }
.explain { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: var(--s3); }
.missing { font-size: 12px; color: var(--warning); margin-top: var(--s2); }
.actions { display: flex; gap: var(--s2); margin-top: var(--s3); }

/* Profile --------------------------------------------------------------- */
.profile-grid { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
                gap: var(--s3); align-items: start; }

/* Taller now that it is the point of the page rather than one panel among
   six. Enough to read a page of a CV without scrolling inside the frame. */
.profile-grid .pdf-frame { height: 780px; }

@media (max-width: 1000px) {
    .profile-grid { grid-template-columns: 1fr; }
    .profile-grid .pdf-frame { height: 560px; }
}
.entry { padding: var(--s3) 0; border-top: 1px solid var(--border); }
.entry:first-of-type { border-top: none; padding-top: 0; }
/* Version history rows. Each is the control for switching to that version, so
   it gets a hit area and a hover state rather than being a label with a link
   buried in it. */
.vrow { display: block; padding: 11px 13px; border: 1px solid var(--border);
        border-radius: var(--radius); margin-bottom: var(--s2);
        color: inherit; text-decoration: none;
        transition: border-color .12s, background .12s; }
.vrow:hover { border-color: var(--border-strong); background: var(--surface-sunken);
              text-decoration: none; }
.vrow:last-child { margin-bottom: 0; }

/* A border, not a tint. A tint reads as a status; a border reads as "you are
   here", which is what it means. 2px with 1px less padding so the row does not
   shift when selected. */
.vrow.on { border: 2px solid var(--accent); padding: 10px 12px; }

.vhead { display: flex; align-items: baseline; justify-content: space-between;
         gap: var(--s2); margin-bottom: 3px; }
.vno { font-size: 14px; font-weight: 500; }
.vno .badge { margin-left: 6px; }
.vwhen { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.vmeta { font-size: 12px; color: var(--text-3); }
.vchange { font-size: 12px; color: var(--accent); margin-top: 4px; }
.entry-title { font-size: 13.5px; }
.entry-body { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: var(--s1); }
.pdf-frame { width: 100%; height: 620px; border: 1px solid var(--border); border-radius: var(--radius); }
.banner { background: var(--warning-bg); color: var(--warning); padding: 10px var(--s4);
          border-radius: var(--radius); font-size: 13px; margin-bottom: var(--s4); }

.spend { font-size: 15px; margin-top: var(--s4); }
.spend strong { font-weight: 500; font-size: 19px; }

/* Users ------------------------------------------------------------------- */
/* Two columns, not three. The password field carries a forty-character hint,
   and a third of the row is not enough space to read it. */
.user-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
             gap: var(--s3); }
.user-meta { display: flex; flex-direction: column; align-items: flex-end;
             gap: 2px; font-size: 12px; color: var(--text-2); text-align: right;
             flex-shrink: 0; }

@media (max-width: 720px) { .user-meta { display: none; } }

/* Sharing ----------------------------------------------------------------- */
.share-form label { margin-top: 0; }
.share-actions { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.share-url { display: block; margin-top: 6px; word-break: break-all; font-size: 11.5px; }
.warn-banner { background: var(--danger-bg); color: var(--text); }
.feedback-list .entry:first-of-type { border-top: 1px solid var(--border); padding-top: var(--s3); }

/* Versions on the profile: latest open, older collapsed. */
.version-doc { border: 1px solid var(--border); border-radius: var(--radius);
               padding: 10px 12px; margin-bottom: var(--s2); }
.version-doc[open] { border-color: var(--border-strong); }
.version-doc summary { display: flex; align-items: center; justify-content: space-between;
                       gap: var(--s2); cursor: pointer; font-size: 13px; }
.version-doc summary::-webkit-details-marker { display: none; }
.version-doc .badge { margin-left: 6px; }

/* The shared page. No navigation — it reaches one candidate and nothing else. */
.shared-body { background: var(--surface-0); }
.shared-bar { display: flex; align-items: center; gap: var(--s2);
              padding: 11px var(--s5); background: var(--surface-1);
              border-bottom: 1px solid var(--border); }
.shared-main { padding: var(--s5); max-width: 1100px; margin: 0 auto; }
.shared-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
                 gap: var(--s3); align-items: start; }

.verdicts { display: flex; gap: 7px; margin: 9px 0 12px; }
.verdict { flex: 1; margin: 0; }
.verdict input { position: absolute; opacity: 0; width: 0; }
.verdict span { display: block; text-align: center; padding: 9px 0; font-size: 13px;
                border: 1px solid var(--border-strong); border-radius: var(--radius);
                cursor: pointer; transition: background .12s, border-color .12s; }
.verdict input:checked + span { border: 2px solid var(--success); padding: 8px 0;
                                background: var(--success-bg); color: var(--success); }
.verdict input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-bg); }

@media (max-width: 900px) { .shared-layout { grid-template-columns: 1fr; } }

/* Charts ---------------------------------------------------------------- */
.chart-wrap { position: relative; height: 260px; }
.chart-wrap.short { height: 200px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
            gap: var(--s3); }

.chart-empty { display: flex; align-items: center; justify-content: center;
               height: 100%; text-align: center; color: var(--text-3); font-size: 13px; }

/* Forms in cards -------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3); }
.inline-form { display: flex; gap: var(--s2); align-items: center; }
.inline-form input { flex: 1; }

/* Results: criteria panel beside the candidates ---------------------------- */
.results-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr);
                  gap: var(--s3); align-items: start; }

/* Sticky is the reason this is a panel and not a header: you are checking each
   candidate against the criteria, so they must not scroll away. */
.criteria-panel { position: sticky; top: calc(var(--topbar) + var(--s3));
                  padding: var(--s4); }
.crit-group { margin-bottom: 13px; }
.crit-group:last-of-type { margin-bottom: 0; }
.crit-group-label { font-size: 10.5px; letter-spacing: .05em; color: var(--text-3);
                    margin-bottom: 5px; }
.crit-group .k { margin: 0 3px 3px 0; display: inline-block; }
.crit-role { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.crit-foot { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border); }

/* Met and missed, in the criteria's own words. */
.match-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.m { font-size: 11px; padding: 2px 7px; border-radius: 4px; }
.m.y { background: var(--success-bg); color: var(--success); }
.m.n { background: var(--danger-bg); color: var(--danger); }

/* Collapsed by default. The chips answer the question the bars were being used
   for; the weighting detail is for someone auditing a ranking. */
.breakdown { margin-top: var(--s3); }
.breakdown summary { font-size: 12px; color: var(--text-2); cursor: pointer; }
.breakdown summary:hover { color: var(--text); }
.breakdown[open] summary { margin-bottom: var(--s2); }

@media (max-width: 1000px) {
    /* A 240px column leaves the cards too narrow to read on a laptop, so the
       criteria become a card above them instead. */
    .results-layout { grid-template-columns: 1fr; }
    .criteria-panel { position: static; }
}

/* Saved searches ---------------------------------------------------------- */
.srow { background: var(--surface-1); border: 1px solid var(--border);
        border-radius: var(--radius-lg); padding: var(--s3) var(--s4); margin-bottom: var(--s2); }
.srow.run { border-color: var(--accent); }
.shead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.sname { font-size: 14px; font-weight: 500; }
.scrit { font-size: 12px; color: var(--text-2); margin-top: 5px; }
.acts { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); flex-wrap: wrap; }
.acts form { display: inline; }
.prog-line { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
             font-size: 12px; color: var(--text-2); margin-top: 7px; }
.prog-line strong { font-weight: 500; color: var(--text); }
.tag { font-size: 11px; padding: 2px 7px; border-radius: var(--radius);
       background: var(--surface-sunken); color: var(--text-2); }

/* Search editor ----------------------------------------------------------- */
.editor { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
          gap: var(--s3); align-items: start; }

.sec-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: 3px; }
.sec-num { width: 19px; height: 19px; border-radius: 50%; flex-shrink: 0;
           background: var(--surface-sunken); color: var(--text-2); font-size: 11px;
           display: flex; align-items: center; justify-content: center; }
.sec-title { font-size: 14px; font-weight: 500; }
.sec-note { font-size: 11.5px; color: var(--text-3); margin: 0 0 13px 27px; }

/* One grid for the whole block rather than a grid per row, so every row's
   columns line up even when a label wraps. The partial emits three cells and
   no wrapper for exactly this reason. */
.crit { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--s2) 10px; align-items: center; }
.crit > .col-inc, .crit > .col-exc,
.crit > .col-pref, .crit > .col-avoid {
    font-size: 10.5px; letter-spacing: .05em; padding-bottom: 1px;
}
.crit-label { font-size: 12.5px; color: var(--text-2); margin: 0; }
.col-inc { color: var(--success); }
.col-exc { color: var(--danger); }
.col-pref { color: var(--accent); }
.col-avoid { color: var(--text-3); }

/* Tinted, not just outlined. Faint enough to stay calm, strong enough to see
   which column the cursor is in without reading the header. */
.inc-field { background: rgba(59, 109, 17, 0.045); border-color: rgba(59, 109, 17, 0.30); }
.exc-field { background: rgba(163, 45, 45, 0.035); border-color: rgba(163, 45, 45, 0.25); }
.inc-field:focus, .exc-field:focus { background: var(--surface-1); }

/* Attached to the last card so Save sits where the form ends. */
.form-bar { display: flex; gap: var(--s2); align-items: center;
            margin: var(--s4) calc(var(--s4) * -1) 0;
            padding: 11px var(--s4); border-top: 1px solid var(--border);
            background: var(--surface-sunken);
            border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.summary { position: sticky; top: calc(var(--topbar) + var(--s3)); }
.sum p { font-size: 13px; line-height: 1.75; margin-bottom: 9px; }
.sum p:last-child { margin-bottom: 0; }
.sum em { color: var(--text-2); font-style: normal; }
.k { padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.k.inc { background: var(--success-bg); color: var(--success); }
.k.exc { background: var(--danger-bg); color: var(--danger); }
.k.pref { background: var(--accent-bg); color: var(--accent-text); }
.summary-foot { margin-top: var(--s4); padding-top: 11px; border-top: 1px solid var(--border); }

@media (max-width: 1000px) {
    .editor { grid-template-columns: 1fr; }
    .summary { position: static; }
}
@media (max-width: 640px) {
    .crit { grid-template-columns: 1fr; gap: 4px; }
    .crit > .col-inc, .crit > .col-exc,
    .crit > .col-pref, .crit > .col-avoid { display: none; }
}

/* Auth ------------------------------------------------------------------ */
.auth-body { background: var(--surface-0); display: flex; align-items: center;
             justify-content: center; min-height: 100vh; padding: var(--s4); }
.auth-split { display: grid; grid-template-columns: 300px 380px; border: 1px solid var(--border);
              border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-1); }
.auth-brand { background: var(--accent-bg); color: var(--accent-text);
              padding: var(--s6) var(--s5); display: flex; flex-direction: column; }
.auth-headline { font-size: 19px; line-height: 1.35; margin-bottom: var(--s2); }
.auth-points { list-style: none; padding: 0; margin: var(--s5) 0 0; font-size: 13px; }
.auth-points li { display: flex; align-items: center; gap: var(--s2); margin-bottom: 10px; }
.auth-form { padding: var(--s6) var(--s5); }
.auth-form.standalone { border: 1px solid var(--border); border-radius: var(--radius-lg);
                        background: var(--surface-1); max-width: 420px; }
.auth-error { background: var(--danger-bg); color: var(--danger); font-size: 13px;
              padding: 9px var(--s3); border-radius: var(--radius); margin-top: var(--s3); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px;
         color: var(--text-2); margin: var(--s4) 0; }
.check input { width: auto; }
.divider { display: flex; align-items: center; gap: 10px; margin: var(--s4) 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 12px; color: var(--text-3); }

.auth-foot { margin-top: var(--s5); }
.dev-box { margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1px dashed var(--border-strong);
           border-radius: var(--radius); background: var(--surface-sunken); }
.dev-title { font-size: 11px; font-weight: 500; color: var(--text-2);
             letter-spacing: .04em; margin-bottom: var(--s2); }
.dev-creds { font-size: 13px; width: 100%; }
.dev-creds td:first-child { color: var(--text-2); width: 76px; }

/* htmx ------------------------------------------------------------------ */
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: .5; }

/* Toast ----------------------------------------------------------------- */
.toast-host { position: fixed; bottom: var(--s5); right: var(--s5); display: flex;
              flex-direction: column; gap: var(--s2); z-index: 50; }
.toast { background: var(--surface-1); border: 1px solid var(--border-strong);
         border-radius: var(--radius); padding: 10px var(--s4); font-size: 13px;
         animation: toast-in .18s ease-out; }
.toast.ok  { border-color: var(--success); color: var(--success); }
.toast.bad { border-color: var(--danger);  color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; }
    .nav-section, .userbox { display: none; }
    .profile-grid, .two-col { grid-template-columns: 1fr; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}
