:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --column: #eceef4;
  --text: #1d2130;
  --muted: #6b7183;
  --border: #e3e6ee;
  --border-strong: #cdd2dd;
  --accent: #5b5bd6;
  --accent-hover: #4b4ac6;
  --accent-text: #ffffff;
  --danger: #c0362c;
  --success: #15a057;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 6px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.16);
  --workua: #2f55d4;
  --workua-bg: #e6ecff;
  --robotaua: #c0262d;
  --robotaua-bg: #fde7e7;
  --manual: #4b5563;
  --manual-bg: #eceef2;
  --sidebar-w: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #20242c;
    --column: #16191f;
    --text: #e8eaf0;
    --muted: #9aa0ae;
    --border: #2b303a;
    --border-strong: #3c4250;
    --accent: #8b8cf6;
    --accent-hover: #a3a4ff;
    --accent-text: #15162e;
    --danger: #ff8a80;
    --success: #4ade80;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
    --workua: #a9c1ff;
    --workua-bg: #1f2c4d;
    --robotaua: #ffb3b3;
    --robotaua-bg: #4a2123;
    --manual: #d1d5db;
    --manual-bg: #30353f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* Elements with their own display (board, banner) must still disappear when hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
button:hover { background: var(--surface-2); border-color: var(--border-strong); }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--surface-2); }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
button:focus-visible, .card:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a { color: var(--accent); }

/* --- sidebar --- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 6;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
}
.brand-mark svg { width: 20px; height: 20px; fill: var(--accent-text); }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

.nav { display: grid; gap: 2px; }
.nav-item {
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.sync-box {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.sidebar-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sync-status { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.sync-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sync-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--success); }
.sync-line.never .sync-dot { background: var(--border-strong); }
.sync-line.error { color: var(--danger); cursor: help; }
.sync-line.error .sync-dot { background: var(--danger); }
.sync-time { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sync-btn { width: 100%; }
.syncing .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .syncing .icon { animation: none; } }
.user-box { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.user-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { padding: 6px; }

/* --- workspace and top bar --- */

.workspace { margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.title-count {
  padding: 1px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.title-count:empty { display: none; }
.filters { flex: 1; display: flex; min-width: 220px; }
.search { position: relative; display: flex; align-items: center; width: min(480px, 100%); }
.search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 38px; padding-left: 38px; }
.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.actions button { white-space: nowrap; }
.actions .primary { padding: 8px 16px 8px 12px; }

/* --- filter bar --- */

.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 16px 24px 0; }
.filter-group { display: grid; gap: 4px; }
.filter-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
#filters-reset { color: var(--accent); }
.multi { position: relative; }
.multi-btn { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.multi-btn::after { content: " ▾"; color: var(--muted); }
.multi-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.multi-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 8;
  display: grid;
  gap: 2px;
  min-width: 300px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.multi-search { margin-bottom: 4px; }
.multi-group { display: grid; gap: 2px; }
.multi-group-title { padding: 8px 8px 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.multi-all { justify-self: start; border: 0; background: none; color: var(--accent); padding: 4px 8px; }
.multi-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.multi-option:hover { background: var(--surface-2); }
.multi-option .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.multi-text { display: grid; gap: 2px; }
.multi-meta { font-size: 11px; color: var(--muted); }

/* --- date range picker --- */

.drp { position: relative; }
.drp-field { display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; min-width: 240px; text-align: left; }
.drp-field svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.drp-field.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.drp-text.placeholder { color: var(--muted); }
.drp-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 8;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.drp-presets { display: grid; align-content: start; gap: 2px; min-width: 170px; padding: 8px; border-right: 1px solid var(--border); }
.drp-presets button { justify-content: flex-start; border: 0; background: none; text-align: left; padding: 8px 10px; }
.drp-presets button:hover { background: var(--surface-2); }
.drp-months { display: flex; }
.drp-month { width: 300px; padding: 10px 14px 12px; }
.drp-month + .drp-month { border-left: 1px solid var(--border); }
.drp-head { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; height: 32px; margin-bottom: 4px; }
.drp-title { text-align: center; font-weight: 600; font-size: 15px; }
.drp-nav-group:last-child { text-align: right; }
.drp-nav { border: 0; background: none; padding: 2px 7px; font-size: 16px; color: var(--muted); }
.drp-nav:hover:not(:disabled) { color: var(--text); background: none; }
.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.drp-wd { font-size: 11px; color: var(--muted); padding: 4px 0 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.drp-day { height: 32px; padding: 0; border: 0; border-radius: 0; background: none; font-variant-numeric: tabular-nums; }
.drp-day.out { color: var(--muted); }
.drp-day.today { color: var(--accent); font-weight: 700; }
.drp-day.in-range { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.drp-day.edge { background: var(--accent); color: var(--accent-text); border-radius: 8px; }
.drp-day:disabled { opacity: 1; color: color-mix(in srgb, var(--muted) 55%, transparent); background: var(--surface-2); cursor: default; }
.drp-day:not(:disabled):hover { box-shadow: inset 0 0 0 1px var(--accent); border-radius: 8px; }

/* --- banner, bulk bar, toast --- */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 24px 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.banner button { margin-left: auto; }

.col-check { width: 40px; }
.col-check input { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; accent-color: var(--accent); }
.bulk-bar {
  position: fixed;
  left: calc(50% + var(--sidebar-w) / 2);
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - var(--sidebar-w) - 32px);
  padding: 10px 12px 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.bulk-bar label { display: inline-flex; align-items: center; gap: 6px; }
#bulk-count { font-weight: 600; }

.toast {
  position: fixed;
  left: calc(50% + var(--sidebar-w) / 2);
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  white-space: pre-line;
}

/* --- avatars and badges --- */

.avatar {
  --h: 240;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--h) 75% 93%);
  color: hsl(var(--h) 45% 34%);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; }
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--h) 28% 25%); color: hsl(var(--h) 80% 84%); }
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.workua { color: var(--workua); background: var(--workua-bg); }
.badge.robotaua { color: var(--robotaua); background: var(--robotaua-bg); }
.badge.manual, .badge.demo { color: var(--manual); background: var(--manual-bg); }
.card-src { display: inline-flex; align-items: center; gap: 2px; }
.ext-link {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.ext-link:hover, .ext-link:focus-visible { color: var(--accent); background: var(--surface-2); }

/* Stage colors are the HR's choice (even black), so text in them leans toward the theme's text color. */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--stage-color) 85%, var(--text));
  background: color-mix(in srgb, var(--stage-color) 14%, transparent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .pill { color: color-mix(in srgb, var(--stage-color) 50%, var(--text)); background: color-mix(in srgb, var(--stage-color) 24%, transparent); }
  .column h2::before { background: color-mix(in srgb, var(--stage-color, var(--border-strong)) 70%, var(--text)); }
}

/* --- board --- */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(276px, 1fr);
  align-items: start;
  gap: 14px;
  min-height: calc(100vh - 150px);
  padding: 16px 24px 28px;
  overflow-x: auto;
}
/* --stage-color is set inline from each stage's own color. */
.column {
  min-height: 160px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--column);
  transition: background 0.15s, border-color 0.15s;
}
.column.drop {
  background: color-mix(in srgb, var(--stage-color) 12%, var(--column));
  border-color: color-mix(in srgb, var(--stage-color) 45%, transparent);
}
.column h2 { display: flex; align-items: center; gap: 8px; margin: 2px 4px 10px; font-size: 13px; font-weight: 600; }
.column h2::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--stage-color, var(--border-strong)); }
.column h2 .count {
  margin-left: auto;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.count { color: var(--muted); font-weight: 500; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.empty { padding: 14px 0; color: var(--muted); font-size: 12px; text-align: center; }

.card {
  position: relative;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card.dragging { opacity: 0.5; }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-title { flex: 1; min-width: 0; }
.card .name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.card .vacancy { margin-top: 1px; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.card-quick { position: absolute; right: 10px; bottom: 9px; opacity: 0; transition: opacity 0.12s; }
.card:hover .card-quick, .card:focus-within .card-quick { opacity: 1; }
.quick-btn {
  padding: 2px 10px;
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.quick-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* --- list view --- */

.list-view { padding: 16px 24px 96px; }  /* bottom room for the bulk bar */
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.tab { gap: 6px; padding: 5px 12px; border-radius: 999px; font-weight: 500; }
.tab .count { font-size: 12px; }
.tab[aria-pressed="true"] { background: var(--stage-color, var(--accent)); border-color: var(--stage-color, var(--accent)); color: #fff; }
.tab[data-stage="all"][aria-pressed="true"] { color: var(--accent-text); }
.tab[aria-pressed="true"] .count { color: inherit; opacity: 0.85; }
.tab[aria-pressed="true"]:not([data-stage="all"])::before { content: "✓"; font-weight: 700; }
.sort-hint { align-self: center; margin-left: auto; color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { background: var(--surface-2); font-size: 12px; white-space: nowrap; }
.table th .sort { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 600; }
.table th[aria-sort] .sort { color: var(--text); }
.table .row { cursor: pointer; transition: background 0.1s; }
.table .row:hover { background: var(--surface-2); }
.table .row.open { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.table .row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.who { display: flex; align-items: center; gap: 10px; }
.table .name { font-weight: 600; }
.col-toggle { width: 32px; color: var(--muted); }
.col-date, .col-source { white-space: nowrap; }
.details-row > td { padding: 6px 20px 22px 58px; background: var(--surface-2); }
.details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; }
.loading { padding: 12px 0; }
.cv-tag {
  margin-left: 8px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 12px 0; }
.pager button { min-width: 38px; }
.pager-gap { padding: 0 4px; color: var(--muted); }
.small { font-size: 12px; }
mark { padding: 0 1px; border-radius: 3px; background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- candidate panel --- */

.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(15, 18, 30, 0.4); }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  width: min(780px, 100vw);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.drawer-head { display: flex; align-items: center; gap: 16px; padding: 24px 24px 14px; }
.drawer-title { flex: 1; min-width: 0; }
.drawer-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.drawer-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.close { align-self: flex-start; padding: 4px 10px; font-size: 20px; line-height: 1; }
.drawer-links { padding: 0 24px 18px; }
.props {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 18px;
  padding: 16px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.prop { display: grid; gap: 6px; align-content: start; }
.prop-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.prop select { width: 100%; }
.prop .hint { margin: 0; color: var(--muted); font-size: 12px; }
.next-stage { justify-self: start; }
.drawer-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 18px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.drawer-tab {
  gap: 6px;
  padding: 13px 2px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.drawer-tab:hover { background: none; color: var(--text); }
.drawer-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.drawer-tab .count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
}
.tab-panel { padding: 4px 24px 40px; }

.muted { color: var(--muted); }
.section { margin-top: 20px; }
.section h3 { margin: 0 0 8px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row select { flex: 1; min-width: 0; }  /* long vacancy names mustn't push it out of its column */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.contacts { display: grid; gap: 4px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.drawer-links.contact-actions { margin-top: 0; }
.contact-actions a, .link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.contact-actions a:hover, .link-button:hover { border-color: var(--border-strong); background: var(--surface-2); }
.contact-actions a.platform-link { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.pre { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pre.scroll { max-height: 380px; overflow-y: auto; }
details summary { cursor: pointer; font-weight: 600; }
details .pre { margin-top: 8px; }
.cv-frame {
  display: block;
  width: 100%;
  height: min(80vh, 900px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.cv-image { display: block; max-width: 100%; border: 1px solid var(--border); border-radius: 10px; }

.note-form { display: grid; gap: 8px; }
.note-form button { justify-self: start; }
.list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.list.notes li { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.list.timeline { gap: 0; }
.list.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--border); margin-left: 5px; }
.list.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.list.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}
.list .when { color: var(--muted); font-size: 12px; }
.list .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-head { display: flex; align-items: center; gap: 6px; }
.note-delete { margin-left: auto; padding: 0 6px; border-color: transparent; background: none; color: var(--muted); font-size: 11px; line-height: 20px; }
.note-delete:hover, .note-delete:focus-visible { border-color: currentColor; background: none; color: var(--danger); }

/* --- dialogs --- */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(15, 18, 30, 0.42); }
dialog h2 { margin: 0 0 14px; font-size: 19px; letter-spacing: -0.01em; }
dialog form { display: grid; gap: 12px; }
dialog label { display: grid; gap: 5px; font-weight: 500; }
dialog.wide { width: min(660px, calc(100vw - 32px)); }
dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
dialog .field { display: grid; gap: 5px; font-weight: 500; }

/* Vacancy picker in the new-candidate form: the filter's list, opening in place inside the form. */
.picker-btn { width: 100%; max-width: none; font-weight: 400; }
.picker-btn .badge { margin-left: 4px; }
.picker-panel {
  display: grid;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 400;
}
/* Option buttons in single-pick lists (the vacancy picker, the "Джерело" filter). */
:is(.picker-panel, .source-panel) .multi-option { width: 100%; justify-content: flex-start; border: 0; background: none; text-align: left; font-weight: 400; }
:is(.picker-panel, .source-panel) .multi-option:hover { background: var(--surface-2); }
:is(.picker-panel, .source-panel) .multi-option[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.source-panel { min-width: 220px; }
.picker-panel .picker-new { color: var(--accent); font-weight: 600; }
.form-error { padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }

.stages-editor { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stage-edit {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--stage-color);
  border-radius: 10px;
}
.stage-edit input[type="color"] { width: 40px; height: 32px; padding: 2px; cursor: pointer; }
.stage-edit .row-actions { display: flex; gap: 4px; }
.stage-edit .info { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.stage-edit.deleted { background: var(--surface-2); }
.stage-edit.deleted input[type="text"] { text-decoration: line-through; }
.stage-edit .icon-btn { padding: 4px 9px; }
.add-stage { justify-self: start; }

/* --- login page --- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: 22px; }
.login-card h1::before {
  content: "";
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 8h18v4H7zM10 14h12v4H10zM13 20h6v4h-6z' fill='white'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.login-card p { margin: 0; }
.login-card form { display: grid; gap: 14px; margin-top: 20px; }
.login-card label { display: grid; gap: 5px; font-weight: 500; }
.login-card button { padding: 9px 14px; }
.login-card code { font-size: 12px; overflow-wrap: anywhere; }
.password-field { position: relative; display: block; }
.password-field input { width: 100%; padding-right: 42px; }
.password-field input::-ms-reveal { display: none; }  /* Edge's own eye; we have ours */
.password-field .reveal {  /* two classes, so it beats ".login-card button" */
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
}
.password-field .reveal:hover { color: var(--text); }
.password-field .reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- narrower screens: the sidebar shrinks to icons, then moves to the top --- */

@media (max-width: 1000px) {
  :root { --sidebar-w: 72px; }
  .sidebar { align-items: center; padding: 16px 10px; }
  .brand { padding: 0; }
  .brand-name, .nav-item span, .sidebar-label, .sync-status, .sync-text, .user-name { display: none; }
  .nav-item { justify-content: center; width: 44px; padding: 10px; }
  .sync-box { padding: 0; border: 0; background: none; }
  .sync-btn { width: 44px; padding: 10px; }
  .user-box { flex-direction: column; padding: 0; }
}

@media (max-width: 700px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: static;
    flex-direction: row;
    width: auto;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav { display: flex; }
  .sidebar-foot { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; }
  .user-box { flex-direction: row; }
  #user-avatar { display: none; }
  .topbar { padding: 12px 14px; }
  .filterbar, .list-view { padding-left: 14px; padding-right: 14px; }
  .board { grid-auto-columns: 85vw; padding: 14px; }
  .banner { margin: 14px 14px 0; }
  .col-vacancy, .col-source, .col-notes, .col-date { display: none; }
  .drp-field { min-width: 0; width: 100%; }
  .drp-panel {
    position: fixed;
    top: 64px;
    left: 8px !important;
    right: 8px !important;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
  .drp-presets { grid-auto-flow: column; overflow-x: auto; min-width: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .drp-presets button { white-space: nowrap; }
  .drp-months { flex-direction: column; }
  .drp-month { width: auto; }
  .drp-month + .drp-month { border-left: 0; border-top: 1px solid var(--border); }
  .details { grid-template-columns: 1fr; }
  .details-row > td { padding-left: 14px; }
  .props { grid-template-columns: 1fr; }
  .drawer-head, .drawer-links, .props, .drawer-tabs, .tab-panel { padding-left: 16px; padding-right: 16px; }
}
