/* FORTO mass. Токены — здесь; цвета статусов — по docs/DATA_MODEL.md §3.
   Принципы ТЗ §53: легко, единообразно, крупные зоны клика, минимум элементов. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --border: #e1e6ed;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn-soft: #fff6dc;
  --ok-soft: #e7f6ec;
  --radius: 12px;
  --tap: 44px; /* минимальная зона клика */
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);

  --st-response: #6b7686;
  --st-docs-ready: #4f6db8;
  --st-sb-check: #7c3aed;
  --st-sb-passed: #0e7490;
  --st-sb-rejected: #b91c1c;
  --st-directed: #2563eb;
  --st-pending: #d9a400;
  --st-started: #16a34a;
  --st-no-show: #ea7a12;
  --st-shifts-3: #15803d;
  --st-shifts-15: #0f5f2f;
  --st-declined: #dc2626;
  --st-irrelevant: #3f4754;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* --- Шапка и меню ------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; min-height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
/* Логотип FORTO + подпись под ним; подпись не шире логотипа (переносится на две строки). */
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 146px; flex: none;
  padding: .35rem 0; color: #23286e; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 100%; height: auto; }
/* Подпись начинается на одной вертикали с «F» в FORTO и «S» в Service: буквы стоят в 22 px из 600 (3,7 %). */
.brand-caption { font-size: .66rem; line-height: 1.2; font-weight: 600; letter-spacing: .01em; color: #23286e;
  padding-left: 3.7%; text-align: left; }
.source-note { margin-top: .5rem; }
.menu { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.menu a {
  display: inline-flex; align-items: center; min-height: var(--tap);
  padding: 0 .85rem; border-radius: 10px; color: var(--muted); font-weight: 500; white-space: nowrap;
}
.menu a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.menu a.active { background: var(--accent-soft); color: var(--accent); }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.menu .icon, .menu-short { display: none; }  /* на компьютере — только слова */
.add-person .icon { margin-right: .1rem; }
.who .btn .icon { display: none; }
.who { display: flex; align-items: center; gap: .5rem; }
.who form { margin: 0; }
.who-name { color: var(--muted); font-size: .9rem; white-space: nowrap; }

/* --- Страница ------------------------------------------------------------ */
.page { max-width: 1320px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
/* Общее правило: страница со списком-таблицей — во всю ширину экрана с отступом 16 px.
   Карточки (с боковой колонкой .layout-split) остаются обычной ширины — так удобнее читать.
   .page-wide — то же правило вручную для страниц, где оно нужно без таблицы. */
.page-wide, .page:has(.table-wrap):not(:has(.layout-split)) { max-width: none; padding-left: 1rem; padding-right: 1rem; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.page-head .btn { margin-left: auto; }
.crumbs { margin-bottom: .5rem; font-size: .95rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card.empty { border-style: dashed; box-shadow: none; }
.layout-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.side { display: grid; gap: 1rem; }
.side .card + .card { margin-top: 0; }

/* --- Кнопки ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: 0 1.1rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
/* Недоступное действие видно сразу: бледная кнопка без реакции (tz2 §27 — блокировка, а не только предупреждение). */
.btn:disabled { opacity: .45; cursor: not-allowed; background: var(--surface); }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:focus-visible, .choice input:focus-visible + span, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, white); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { min-height: 36px; padding: 0 .75rem; font-size: .9rem; }
.btn-block { width: 100%; }

/* --- Формы -------------------------------------------------------------- */
.form { display: grid; gap: 1rem; }
.form.narrow { max-width: 480px; }
.field { display: grid; gap: .35rem; border: 0; margin: 0; padding: 0; min-width: 0; align-content: start; }
[hidden] { display: none !important; }
.field-label { font-weight: 600; font-size: .95rem; padding: 0; }
.req { color: var(--danger); font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date],
input[type=search],
input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 0 .85rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  font: inherit; color: inherit;
}
textarea { padding: .6rem .85rem; resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
/* align-items: start — подписи соседних полей на одной линии, даже если под одним есть подсказка (tz2 §1.1). */
.grid-2, .grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checklist { display: grid; gap: 0; max-height: 320px; overflow-y: auto; }
.field-error { color: var(--danger); margin: 0; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }

/* Выбор кнопками (ТЗ §2.1): радиокнопки выглядят как плитки */
.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 1rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  cursor: pointer; font-weight: 500; user-select: none;
}
.choice span:hover { border-color: var(--accent); }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Тип подборщика нужен только роли «Подборщик» */
.form:has(input[name=role][value=recruiter]:not(:checked)) .kind-field { display: none; }

/* --- Сообщения ----------------------------------------------------------- */
.flash, .alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.flash-ok { background: var(--ok-soft); color: #14532d; }
.alert-error { background: var(--danger-soft); color: #7f1d1d; }
.alert-warn { background: var(--warn-soft); color: #713f12; margin: 0; }

/* --- Значки -------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; padding: .15rem .6rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap;
}
.badge-green { background: var(--ok-soft); color: #166534; }
.badge-yellow { background: var(--warn-soft); color: #854d0e; }
.badge-red { background: var(--danger-soft); color: #991b1b; }

/* --- Таблицы ----------------------------------------------------------- */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .7rem .9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table-candidates { font-size: .92rem; }
.table-candidates th, .table-candidates td { padding: .6rem .7rem; }
.table-candidates td:first-child { min-width: 130px; }
/* Подписи колонок переносятся, чтобы таблица помещалась в экран без прокрутки. */
.table-candidates th a.sort { white-space: normal; display: inline; }
.table-candidates .badge, .table-candidates .status, .table-candidates .flag { white-space: normal; }
.table-candidates .status { max-width: 170px; }
/* Сортировка в заголовке (tz2 §24): активная колонка и направление видны сразу. */
.table th a.sort { color: inherit; display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.table th a.sort:hover { color: var(--accent); text-decoration: none; }
.table th a.sort-active { color: var(--accent); }
.sort-arrow { opacity: .45; font-size: .9em; }
.sort-active .sort-arrow { opacity: 1; }
.sort-mobile { display: none; margin-bottom: .75rem; }
.sort-mobile summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: .5rem; }
.chip-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 .8rem; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font-size: .9rem; }
.chip-link.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-link:hover { text-decoration: none; }
.link-card { display: grid; gap: .6rem; }
.link-card > * { margin: 0; }
.link-current ul { margin: .25rem 0 0; padding-left: 1.1rem; display: grid; gap: .2rem; }
/* Каждая вакансия в карточке — в тонкой рамке: так их легко различать. */
.card.participation { border: 1px solid #b9c6da; }
/* Действия: «что дальше» — плитки с пояснением; завершение работы — отдельно и спокойнее. */
.steps { display: grid; gap: .45rem; }
.steps-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.action-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.action-tile { display: grid; gap: .15rem; align-content: start; text-align: left; padding: .6rem .8rem; min-height: var(--tap);
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
  cursor: pointer; list-style: none; transition: border-color .15s, background-color .15s, box-shadow .15s, transform .1s; }
.action-tile::-webkit-details-marker { display: none; }
.action-tile b { font-weight: 600; }
.action-tile small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.action-tile:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(37, 99, 235, .12); text-decoration: none; }
.action-tile:active { transform: translateY(1px); }
.action-tile:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; border-color: var(--border); }
.action-main { border-color: var(--accent); background: var(--accent-soft); }
.action-main b { color: var(--accent); }
.action-stop:hover { border-color: var(--danger); box-shadow: 0 2px 8px rgba(220, 38, 38, .12); }
.action-stop b { color: #9f1d1d; }
.action-tile-box { display: contents; }
.action-tile-box[open] { display: block; grid-column: 1 / -1; }
.action-tile-box[open] > form { margin-top: .5rem; padding: .75rem; border: 1px dashed var(--border); border-radius: 10px; }
.status-form { border-top: 0; margin-top: 0; padding-top: 0; }
/* Всплывающая подсказка о выполненном действии. */
.toast { position: fixed; top: 76px; right: 16px; z-index: 60; display: flex; align-items: flex-start; gap: .6rem;
  max-width: min(440px, calc(100vw - 32px)); padding: .8rem 1rem; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); border-left: 5px solid var(--st-started); box-shadow: 0 10px 30px rgba(16, 24, 40, .16);
  animation: toast-in .35s cubic-bezier(.2, .8, .2, 1); transition: opacity .35s, transform .35s; }
.toast-err { border-left-color: var(--danger); }
.toast-icon { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok-soft); color: #14532d; font-weight: 700; }
.toast-err .toast-icon { background: var(--danger-soft); color: #7f1d1d; }
.toast-text { flex: 1; padding-top: .1rem; }
.toast-close { flex: none; border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.toast-hide { opacity: 0; transform: translateY(-10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
/* Блок, в котором только что что-то сделали, — мягкая подсветка. */
.just-changed { animation: block-pulse 1.8s ease-out; }
@keyframes block-pulse { 0% { box-shadow: 0 0 0 3px rgba(37, 99, 235, .45); } 100% { box-shadow: var(--shadow); } }
/* Раскрывающиеся формы появляются плавно. */
details[open] > :not(summary) { animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.btn { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.role-hints { margin: .25rem 0 0; padding-left: 1.1rem; display: grid; gap: .15rem; font-size: .85rem; color: var(--muted); }
/* Сообщение кандидату (tz2 §11): текст для проверки и копирования. */
.message-sample summary { cursor: pointer; }
.message-sample summary h2 { display: inline; }
.message-item { display: grid; gap: .4rem; padding: .85rem 0; border-top: 1px solid var(--border); }
.message-item:first-of-type { border-top: 0; }
.message-head { display: flex; gap: .75rem; flex-wrap: wrap; align-items: baseline; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.row-link { font-weight: 600; }
.row-muted td { color: var(--muted); }
.changes { margin: 0; padding: 0; list-style: none; font-size: .9rem; }

/* --- Вкладки и фильтры ----------------------------------------------------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .6rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chips a { padding: .35rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .9rem; }
.chips a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips a:hover { text-decoration: none; border-color: var(--accent); }

/* --- Прочее ------------------------------------------------------------- */
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0 0 1rem; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; font-size: .9rem; }
.side form { display: grid; gap: .75rem; }

.login-wrap { min-height: calc(100vh - 6rem); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; display: grid; gap: 1rem; }
.login-brand { margin: 0 auto .25rem; display: flex; flex-direction: column; align-items: stretch; gap: .5rem;
  width: min(240px, 80%); text-align: left; }
.login-logo { display: block; width: 100%; height: auto; }
.login-brand .brand-caption { font-size: .9rem; font-weight: 600; }
.login-card .muted { margin: -.75rem 0 0; }
.login-card .alert { margin: 0; }

.error-card { max-width: 520px; margin: 3rem auto; text-align: center; display: grid; gap: .75rem; justify-items: center; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--border); margin: 0; line-height: 1; }

/* --- Вакансии: плитки (ТЗ §10.1) ------------------------------------------ */
.section { margin-bottom: 1.5rem; }
.layout-split + .card, .layout-split + section { margin-top: 1rem; }
.block { display: block; }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--st-started);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile-urgent { border-left-color: var(--danger); }
.tile-closing { border-left-color: var(--st-pending); }
.tile-closed { border-left-color: var(--border); opacity: .75; }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.tile h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.tile h3 a { color: var(--text); }
.tile-flag { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--danger); white-space: nowrap; }
.tile-closing .tile-flag { color: #854d0e; }
.tile-closed .tile-flag { color: var(--muted); }
.tile-site, .tile-need { margin: 0; }
.tile-need b { font-size: 1.25rem; }
.tile-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .25rem; }
.tile-actions .btn { flex: 1; }
.head-actions { display: flex; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.status-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.people { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .25rem; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.prewrap { white-space: pre-line; margin-top: 0; }
.terms-block { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fafbfd; gap: .9rem; }
.term { display: grid; gap: .35rem; padding-top: .75rem; border-top: 1px dashed var(--border); }
.terms { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: .55rem 1rem; margin: 0 0 1rem; }
.terms dt { color: var(--muted); }
.terms dd { margin: 0; display: grid; gap: .15rem; }
.pay { font-size: 1.15rem; }
.term-value { font-weight: 600; }
.term-no { color: var(--muted); font-weight: 500; }
.housing-photos { margin-bottom: 1rem; }
.housing-photos h3 { font-size: 1rem; margin: 0 0 .5rem; }
.photo-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: .75rem; }
.photo-grid figure { margin: 0; display: grid; gap: .25rem; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.tile-pay { margin-left: .6rem; font-weight: 700; color: #166534; white-space: nowrap; }
.directions { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.directions li { display: grid; gap: .1rem; }
.direction-when { font-size: .9rem; color: var(--muted); }
.direction-people { line-height: 1.5; }

/* --- Кандидаты ------------------------------------------------------------- */
/* Статус участия: цвет из токенов --st-* (docs/DATA_MODEL.md §3). */
.status {
  --c: var(--st-response);
  display: inline-flex; flex-direction: column; align-items: flex-start; padding: .2rem .65rem; border-radius: 10px;
  font-size: .8rem; font-weight: 600; line-height: 1.3; color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, white);
}
.status > span { white-space: nowrap; }
.status-sub { font-weight: 500; font-size: .75rem; opacity: .9; }
.status-docs-ready { --c: var(--st-docs-ready); }
.status-sb-check { --c: var(--st-sb-check); }
.status-sb-passed { --c: var(--st-sb-passed); }
.status-sb-rejected { --c: var(--st-sb-rejected); }
.status-directed { --c: var(--st-directed); }
.status-started { --c: var(--st-started); }
.status-no-show { --c: var(--st-no-show); }
.status-shifts-3 { --c: var(--st-shifts-3); }
.status-shifts-15 { --c: var(--st-shifts-15); }
.status-declined { --c: var(--st-declined); }
.status-irrelevant { --c: var(--st-irrelevant); }
.status.conf-pending { --c: var(--st-pending); }
.status.conf-rejected { --c: var(--st-declined); }
.flag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .05rem .5rem; border-radius: 6px; white-space: nowrap; }
.flag-warn { background: var(--warn-soft); color: #854d0e; }
.flag-danger { background: var(--danger-soft); color: #991b1b; }
.phone-check { margin: .25rem 0 0; font-size: .9rem; }
.phone-check.ok { color: #166534; }
.phone-check.warn { color: #991b1b; font-weight: 600; }
.phone-link { font-size: 1.1rem; font-weight: 700; }
.form.narrow-lg { max-width: 760px; }
.add-person { margin-left: auto; }
.tile-stat { margin: 0; }
.section-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.section-head h2 { margin: 0; }
.section-head .chips { margin: 0 0 0 auto; }
.section-title { margin: 1.5rem 0 .75rem; }
.stack { display: grid; gap: 1rem; min-width: 0; }
.stack .card + .card { margin-top: 0; }

.filters { display: grid; gap: .6rem; margin-bottom: 1rem; }
.filters .search { min-height: 48px; font-size: 1.05rem; }
.filter-row { display: flex; gap: .75rem 1.5rem; flex-wrap: wrap; }
.chip-group { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 .8rem; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); font-size: .9rem;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.more-filters summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.filter-grid { display: grid; gap: .6rem 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.filter { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }

.completeness { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
/* Полоса прогресса одинакова во всех браузерах: светлая дорожка + цветное заполнение. */
progress { -webkit-appearance: none; appearance: none; border: 0; border-radius: 999px; overflow: hidden;
  background: var(--border); color: var(--st-started); }
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: currentColor; border-radius: 999px; }
progress::-moz-progress-bar { background: currentColor; border-radius: 999px; }
.completeness progress { flex: 1; height: 10px; }
.completeness.incomplete progress { color: var(--st-pending); }
.missing { margin: 0 0 1rem; padding: .6rem .9rem .6rem 2rem; background: var(--warn-soft); border-radius: 10px; color: #713f12; }
.slot.is-missing input, .slot.is-missing select { border-color: var(--st-pending); background: #fffcf0; }
.participation-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.participation-head h2 { margin-bottom: .2rem; }
.participation-head p { margin: 0; font-size: .9rem; }
.internal { background: var(--bg); padding: .5rem .75rem; border-radius: 8px; font-size: .9rem; }
.action-box { margin-top: .75rem; }
.action-box summary { list-style: none; width: fit-content; }
.action-box summary::-webkit-details-marker { display: none; }
.action-box[open] summary { margin-bottom: .75rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.inline-form select { width: auto; flex: 1; min-width: 200px; }
.duplicate h2 { color: #991b1b; }
.resolve-form { display: grid; gap: .75rem; }

/* --- Воронка ------------------------------------------------------------- */
.hint-line { display: block; width: fit-content; margin: .25rem 0 .5rem; }
.status-form { display: grid; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--border); }
.status-buttons { display: flex; gap: .4rem; flex-wrap: wrap; }
/* Карточка соискателя (tz2 §29): ФИО слева, текущий статус справа; блоки участия разделены линией. */
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.card-title { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-width: 0; }
.card-title h1 { margin: 0; }
.current-status { display: grid; gap: .35rem; justify-items: end; flex: none; max-width: 50%; }
.current-status-row { display: flex; align-items: center; gap: .4rem; color: inherit; text-align: right; }
.current-status-row:hover { text-decoration: none; }
.current-status .status { font-size: .95rem; padding: .35rem .75rem; }
.block { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--border); display: grid; gap: .55rem; }
.block > * { margin: 0; }
.block-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
summary.block-title { cursor: pointer; list-style-position: inside; }
.service-block { opacity: .9; }
.service-block .inline-form { margin-top: .5rem; }
.confirm-title { margin: 0 0 .15rem; font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--st-sb-check); }
.readiness { display: block; }
.confirm-box {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .75rem 0;
  padding: .75rem; border-radius: 10px; background: var(--warn-soft);
}
.confirm-box input { flex: 1; min-width: 180px; width: auto; }
.history { margin-top: .75rem; }
.history summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: .4rem; }
.copy-text { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; margin-bottom: .75rem; }
.pick-list { max-height: 420px; }

/* --- Документы ---------------------------------------------------------- */
.doc-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.doc-row {
  display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: .25rem 1rem; align-items: start;
  padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 10px;
}
.doc-row > .muted { align-self: center; }
.doc-missing { border-color: color-mix(in srgb, var(--st-pending) 60%, white); background: #fffcf0; }
.doc-type small { display: block; }
.doc-file { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.doc-actions { grid-column: 2; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.doc-actions form { display: flex; gap: .4rem; }
.upload-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.upload-form select { width: auto; flex: 0 1 240px; }
.upload-form input[type=file] { flex: 1; min-width: 200px; }
.req-grid { display: grid; gap: .4rem; }
.req-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .35rem 0; border-bottom: 1px solid var(--border); }

/* --- Аналитика ------------------------------------------------------------ */
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.funnel-step {
  display: grid; gap: .15rem; align-content: start; padding: .75rem .9rem; border-radius: 10px; background: var(--accent-soft);
  position: relative;
}
.funnel-step + .funnel-step::before {
  content: "→"; position: absolute; left: -.55rem; top: 50%; transform: translateY(-50%); color: var(--muted);
}
.funnel-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.funnel-value { font-size: 1.8rem; line-height: 1.1; }
.table-numbers td:not(:first-child), .table-numbers th:not(:first-child) { text-align: right; white-space: nowrap; }
.table-numbers tfoot th { background: #fafbfc; border-top: 2px solid var(--border); font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: .75rem; align-items: center;
  padding: .4rem 0; border-bottom: 1px solid var(--border); }
.progress-row progress { width: 100%; height: 10px; }

.rates-table input { width: 110px; text-align: right; min-height: 38px; }
.rates-table td, .rates-table th { vertical-align: middle; }
.input-error { border-color: var(--danger) !important; }

.audit-filter { margin-bottom: 1rem; max-width: 560px; }
@media (max-width: 1500px) {
  .who-name { display: none; }
  .menu a { padding: 0 .65rem; }
}
/* Таблица кандидатов во всю ширину: по мере сужения экрана прячем второстепенные колонки,
   прокрутка вбок остаётся только на небольших экранах (на телефоне — строки-карточки). */
@media (max-width: 1600px) {
  .table-candidates .c-source { display: none; }
}
@media (max-width: 1440px) {
  .table-candidates .c-docs, .table-candidates .c-ready { display: none; }
}
@media (max-width: 1280px) {
  .table-candidates .c-created, .table-candidates .c-region { display: none; }
  .table-candidates th, .table-candidates td { padding: .55rem .5rem; }
}
@media (max-width: 1024px) {
  .table-candidates .c-recruiter, .table-candidates .c-shift { display: none; }
}

/* --- Мобильные (ТЗ §54) ---------------------------------------------------- */
@media (max-width: 860px) {
  .layout-split { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  /* Шапка телефона: логотип + две кнопки-пиктограммы; меню — сетка пиктограмм без прокрутки. */
  .topbar { flex-wrap: wrap; padding: .4rem .75rem 0; gap: .25rem .5rem; min-height: 0; }
  .who { margin-left: 0; }
  .who-name, .btn-text { display: none; }
  .who .btn .icon { display: inline; }
  .brand { width: 112px; padding: .2rem 0; }
  .brand-caption { font-size: .56rem; }
  .add-person { margin-left: auto; width: var(--tap); padding: 0; }
  .add-person .icon, .who .btn .icon { width: 1.4em; height: 1.4em; margin: 0; }
  .who .btn { width: var(--tap); min-height: var(--tap); padding: 0; }
  .menu { order: 3; flex-basis: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    gap: 2px; overflow: visible; padding-bottom: .35rem; }
  .menu a { flex-direction: column; justify-content: center; gap: .15rem; min-height: 54px; padding: .3rem .15rem;
    font-size: .72rem; line-height: 1.1; text-align: center; white-space: nowrap; }
  .menu .icon { display: block; width: 1.45rem; height: 1.45rem; }
  .menu-label { display: none; }
  .menu-short { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .page { padding: 1rem .75rem 3rem; }
  .card { padding: 1rem; }
  .page-head .btn { width: 100%; margin-left: 0; }
  .actions .btn { flex: 1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* На телефоне статус — сразу под ФИО, во всю ширину: не теряется (tz2 §25). */
  .card-head { flex-direction: column; gap: .5rem; }
  .current-status { justify-items: start; max-width: none; }
  .action-grid { grid-template-columns: 1fr; }
  .toast { top: auto; bottom: 16px; left: 16px; right: 16px; max-width: none; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { padding: .5rem .6rem; }
  .doc-row { grid-template-columns: 1fr; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .funnel-step + .funnel-step::before { content: none; }
  .progress-row { grid-template-columns: 1fr; gap: .25rem; }
  .doc-actions { grid-column: 1; }
  .head-actions { width: 100%; margin-left: 0; }
  .head-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 .6rem; }
  .head-actions .head-main { flex-basis: 100%; order: -1; }
  /* Ставки на телефоне: строка — карточка «кому» + три поля с подписями. */
  .rates-table thead { display: none; }
  .rates-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem .5rem;
    padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .rates-table td { display: block; padding: 0; border: 0; }
  .rates-table td:first-child { grid-column: 1 / -1; }
  .rates-table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); }
  .rates-table input { width: 100%; }
  .terms { grid-template-columns: 1fr; gap: .1rem; }
  .terms dd { margin-bottom: .5rem; }
  .terms-block { padding: .75rem; }
  .section-head .chips { margin-left: 0; }
  /* Таблица кандидатов на телефоне — строки-карточки: кто, телефон, вакансия, звонок; справа статус. */
  .table-candidates thead { display: none; }
  .table-candidates tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem;
    padding: .7rem .85rem; border-bottom: 1px solid var(--border); }
  .table-candidates tbody tr:last-child { border-bottom: 0; }
  .table-candidates td { display: block; padding: 0; border: 0; min-width: 0; }
  .table-candidates td.c-name { grid-column: 1; grid-row: 1; min-width: 0; font-size: 1rem; }
  .table-candidates td.c-phone { grid-column: 1; grid-row: 2; }
  .table-candidates td.c-vacancy { grid-column: 1; grid-row: 3; }
  .table-candidates td.c-status { grid-column: 2; grid-row: 1 / span 3; }
  .table-candidates td.c-contact { grid-column: 1 / span 2; grid-row: 4; font-size: .85rem; color: var(--muted); }
  .table-candidates td.c-shift { grid-column: 1 / span 2; grid-row: 5; font-size: .85rem; color: var(--muted); }
  .table-candidates td.c-shift::before { content: "Первая смена: "; }
  .table-candidates td.c-region, .table-candidates td.c-source, .table-candidates td.c-recruiter,
  .table-candidates td.c-created, .table-candidates td.c-ready, .table-candidates td.c-docs,
  .table-candidates td.c-shift.is-empty { display: none; }
  .sort-mobile { display: block; }
}
