:root {
  /* Серый нейтральный фон, красноватый акцент. Зелёный — только для «хороших» статусов. */
  --bg: #e9eaec; --surface: #ffffff; --ink: #1f2124; --muted: #62666d; --line: #d3d6da;
  --accent: #b3243b; --accent-ink: #ffffff; --accent-soft: #f8e4e7;
  --good: #1d6b34; --good-soft: #e1f2e6;
  --danger: #b84a00; --danger-soft: #fdebdc; --warn: #7a5a00; --warn-soft: #fbf0d0; --ok: #1d6b34;
  --radius: 8px; --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1c1f; --surface: #26282c; --ink: #ecedef; --muted: #a0a4ab; --line: #3a3d43;
    --accent: #f0728a; --accent-ink: #2a060d; --accent-soft: #43202a;
    --good: #7bd493; --good-soft: #1c3524;
    --danger: #ffa366; --danger-soft: #40260f; --warn: #f2c261; --warn-soft: #3a2e12; --ok: #7bd493;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
h1 { font-size: 22px; margin: 0; line-height: 1.25; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 6px; }
h4 { font-size: 13px; margin: 14px 0 6px; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12px; background: var(--bg); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.error { color: var(--danger); } .ok { color: var(--ok); }
.pad { padding: 16px 0; }
.pre { white-space: pre-wrap; }
.empty { color: var(--muted); padding: 32px 16px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: var(--radius); }

/* Каркас */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: .02em; color: var(--accent); padding: 0 10px 14px; }
.brand.big { font-size: 34px; padding: 0 0 4px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.side nav a:hover { background: var(--bg); text-decoration: none; }
.side nav a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.who { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.who span { color: var(--muted); font-size: 12px; }
.content { padding: 20px 24px 48px; min-width: 0; }
.page-head select { width: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.meta { color: var(--muted); margin: 4px 0 8px; }

/* Кнопки и поля */
.btn { font: inherit; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.block { display: block; text-align: center; margin: 14px 0; }
.btn.score { padding: 5px 10px; }
.link { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-align: left; }
.link.danger { color: var(--danger); }
.icon { font-size: 20px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.icon:hover { background: var(--bg); color: var(--ink); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; flex-direction: row; cursor: pointer; }
.inline { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); }
.inline select, .inline input { width: auto; color: var(--ink); }
.narrow { width: 84px !important; flex: none; } .narrow2 { width: 110px !important; }
.form { display: flex; flex-direction: column; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.grid2, .grid3 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span { grid-column: 1 / -1; }
.choices { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.choices legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.order { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 0 7px; font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; align-items: flex-start; } .row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; max-width: 560px; }

/* Вкладки */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; cursor: pointer; color: var(--ink); }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs b { margin-left: 6px; font-weight: 600; opacity: .7; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.seg button { font: inherit; border: 0; background: var(--surface); color: var(--ink); padding: 6px 12px; cursor: pointer; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Карточки и таблицы */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.cards .card { margin: 0; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--bg); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); margin: 0 4px 2px 0; border: 1px solid var(--line); }
a.tag:hover { text-decoration: none; border-color: var(--accent); }
.tag.open, .tag.active, .tag.hired, .tag.approved { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag.rejected, .tag.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.warn, .tag.paused { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chain { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { padding-left: 16px; position: relative; color: var(--muted); }
.step::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.step.pending { color: var(--ink); } .step.pending::before { background: var(--warn); }
.step.approved::before { background: var(--good); } .step.rejected { color: var(--danger); } .step.rejected::before { background: var(--danger); }

/* Вакансия: список + карточка кандидата */
.split { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.split.open { grid-template-columns: minmax(240px, 320px) 1fr; }
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list .empty { border: 0; }
.list-item { font: inherit; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--bg); } .list-item.on { background: var(--accent-soft); }
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.modal .detail { border: 0; padding: 0; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.notebox { background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.composer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { border-left: 2px solid var(--line); padding-left: 10px; }
.timeline li.stage { border-color: var(--accent); } .timeline li.reject { border-color: var(--danger); } .timeline li.rating { border-color: var(--warn); }
.timeline p { margin: 2px 0 0; white-space: pre-wrap; }
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.column.over { border-color: var(--accent); background: var(--accent-soft); }
.column h4 { margin: 0 0 4px; display: flex; justify-content: space-between; gap: 6px; }
.column h4 b { color: var(--muted); }
.kcard { font: inherit; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; cursor: grab; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.kcard:hover { border-color: var(--accent); }

/* Адаптация, опросы, цели, аналитика */
.checklist, .krs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.checklist li.done .check span { text-decoration: line-through; color: var(--muted); }
.checklist li.overdue .muted { color: var(--danger); }
.krs li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 6px; }
.progress { display: inline-flex; align-items: center; gap: 6px; width: 120px; flex: none; position: relative; height: 8px; background: var(--bg); border-radius: 4px; margin-right: 36px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.progress em { position: absolute; left: 100%; margin-left: 6px; font-style: normal; font-size: 12px; color: var(--muted); }
.question { border: 0; padding: 0; margin: 0 0 4px; } .question legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.scale { display: flex; gap: 6px; }
.scale label { border: 1px solid var(--line); border-radius: 6px; padding: 6px 14px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.scale label.on { border-color: var(--accent); background: var(--accent-soft); }
.result { border-top: 1px solid var(--line); padding-top: 10px; } .result h4 { margin-top: 0; font-size: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 220px) 1fr max-content; gap: 10px; align-items: center; margin: 5px 0; }
.result .bar-row { grid-template-columns: 20px 1fr max-content; }
.bar-track { background: var(--bg); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.bar-count { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 28px; text-align: right; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.tiles b { font-size: 24px; } .tiles span { color: var(--muted); font-size: 12px; }

/* Окна и вход */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 14, .5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; z-index: 10; }
.modal { background: var(--surface); border-radius: 10px; padding: 18px 20px; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.modal.wide { max-width: 820px; }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 380px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  .side nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .side nav a { white-space: nowrap; }
  .who { border: 0; padding: 0; flex-direction: row; gap: 8px; margin-left: auto; align-items: center; }
  .who span { display: none; }
  .content { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .split.open { grid-template-columns: 1fr; } .split.open .list { display: none; }
  .cards { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr max-content; }
}

/* Фильтры и выбор сотрудника */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { width: auto; flex: 1 1 160px; max-width: 280px; }
.person { position: relative; }
.person-value { font: inherit; width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; cursor: pointer; }
.person-value span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-value i { font-style: normal; color: var(--muted); }
.person-required { position: absolute; opacity: 0; pointer-events: none; height: 1px; bottom: 0; left: 20px; width: 1px; padding: 0; border: 0; }
.person-pop { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: min(440px, 86vw); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 10px; }
.person-pop .filters { margin-bottom: 8px; }
.person-pop .filters input, .person-pop .filters select { flex: 1 1 120px; max-width: none; }
.person-pop ul { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.person-pop li button { font: inherit; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; color: var(--ink); }
.person-pop li button:hover, .person-pop li button[aria-selected=true] { background: var(--accent-soft); }
.pad-s { padding: 6px 8px; }
.picked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.picked li { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 6px; padding: 4px 8px; }
.picked li > span { flex: 1; min-width: 0; }
