:root {
  --bg: #f6f7f9; --surface: #fff; --border: #e3e6ea; --text: #16191d;
  --muted: #6b7280; --accent: #1f6feb; --warn: #b45309; --warn-bg: #fef3c7;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --surface: #1c2024; --border: #2c3238; --text: #e6e9ec;
    --muted: #9aa3ad; --accent: #4c8dff; --warn: #fbbf24; --warn-bg: #3a2f14;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.num { text-align: right; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 650; letter-spacing: .02em; color: var(--text); }
.topbar nav { display: flex; gap: 18px; flex: 1; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
button.link:hover { color: var(--text); }

main { padding: 24px; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
h1 { font-size: 20px; margin: 0 0 2px; }
h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.button, button.primary {
  display: inline-block; padding: 7px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font: inherit;
}
.button:hover { text-decoration: none; border-color: var(--muted); }
button.primary, a.primary.button { background: var(--accent); border-color: var(--accent); color: #fff; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 460px; }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.filters { display: flex; gap: 14px; margin-bottom: 14px; font-size: 13px; }
.filters a { color: var(--muted); }
.filters a.active { color: var(--text); font-weight: 600; }

table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.warn td { background: color-mix(in srgb, var(--warn-bg) 55%, transparent); }

.banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.empty { padding: 40px 0; text-align: center; }

/* Канбан */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.column { flex: 0 0 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.column.terminal { opacity: .75; }
.column.over { border-color: var(--accent); }
.column header { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.column .count { color: var(--muted); font-weight: 400; }
.column .cards { padding: 8px; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }

.card-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; cursor: grab; }
.card-item.dragging { opacity: .4; }
.card-item a { color: var(--text); font-weight: 500; }
.card-item .meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--border); color: var(--muted); }
.score { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; color: #fff; background: #9ca3af; }
.score.s3 { background: #16a34a; } .score.s2 { background: #65a30d; }
.score.s1 { background: #d97706; } .score.s0 { background: #dc2626; }
.age { font-size: 11px; color: var(--muted); margin-top: 5px; }
.age.over { color: var(--warn); font-weight: 600; }

.contacts, .applications, .notes { list-style: none; padding: 0; margin: 0; }
.contacts li, .applications li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: baseline; }
.contacts li:last-child, .applications li:last-child { border-bottom: 0; }
.kind { font-size: 11px; color: var(--muted); width: 60px; }
.stage { font-size: 12px; padding: 1px 7px; border-radius: 5px; background: var(--border); }
.notes li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.note-head { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.resume-text { white-space: pre-wrap; font-size: 13px; background: var(--bg); padding: 12px; border-radius: 8px; max-height: 420px; overflow: auto; }
details summary { cursor: pointer; padding: 6px 0; font-size: 13px; }

/* Панель фільтрів */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 280px; margin: 0; }
.toolbar select { width: auto; margin: 0; }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.toolbar label.inline input { width: auto; margin: 0; }

/* Статуси вакансій */
.status { font-size: 12px; padding: 2px 8px; border-radius: 20px; background: var(--border); color: var(--muted); font-weight: 500; white-space: nowrap; }
.status.st-open { background: #dcfce7; color: #15803d; }
.status.st-in_progress { background: #dbeafe; color: #1d4ed8; }
.status.st-on_hold { background: #fef3c7; color: #b45309; }
.status.st-closed { background: #fee2e2; color: #b91c1c; }
.status.st-cancelled { background: var(--border); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .status.st-open { background: #14331f; color: #4ade80; }
  .status.st-in_progress { background: #16243f; color: #7cb0ff; }
  .status.st-on_hold { background: #3a2f14; color: #fbbf24; }
  .status.st-closed { background: #3b1717; color: #f87171; }
}
h1 .status { font-size: 12px; vertical-align: middle; margin-left: 8px; }
.fresh { color: #2563eb; font-weight: 600; margin-left: 3px; }

/* Картка кандидата */
.card-item .pos { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-item .sub { display: flex; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.avatar {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Аналітика */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tile-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tile-value { font-size: 30px; font-weight: 600; line-height: 1.1; }
.tile-value .pct { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 6px; }

.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.funnel-label { text-align: right; font-size: 13px; }
.funnel-label .small { font-size: 11px; }
.funnel-bar { display: flex; align-items: center; height: 30px; }
.seg { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #14532d; font-weight: 600; min-width: 0; }
.seg.pass { background: #a7d8ab; border-radius: 4px 0 0 4px; }
.seg.drop { background: #e8a9a1; color: #7f1d1d; border-radius: 0 4px 4px 0; }
.funnel-total { padding-left: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }

table.grid.bare { border: 0; background: none; }
table.grid.bare td, table.grid.bare th { padding: 7px 8px; }
.tag.company { background: #fee2e2; color: #b91c1c; }
@media (prefers-color-scheme: dark) { .tag.company { background: #3b1717; color: #f87171; } }
.actions { display: flex; gap: 8px; }

.banner-form { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: var(--radius); }
.banner-form select, .banner-form button { margin: 0; }

body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
body.centered main { padding: 0; width: 100%; max-width: 420px; }
body.centered h1 { font-size: 22px; margin-bottom: 6px; }
body.centered .card { margin-bottom: 0; }

/* Картка кандидата */
.person-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.photo {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.alarm-banner { background: #fee2e2; color: #b91c1c; font-weight: 600; }
@media (prefers-color-scheme: dark) { .alarm-banner { background: #3b1717; color: #f87171; } }

.vacancy-block { padding: 12px 0; border-bottom: 1px solid var(--border); }
.vacancy-block:last-child { border-bottom: 0; padding-bottom: 0; }
.vacancy-line { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.vacancy-line a:first-child { font-weight: 500; }
.reject-line { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.inline-form { display: inline; }
.stage-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.stage-form select { width: auto; margin: 0; font-size: 13px; padding: 5px 8px; }
.stage-form button { padding: 5px 12px; font-size: 13px; }
.vacancy-block .meta { margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.small { font-size: 12px; }

.contacts li { display: flex; gap: 10px; align-items: center; }
.contacts .value { flex: 1; }
.messengers { display: flex; gap: 6px; }
.messengers a {
  width: 22px; height: 22px; border-radius: 6px; background: var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.messengers a:hover { background: var(--accent); color: #fff; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag.alarm { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.tag.good { background: #dcfce7; color: #15803d; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .tag.alarm { background: #3b1717; color: #f87171; }
  .tag.good { background: #14331f; color: #4ade80; }
}

dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed-main { font-size: 14px; }
.feed-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.note-body { white-space: pre-wrap; }

.row-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.matched { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 460px; font-style: italic; }
.vac-cell { font-size: 13px; max-width: 320px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; }

table.bulk select { margin: 0; padding: 5px 8px; font-size: 13px; }
table.bulk td { vertical-align: top; }
.sticky-save {
  position: sticky; bottom: 0; padding: 14px 0; margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}

.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none;
}
.google-btn:hover { border-color: var(--muted); text-decoration: none; }
.google-btn .g {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #4285f4;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; border: 1px solid #dadce0;
}
.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.card.narrow-wide { max-width: 720px; }
.card.narrow-wide form { display: flex; gap: 10px; align-items: flex-end; }
.card.narrow-wide label { flex: 1; margin: 0; }
.card.narrow-wide button { margin-bottom: 0; }

.conn { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.conn-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.conn-form label { margin: 0; flex: 1; min-width: 180px; }
.conn-form button { margin-bottom: 0; }
.code-big { font-size: 20px; letter-spacing: 3px; font-family: ui-monospace, monospace; }
.row-actions { display: flex; gap: 12px; white-space: nowrap; }
tr.muted-row td { opacity: .5; }
table.grid select { margin: 0; padding: 4px 8px; font-size: 13px; }
