:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --text: #1c2230;
  --muted: #687085;
  --line: #e3e6ee;
  --line-strong: #cfd4e0;
  --accent: #3b5bdb;
  --accent-hover: #2f4bc0;
  --accent-weak: #e9edff;
  --ok: #2b8a3e;
  --ok-weak: #e7f5ea;
  --warn: #a95c00;
  --warn-weak: #fff3e0;
  --danger: #c92a2a;
  --danger-weak: #fdecec;
  --input: #ffffff;
  --shadow: 0 1px 2px rgba(20, 28, 50, .06), 0 4px 16px rgba(20, 28, 50, .05);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c;
    --card: #1a1e27;
    --text: #e6e8ee;
    --muted: #9aa1b2;
    --line: #2a303d;
    --line-strong: #3a4252;
    --accent: #7c93ff;
    --accent-hover: #93a6ff;
    --accent-weak: #232c4d;
    --ok: #69c47c;
    --ok-weak: #1d3324;
    --warn: #f0a24b;
    --warn-weak: #3a2b16;
    --danger: #ff7b7b;
    --danger-weak: #3d1f22;
    --input: #141821;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }
code { background: var(--accent-weak); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.lead { font-size: 15px; margin: 0 0 10px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.logo { background: var(--accent); color: #fff; border-radius: 7px; padding: 1px 6px; margin-right: 3px; font-size: 14px; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a {
  display: flex; align-items: center; gap: 6px; padding: 0 14px; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.top-status { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line); white-space: nowrap; color: var(--muted);
}
.status-chip.ok { color: var(--ok); background: var(--ok-weak); border-color: transparent; }
.status-chip.warn { color: var(--warn); background: var(--warn-weak); border-color: transparent; }
a.status-chip:hover { text-decoration: none; filter: brightness(.97); }
.pill { background: var(--accent-weak); color: var(--accent); border-radius: 999px; padding: 0 7px; font-size: 12px; font-weight: 600; }

main { max-width: 1440px; margin: 0 auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }

/* ---------- cards & controls ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }

input, select, textarea {
  font: inherit; color: inherit; background: var(--input);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--text); }
label.check { flex-direction: row; align-items: center; gap: 7px; color: var(--text); cursor: pointer; }
label.check > input { flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input, .row > select { flex: 1; }

.btn {
  font: inherit; font-weight: 500; cursor: pointer; border-radius: 8px; padding: 7px 14px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger-weak); background: var(--danger-weak); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 10px; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; animation: spin .8s linear infinite;
}
.btn.primary.loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.icon { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon:hover { background: var(--bg); color: var(--text); }

.badge { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.info { background: var(--accent-weak); color: var(--accent); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
button.badge { border: 0; cursor: pointer; font-family: inherit; }
button.badge:hover { filter: brightness(.95); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-weak); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; opacity: .7; }
.chip button:hover { opacity: 1; }
.chip.plain { padding: 3px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }

/* ---------- search ---------- */
.search-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.filters { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; padding-bottom: 0; }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; padding: 0; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.checks.one-col { grid-template-columns: 1fr; }
.checks label { font-size: 13px; }
details.more { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 14px; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.filters .form-actions { position: sticky; bottom: 0; background: var(--card); padding: 12px 0 18px; border-top: 1px solid var(--line); }

.kw-row { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.kw-row .kw-text { grid-column: 1 / 3; }
.kw-row .kw-del { grid-column: 3; grid-row: 1; align-self: center; }
.kw-row select { font-size: 12.5px; padding: 5px 6px; }
.kw-row .kw-period { grid-column: 1 / 3; }
#kw-list { display: flex; flex-direction: column; gap: 8px; }

.chip-input { position: relative; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 6px; background: var(--input); }
.chip-input:focus-within { border-color: var(--accent); }
.chip-input .chips { display: contents; }
.chip-input input { border: 0; outline: 0; flex: 1; min-width: 120px; padding: 3px 4px; background: transparent; }
.suggest {
  position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); z-index: 30; max-height: 280px; overflow: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow);
}
.suggest .opt { padding: 7px 10px; cursor: pointer; }
.suggest .opt:hover, .suggest .opt.active { background: var(--accent-weak); }
.suggest .opt .muted { font-size: 12px; }

.results-head { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 56px; z-index: 5; }
.results-summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.big { font-size: 17px; font-weight: 600; }
.results-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.import-options { display: flex; gap: 6px 18px; flex-wrap: wrap; padding: 10px 12px; background: var(--bg); border-radius: 10px; }
.import-options label { font-size: 13px; }

.res-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.res-card { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.res-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.res-card .res-check { padding-top: 3px; }
.res-main { flex: 1; min-width: 0; }
.res-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.res-title a { font-size: 15.5px; font-weight: 600; }
.res-salary { margin-left: auto; font-weight: 600; white-space: nowrap; }
.res-sub { color: var(--muted); margin-top: 3px; }
.res-exp { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 3px; }
.res-exp li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.res-error { padding: 16px; border-radius: var(--radius); background: var(--danger-weak); color: var(--danger); }
.res-error a { font-weight: 600; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

.pager { display: flex; gap: 4px; justify-content: center; margin: 16px 0 6px; flex-wrap: wrap; }
.pager button { min-width: 34px; }
.pager button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- AI ---------- */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.ai-main .card + .card { margin-top: 16px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.examples button { font: inherit; font-size: 12.5px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 999px; padding: 3px 10px; cursor: pointer; color: var(--muted); }
.examples button:hover { color: var(--text); border-color: var(--accent); }
.filter-summary { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.filter-summary .fs-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.filter-summary .fs-label { color: var(--muted); min-width: 130px; font-size: 13px; }
.warning { background: var(--warn-weak); color: var(--warn); padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.preview-head { margin: 4px 0 8px; }
.mini-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.mini-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.mini-item .t { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .s { color: var(--muted); white-space: nowrap; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; align-items: end; }
.big-check { padding-bottom: 8px; }
.ai-history { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.history { display: flex; flex-direction: column; gap: 8px; }
.h-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.h-item .h-title { font-weight: 500; overflow-wrap: anywhere; }
.h-item .h-meta { font-size: 12px; color: var(--muted); margin: 3px 0 6px; }
.h-item .row { gap: 10px; }

/* ---------- base ---------- */
.base-toolbar { display: flex; flex-direction: column; gap: 10px; }
.base-toolbar .row > input { flex: 1; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters-row select, .filters-row input { padding: 6px 8px; font-size: 13px; }
.filters-row .range { display: inline-flex; gap: 4px; }
.filters-row .range input { width: 112px; }
.filters-row #bf-min-score { width: 100px; }
.ai-note { background: var(--accent-weak); color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.table-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--bg); }
.table .num { text-align: right; white-space: nowrap; }
.table .cand-name { font-weight: 600; }
.table .cand-title { color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .contacts { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; white-space: nowrap; }
.table select { font-size: 12.5px; padding: 3px 6px; }
.table .tg-cell { white-space: nowrap; }
.score { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.score.hi { background: var(--ok-weak); color: var(--ok); }
.score.mid { background: var(--warn-weak); color: var(--warn); }
.score.lo { background: var(--danger-weak); color: var(--danger); }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 24, .35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); z-index: 41;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column;
}
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.drawer-head img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--bg); }
.drawer-head h2 { margin: 0 0 2px; font-size: 19px; }
.drawer-head .title { color: var(--muted); }
.drawer-body { overflow: auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.drawer section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-list { display: flex; flex-direction: column; gap: 6px; }
.contact { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.contact .ct-type { color: var(--muted); font-size: 12px; min-width: 92px; }
.contact .ct-value { font-weight: 600; flex: 1; overflow-wrap: anywhere; }
.contact .ct-comment { color: var(--muted); font-size: 12px; }
.meta-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-edit .full { grid-column: 1 / -1; }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.tl-item .tl-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tl-item .tl-pos { font-weight: 600; }
.tl-item .tl-period { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tl-item .tl-company { color: var(--muted); }
.tl-item .tl-desc { white-space: pre-wrap; margin-top: 4px; font-size: 13.5px; }
.pre { white-space: pre-wrap; }
.ai-box { background: var(--accent-weak); border-radius: 10px; padding: 10px 12px; }

/* ---------- vacancies ---------- */
.vac-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.vac-list { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.vac-co { border-top: 1px solid var(--line); padding: 10px 0; }
.vac-co:first-child { border-top: 0; }
.vac-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.vac-item:hover { background: var(--bg); }
.vac-item.active { background: var(--accent-weak); }
.vac-item.co { font-weight: 600; }
.vac-item .muted { margin-left: auto; font-size: 12px; }
.vac-sub { padding-left: 12px; display: flex; flex-direction: column; }
.vac-form { display: flex; flex-direction: column; gap: 12px; }
.vac-form .row.actions { justify-content: flex-end; }

/* ---------- dialogs ---------- */
.dl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dl-bar select { max-width: 280px; }
.dl-account { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.dl-layout { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.dl-layout .card + .card { margin-top: 0; }
.dl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dl-filters button { font: inherit; font-size: 12.5px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.dl-filters button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.dl-list { display: flex; flex-direction: column; max-height: calc(100vh - 290px); overflow: auto; margin-top: 8px; }
.dl-item { text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; color: var(--text); padding: 10px 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.dl-item:hover { background: var(--bg); }
.dl-item.active { background: var(--accent-weak); }
.dl-item .top { display: flex; gap: 8px; align-items: baseline; }
.dl-item .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-item .top .badge { margin-left: auto; }
.dl-item .last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-chat { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 96px); }
.dl-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.dl-head h3 { margin: 0; }
.dl-msgs { display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 120px; padding: 4px 2px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.bubble.in { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent-weak); border-bottom-right-radius: 4px; }
.bubble.out.recruiter { background: var(--ok-weak); }
.bubble .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.dl-note { background: var(--warn-weak); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.ai-always { font-size: 12.5px; color: var(--muted); }
.dl-item .top .badge + .badge { margin-left: 4px; }
.dl-send { display: flex; gap: 8px; align-items: flex-end; }
.dl-send textarea { flex: 1; }
.pill.warn { background: var(--warn-weak); color: var(--warn); }

dialog.wide { width: min(760px, calc(100vw - 32px)); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; align-self: flex-start; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 13px; border: 0; background: var(--card); color: var(--text); padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.active { background: var(--accent); color: #fff; }
.pp-pane { display: flex; flex-direction: column; gap: 8px; }
.pp-pick-head { font-size: 13px; }
.pp-list { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.pp-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--text); font-size: 13.5px; flex-direction: row; }
.pp-row:last-child { border-bottom: 0; }
.pp-row:hover { background: var(--bg); }
.pp-row.off { opacity: .5; cursor: default; }
.pp-row .t { flex: 1; min-width: 0; }
.pp-row .t b { font-weight: 600; }
.pp-row .muted { font-size: 12.5px; }
.pp-when { margin: 0; gap: 8px; }
.presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.presets button { font: inherit; font-size: 12.5px; background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 999px; padding: 3px 10px; cursor: pointer; color: var(--text); }
.presets button:hover { border-color: var(--accent); }
.tone-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.tone-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; font-size: 13px; }
.tone-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tone-title { font-size: 12px; color: var(--muted); min-width: 92px; }
.tone-chip { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.tone-chip:hover { border-color: var(--accent); }
.tone-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tone-chip.on::before { content: "✓ "; }
.tpl-preview { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.vac-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sched { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }

/* ---------- calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.cal-layout .card + .card { margin-top: 0; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-toolbar b { font-size: 16px; margin-left: 6px; }
.cal-scroll { overflow-x: auto; margin-top: 10px; }
.cal-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 840px; user-select: none; }
.cal-dayhead { text-align: center; padding: 6px 0 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-dayhead b { display: block; font-size: 18px; color: var(--text); font-weight: 600; }
.cal-dayhead.today b { color: #fff; background: var(--accent); border-radius: 999px; width: 32px; height: 32px; line-height: 32px; margin: 2px auto 0; }
.cal-times { position: relative; }
.cal-times span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: crosshair;
  background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 48px; }
.cal-col.past { background-color: color-mix(in srgb, var(--bg) 60%, transparent); }
.cal-blk { position: absolute; left: 3px; right: 3px; border-radius: 6px; font-size: 11.5px; padding: 2px 6px; overflow: hidden; cursor: pointer; line-height: 1.3; }
.cal-blk.work { left: 0; right: 0; border-radius: 0; background: color-mix(in srgb, var(--accent) 7%, transparent); cursor: pointer; }
.cal-blk.calls { background: color-mix(in srgb, var(--ok) 16%, transparent); border-left: 3px solid var(--ok); color: var(--ok); }
.cal-blk.busy { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 6px, var(--line) 6px, var(--line) 8px); border: 1px solid var(--line-strong); color: var(--muted); }
.cal-blk.call { background: var(--accent); color: #fff; z-index: 3; box-shadow: var(--shadow); }
.cal-blk.ghost { background: color-mix(in srgb, var(--accent) 25%, transparent); border: 1px dashed var(--accent); z-index: 4; pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.cal-side { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.cal-free-day { margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
.cal-free-list { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-free-list span { font-size: 12px; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.cal-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.cal-legend .lg { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.lg.calls { background: color-mix(in srgb, var(--ok) 30%, transparent); border-left: 3px solid var(--ok); }
.lg.work { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.lg.busy { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 3px, var(--line-strong) 3px, var(--line-strong) 4px); }
.lg.call { background: var(--accent); }
.facts-box { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.facts-box dt { color: var(--muted); }
.facts-box dd { margin: 0; white-space: pre-line; }

/* ---------- job panel ---------- */
.job-panel {
  position: fixed; right: 20px; bottom: 20px; width: 400px; max-width: calc(100vw - 40px); z-index: 35;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}
.job-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.job-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.job-panel.min .job-body { display: none; }
.progress { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.counters { display: flex; flex-wrap: wrap; gap: 6px; }
.captcha { background: var(--warn-weak); color: var(--warn); padding: 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.job-error { background: var(--danger-weak); color: var(--danger); padding: 8px 10px; border-radius: 8px; }
.log { max-height: 220px; overflow: auto; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border-radius: 8px; padding: 8px; margin-top: 6px; }
.log div { padding: 1px 0; }
.log .warn { color: var(--warn); }
.log .error { color: var(--danger); }
.job-actions { justify-content: flex-end; }

/* ---------- settings ---------- */
.settings-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; align-items: start; }
.settings-layout .card + .card { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 16px; align-items: end; }
.form-grid > label > input, .form-grid > label > select { width: 100%; }
.form-grid .form-actions { grid-column: 1 / -1; position: static; padding: 0; border-top: 0; }
.account { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tg-chats { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.tg-chat { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.tg-chat .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
details.help { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.help ol { padding-left: 18px; }
details.help li { margin-bottom: 6px; }

/* ---------- dialogs & toasts ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); color: var(--text); padding: 20px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(10, 14, 24, .4); }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h3 { margin: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 6px; }
.toasts {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(460px, calc(100vw - 32px));
  pointer-events: none; /* never block clicks on what is underneath */
}
.toast a { pointer-events: auto; }
.toast { background: var(--card); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); animation: slide .2s ease-out; overflow-wrap: anywhere; }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
@keyframes slide { from { transform: translateY(-6px); opacity: 0; } }

@media (max-width: 1100px) {
  .ai-layout { grid-template-columns: 1fr; }
  .ai-history { position: static; max-height: none; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; height: 40px; }
  .search-layout { grid-template-columns: 1fr; }
  .vac-layout, .dl-layout, .vac-cols, .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; }
  .vac-list, .dl-chat { position: static; max-height: none; }
  .filters, .results-head { position: static; max-height: none; }
  main { padding: 12px; }
  .settings-layout { grid-template-columns: 1fr; }
  .form-grid, .grid-2, .meta-edit { grid-template-columns: 1fr; }
}

.cal-contacts-title { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }

.edition { margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: .02em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); vertical-align: 2px; }

/* ---------- login, user, team ---------- */
body.booting .topbar, body.booting main, body.logged-out .topbar, body.logged-out main { display: none; }
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.brand.big { font-size: 24px; justify-content: center; margin-bottom: 4px; }
.user-chip { cursor: pointer; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.top-status { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.badge.src { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.source-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.comment { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.comment .c-head { font-size: 12.5px; margin-bottom: 2px; }
#d-comment-form { align-items: flex-end; }
#d-comment-form textarea { flex: 1; }
.history-box summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.history-box .hist { font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.users-table tr.off td { color: var(--muted); }
.users-table td.row { display: flex; gap: 6px; flex-wrap: wrap; }
#user-form { margin-top: 12px; }
dialog.wide { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.file-btn { cursor: pointer; }
.filters-toggle { display: none; }
#cand-dups div { margin-top: 4px; }

/* ---------- phone ---------- */
@media (max-width: 700px) {
  .brand { font-size: 15px; }
  .top-status .status-chip:not(.user-chip) { display: none; }
  .user-chip { max-width: 150px; }
  .table .cand-title { max-width: 46vw; }
  .table .contacts { white-space: normal; }
  .table select { font-size: 15px; padding: 6px 8px; }
  .table-head { flex-wrap: wrap; }
  .base-toolbar .row { flex-wrap: wrap; }
  .filters-toggle { display: inline-flex; }
  .base-toolbar:not(.open) .filters-row, .base-toolbar:not(.open) .ai-row { display: none; }
  #bf-form input { flex: 1 1 100%; }
  .table select { max-width: 112px; }
  #base-table th { font-size: 11px; padding: 6px; }
  #base-table td { padding: 8px 6px; }
  .base-toolbar input, .base-toolbar select { font-size: 16px; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .drawer-head { padding: 12px 14px; }
  .drawer-body { padding: 12px 14px 40px; }
  .drawer .row { flex-wrap: wrap; }
  .meta-edit select, .meta-edit input, .meta-edit textarea, #d-comment { font-size: 16px; }
  .job-panel { right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; }
}

.ai-fill { align-items: center; flex-wrap: wrap; }
.badge.parse { background: var(--warn-weak); color: var(--warn); }
.badge.parse.failed { background: var(--danger-weak); color: var(--danger); }
#src-list .chip button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 0 0 4px; }
#src-form { margin-top: 10px; }

/* ---------- vacancies and the funnel ---------- */
.fn-toolbar .row { flex-wrap: wrap; }
.daily-row { margin-top: 10px; align-items: center; gap: 8px; flex-wrap: wrap; }
.daily-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.daily-row input[type=number] { width: 80px; }
.fn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 12px; }
.vac-card { cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.vac-card:hover { border-color: var(--accent); }
.vac-title { font-size: 15px; }
.stage-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.stage-bar .st { display: inline-flex; align-items: baseline; gap: 4px; font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); }
.stage-bar .st b { font-size: 12.5px; }
.stage-bar .st.zero { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.stage-bar .st.s6, .stage-bar .st.s7 { background: var(--ok-weak); color: var(--ok); }
.stage-bar .st.drop { background: var(--bg); color: var(--muted); }
.board { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)) minmax(140px, .85fr); gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 8px; scrollbar-width: thin; }
.board .col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.board .col.dropped { opacity: .85; }
.col-head { font-weight: 600; font-size: 12.5px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.col-head .pill { flex: none; }
.app-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; background: var(--bg); }
.app-card .app-name { font-weight: 600; }
.app-card select { font-size: 12.5px; padding: 4px 6px; width: 100%; }
.app-card[draggable="true"] { cursor: grab; }
.app-card.dragging { opacity: .45; }
.board .col.drop-target { border-color: var(--accent); background: var(--accent-weak); }
.board .small-empty { font-size: 12px; text-align: center; padding: 14px 4px; border: 1px dashed var(--line); border-radius: 8px; }
.app-card .row { gap: 4px; flex-wrap: wrap; }
.small { font-size: 12px; }
.small-empty { font-size: 12px; text-align: center; padding: 10px 0; }
.app-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 4px; }
.pp-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 4px; border-bottom: 1px solid var(--line); }
#pick-list { max-height: 50vh; overflow: auto; }
@media (max-width: 700px) {
  .board { grid-template-columns: repeat(8, 78vw); }
  .daily-row input[type=number] { width: 64px; }
}

/* ---------- reports ---------- */
.rp-filters { flex-wrap: wrap; align-items: center; gap: 8px; }
.rp-filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.seg button.active { background: var(--accent); color: #fff; }
.kpi-table td.ok { color: var(--ok); font-weight: 600; }
.kpi-table td.bad { color: var(--danger); font-weight: 600; }
.rep-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tile .t-val { font-size: 20px; font-weight: 700; }
.tile .t-label { color: var(--muted); font-size: 12.5px; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 14px; }
code.key { word-break: break-all; }
#tab-reports h3 { margin-top: 14px; }

body.no-ai .ai-col { display: none; }

/* ---------- Telegram inbox ---------- */
.pill.hot { background: var(--danger); color: #fff; }
body.in-inbox main { max-width: none; padding: 12px 16px 0; }
#tab-inbox.active { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h, 56px) - 12px); }
.ib-banner { background: var(--warn-weak); color: var(--warn); border-radius: 10px; padding: 8px 14px; margin-bottom: 10px; font-size: 13.5px; }
.ib {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 236px 340px minmax(0, 1fr);
  grid-template-areas: "folders list chat"; background: var(--card); border: 1px solid var(--line);
  border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; box-shadow: var(--shadow);
}
.ib-folders { grid-area: folders; border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow: auto; background: var(--bg); }
.ib-folder { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; font: inherit; color: var(--text); text-align: left; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.ib-folder:hover { background: var(--card); }
.ib-folder.active { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.ib-folder.off { opacity: .6; }
.ib-f-icon { width: 24px; display: inline-flex; justify-content: center; font-size: 15px; flex: none; }
.ib-f-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-f-n { color: var(--muted); font-size: 12px; }
.ib-f-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 10px 4px; }
.ib-acc { margin-top: auto; padding: 10px 8px 2px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.ib-list { grid-area: list; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ib-list-head { padding: 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.ib-list-head input[type="search"] { width: 100%; }
.ib-unread { font-size: 12.5px; color: var(--muted); }
.ib-chats { overflow: auto; flex: 1; }
.ib-item { display: flex; gap: 10px; width: 100%; border: 0; background: none; font: inherit; color: var(--text); text-align: left; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); align-items: center; }
.ib-item:hover { background: var(--bg); }
.ib-item.active { background: var(--accent-weak); }
.ib-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ib-item-top, .ib-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ib-item-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item-time { color: var(--muted); font-size: 12px; flex: none; }
.ib-item-last { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-item.unread .ib-item-last { color: var(--text); }
.ib-item.unread .ib-item-time { color: var(--accent); font-weight: 600; }
.ib-linked { font-size: 10.5px; color: var(--ok); background: var(--ok-weak); border-radius: 999px; padding: 0 6px; flex: none; }
.ib-item-owner { font-size: 11.5px; color: var(--muted); }
.ib-item-owner.free { color: var(--warn); }
.av { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; letter-spacing: .02em; }
.av.xs { width: 22px; height: 22px; font-size: 10px; }
.av.lg { width: 42px; height: 42px; }
.ib-chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background: var(--bg); }
.ib-head { display: flex; align-items: center; gap: 8px 14px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ib-head:empty { display: none; }
.ib-head-top { display: flex; align-items: center; gap: 10px; flex: 1 1 300px; min-width: 0; }
.ib-head-main { flex: 1; min-width: 0; }
.ib-head-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.ib-head-meta { font-size: 12.5px; }
.ib-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ib-owner { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin: 0; }
.ib-owner select { font-size: 13px; padding: 4px 6px; max-width: 200px; }
.ib-back { display: none; font-size: 22px; }
.ib-msgs { flex: 1; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.ib-day { text-align: center; margin: 10px 0 6px; }
.ib-day span { background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.ib-msg { display: flex; }
.ib-msg.out { justify-content: flex-end; }
.ib-bubble { max-width: min(560px, 78%); padding: 7px 11px 5px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.ib-msg.in .ib-bubble { border-bottom-left-radius: 4px; }
.ib-msg.out .ib-bubble { background: var(--accent-weak); border-color: transparent; border-bottom-right-radius: 4px; }
.ib-msg.pending { opacity: .6; }
.ib-text { white-space: pre-wrap; }
.ib-meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ib-who { font-weight: 600; }
.ib-ticks { letter-spacing: -2px; }
.ib-ticks.read { color: var(--accent); }
.ib-photo img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.ib-file { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ib-file-icon { font-size: 24px; flex: none; }
.ib-file-main { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 13px; }
.ib-file-main a { font-weight: 600; overflow-wrap: anywhere; }
.ib-file-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.ib-sticker { font-size: 44px; line-height: 1.1; }
.ib-bubble audio { width: 270px; max-width: 100%; display: block; }
.ib-bubble video { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.ib-bubble .small { font-size: 12px; }
.ib-more, .ib-start { text-align: center; margin: 4px 0 8px; font-size: 12px; color: var(--muted); }
.ib-placeholder { margin: auto; text-align: center; color: var(--muted); padding: 30px; max-width: 380px; }
.ib-placeholder p { margin: 4px 0; }
.ib-placeholder-icon { font-size: 40px; margin-bottom: 6px; }
.ib-compose { background: var(--card); border-top: 1px solid var(--line); padding: 10px 12px; }
.ib-compose.foreign { box-shadow: inset 0 2px 0 var(--warn); }
.ib-compose-row { display: flex; align-items: flex-end; gap: 8px; }
.ib-compose textarea { flex: 1; resize: none; min-height: 40px; max-height: 220px; line-height: 1.4; }
.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; font-size: 17px; }
.icon-btn:hover { background: var(--bg); }
.ib-tpl { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; max-height: 280px; overflow: auto; background: var(--bg); }
.ib-tpl-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; flex-wrap: wrap; }
.ib-tpl-item { display: flex; gap: 4px; align-items: flex-start; }
.ib-tpl-text { flex: 1; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; }
.ib-tpl-text:hover { background: var(--accent-weak); }
.ib-drop { position: absolute; inset: 6px; background: rgba(59, 91, 219, .12); border: 2px dashed var(--accent); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--accent); z-index: 5; pointer-events: none; }
.ib-pick { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: var(--text); padding: 8px 12px; cursor: pointer; }
.ib-pick:hover { background: var(--accent-weak); }
#dlg-ib-link input[type="search"] { width: 100%; margin-bottom: 8px; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13.5px; }
.form-grid > label.check > input { width: auto; flex: none; }

@media (max-width: 1180px) {
  .ib { grid-template-columns: 200px 300px minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .ib { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "folders folders" "list chat"; }
  .ib-folders { flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; gap: 4px; }
  .ib-folder { width: auto; flex: none; padding: 5px 10px; }
  .ib-f-sep, .ib-acc { display: none; }
}
@media (max-width: 800px) {
  body.in-inbox main { padding: 0; }
  #tab-inbox.active { height: calc(100dvh - var(--top-h, 100px)); }
  .ib-banner { margin: 8px; }
  .ib { grid-template-columns: minmax(0, 1fr); grid-template-areas: "folders" "list"; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .ib-chat { display: none; }
  .ib-list { border-right: 0; }
  .ib.show-chat { grid-template-rows: minmax(0, 1fr); grid-template-areas: "chat"; }
  .ib.show-chat .ib-folders, .ib.show-chat .ib-list { display: none; }
  .ib.show-chat .ib-chat { display: flex; }
  .ib-back { display: inline-flex; }
  #tab-inbox.chat-open .ib-banner { display: none; }
  .ib-head { padding: 8px 10px; gap: 6px; }
  .ib-head-actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .ib-owner span { display: none; }
  .ib-head-actions .btn { flex: none; }
  .ib-msgs { padding: 10px; }
  .ib-bubble { max-width: 88%; }
  .ib-compose textarea { font-size: 16px; }
}

/* ---------- conveniences ---------- */
.fn-list .card + .card { margin-top: 0; }
.settings-layout .wide-card { grid-column: 1 / -1; }
dialog .dialog-actions { position: sticky; bottom: -1px; background: var(--card); padding: 10px 0 2px; border-top: 1px solid var(--line); z-index: 2; }
.drop-zone { display: flex; flex-direction: row; align-items: center; gap: 12px; border: 2px dashed var(--line-strong); border-radius: 12px; padding: 14px 16px; margin: 4px 0 12px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-weak); }
.drop-zone.chosen { border-style: solid; border-color: var(--ok); background: var(--ok-weak); }
.dz-icon { font-size: 26px; }
#tab-base { position: relative; }
.drop-overlay { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; background: rgba(59, 91, 219, .1); border: 3px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-weight: 600; font-size: 16px; pointer-events: none; }
.drop-list { max-height: 200px; overflow: auto; padding-left: 18px; font-size: 13px; }
#base-table.loading tbody { opacity: .45; transition: opacity .15s; }
.resume-box summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.resume-box .pre { margin-top: 8px; }
.t-short { display: none; }
.contacts a { color: inherit; }

@media (max-width: 700px) {
  .hide-phone { display: none !important; }
  .table .contacts > span { overflow-wrap: normal; word-break: keep-all; }
  .table .contacts .muted { display: none; }
  .table .contacts a[href^="tel:"] { white-space: nowrap; }
  .fn-toolbar select, .daily-row select { flex: 1 1 100%; max-width: none; }
  .daily-row b { flex: 1 1 100%; }
  /* the tabs become a bar at the bottom of the screen, like in phone apps */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; height: 58px; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
    order: 0; width: auto; gap: 0; padding: 0 4px env(safe-area-inset-bottom); overflow-x: auto; }
  .tabs a { flex: 1 0 64px; flex-direction: column; justify-content: center; gap: 1px; padding: 4px 2px; font-size: 11px; border-bottom: 0; border-top: 2px solid transparent; position: relative; }
  .tabs a.active { border-top-color: var(--accent); color: var(--accent); }
  .tabs a::before { content: attr(data-icon); font-size: 18px; line-height: 1.1; }
  .tabs a .pill { position: absolute; top: 3px; left: calc(50% + 6px); font-size: 10px; padding: 0 5px; }
  .t-full { display: none; }
  .t-short { display: inline; }
  main { padding-bottom: 76px; }
  body.in-inbox main { padding-bottom: 0; }
  #tab-inbox.active { height: calc(100dvh - var(--top-h, 52px) - 58px); }
}

/* ---------- the base ---------- */
.bf-main { flex-wrap: nowrap; }
.bf-main #bf-q { flex: 1; min-width: 160px; }
.bf-main #bf-sort { width: auto; max-width: 200px; }
#bf-more.active { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
#bf-more .pill { margin-left: 4px; }
.status-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 11px; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; }
.st-chip span { color: var(--muted); font-size: 12px; }
.st-chip:hover { border-color: var(--line-strong); }
.st-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-chip.active span { color: rgba(255, 255, 255, .85); }
.st-chip.zero:not(.active) { opacity: .5; }
.active-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip-x { font: inherit; font-size: 12.5px; border: 0; background: var(--accent-weak); color: var(--accent); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.chip-x:hover { filter: brightness(.95); }
.chip-x span { margin-left: 2px; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#base-table th.sel, #base-table td.sel { width: 34px; padding-left: 8px; padding-right: 2px; cursor: default; }
#base-table th.sortable { cursor: pointer; user-select: none; }
#base-table th.sortable:hover { color: var(--text); }
#base-table th.sorted { color: var(--accent); }
#base-table th.sorted.asc::after { content: ' ↑'; }
#base-table th.sorted.desc::after { content: ' ↓'; }
#base-table tbody tr.selected { background: var(--accent-weak); }
#base-table tbody tr.selected .src-chip, #base-table tbody tr.selected .tag-chip { background: var(--card); }
#base-table tbody tr.current { box-shadow: inset 3px 0 0 var(--accent); }
#base-table td.cand { min-width: 220px; }
#base-table td { padding-top: 9px; padding-bottom: 9px; }
.cand-info { display: none; color: var(--muted); font-size: 12.5px; }
.cand-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.src-chip, .tag-chip { font: inherit; font-size: 11px; line-height: 1.5; border: 0; border-radius: 6px; padding: 0 6px; cursor: pointer; background: var(--bg); color: var(--muted); }
span.src-chip { cursor: default; }
.src-chip { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.src-chip:hover, .tag-chip:hover { filter: brightness(.93); }
.funnel-chip { font-size: 11px; line-height: 1.5; border-radius: 6px; padding: 0 6px; background: var(--ok-weak); color: var(--ok); font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fill-note { font-size: 11px; color: var(--warn); }
.fill-note.bad { color: var(--danger); }
.file-label { font-weight: 400; font-size: 12px; }
.chat-mark { font-size: 12px; }
.st-sel { border-radius: 999px; font-weight: 600; }
.st-sel[data-st="interesting"], .st-sel[data-st="contacted"] { color: var(--accent); border-color: var(--accent); }
.st-sel[data-st="interview"], .st-sel[data-st="offer"] { color: var(--warn); border-color: var(--warn); }
.st-sel[data-st="hired"] { color: var(--ok); border-color: var(--ok); }
.st-sel[data-st="rejected"] { color: var(--danger); border-color: var(--danger); }
.st-sel[data-st="reserve"] { color: var(--muted); }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }
.icon-act { border: 0; background: none; color: var(--text); cursor: pointer; font-size: 15px; padding: 3px 6px; border-radius: 8px; opacity: .5; }
#base-table tr:hover .icon-act, .icon-act:focus-visible { opacity: 1; }
.icon-act:hover { background: var(--accent-weak); }
.icon-act.sent { color: var(--ok); font-weight: 700; opacity: .9; }
#base-table td.when { white-space: nowrap; font-size: 12.5px; }
.base-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-top: 10px; }
.base-foot .pager { margin: 0; }
.per-page { flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; }
.per-page select { padding: 3px 6px; font-size: 12.5px; }
.bulk-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 8px 30px rgba(10, 14, 24, .28); padding: 8px 12px; width: max-content; max-width: calc(100vw - 24px); }
.bulk-bar select { font-size: 13px; padding: 5px 8px; max-width: 220px; }
.bulk-sep { width: 1px; height: 22px; background: var(--line); }
body.has-bulk main { padding-bottom: 96px; }
.drawer-nav { display: flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.drawer-nav .icon { font-size: 22px; padding: 0 8px; }
.drawer-nav .icon[disabled] { opacity: .3; cursor: default; }

@media (min-width: 1101px) {
  /* the titles of the columns stay in view while the list scrolls */
  .base-table-wrap { overflow: visible; }
  #base-table thead th { position: sticky; top: var(--top-h, 56px); background: var(--card); z-index: 3; }
}
@media (max-width: 700px) {
  /* the rows become cards */
  #base-table thead { display: none; }
  #base-table, #base-table tbody { display: block; }
  #base-table tbody tr { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "sel cand act" "sel contacts status"; gap: 6px 8px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  #base-table tbody tr.no-rows { display: block; }
  #base-table td { display: block; padding: 0; border: 0; }
  #base-table td.sel { grid-area: sel; padding: 2px 0 0; }
  #base-table td.cand { grid-area: cand; min-width: 0; }
  #base-table td.act { grid-area: act; }
  #base-table td.contacts-cell { grid-area: contacts; align-self: center; }
  #base-table td.status-cell { grid-area: status; }
  #base-table td.city, #base-table td.num, #base-table td.when { display: none; }
  .cand-info { display: block; }
  .icon-act { opacity: 1; font-size: 17px; }
  .bulk-bar { bottom: 66px; }
  body.has-bulk main { padding-bottom: 170px; }
  .bf-main { flex-wrap: wrap; }
  .bf-main #bf-q { flex: 1 1 100%; }
  .bf-main #bf-sort { flex: 1; max-width: none; min-width: 0; }
  .status-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding: 0 4px 2px; scrollbar-width: none; }
  .status-chips::-webkit-scrollbar { display: none; }
  .st-chip { flex: none; }
  .bulk-bar { gap: 6px; padding: 8px; }
  .bulk-bar .bulk-sep { display: none; }
  .base-foot { justify-content: center; }
}

/* ---------- layout fixes from the check of every page ---------- */
/* the top bar stays one row on a wide screen: chips give way, tabs scroll if there are many */
.tabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.top-status { flex: none; flex-wrap: nowrap; }
@media (max-width: 1240px) {
  .topbar { gap: 14px; padding: 0 14px; }
  .tabs a { padding: 0 10px; }
  #chip-hh, #chip-limit, #chip-groq { display: none; }
  .user-chip { max-width: 150px; }
}
/* a table's own scroll keeps everything in it (a hidden caption must not widen the page) */
.table-wrap { position: relative; }
/* settings: a card never grows wider than the screen; no holes between cards */
.settings-layout { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); grid-auto-flow: row dense; }
.settings-layout > .card { min-width: 0; }
/* dialogs: the buttons stick to the very bottom, nothing shows below them */
dialog .dialog-actions { bottom: -20px; margin-bottom: -20px; padding-bottom: 20px; }
/* the pick list: same checkboxes in every row */
.pp-row input { flex: none; margin-top: 3px; }
/* a phone number in the card does not break in the middle */
.contact .ct-value a[href^="tel:"] { white-space: nowrap; }
/* row actions are visible enough to look clickable */
.icon-act { opacity: .75; }
@media (hover: none) { .icon-act { opacity: 1; } }
/* reports */
#tab-reports > [data-admin] { margin-top: 16px; }
.rp-filters label { flex-direction: column; align-items: flex-start; gap: 2px; }
.rp-filters select { flex: 1 1 160px; min-width: 140px; }
.kpi-table th { white-space: normal; min-width: 70px; vertical-align: bottom; }
.table tr.no-data td { text-align: center; padding: 14px; }
@media (max-width: 1280px) {
  /* the base: the narrow columns go into the candidate cell, as on a phone */
  #base-table th.city, #base-table td.city, #base-table th.num:not(.ai-col), #base-table td.num:not(.ai-col),
  #base-table th.when, #base-table td.when { display: none; }
  .cand-info { display: block; }
}
@media (max-width: 1000px) {
  .daily-row select { flex: 1 1 200px; }
  .daily-row b { flex: 1 1 100%; }
}
@media (max-width: 900px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .rp-filters select, .rp-filters label { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .rp-filters label input { width: 100%; }
}

/* the base on a computer and a tablet: the columns share the width, nothing can widen the table */
@media (min-width: 701px) {
  #base-table { table-layout: fixed; }
  #base-table th.sel { width: 36px; }
  #base-table th.city { width: 10%; }
  #base-table th.col-age { width: 94px; }
  #base-table th.col-salary { width: 9%; }
  #base-table th.col-exp { width: 8%; }
  #base-table th.col-contacts { width: 21%; }
  #base-table th.col-status { width: 150px; }
  #base-table th.ai-col { width: 56px; }
  #base-table th.when { width: 118px; }
  #base-table th.act { width: 84px; }
  #base-table th { overflow: hidden; text-overflow: ellipsis; }
  #base-table td { overflow-wrap: anywhere; }
  #base-table .contacts { white-space: normal; }
  #base-table .cand-title, #base-table .funnel-chip { max-width: 100%; }
  #base-table .st-sel { width: 100%; }
}
/* a tab clicked with the mouse keeps no frame; with the keyboard the frame is neat */
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -6px; border-radius: 10px; }
/* contacts in the list: one line each, a long address ends with "…" (the whole one is in the tooltip) */
#base-table .contacts { white-space: normal; min-width: 0; }
#base-table .contacts > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the file of a card without a name: its own line, cut with "…" */
#base-table .file-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (min-width: 701px) and (max-width: 1280px) {
  #base-table th.col-contacts { width: 30%; }
  #base-table th.col-status { width: 140px; }
}

/* requests from the company site (the "Вакансии" tab, managers) */
#leads-card h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
#leads-card .small-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
#leads-list { display: flex; flex-direction: column; margin-top: 10px; }
.lead { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.lead:first-child { border-top: 0; }
.lead-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lead-main .small { font-size: 12px; margin-top: 2px; }
.lead-msg { margin-top: 6px; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.lead-act { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; font-size: 12px; }
.lead.done .lead-main { opacity: .7; }
@media (max-width: 700px) {
  .lead { flex-direction: column; }
  .lead-act { align-items: flex-start; text-align: left; }
}
