/* ==========================================================================
   Jet HR — Оценка 1.2 — Refined Corporate Design System
   Internal YUSR Group fintech tool. Light theme. Editorial / premium.
   Hand-written, no build step.
   --------------------------------------------------------------------------
   Sections:
     1. Design tokens (:root)
     2. Reset & base
     3. Typography
     4. Layout (top-bar, header, container, footer)
     5. Components (buttons, cards, badges, chips, tables, forms, flash)
     6. Page-specific (login, results matrix, segmented control)
     7. Motion (page-load animation, reduced-motion)
   ========================================================================== */

/* 1. Design tokens ------------------------------------------------------- */
:root {
    /* Surfaces */
    --paper: #F5F3EE;          /* warm paper background */
    --surface: #FFFFFF;        /* cards / panels */
    --surface-2: #FBFAF6;      /* subtly recessed panels */

    /* Ink */
    --ink: #16181D;            /* primary text */
    --muted: #6A6E78;          /* secondary text */
    --line: #E4E0D7;           /* hairline borders */
    --line-strong: #D6D1C5;

    /* Accent — deep green */
    --accent: #15543F;
    --accent-hover: #0E3F2F;
    --accent-soft: #E7EEE9;    /* tint */
    --accent-ink: #0E3F2F;

    /* Score semantics */
    --below: #B0553C;          /* clay — below / 0.8 */
    --below-soft: #F4E6E0;
    --meets: #4F5663;          /* slate — meets / 1.0 */
    --meets-soft: #E7E9EE;
    --meets-line: #C9CDD6;     /* meets chip border (clearly ≠ empty) */
    --above: #2E7D5B;          /* green — above / 1.2 */
    --above-soft: #E2EFE8;

    /* Status */
    --warn: #B0553C;
    --warn-soft: #F6E9E3;

    /* Radius & shadow */
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.10);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);

    /* Type */
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Spacing scale */
    --container: 1100px;
}

/* 2. Reset & base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img, svg { max-width: 100%; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 3. Typography ---------------------------------------------------------- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 560;
    color: var(--ink);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 .5em;
}
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.7rem); font-weight: 600; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; }

.eyebrow,
.label-caps {
    font-family: var(--font-body);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 .35rem;
}

.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }

/* 4. Layout -------------------------------------------------------------- */
.topbar-accent {
    height: 3px;
    background: var(--accent);
    width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,.86);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: .85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: .5rem;
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1;
}
.wordmark:hover { color: var(--ink); }
.wordmark__name {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}
.wordmark__sub {
    font-family: var(--font-body);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    padding-left: .55rem;
    border-left: 1px solid var(--line-strong);
}

.site-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .35rem;
}
.site-nav a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--ink);
    padding: .45rem .8rem;
    border-radius: var(--radius-sm);
    transition: background .15s ease, color .15s ease;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.site-nav a.nav-hr { color: var(--accent); }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3.5rem;
    flex: 1 0 auto;
}

.page-head { margin-bottom: 2rem; }
.page-head h1 { margin-bottom: .25rem; }

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: .82rem;
}
.site-footer__inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 1.4rem 1.5rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

/* 5. Components ----------------------------------------------------------- */

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem 1.75rem;
}
.card + .card { margin-top: 1.25rem; }
.card__title { margin-bottom: 1rem; }

/* Buttons
   The shared box model (size, padding, radius, flex centring) applies to every
   button-like element — primary .btn, .btn-secondary, .btn-ghost, and bare
   <button>s — so link-buttons (<a class="btn-secondary">) and real buttons stay
   pixel-identical. Colour treatment is layered on top per variant. */
.btn,
.btn-secondary,
.btn-ghost,
button[type="submit"],
.container button {
    font-family: var(--font-body);
    font-size: .92rem;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
    box-shadow: var(--shadow-sm);
}
.btn:hover,
button[type="submit"]:hover,
.container button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.btn:active,
.btn-secondary:active,
.btn-ghost:active,
button[type="submit"]:active,
.container button:active { transform: translateY(1px); }

/* Secondary / ghost: same box, inverted (outlined) colour treatment. */
.btn-ghost,
.btn-secondary,
.container button.btn-ghost,
.container button.btn-secondary {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}
.btn-ghost:hover,
.btn-secondary:hover,
.container button.btn-ghost:hover,
.container button.btn-secondary:hover {
    background: var(--accent-soft);
    color: var(--accent-ink);
    border-color: var(--accent);
}

/* Disabled affordance for any button-like control. */
.btn:disabled, .btn-secondary:disabled, .btn-ghost:disabled,
button:disabled, .container button:disabled,
.btn[aria-disabled="true"] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

a.btn-link {
    font-weight: 600;
    font-size: .92rem;
}

/* Inline text-style button (e.g. the per-row "Удалить" action). Matches the
   anchor variant but works on a real <button> inside a form. */
button.btn-link {
    background: none;
    border: 0;
    padding: 0;
    width: auto;
    min-height: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: .92rem;
    color: var(--accent);
}
button.btn-link:hover { text-decoration: underline; }
.btn-link--danger { color: #b42318; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
}
.back-link:hover { color: var(--accent); }

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.75rem;
}

/* Badges / pills */
.badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-body);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .3rem .6rem;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1;
}
.badge--draft  { background: var(--meets-soft); color: var(--meets); border-color: #DADDE2; }
.badge--active { background: var(--above-soft); color: var(--above); border-color: #BFDFCF; }
.badge--closed { background: #ECEAE3; color: var(--ink); border-color: var(--line-strong); }

/* Profile badge (results hero) */
.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.profile-badge::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: currentColor;
}
.profile-risk   { background: var(--below-soft); color: var(--below); border-color: #E6CBC0; }
.profile-meets  { background: var(--meets-soft); color: var(--meets); border-color: #D6DAE0; }
.profile-exceeds{ background: var(--above-soft); color: var(--above); border-color: #BFDFCF; }

/* Score chips */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.9rem;
    padding: .25rem .55rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums lining-nums;
    font-size: .9rem;
    border: 1px solid transparent;
}
.chip--below { background: var(--below-soft); color: var(--below); border-color: #E6CBC0; }
.chip--meets { background: var(--meets-soft); color: var(--meets); border-color: var(--meets-line); }
.chip--above { background: var(--above-soft); color: var(--above); border-color: #BFDFCF; }
.chip--empty { background: transparent; color: var(--line-strong); border-color: transparent; min-width: 0; }

/* Tables */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    /* Allow wide tables to scroll horizontally inside the wrapper on narrow
       screens instead of clipping or breaking the page layout. */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .94rem;
}
table.data thead th {
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data tbody td {
    padding: .8rem 1.1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { font-variant-numeric: tabular-nums lining-nums; }

/* Forms */
label { font-size: .95rem; }
.field { margin-bottom: 1.25rem; }
.field > label,
.field-label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .4rem;
}
input[type="text"],
input[type="date"],
input[type="email"],
select,
textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: .95rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: .65rem .8rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus,
input[type="date"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 3rem; }
select { width: auto; min-width: 12rem; }

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    margin: 0 0 1.25rem;
    background: var(--surface);
}
legend {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0 .5rem;
}

/* Checkbox list (campaign new) */
.check-list {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .5rem;
}
.check-list label {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}
.check-list label:hover { border-color: var(--accent); background: var(--accent-soft); }
.check-list input[type="checkbox"] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }

/* Company filter + tags */
.company-filter { margin-bottom: 1rem; }
.company-tag {
    display: inline-block;
    margin-left: .35rem;
    padding: .1rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    vertical-align: middle;
}
.peer-company-filter { min-width: 11rem; }

/* Department tag — sibling of .company-tag, slate palette to read as distinct
 * (department) vs. green (company) while staying within the design system. */
.department-tag {
    display: inline-block;
    margin-left: .35rem;
    padding: .1rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--meets);
    background: var(--meets-soft);
    border-radius: var(--radius-sm);
    vertical-align: middle;
}

/* Department badge (employee profile) — pairs with .badge--draft (company). */
.badge--department { background: var(--meets-soft); color: var(--meets); border-color: var(--meets-line); }

/* Probation badge (employee profile) — distinct amber/clay tint. */
.badge--probation { background: #FBF0DD; color: #8A5A18; border-color: #E8D2A6; }

/* Two filters side by side (company + department) on the campaign-new form. */
.filter-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.filter-row .company-filter { margin-bottom: 0; }

.manager-options { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0 0 1rem; }
.manager-options label { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400; }

/* View-mode toggle on the org page (manager forest vs. grouped by department). */
.seg-toggle {
    display: inline-flex;
    margin: 0 0 1.25rem;
    border: 1px solid var(--meets-line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.seg-toggle__btn {
    padding: .45rem .9rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--meets);
    background: var(--surface, #fff);
    text-decoration: none;
}
.seg-toggle__btn + .seg-toggle__btn { border-left: 1px solid var(--meets-line); }
.seg-toggle__btn:hover { background: var(--meets-soft); }
.seg-toggle__btn.is-active { background: var(--accent); color: #fff; }

/* Department grouping sections on the org page. */
.dept-section { margin-bottom: 2rem; }
.dept-section__head {
    margin: 0 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 2px solid var(--accent-soft);
    font-size: 1.1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Flash banners */
.flash {
    border-radius: var(--radius);
    padding: .85rem 1.1rem;
    margin: 0 0 1rem;
    font-size: .92rem;
    border: 1px solid transparent;
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}
.flash::before { font-weight: 700; }
.flash-success { background: var(--accent-soft); color: var(--accent-ink); border-color: #BFD7C9; }
.flash-success::before { content: "✓"; }
.flash-error,
.flash-danger { background: var(--warn-soft); color: var(--warn); border-color: #E6CBC0; }
.flash-error::before, .flash-danger::before { content: "!"; }
.flash-info { background: var(--meets-soft); color: var(--meets); border-color: #D6DAE0; }

/* Alert banner (readiness flag) */
.alert-banner {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    background: var(--warn-soft);
    border: 1px solid #E6CBC0;
    border-left: 4px solid var(--warn);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    color: #7E3B27;
}
.alert-banner__icon { font-size: 1.25rem; line-height: 1.3; }
.alert-banner strong { color: var(--warn); }

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 2.5rem 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}

/* Stat strip (results summary) */
.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.75rem;
}
.stat {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.stat__label {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.stat__value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums lining-nums;
    color: var(--ink);
    line-height: 1.1;
}
.stat__hint {
    font-size: .76rem;
    color: var(--muted);
    margin-top: .1rem;
}
/* The official average is the headline number — give it more presence and a
   warm accent so the eye lands there first; the self-score is intentionally
   quieter (it does not count toward the official average). */
.stat--primary .stat__value {
    color: var(--accent);
    font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem);
}
.stat--primary { position: relative; padding-right: 2.5rem; }
.stat--primary::after {
    content: "";
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 1px; height: 2.6rem;
    background: var(--line);
}
.stat__value--muted { color: var(--muted); font-weight: 560; }
.stat--profile { margin-left: auto; }

/* Score legend — decodes the 0.8/1.0/1.2 colour coding for HR. */
.score-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem 1.4rem;
    margin-bottom: 1.25rem;
    padding: .85rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: .85rem;
    color: var(--ink);
}
.score-legend__title {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.score-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.score-legend .chip { min-width: 3.1rem; }
.legend-item--note {
    margin-left: auto;
    color: var(--muted);
    font-size: .8rem;
}

/* Group averages — one row per evaluator-role group, mirrors .score-legend. */
.group-averages { margin-bottom: 1.25rem; }
.group-averages h2 {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 .5rem;
}
.group-averages__list {
    list-style: none;
    margin: 0;
    padding: .85rem 1.1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1.4rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.group-averages__row {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--ink);
}
.group-averages__label { color: var(--muted); }

/* 6. Page-specific -------------------------------------------------------- */

/* List of evaluations */
.eval-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.eval-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    color: var(--ink);
    font-weight: 500;
    transition: border-color .12s ease, transform .08s ease, box-shadow .15s ease;
}
.eval-list a:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.eval-list a:hover::after { transform: translateX(3px); }
.eval-list__subject { font-weight: 600; }
.eval-list__role {
    margin-left: .65rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent-ink);
    background: var(--accent-soft);
    border: 1px solid #BFDFCF;
    border-radius: 999px;
    padding: .2rem .55rem;
    white-space: nowrap;
}
.eval-list a::after {
    content: "→";
    color: var(--accent);
    margin-left: auto;
    padding-left: 1rem;
    transition: transform .15s ease;
}
.eval-list__arrow { display: none; }

/* Login */
.auth-wrap {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2.5rem 2.25rem;
    text-align: center;
}
.auth-card .eyebrow { text-align: center; }
.auth-card h1 { font-size: 1.9rem; margin-bottom: .5rem; }
.auth-card p { color: var(--muted); }
.auth-card .version-line { margin: 1.25rem 0 0; font-size: .75rem; letter-spacing: .02em; color: var(--muted); text-align: center; }
.btn-azure {
    width: 100%;
    margin-top: 1.25rem;
    font-size: .95rem;
}
.btn-azure svg { flex: none; }

/* Evaluation form */
.scale-note {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: .95rem 1.15rem;
    color: var(--ink);
    font-size: .9rem;
    margin-bottom: 1.75rem;
}
.scale-note__keys {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1.4rem;
    align-items: center;
}
.scale-note__keys .legend-item { display: inline-flex; align-items: center; gap: .5rem; }
.scale-note__keys .chip { min-width: 2.6rem; }
.scale-note__hint {
    margin: .65rem 0 0;
    padding-top: .65rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
}

.criterion-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem 1.5rem;
    margin: 0 0 1.1rem;
}
.criterion-card legend,
.criterion-card .criterion-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: block;
    padding: 0;
}
.criterion-card .criterion-num {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* Readiness Да/Нет breakdown on the HR results page. */
.readiness-summary {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem 1.5rem;
    margin: 1.4rem 0 0;
}
.readiness-summary__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    margin: 0 0 .35rem;
}
.readiness-summary__hint {
    color: var(--muted);
    font-size: .9rem;
    margin: 0 0 1rem;
}
.readiness-summary__list { list-style: none; margin: 0; padding: 0; }
.readiness-summary__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem 0;
    border-top: 1px solid var(--line);
}
.readiness-summary__q { font-size: .95rem; }
.readiness-summary__counts { display: inline-flex; gap: .5rem; flex: 0 0 auto; }
.rs-count {
    font-size: .85rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    color: var(--muted);
    white-space: nowrap;
}
.rs-count--yes { background: var(--above-soft); color: var(--above); border-color: #BFDFCF; }
.rs-count--no-active { background: var(--below-soft); color: var(--below); border-color: #E6CBC0; }

/* Free-text feedback per role group — anonymised and shuffled, so it stays
   below the score table and is visually a separate card per group. */
.open-answers {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.4rem 1.5rem;
    margin: 1.4rem 0 0;
}
.open-answers h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    margin: 0 0 .35rem;
}
.open-answers > .muted {
    color: var(--muted);
    font-size: .9rem;
    margin: 0 0 1rem;
}
.open-answers__entry {
    padding: .65rem 0;
    border-top: 1px solid var(--line);
}
.open-answers__entry:first-of-type { border-top: none; }
.open-answers__q {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
    margin: 0;
}
.open-answers__a {
    font-size: .95rem;
    margin: .15rem 0 .75rem;
}
.open-answers__entry .open-answers__a:last-child { margin-bottom: 0; }

/* "What we evaluate" description under the criterion title. */
.criterion-desc {
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.5;
    margin: -.5rem 0 1rem;
}

/* Per-level meaning of 0.8 / 1.0 / 1.2 for this criterion. */
.criterion-anchors {
    margin: 0 0 1rem;
    border-top: 1px solid var(--line);
}
.criterion-anchors__row {
    display: grid;
    grid-template-columns: 3.4rem 1fr;
    gap: .65rem;
    align-items: start;
    padding: .55rem 0;
    border-bottom: 1px solid var(--line);
}
.criterion-anchors__row dt { margin: 0; }
.criterion-anchors__row dd {
    margin: 0;
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.45;
}
.criterion-anchors__summary { margin: 0; font-weight: 600; }
.criterion-anchors__markers {
    margin: .35rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted, var(--ink));
    font-size: .88rem;
}
.criterion-anchors__markers li { margin: .15rem 0; }

/* Segmented control — column count comes from --seg-count (set per-instrument
   in the template from the rendered scale points), falling back to 3 for the
   legacy 0.8 / 1.0 / 1.2 scale. */
.segmented {
    display: grid;
    grid-template-columns: repeat(var(--seg-count, 3), 1fr);
    gap: .5rem;
    margin-bottom: 1rem;
}
.segmented .seg {
    position: relative;
    display: block;
    cursor: pointer;
}
.segmented .seg input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.segmented .seg__face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
    padding: .7rem .5rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: border-color .12s ease, background .12s ease, box-shadow .12s ease, color .12s ease;
    text-align: center;
}
.segmented .seg__num {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums lining-nums;
}
/* Subtle un-selected colour cue so each option's meaning reads pre-attentively
   (clay / slate / green) before the rater even clicks. The selected state below
   intensifies this. */
.segmented .seg--below .seg__num { color: var(--below); }
.segmented .seg--meets .seg__num { color: var(--meets); }
.segmented .seg--above .seg__num { color: var(--above); }
.segmented .seg--below:hover .seg__face { border-color: var(--below); background: var(--below-soft); }
.segmented .seg--meets:hover .seg__face { border-color: var(--meets); background: var(--meets-soft); }
.segmented .seg--above:hover .seg__face { border-color: var(--above); background: var(--above-soft); }
.segmented .seg__txt {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}
.segmented .seg:hover .seg__face { border-color: var(--accent); }
/* Focus ring via keyboard */
.segmented .seg input:focus-visible + .seg__face {
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}
/* Checked states — color-coded */
.segmented .seg--below input:checked + .seg__face {
    background: var(--below-soft); border-color: var(--below); color: var(--below);
}
.segmented .seg--meets input:checked + .seg__face {
    background: var(--meets-soft); border-color: var(--meets); color: var(--meets);
}
.segmented .seg--above input:checked + .seg__face {
    background: var(--above-soft); border-color: var(--above); color: var(--above);
}
.segmented .seg input:checked + .seg__face .seg__txt { color: inherit; }

.criterion-comment { margin-top: .25rem; }
.criterion-comment .field-label { font-weight: 500; color: var(--muted); font-size: .82rem; }

/* Readiness — full questions with a compact Да / Нет segmented control */
.readiness__hint {
    color: var(--muted);
    font-size: .85rem;
    margin: -.15rem 0 1rem;
}
.readiness {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.readiness-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem .95rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.readiness-row__q {
    margin: 0;
    font-weight: 500;
    line-height: 1.4;
}
.yesno {
    flex: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem;
}
.yesno__opt {
    position: relative;
    display: block;
    cursor: pointer;
}
.yesno__opt input {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.yesno__face {
    display: block;
    min-width: 64px;
    padding: .5rem .9rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: center;
    font-weight: 600;
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    transition: border-color .12s ease, background .12s ease, color .12s ease, box-shadow .12s ease;
}
.yesno__opt--yes:hover .yesno__face { border-color: var(--above); background: var(--above-soft); }
.yesno__opt--no:hover .yesno__face { border-color: var(--below); background: var(--below-soft); }
.yesno__opt input:focus-visible + .yesno__face {
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}
.yesno__opt--yes input:checked + .yesno__face {
    background: var(--above-soft); border-color: var(--above); color: var(--above);
}
.yesno__opt--no input:checked + .yesno__face {
    background: var(--below-soft); border-color: var(--below); color: var(--below);
}

.form-submit { margin-top: 1.75rem; display: flex; gap: .75rem; align-items: center; }

/* Campaign detail subject sections */
.subject-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.6rem;
    margin-bottom: 1.25rem;
}
.subject-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.subject-section__head h2 { margin: 0; }
.progress-note {
    font-size: .85rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.add-peer-row {
    display: flex;
    gap: .65rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px dashed var(--line);
}
.add-peer-row select { min-width: 14rem; }
/* Inline note for async add-peer (success / error), non-blocking. */
.add-peer-note {
    margin: .6rem 0 0;
    font-size: .85rem;
}
.add-peer-note--success { color: var(--accent-ink); }
.add-peer-note--error { color: var(--warn); }

/* Results matrix */
.matrix-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table.matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
    background: var(--surface);
}
table.matrix th, table.matrix td {
    padding: .7rem .85rem;
    border-bottom: 1px solid var(--line);
    text-align: center;
    font-variant-numeric: tabular-nums lining-nums;
}
table.matrix thead th {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    white-space: nowrap;
}
table.matrix th.crit, table.matrix td.crit {
    text-align: left;
    font-variant-numeric: normal;
    min-width: 16rem;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
}
table.matrix thead th.crit { background: var(--surface-2); }
table.matrix td.crit .crit-num { color: var(--accent); font-weight: 600; }
table.matrix .col-avg {
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 700;
}
table.matrix thead th.col-avg { background: #DCE7E0; color: var(--accent-ink); }
table.matrix tbody tr:last-child td { border-bottom: none; }

/* Self-review column: visually set apart (it is excluded from the official
   average). A dotted left rule + faint recessed tint, no hard background. */
table.matrix th.col-self,
table.matrix td.col-self {
    border-left: 1.5px dotted var(--line-strong);
    background: var(--surface-2);
}
table.matrix thead th.col-self { color: var(--muted); }
table.matrix td.col-self .chip--meets { opacity: .9; }

/* Comment affordance: a small dotted underline + help cursor on the chip. */
table.matrix .has-comment { cursor: help; }
table.matrix .has-comment .chip {
    text-decoration: underline dotted var(--muted);
    text-underline-offset: 3px;
}

/* 7. Motion --------------------------------------------------------------- */
@keyframes fade-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.reveal { animation: fade-rise .5s cubic-bezier(.21,.6,.35,1) both; }
.reveal-1 { animation-delay: .04s; }
.reveal-2 { animation-delay: .10s; }
.reveal-3 { animation-delay: .16s; }
.reveal-4 { animation-delay: .22s; }

/* Org chart -------------------------------------------------------------- */
.org-tree-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: .25rem;
}
.org-tree,
.org-children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.org-tree { padding-left: 0; }

/* Nested reports: indented with vertical + horizontal connector lines. */
.org-children {
    margin-left: 1.4rem;
    padding-left: 1.4rem;
    border-left: 1.5px solid var(--line-strong);
}
.org-node {
    position: relative;
    margin-top: .6rem;
}
.org-children > .org-node::before {
    content: "";
    position: absolute;
    top: 1.25rem;
    left: -1.4rem;
    width: 1.1rem;
    height: 1.5px;
    background: var(--line-strong);
    border-bottom-left-radius: 6px;
}
/* The vertical guide should stop at the last child's connector elbow so the
   line doesn't dangle past the final report. */
.org-children > .org-node:last-child::after {
    content: "";
    position: absolute;
    top: 1.25rem;
    bottom: 0;
    left: -1.4rem;
    width: 1.5px;
    background: var(--paper);
}

.org-card {
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 16rem;
    max-width: 22rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line-strong);
    border-radius: var(--radius);
    padding: .65rem .95rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, opacity .15s ease, border-color .15s ease, transform .12s ease;
}
.org-card:hover {
    border-left-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateX(2px);
}
.org-card__name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--ink);
    line-height: 1.2;
    text-decoration: none;
}
.org-card__name:hover { color: var(--accent); text-decoration: underline; }
.org-card__title {
    font-size: .82rem;
    color: var(--muted);
}
.org-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .25rem;
}
.org-card__company,
.org-card__department {
    align-self: flex-start;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: .2rem .5rem;
    line-height: 1;
}
.org-card__company {
    color: var(--accent-ink);
    background: var(--accent-soft);
    border: 1px solid #BFDFCF;
}
.org-card__department {
    color: var(--meets);
    background: var(--meets-soft);
    border: 1px solid var(--meets-line);
}

/* Company filter dimming: keep matches + their ancestors readable. */
.org-node.is-dim > .org-card { opacity: .32; }
.org-node.is-match > .org-card { border-left-color: var(--above); }
.org-node.is-ancestor > .org-card { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   8. Responsive — mobile-first refinements
   Breakpoints: ~900px tablet, ~640px phone.
   Display headings scale via clamp() inline (see :root / h1 / .stat__value).
   ========================================================================== */

/* Large display numbers scale down on smaller viewports so they never
   overflow their container. */
.stat__value { font-size: clamp(1.4rem, 1.05rem + 1.6vw, 1.8rem); }
.profile-badge { font-size: clamp(.92rem, .82rem + .4vw, 1.05rem); }

/* --- Tablet (≤ 900px) --------------------------------------------------- */
@media (max-width: 900px) {
    .container { padding: 2rem 1.25rem 3rem; }

    /* Header: let wordmark + nav wrap to a second line rather than overflow. */
    .site-header__inner { flex-wrap: wrap; gap: .5rem 1rem; }
    .site-nav { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

    /* Cards: slightly tighter padding. */
    .card { padding: 1.4rem 1.4rem; }
    .subject-section { padding: 1.3rem 1.3rem; }
    .criterion-card { padding: 1.2rem 1.25rem; }

    /* Org tree: reduce indentation depth. */
    .org-children { margin-left: 1rem; padding-left: 1rem; }
    .org-children > .org-node::before { left: -1rem; width: .85rem; }

    /* Add-peer + filter selects shouldn't force overflow. */
    .add-peer-row select,
    .peer-company-filter { min-width: 0; }
}

/* --- Phone (≤ 640px) ---------------------------------------------------- */
@media (max-width: 640px) {
    .container { padding: 1.5rem 1rem 2.5rem; }

    /* Header / nav: compact, comfortable tap targets (≥44px). */
    .site-header__inner { padding: .65rem 1rem; gap: .4rem .75rem; }
    .wordmark__sub { display: none; }
    .site-nav {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        gap: .25rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .site-nav a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: .5rem .7rem;
        white-space: nowrap;
    }

    /* Display typography: trim heading margins on small screens. */
    .page-head { margin-bottom: 1.4rem; }
    h2 { font-size: 1.3rem; }

    /* Footer stacks. */
    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: .25rem;
    }

    /* Cards / sections: tighter padding. */
    .card { padding: 1.15rem 1.15rem; }
    .subject-section { padding: 1.1rem 1.1rem; }
    .criterion-card { padding: 1.05rem 1.05rem; }
    fieldset { padding: 1rem 1.1rem; }

    /* Action rows + form submits: stack and go full-width for easy tapping. */
    .action-row { gap: .6rem; }
    .action-row > .btn,
    .action-row > .btn-secondary,
    .action-row > form,
    .action-row > form > button,
    .form-submit { width: 100%; }
    .form-submit { flex-direction: column; align-items: stretch; }
    .action-row > form > button { width: 100%; }
    /* Primary/secondary buttons full-width & ≥44px tall on phones. */
    .btn, .btn-secondary, .btn-ghost,
    button[type="submit"],
    .container button {
        width: 100%;
        min-height: 44px;
    }
    /* …but keep inline text links and small in-table links compact. */
    a.btn-link { width: auto; min-height: 0; }

    /* Forms: every control full-width; selects too. */
    select { width: 100%; min-width: 0; }
    .field { margin-bottom: 1rem; }

    /* Tables: subtle scroll affordance + comfortable cell sizing. */
    .table-wrap, .matrix-wrap { position: relative; }
    table.data { font-size: .9rem; }
    table.data thead th { padding: .7rem .85rem; }
    table.data tbody td { padding: .7rem .85rem; }

    /* Results matrix: keep the criterion column sticky & a bit narrower; add a
       hairline so the sticky column reads as pinned while scrolling. */
    table.matrix th.crit, table.matrix td.crit {
        min-width: 11rem;
        box-shadow: 1px 0 0 var(--line);
    }
    table.matrix th, table.matrix td { padding: .6rem .6rem; }

    /* Stat strip: stack into a single column. */
    .stat-strip {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.2rem 1.25rem;
    }
    .stat--profile { margin-left: 0; }
    .stat--primary { padding-right: 0; }
    .stat--primary::after { display: none; }
    .score-legend .legend-item--note { margin-left: 0; width: 100%; }

    /* Segmented score control: keep it in one row but shrink so it fits ~360px. */
    .segmented { gap: .35rem; }
    .segmented .seg__face { padding: .55rem .25rem; }
    .segmented .seg__num { font-size: 1rem; }
    .segmented .seg__txt { font-size: .62rem; letter-spacing: .02em; }

    /* A 1-5 (or 1-4) scale has more columns than the legacy 0.8/1.0/1.2 one —
       shrink further so five segments still fit ~360px without wrapping. */
    .segmented[data-seg-count="4"], .segmented[data-seg-count="5"] { gap: .2rem; }
    .segmented[data-seg-count="4"] .seg__face, .segmented[data-seg-count="5"] .seg__face { padding: .45rem .1rem; }
    .segmented[data-seg-count="4"] .seg__num, .segmented[data-seg-count="5"] .seg__num { font-size: .8rem; }
    .segmented[data-seg-count="4"] .seg__txt, .segmented[data-seg-count="5"] .seg__txt { font-size: .5rem; letter-spacing: 0; }

    /* Readiness rows: stack the question above its Да/Нет control,
       which stretches full-width with ≥44px tap targets. */
    .readiness-row {
        flex-direction: column;
        align-items: stretch;
        gap: .65rem;
    }
    .yesno { width: 100%; }
    .yesno__face { min-height: 44px; display: flex; align-items: center; justify-content: center; }

    /* Checkbox list: single column; cap height so a long list scrolls
       instead of pushing the submit button off-screen. ≥44px rows. */
    .check-list {
        grid-template-columns: 1fr;
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .check-list label { min-height: 44px; }
    .check-list input[type="checkbox"] { width: 1.2rem; height: 1.2rem; }

    /* Add-peer row: stack controls and let the results link sit on its own. */
    .add-peer-row { flex-direction: column; align-items: stretch; }
    .add-peer-row select,
    .add-peer-row button { width: 100%; }
    .add-peer-row .btn-link { margin-left: 0 !important; align-self: flex-start; }

    /* Subject section head: stack title + progress note. */
    .subject-section__head { gap: .25rem; }

    /* Login card: reduce padding so it breathes on small screens. */
    .auth-wrap { padding: 2rem 1rem; }
    .auth-card { padding: 2rem 1.5rem; }
    .auth-card h1 { font-size: clamp(1.5rem, 1.2rem + 2vw, 1.9rem); }

    /* Org tree: minimal indentation; allow node cards to wrap full-width. */
    .org-children { margin-left: .75rem; padding-left: .75rem; }
    .org-children > .org-node::before { left: -.75rem; width: .6rem; }
    .org-card { display: flex; }
}

/* ==========================================================================
   8. Tom Select (vendored, searchable dropdowns)
   Themed to match the refined design system: surface/white control,
   hairline border, accent focus ring, body font, accent-soft option tints.
   Loaded after tom-select.css so these rules win.
   ========================================================================== */

/* Width parity with native selects so it sits inline with adjacent buttons. */
.ts-wrapper {
    width: auto;
    min-width: 12rem;
    font-family: var(--font-body);
    position: relative;
}
.peer-company-filter + .ts-wrapper,
.ts-wrapper.peer-company-filter { min-width: 11rem; }
.add-peer-row .ts-wrapper { min-width: 14rem; }

/* The control box — mirror padding/height of native inputs (.65rem .8rem). */
.ts-wrapper .ts-control {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: .65rem .8rem;
    min-height: 44px; /* comfortable tap target */
    color: var(--ink);
    font-size: .95rem;
    line-height: 1.2;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ts-wrapper.single .ts-control,
.ts-wrapper .ts-control input {
    color: var(--ink);
    font-family: var(--font-body);
    font-size: .95rem;
}
.ts-wrapper .ts-control input::placeholder { color: var(--muted); }

/* Focus / open: accent border + soft ring, matching native :focus. */
.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* Disabled state. */
.ts-wrapper.disabled .ts-control {
    background: var(--surface-2);
    opacity: .65;
}

/* When open, lift the whole control above adjacent page content.
   Root cause of the original bug: page sections are wrapped in `.reveal`, whose
   fade-rise animation uses fill-mode `both` — so after it settles each block keeps
   a `transform` (translateY(0)), and a settled transform STILL forms a stacking
   context. The dropdown lives inside one such context (the form / `.action-row`);
   a LATER `.reveal` sibling (e.g. `.org-tree-wrap`) forms its own context at the
   same level and, painting later, drew its org-cards OVER the dropdown — no matter
   how high the dropdown's own z-index, since that z-index is trapped inside the
   form's context.
   Fix: promote the *containing* `.reveal` / `.action-row` block (the real stacking
   context) above its siblings whenever it holds an open Tom Select, via `:has()`.
   We also keep a high z-index on the wrapper + panel for the simple (non-reveal)
   cases. */
.ts-wrapper.dropdown-active {
    z-index: 1000;
}
.reveal:has(.ts-wrapper.dropdown-active),
.action-row:has(.ts-wrapper.dropdown-active),
.add-peer-row:has(.ts-wrapper.dropdown-active),
.subject-section:has(.ts-wrapper.dropdown-active),
.company-filter:has(.ts-wrapper.dropdown-active) {
    position: relative;
    z-index: 1000;
}

/* The dropdown panel — opaque surface, hairline border, own high z-index so it
   sits above anything rendered behind it. */
.ts-wrapper .ts-dropdown {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-top: .35rem;
    font-family: var(--font-body);
    z-index: 1000;
    /* Hard reset: never let card / list / org-node rules bleed into the panel. */
    padding: .3rem;
}
.ts-wrapper .ts-dropdown .ts-dropdown-content {
    background: transparent;
}
/* Option rows: simple padded rows. Explicitly neutralise any card-like treatment
   (border, left-rule, shadow, transform) that broad page rules could impose, so
   options can never render as org-card / list-item cards. */
.ts-wrapper .ts-dropdown .option {
    display: block;
    color: var(--ink);
    font-size: .92rem;
    font-weight: 500;
    padding: .55rem .7rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    box-shadow: none;
    transform: none;
    line-height: 1.3;
    cursor: pointer;
}
.ts-wrapper .ts-dropdown .option:hover { color: var(--accent-ink); }
/* Hover / keyboard-highlighted ("active") option: accent-soft tint, clearly
   readable. Note: this Tom Select build puts `aria-selected="true"` on the
   keyboard-highlighted row, NOT on the chosen value — so the highlight is the
   `.option.active` row, and we tint it accent-soft. */
.ts-wrapper .ts-dropdown .option.active,
.ts-wrapper .ts-dropdown .option:hover {
    background: var(--accent-soft);
    color: var(--accent-ink);
}
/* The chosen value carries the `.selected` class — paint it solid accent. When a
   row is BOTH chosen and highlighted, keep the strong accent so it stays clear. */
.ts-wrapper .ts-dropdown .option.selected,
.ts-wrapper .ts-dropdown .option.selected.active {
    background: var(--accent);
    color: #fff;
}
.ts-wrapper .ts-dropdown .no-results,
.ts-wrapper .ts-dropdown .optgroup-header {
    color: var(--muted);
    font-size: .85rem;
    padding: .5rem .8rem;
    background: transparent;
}

/* The caret. */
.ts-wrapper.single .ts-control:after {
    border-color: var(--muted) transparent transparent;
}

/* Phone: full-width, consistent with native select responsive rules. */
@media (max-width: 640px) {
    .ts-wrapper,
    .add-peer-row .ts-wrapper,
    .peer-company-filter + .ts-wrapper { width: 100%; min-width: 0; }
}

/* Employee detail page */
.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1.25rem;
}
.detail-list { display: grid; gap: .9rem; margin: 0; }
.detail-row {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: .5rem 1rem;
    align-items: start;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--line);
}
.detail-row:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-row dt {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}
.detail-row dd { margin: 0; color: var(--ink); }
.report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }

.section-head { margin: 2rem 0 1rem; }
.section-head h2 { margin: 0; }

.result-summary__head {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.result-summary__head h3 { margin: 0; font-size: 1.15rem; }
.result-summary__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 2.25rem;
    align-items: center;
}
.result-summary__flag {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 1rem 0 0;
    color: var(--warn);
}
.result-summary__foot { margin-top: 1.1rem; }

@media (max-width: 640px) {
    .detail-row { grid-template-columns: 1fr; gap: .25rem; }
}

/* Manager's guide -------------------------------------------------------- */
.guide { max-width: 760px; }
.guide .guide-section { margin-bottom: 1.25rem; }
.guide .guide-section h2.card__title { font-size: 1.3rem; }

/* Small inline links to the guide from the evaluation pages. */
.guide-link { margin: .6rem 0 0; font-size: .92rem; }

/* Readable prose measure inside guide cards. */
.guide .prose p { margin: 0 0 .75rem; color: var(--ink); }
.guide .prose p:last-child { margin-bottom: 0; }

/* Color-coded scale block, mirroring the evaluation form legend. */
.guide-scale {
    display: grid;
    gap: .65rem;
    margin: 1rem 0;
}
.guide-scale__row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .85rem;
    align-items: start;
    padding: .85rem 1rem;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.guide-scale__row p { margin: 0; }
.guide-scale__row .chip { margin-top: .1rem; }
.guide-scale__row--below { border-left-color: var(--below); background: var(--below-soft); }
.guide-scale__row--meets { border-left-color: var(--meets); background: var(--meets-soft); }
.guide-scale__row--above { border-left-color: var(--above); background: var(--above-soft); }

/* Numbered criteria list. */
.guide-criteria {
    list-style: none;
    margin: .5rem 0 0;
    padding: 0;
    display: grid;
    gap: .5rem;
}
.guide-criteria li {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: .75rem;
    align-items: baseline;
    padding: .55rem 0;
    border-bottom: 1px solid var(--line);
}
.guide-criteria li:last-child { border-bottom: none; }
.guide-criteria__num {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums lining-nums;
}
.guide-criteria__title { color: var(--ink); }

/* Readiness questions + bullet lists. */
.guide-questions,
.guide-bullets {
    margin: .75rem 0 0;
    padding-left: 1.3rem;
    color: var(--ink);
}
.guide-questions li,
.guide-bullets li { margin-bottom: .5rem; }
.guide-questions li:last-child,
.guide-bullets li:last-child { margin-bottom: 0; }

/* Closing pull-quote. */
.guide-quote {
    margin: 1.75rem 0 0;
    padding: 1.4rem 1.75rem;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .guide-scale__row { grid-template-columns: 1fr; gap: .5rem; }
    .guide-quote { font-size: 1.08rem; padding: 1.1rem 1.25rem; }
}

/* Language switcher (RU · EN) in the site header */
.locale-switch { display: inline-flex; align-items: center; gap: .35rem; margin-left: .5rem; font-size: .82rem; letter-spacing: .04em; }
.locale-switch a { padding: .15rem .3rem; border-radius: 4px; color: inherit; opacity: .65; }
.locale-switch a:hover { opacity: 1; background: var(--accent-soft); }
.locale-switch a.locale-switch__active { opacity: 1; font-weight: 600; color: var(--accent-ink); }
