/* Witstaff — дизайн-система платформы.
   Токены взяты из брендбука (design-system/tokens.css): синий — только для основных действий,
   тёмно-синий — навигация и экран входа, Inter, шаг отступов 8px, скругления 8–24px. */
:root {
  --brand: #1e3a8a;
  --brand-600: #172e6e;
  --brand-50: #eef1f8;
  --brand-light: #9fb3e8;
  --accent: #4f6bb8;
  --accent-50: #f1f4fa;
  --navy: #101828;
  --navy-deep: #101828;
  --ink: #101828;
  --ink-2: #334155;
  --muted: #5b6475;
  --line: #e2e8f0;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ok: #16a34a;
  --ok-50: #dcfce7;
  --warn: #d97706;
  --warn-50: #fef3c7;
  --danger: #dc2626;
  --danger-50: #fee2e2;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 36px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .16);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-bg: var(--navy-deep);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; overscroll-behavior-y: none; }
body.no-scroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
img, svg { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.pre { white-space: pre-wrap; }

/* ---------- Кнопки и формы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--brand); color: #fff; transition: background .15s, box-shadow .15s; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--brand-600); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f1f5f9; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: #eef1f6; }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--ok); }
.btn.success:hover { background: #15803d; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 13px 22px; font-size: 16px; }

label.field { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field > span { display: block; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 400; }
.check input { margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.error-box { background: var(--danger-50); color: var(--danger); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.ok-box { background: var(--ok-50); color: #166534; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; }

/* ---------- Бейджи ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }
.badge.ok { background: var(--ok-50); color: #166534; }
.badge.warn { background: var(--warn-50); color: #92400e; }
.badge.danger { background: var(--danger-50); color: #991b1b; }
.badge.accent { background: var(--accent-50); color: var(--brand-600); }

/* ---------- Карточки и таблицы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { font-size: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f8fafc; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 10px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.bar-row.accent .fill { background: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline li::after { content: ''; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .meta { font-size: 12px; color: var(--muted); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.progress { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

.docx-view { background: #e9edf2; border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 62vh; overflow: auto; color: #000; }
.docx-view .docx-wrapper { background: transparent; padding: 12px; }
.docx-view.zoomable { cursor: zoom-in; }
.docx-view.zoomed { cursor: zoom-out; }
.docx-hint { text-align: center; margin-top: 4px; }
.docx-view .docx-wrapper > section.docx { box-shadow: 0 1px 6px rgba(15, 23, 42, 0.18); margin-bottom: 12px; }
#print-root { display: none; }
#print-root.measure { display: block; position: fixed; left: -10000px; top: 0; }
/* Документ Word — одним шрифтом: Times New Roman, на Android — Tinos (тот же размер букв) */
.docx-view section.docx, .docx-view section.docx *, #print-root section.docx, #print-root section.docx *, #print-root .print-band, #print-root .print-band * { font-family: 'Times New Roman', Tinos, Times, serif !important; }
@media print {
  @page { size: A4; margin: 8mm 0; }
  body.printing-docx > *:not(#print-root) { display: none !important; }
  html:has(body.printing-docx), body.printing-docx { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.printing-docx #print-root { display: block; position: static; color: #000; width: 210mm; margin: 0 auto; }
  /* Поля сверху и снизу — у каждой печатной страницы (@page), а не только у первой */
  #print-root section.docx { box-shadow: none !important; margin: 0 !important; padding-top: 4mm !important; padding-bottom: 0 !important; min-height: 0 !important; background: #fff; }
  #print-root section.docx > header, #print-root section.docx > footer { display: none !important; }
  #print-root .print-frame { width: 210mm; margin: 0 auto; border-collapse: collapse; table-layout: fixed; }
  #print-root section.docx { margin-left: auto !important; margin-right: auto !important; }
  #print-root .print-frame > * > tr > td { padding: 0; }
  #print-root .print-band > header, #print-root .print-band > footer { display: block; }
  #print-root .print-band img { max-width: none; }
  #print-root section.docx:not(:last-of-type) { break-after: page; }
  #print-root .print-sigs { padding: 8mm 20mm; font-family: 'Times New Roman', Tinos, serif; font-size: 10pt; break-inside: avoid; }
  #print-root .print-sigs .vq { display: flex; gap: 10pt; align-items: center; margin-top: 8pt; }
  #print-root .print-sigs .vq img { width: 26mm; height: 26mm; }
}
.doc-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 28px 32px; font-family: 'Times New Roman', Georgia, serif; font-size: 15px; line-height: 1.6; white-space: pre-wrap; max-height: 55vh; overflow: auto; }
.signature { border: 1px dashed var(--ok); background: var(--ok-50); color: #166534; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; word-break: break-all; }

/* ---------- Модальные окна и уведомления ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; max-width: 360px; }
.toast.error { background: var(--danger); }

/* =================== ПЛАТФОРМА (app.html) =================== */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar { background: var(--sidebar-bg); color: #cbd5e1; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .logo { color: #fff; padding: 4px 10px 18px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5b6b85; padding: 14px 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cbd5e1; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; text-decoration: none; }
.nav a:hover { background: #1e293b; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .count { margin-left: auto; background: #1e3a8a; color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.sidebar .user { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #1e293b; font-size: 13px; }
.sidebar .user b { color: #fff; display: block; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 20px; margin: 0; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1400px; }

.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 18px; letter-spacing: -.03em; color: var(--ink); text-decoration: none !important; }
.logo img { width: 30px; height: 30px; flex-shrink: 0; }
.logo b { color: #9fb3e8; font-weight: 800; }
.sidebar .logo b { color: #4f6bb8; }
/* Аватар с инициалами сотрудника */
.avatar { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #172e6e, var(--brand) 55%, #9fb3e8); display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 700; flex-shrink: 0; }

/* Канбан-воронка */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(158px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eef1f6; border-radius: var(--radius); padding: 8px; min-height: 220px; display: flex; flex-direction: column; min-width: 0; }
.kcol.drag-over { outline: 2px dashed var(--brand); background: var(--brand-50); }
.kcol-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; padding: 2px 4px 10px; }
.kcol-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; flex: 1; }
.kcard { background: #fff; border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); cursor: grab; border: 1px solid transparent; font-size: 13px; }
.kcard:hover { border-color: var(--brand); }
.kcard.dragging { opacity: .5; }
.kcard b { font-size: 14px; display: block; margin-bottom: 2px; color: var(--ink); }
/* Карточка не шире колонки: длинные имена переносятся по словам */
.kcard { min-width: 0; overflow-wrap: break-word; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.kcard-foot .match-chip { margin-left: auto; }
.stars { color: #f59e0b; letter-spacing: 1px; }
.star-input { display: inline-flex; gap: 2px; }
.star-input button { background: none; border: 0; font-size: 20px; cursor: pointer; color: #cbd5e1; padding: 0; }
.star-input button.on { color: #f59e0b; }

.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; color: #fff;
  background: radial-gradient(900px 520px at 88% -12%, rgba(30, 58, 138, .85), transparent 62%), radial-gradient(640px 480px at -12% 112%, rgba(30, 58, 138, .5), transparent 60%), radial-gradient(260px 200px at 50% 4%, rgba(200, 162, 74, .08), transparent 70%), var(--navy-deep); }
html.login-mode, html.login-mode body { background: var(--navy-deep); }
.login-page .card { color: var(--ink); border: 0; border-radius: 20px; box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 60px -12px rgba(0, 0, 0, .55); padding: 32px; }
.login-card { width: 100%; max-width: 420px; }
.login-brand { text-align: center; margin-bottom: 28px; display: grid; justify-items: center; gap: 10px; }
.login-brand img { width: 64px; height: 64px; filter: drop-shadow(0 10px 24px rgba(30, 58, 138, .6)); }
.brand-name { font-size: 30px; font-weight: 650; letter-spacing: -.035em; line-height: 1.1; }
.brand-name b { font-weight: 800; color: #9fb3e8; }
.tagline { font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: #9fb3e8; opacity: .85; }
.login-note { color: #8b95a7; font-size: 13px; text-align: center; margin-top: 18px; }
.login-note a { color: #9fb3e8; }
.login-form { display: grid; gap: 16px; }
.login-head h2 { font-size: 22px; font-weight: 750; letter-spacing: -.02em; margin: 0; }
.login-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.lf { display: grid; gap: 6px; }
.lf-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lf-row a { font-size: 13px; font-weight: 600; }
.lf-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.lf-input { position: relative; display: flex; align-items: center; }
.lf-input > svg { position: absolute; left: 14px; width: 18px; height: 18px; fill: none; stroke: #8b95a7; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: stroke .15s; }
.lf-input input { width: 100%; height: 48px; padding: 0 44px; border: 1px solid #dfe3ea; border-radius: 12px; background: #f7f8fa; font: inherit; font-size: 15px; color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s; }
.lf-input input::placeholder { color: #a3aab6; }
.lf-input input:hover { border-color: #c9cfd9; }
.lf-input input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(30, 58, 138, .12); }
.lf-input:focus-within > svg { stroke: var(--brand); }
.lf-input input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #eef1f8 inset; -webkit-text-fill-color: var(--ink); }
.lf-eye { position: absolute; right: 6px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; cursor: pointer; display: grid; place-items: center; }
.lf-eye:hover { background: #eef1f8; }
.lf-eye svg { width: 18px; height: 18px; fill: none; stroke: #8b95a7; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lf-eye.on svg { stroke: var(--brand); }
.login-submit { width: 100%; height: 50px; border-radius: 12px; margin-top: 4px; box-shadow: 0 10px 24px -10px rgba(30, 58, 138, .8); }
.login-submit:hover { background: var(--brand-600); }
.login-or { display: flex; align-items: center; gap: 12px; color: #a3aab6; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: #e6e9ef; }
.login-alt { display: grid; grid-template-columns: 1fr; gap: 10px; }
.login-alt:has(#tg-login:not(.hidden)) { grid-template-columns: 1fr 1fr; }
.login-alt .btn { height: 46px; border-radius: 12px; gap: 8px; white-space: nowrap; padding: 0 12px; }
.login-alt .btn span { overflow: hidden; text-overflow: ellipsis; }
.login-alt .btn svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-alt .btn svg.tg { fill: #229ed9; stroke: none; }
.login-help { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
/* Ввод одноразового кода (второй фактор) */
.otp-form { max-width: 440px; }
.otp { display: grid; justify-items: center; text-align: center; padding: 4px 0 2px; }
.otp-ico { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(145deg, #eef1f8, #dfe6f5); color: var(--brand); margin-bottom: 14px; box-shadow: 0 8px 20px -10px rgba(30, 58, 138, .5); }
.otp-ico svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.otp-ico svg.fill { fill: #229ed9; stroke: none; }
.otp-lead { margin: 0; font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.otp-sub { margin: 6px 0 20px; font-size: 13px; color: var(--muted); max-width: 320px; }
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; width: 100%; max-width: 336px; }
.otp-boxes .otp-d:nth-child(3) { margin-right: 8px; }
.otp-d { width: 100%; height: 56px; padding: 0; text-align: center; font: inherit; font-size: 24px; font-weight: 700; color: var(--ink); border: 1px solid #dfe3ea; border-radius: 12px; background: #f7f8fa; caret-color: var(--brand); transition: border-color .15s, box-shadow .15s, background .15s; }
.otp-d:hover { border-color: #c9cfd9; }
.otp-d:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(30, 58, 138, .12); }
.otp-d.filled { background: #fff; border-color: #b9c4dd; }
.otp-backup { width: 100%; max-width: 336px; }
.otp-backup-in { width: 100%; height: 52px; text-align: center; font: inherit; font-size: 20px; font-weight: 600; letter-spacing: .12em; border: 1px solid #dfe3ea; border-radius: 12px; background: #f7f8fa; }
.otp-backup-in:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(30, 58, 138, .12); }
.otp-links { display: grid; gap: 6px; margin-top: 18px; }
.otp-link { border: 0; background: none; padding: 4px; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand); cursor: pointer; }
.otp-link:hover { text-decoration: underline; }
.otp-form .modal-foot .btn[type=submit] { min-width: 120px; }
.otp-step { display: grid; justify-items: center; width: 100%; }
.otp-login { width: 100%; max-width: 336px; }
.otp-link:disabled { color: var(--muted); cursor: default; text-decoration: none; font-weight: 500; }
.otp-link.muted-link { color: var(--muted); font-weight: 500; }
@media (max-width: 400px) { .otp-boxes { gap: 6px; } .otp-d { height: 50px; font-size: 22px; } .otp-boxes .otp-d:nth-child(3) { margin-right: 4px; } }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.login-page :focus-visible { outline-color: #9fb3e8; }
.nav-backdrop { display: none; }
.kstage { margin-top: 8px; padding: 6px 8px; font-size: 13px; }
.show-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .show-touch { display: revert; }
  .hide-touch { display: none; }
  select.show-touch { display: block; }
  .table tr.click:hover td { background: none; }
  .table tr.click:active td { background: #f1f5f9; }
}

.org-tree ul { list-style: none; margin: 0; padding-left: 24px; border-left: 2px solid var(--line); }
.org-tree > ul { padding-left: 0; border: 0; }
.org-node { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.org-node b { display: block; }

.calendar-day { margin-bottom: 18px; }
.calendar-day h4 { font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; margin-bottom: 8px; }

/* Файлы */
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.file-ico { font-size: 20px; width: 24px; text-align: center; }
.file-main { flex: 1; min-width: 0; display: grid; gap: 2px; color: inherit; text-decoration: none !important; overflow-wrap: anywhere; }
.file-main:hover .task-title { color: var(--brand); }
.file-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); background: #fafbfd; }
.file-upload select { max-width: 260px; }
.file-upload input[type=file] { max-width: 300px; padding: 6px; }

/* Задачи процессов адаптации и шаги программ */
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.task-row:last-child, .step-row:last-child { border-bottom: 0; }
.task-row input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.task-main { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; }
.task-main:hover .task-title { color: var(--brand); }
.task-title { font-weight: 600; }
.task-row.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { font-size: 12px; color: var(--muted); }
.task-due { flex-shrink: 0; }
.step-row { display: grid; gap: 3px; width: 100%; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.step-row:hover { background: #f8fafc; }
.step-content { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Адаптивность: планшеты и телефоны (iOS, Android) ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(290px, 86vw); z-index: 60; transform: translateX(-100%); transition: transform .22s ease;
    padding: calc(18px + var(--safe-top)) 12px calc(14px + var(--safe-bottom)) calc(12px + var(--safe-left)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .nav-backdrop.show { opacity: 1; pointer-events: auto; }
  .nav a { padding: 11px 10px; font-size: 15px; }
  .menu-btn { display: inline-flex; font-size: 20px; width: 42px; height: 42px; padding: 0; }
  .topbar { padding: calc(8px + var(--safe-top)) calc(14px + var(--safe-right)) 8px calc(10px + var(--safe-left)); flex-wrap: wrap; gap: 8px; }
  .topbar h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .grow { display: none; }
  #page-actions { width: 100%; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  #page-actions::-webkit-scrollbar { display: none; }
  #page-actions.more { -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent); mask-image: linear-gradient(90deg, #000 78%, transparent); }
  #page-actions:empty { display: none; }
  .content { padding: 16px calc(16px + var(--safe-right)) calc(32px + var(--safe-bottom)) calc(16px + var(--safe-left)); }
  .grid.c2, .grid.c3, .grid.side { grid-template-columns: 1fr; }
  .kanban { scroll-snap-type: x mandatory; grid-auto-columns: minmax(78vw, 1fr); -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; }
  .kcol { scroll-snap-align: start; }
  .toasts { left: 16px; right: 16px; bottom: calc(16px + var(--safe-bottom)); }
  .toast { max-width: none; }
}
@media (max-width: 640px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 22px; }
  .card { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .bar-row { grid-template-columns: 100px 1fr 32px; }
  .doc-paper { padding: 16px; font-size: 14px; max-height: none; }
  .docx-view { max-height: 70vh; }
  .docx-view .docx-wrapper { padding: 6px; }
  /* iOS увеличивает страницу при фокусе на поле со шрифтом меньше 16px */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  textarea { min-height: 90px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
  input[type=date], input[type=datetime-local] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; padding: 6px 12px; }
  .row > input[type=search], .row > select { max-width: none !important; flex: 1 1 100%; }

  /* Таблицы превращаются в карточки: подписи столбцов берутся из data-label (см. labelTables в app.js) */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 3px 0; text-align: left; }
  .table td[data-label] { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; text-align: left; flex-shrink: 0; padding-top: 2px; }
  .table td[data-label]:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .table td[data-label]:first-child::before, .table td[data-label=""]::before { display: none; }
  .table td.right { text-align: left; }
  .table td:empty { display: none; }
  .table-wrap { overflow: visible; }

  /* Модальные окна — нижний лист на всю ширину */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { max-width: none; border-radius: 18px 18px 0 0; max-height: calc(100dvh - var(--safe-top) - 12px); display: flex; flex-direction: column; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; }
  .modal-foot { padding: 12px 16px calc(12px + var(--safe-bottom)); border-radius: 0; }
  .modal-foot .btn { flex: 1; }
  .modal-body .row[style*="flex-end"] .btn { flex: 1 1 calc(50% - 6px); }
  .task-row { padding: 12px 16px; flex-wrap: wrap; row-gap: 6px; }
  .file-row, .file-upload { padding: 12px 16px; }
  .file-upload select, .file-upload input[type=file] { max-width: none; width: 100%; }
  .task-main { flex: 1 1 calc(100% - 40px); }
  .task-due { margin-left: 32px; }
  .step-row { padding: 12px 16px; }
  .x { font-size: 28px; padding: 4px 8px; }
  .login-page { padding: calc(12vh + var(--safe-top)) 16px calc(24px + var(--safe-bottom)); align-items: start; }
  .login-page .btn { width: 100%; }
  .tagline { letter-spacing: .18em; font-size: 10px; }
  .brand-name { font-size: 26px; }
}

/* ---------- Календарь отсутствий и график отпусков ---------- */
.mb { margin-bottom: 12px; }
.text-warn { color: var(--warn); }
button.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--brand); cursor: pointer; }
button.link:hover { text-decoration: underline; }
.group-row td { background: var(--bg); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.plan-list { display: flex; flex-direction: column; gap: 6px; }
.plan-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cal-toolbar select { max-width: 260px; }
.cal-month { min-width: 130px; text-align: center; font-size: 16px; }
.cal-card { overflow: hidden; }
.cal-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.cal th, .cal td { border-bottom: 1px solid var(--line); text-align: center; padding: 0; min-width: 28px; height: 38px; }
.cal thead th { font-weight: 600; color: var(--ink-2); height: 44px; }
.cal thead th span { display: block; font-size: 13px; }
.cal thead th small { display: block; font-size: 10px; color: var(--muted); font-weight: 500; }
.cal .off { background: #f1f4f9; }
.cal thead th.hol span { color: var(--danger); }
.cal thead th.today { box-shadow: inset 0 -2px 0 var(--brand); }
.cal thead th.today span { color: var(--brand); }
.cal td.today { background-image: linear-gradient(var(--brand-50), var(--brand-50)); }
.cal .cal-name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 190px; max-width: 220px; border-right: 1px solid var(--line); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .cal-name small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.cal .cal-name a { color: var(--ink); }
.ab { display: block; height: 18px; margin: 0 -1px; background: var(--brand); }
.ab.first { margin-left: 3px; border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.ab.last { margin-right: 3px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.ab-sick { background: var(--danger); }
.ab-unpaid, .ab-away { background: #94a3b8; }
.ab-study { background: #7c3aed; }
.ab-maternity { background: #db2777; }
.ab-plan { background: var(--brand-50); box-shadow: inset 0 0 0 1.5px var(--brand-light); }
.ab.pending { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 4px, transparent 4px 8px); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; font-size: 12px; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .ab { width: 22px; height: 12px; margin: 0; }
.sw-off { display: inline-block; width: 16px; height: 12px; border-radius: 3px; background: #f1f4f9; border: 1px solid var(--line); }
@media (max-width: 640px) {
  .cal .cal-name { min-width: 120px; max-width: 130px; padding: 6px 8px; font-size: 12px; }
  .cal th, .cal td { min-width: 26px; }
  .cal-toolbar select { max-width: none; width: 100%; }
}

/* ---------- Кандидаты: фильтры, профиль по полям, импорт ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input { flex: 1 1 320px; min-width: 0; }
.filters select { flex: 0 1 190px; }
.pager { justify-content: center; gap: 12px; margin-top: 14px; }
.profile-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.profile-section h4 { margin: 0 0 10px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list .badge { white-space: normal; }
.exp-list { display: flex; flex-direction: column; gap: 14px; }
.exp-item { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.exp-period { font-size: 13px; color: var(--ink-2); }
.exp-period span { display: block; color: var(--muted); font-size: 12px; }
.edu-item { display: grid; grid-template-columns: 50px 1fr; gap: 12px; margin-bottom: 8px; }
.list-block [data-rows] { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.list-row { display: flex; gap: 8px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.list-row .form-grid { flex: 1; }
details summary { cursor: pointer; color: var(--brand); }
@media (max-width: 640px) {
  .filters select { flex: 1 1 45%; }
  .exp-item { grid-template-columns: 1fr; gap: 2px; }
  .list-row { padding: 10px; }
}
/* Переключатель «Оригинал / Перевод» */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--bg); }
.seg button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }

/* ---------- Анализ соответствия вакансии ---------- */
.match-chip { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.match-badge { white-space: nowrap; }
.match-head { display: flex; gap: 16px; align-items: center; }
.match-score { min-width: 112px; text-align: center; border-radius: var(--radius); padding: 10px 8px; background: var(--bg); border: 2px solid var(--line); }
.match-score b { display: block; font-size: 30px; line-height: 1.1; }
.match-score span { font-size: 12px; font-weight: 600; }
.match-score.ok { border-color: var(--ok); color: var(--ok); }
.match-score.brand { border-color: var(--brand); color: var(--brand); }
.match-score.warn { border-color: var(--warn); color: var(--warn); }
.match-score.danger { border-color: var(--danger); color: var(--danger); }
.match-list { margin: 0; padding-left: 18px; }
.match-list li { margin-bottom: 4px; }
@media (max-width: 640px) {
  .match-head { flex-direction: column; align-items: stretch; }
}
/* Этап «Подходящие» — найденные ИИ в базе */
.kcol[data-stage="suitable"] { background: var(--ok-50); }

/* Неместный персонал (expat) */
.expat-badge { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 16px; letter-spacing: .03em; text-transform: uppercase; color: #6d28d9; background: #ede9fe; white-space: nowrap; }
.kcard b .expat-badge, .pick-row b + .expat-badge { margin-left: 4px; }
.pick-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.pick-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.pick-row:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.pick-row input { margin-top: 3px; flex-shrink: 0; padding: 0; }
.pick-row > span { min-width: 0; }

/* ---------- Кабинет кандидата ---------- */
body.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-top { background: var(--navy-deep); color: #fff; padding: calc(12px + var(--safe-top)) 16px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-top .btn.ghost { color: #fff; }
.portal-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.portal-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; flex: 1; box-sizing: border-box; }
.portal-narrow { max-width: 440px; margin: 24px auto 0; }
.portal-title { font-size: 24px; margin-bottom: 16px; }
.portal-task { margin-bottom: 16px; }
.offer-doc { width: 100%; height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; margin-top: 8px; }
.portal-task h2 { font-size: 20px; margin: 4px 0 8px; }
.portal-questions { padding-left: 22px; margin: 0 0 16px; }
.portal-q { padding: 14px 0; border-top: 1px solid var(--line); }
.portal-q > * + * { margin-top: 8px; }
.portal-q textarea { width: 100%; box-sizing: border-box; }
.portal-q-text { font-weight: 600; }
.portal-rec:empty { display: none; }
.portal-rec video, .portal-answer video { width: 100%; max-height: 420px; background: #000; border-radius: var(--radius-sm); display: block; }
.portal-rec audio, .portal-answer audio { width: 100%; }
.portal-answer img { max-width: 100%; max-height: 320px; border-radius: var(--radius-sm); display: block; }
.portal-rec .row, .portal-answer .row { margin-top: 8px; }
.portal-mic { font-size: 42px; text-align: center; padding: 12px; background: var(--brand-50); border-radius: var(--radius-sm); }
.portal-timer { font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 600; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 16px calc(16px + var(--safe-bottom)); }
.file-pick { cursor: pointer; }

/* Вопросы интервью в окне рекрутера */
.q-list { display: flex; flex-direction: column; gap: 10px; }
.q-row { display: grid; grid-template-columns: 1fr 170px 36px; gap: 8px; align-items: start; }
.q-row textarea { width: 100%; box-sizing: border-box; min-height: 42px; resize: vertical; }
.q-row .x { height: 38px; width: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 18px; color: var(--muted); }
.q-row .x:hover { color: var(--danger); border-color: var(--danger); }
.answer-item { padding: 12px 0; border-top: 1px solid var(--line); }
.answer-item video { width: 100%; max-height: 360px; background: #000; border-radius: var(--radius-sm); }
.answer-item audio { width: 100%; }
.answer-item img { max-width: 100%; max-height: 360px; border-radius: var(--radius-sm); }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .q-row { grid-template-columns: 1fr 36px; }
  .q-row select { grid-column: 1; grid-row: 2; }
  .q-row .x { grid-column: 2; grid-row: 1; }
}

/* ---------- Календарь видео-собеседований ---------- */
.vc-title { min-width: 220px; text-align: center; text-transform: none; }
.vc-title::first-letter { text-transform: uppercase; }
.vc-month-head, .vc-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.vc-month-head div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.vc-cell { min-height: 108px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.vc-cell:nth-child(7n) { border-right: 0; }
.vc-cell:hover { background: var(--brand-50); }
.vc-cell.other { background: var(--bg); }
.vc-cell.other .vc-num { color: #cbd5e1; }
.vc-num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.vc-cell.today .vc-num { background: var(--brand); color: #fff; }
.vc-chip { border: 0; text-align: left; font: inherit; font-size: 12px; padding: 2px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--brand-50); color: var(--brand-600); }
.vc-more { font-size: 11px; color: var(--muted); padding-left: 6px; }
.vc-chip.done, .vc-ev.done { background: var(--ok-50); color: #166534; }
.vc-chip.miss, .vc-ev.miss { background: var(--danger-50); color: var(--danger); }
.vc-chip.past, .vc-ev.past { background: #f1f5f9; color: var(--muted); }
.vc-scroll { max-height: calc(100vh - 230px); min-height: 420px; overflow: auto; }
.vc-grid { display: grid; grid-template-columns: 56px repeat(var(--vc-days), minmax(0, 1fr)); min-width: calc(56px + var(--vc-days) * 96px); }
.vc-day .vc-grid { min-width: 0; }
.vc-corner, .vc-dayhead { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.vc-dayhead { border: 0; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); font: inherit; font-size: 13px; padding: 8px 4px; cursor: pointer; color: var(--ink-2); }
.vc-dayhead span { color: var(--muted); }
.vc-dayhead.today b { background: var(--brand); color: #fff; border-radius: 99px; padding: 1px 7px; }
.vc-count { font-size: 11px; background: var(--brand-50); color: var(--brand); border-radius: 99px; padding: 0 6px; }
.vc-hours { position: relative; }
.vc-hours div { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--muted); }
.vc-hours div:first-child { transform: none; }
.vc-col { position: relative; border-left: 1px solid var(--line); }
.vc-col.today { background: #fbfdff; }
.vc-slot { position: absolute; left: 0; right: 0; border-top: 1px solid #eef1f6; }
.vc-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 2; }
.vc-now::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.vc-ev { position: absolute; z-index: 1; border: 0; border-left: 3px solid currentColor; border-radius: 6px; padding: 3px 6px; text-align: left; font: inherit; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; background: var(--brand-50); color: var(--brand-600); display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); }
.vc-ev:hover { filter: brightness(.97); box-shadow: 0 4px 12px rgba(15, 23, 42, .12); z-index: 2; }
.vc-ev b { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-ev-time { font-weight: 600; white-space: nowrap; }
.vc-ev-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-link { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vc-link span { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .vc-cell { min-height: 72px; padding: 3px; }
  .vc-chip b { display: none; }
  .vc-chip { font-size: 11px; padding: 1px 4px; }
  .vc-title { min-width: 0; }
}
.vc-ev.short .vc-ev-sub { display: none; }

/* ---------- Тестовое задание ---------- */
.t-gen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; background: var(--brand-50); border-radius: var(--radius-sm); }
.t-gen label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.t-gen input { width: 64px; padding: 6px 8px; min-height: 0; }
.t-list { display: flex; flex-direction: column; gap: 12px; }
.t-task { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.t-task-head { display: flex; gap: 8px; align-items: center; }
.t-task-head select { width: auto; flex: 0 1 200px; }
.t-task-head .t-num { font-weight: 700; min-width: 22px; }
.t-task-head .x, .t-option .x { margin-left: auto; height: 34px; width: 34px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-size: 18px; color: var(--muted); flex-shrink: 0; }
.t-task-head .x:hover, .t-option .x:hover { color: var(--danger); border-color: var(--danger); }
.t-options { display: flex; flex-direction: column; gap: 6px; padding-left: 4px; }
.t-option { display: flex; gap: 8px; align-items: center; }
.t-option input[type=radio] { margin: 0; flex-shrink: 0; }
.t-option input[data-otext] { padding: 6px 9px; }
.t-criteria summary { cursor: pointer; }
.t-criteria textarea { margin-top: 6px; }
.t-proctor { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.t-proctor legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.t-summary { display: flex; gap: 16px; align-items: flex-start; }
.t-score { font-size: 34px; font-weight: 800; padding: 10px 16px; border-radius: var(--radius); line-height: 1; }
.t-score.ok { background: var(--ok-50); color: #166534; }
.t-score.warn { background: var(--warn-50); color: #92400e; }
.t-score.danger { background: var(--danger-50); color: var(--danger); }
.badge.warn-badge { background: var(--warn-50); color: #92400e; }
.t-snaps { display: flex; flex-wrap: wrap; gap: 6px; }
.t-snaps img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; display: block; }
.t-choice li { padding: 2px 0; }
.t-choice li.is-correct { color: #166534; font-weight: 600; }
.t-choice li.picked:not(.is-correct) { color: var(--danger); font-weight: 600; }
.t-answer { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; }
.portal-rules { padding-left: 20px; margin: 8px 0 14px; }
.portal-rules li { margin-bottom: 6px; }
.portal-choice { display: flex; flex-direction: column; gap: 6px; }
.portal-timer-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--brand-50); color: var(--brand-600); font-weight: 700; padding: 8px 12px; border-radius: var(--radius-sm); margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.portal-timer-bar.warn { background: var(--danger-50); color: var(--danger); }
.portal-cam { position: fixed; right: 12px; bottom: 12px; width: 120px; height: 90px; object-fit: cover; border-radius: 10px; border: 2px solid #fff; box-shadow: var(--shadow-lg); z-index: 40; background: #000; }
@media (max-width: 640px) { .t-summary { flex-direction: column; } .t-task-head select { flex: 1 1 0; min-width: 0; } }

/* ---------- Анализ собеседования ---------- */
.m-scores { display: flex; flex-wrap: wrap; gap: 16px; }
.m-score { display: flex; align-items: center; gap: 12px; }
.m-cols .card { margin: 0; }
.m-cols h4 { margin-bottom: 6px; }
.m-quote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--brand); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.m-transcript { max-height: 420px; overflow: auto; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.m-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.m-bar > span:first-child { min-width: 140px; }

/* ---------- Динамика процента соответствия ---------- */
.match-badge[data-fit] { cursor: help; }
.fit-pop { position: fixed; z-index: 200; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 10px 12px; width: 300px; max-width: calc(100vw - 16px); box-sizing: border-box; font-size: 13px; pointer-events: none; }
.fit-title { margin-bottom: 4px; }
.fit-spark { display: block; color: var(--brand); margin: 4px 0 6px; }
.fit-rows { width: 100%; border-collapse: collapse; }
.fit-rows td { padding: 3px 0; vertical-align: top; }
.fit-rows td:first-child { padding-right: 6px; white-space: nowrap; }
.fit-up { color: var(--ok); font-size: 11px; }
.fit-down { color: var(--danger); font-size: 11px; }
.fit-note { margin-top: 6px; }

/* Фото 3×4 и раздел «Сотрудники» карточками */
.photo34 { aspect-ratio: 3 / 4; width: 100%; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #172e6e, var(--brand) 55%, #9fb3e8); display: grid; place-items: center; color: #fff; font-weight: 700; position: relative; }
.photo34 img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo34 .ini { font-size: 34px; letter-spacing: .02em; }
.emp-photo { width: 96px; flex-shrink: 0; }
.emp-photo .ini { font-size: 26px; }
.emp-photo .photo-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.emp-photo .photo-actions .btn { padding: 4px 8px; font-size: 12px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.person-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; color: inherit; }
.person-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.person-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.person-card .pc-name { font-weight: 700; line-height: 1.25; }
.person-card .pc-pos { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.person-card .pc-dep { font-size: 12px; color: var(--muted); }
.person-card .pc-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.person-card .pc-pick { position: absolute; top: 10px; right: 10px; z-index: 1; width: 20px; height: 20px; cursor: pointer; }
.person-card.terminated .photo34 { filter: grayscale(1); opacity: .7; }
.crop-box { width: 300px; max-width: 100%; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 12px; overflow: hidden; position: relative; background: #0f172a; touch-action: none; cursor: grab; }
.crop-box canvas { width: 100%; height: 100%; display: block; }
@media (max-width: 560px) { .people-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .emp-photo { width: 72px; } }

/* Заказчики карточками с логотипами */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.client-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 12px; color: inherit; transition: box-shadow .15s, transform .15s; }
.client-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.client-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.client-card .cc-name { font-weight: 700; line-height: 1.25; }
.client-card .cc-meta { font-size: 12px; color: var(--muted); }
.client-card .cc-stats { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; font-size: 13px; }
.client-card .cc-stats b { display: block; font-size: 16px; }
.logo-box { aspect-ratio: 16 / 9; width: 100%; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 12px; box-sizing: border-box; width: 100%; height: 100%; }
.logo-box .ini { font-size: 30px; font-weight: 800; color: var(--brand-600); letter-spacing: .03em; }
.client-head { display: flex; gap: 16px; align-items: center; }
.client-head .logo-wrap { width: 180px; flex-shrink: 0; }
.client-head .logo-wrap .photo-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.logo-preview { width: 320px; max-width: 100%; margin: 0 auto; }
@media (max-width: 560px) { .client-head { flex-direction: column; align-items: stretch; } .client-head .logo-wrap { width: 100%; } }

/* Оргструктура: древо */
.oc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.oc-tools [data-zoom-label] { min-width: 44px; text-align: center; font-weight: 600; }
.oc-viewport { overflow: auto; background: radial-gradient(circle at 1px 1px, #dbe3ef 1px, transparent 0) 0 0 / 22px 22px, var(--bg); border: 1px solid var(--line); border-radius: var(--radius); min-height: 420px; max-height: calc(100vh - 220px); cursor: grab; user-select: none; }
.oc-viewport.dragging { cursor: grabbing; }
.oc-canvas { padding: 28px 24px 40px; width: max-content; min-width: 100%; box-sizing: border-box; }
.orgchart, .orgchart ul { display: flex; justify-content: center; margin: 0; padding: 0; position: relative; }
.orgchart ul { padding-top: 26px; }
.orgchart li { list-style: none; position: relative; padding: 26px 10px 0; display: flex; flex-direction: column; align-items: center; }
.orgchart > li { padding-top: 0; }
/* Линии: горизонталь над братьями, вертикаль к каждому узлу и от родителя вниз */
.orgchart li::before, .orgchart li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 26px; border-top: 2px solid #9fb3d1; }
.orgchart li::after { right: auto; left: 50%; border-left: 2px solid #9fb3d1; }
.orgchart li:only-child::before { display: none; }
.orgchart li:only-child::after { border-top: 0; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border: 0 none; }
.orgchart li:last-child::before { border-right: 2px solid #9fb3d1; border-radius: 0 10px 0 0; }
.orgchart li:first-child::after { border-radius: 10px 0 0 0; }
.orgchart > li::before, .orgchart > li::after { display: none; }
.orgchart ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid #9fb3d1; }
.oc-card { width: 232px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; text-align: left; position: relative; z-index: 1; }
.oc-card.oc-root { border-top-color: var(--navy); background: linear-gradient(180deg, #f3f6ff, #fff 60%); width: 260px; }
.orgchart ul ul .oc-card { border-top-color: var(--accent); }
.orgchart ul ul ul .oc-card { border-top-color: #a5b4fc; }
.oc-title { font-weight: 800; font-size: 14px; line-height: 1.25; }
.oc-head { display: flex; gap: 10px; align-items: center; color: inherit; border-radius: 10px; padding: 4px; margin: -4px; }
a.oc-head:hover { background: var(--brand-50); }
.oc-head span:last-child { display: flex; flex-direction: column; min-width: 0; }
.oc-head b { font-size: 13px; line-height: 1.2; }
.oc-head small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.oc-head.empty b, .oc-head.empty small { color: var(--muted); }
.oc-face { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; flex-shrink: 0; background: linear-gradient(135deg, #172e6e, var(--brand) 55%, #9fb3e8); color: #fff; font-size: 11px; font-weight: 700; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.oc-face.lg { width: 46px; height: 46px; font-size: 15px; }
.oc-face img { width: 100%; height: 100%; object-fit: cover; }
.oc-face.more { background: var(--bg); color: var(--ink-2); }
.oc-team { display: flex; flex-wrap: wrap; }
.oc-team > a { margin-right: -6px; transition: transform .12s; }
.oc-team > a:hover { transform: translateY(-2px); position: relative; z-index: 2; }
.oc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; border-top: 1px dashed var(--line); padding-top: 8px; }
.oc-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font: inherit; font-size: 12px; font-weight: 600; padding: 2px 7px; cursor: pointer; color: var(--ink-2); }
.oc-btn:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 560px) { .oc-viewport { max-height: none; min-height: 360px; } .oc-card { width: 200px; } }

/* Карточки-ссылки без подчёркивания */
a.client-card, a.client-card:hover, a.client-card *, a.person-card, a.person-card:hover, a.person-card * { text-decoration: none !important; }

/* ---------- Инфографика: обзор и аналитика ---------- */
.kpi { display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none !important; }
a.kpi:hover { box-shadow: var(--shadow-lg); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.kpi-spark { width: 110px; height: 32px; flex-shrink: 0; }
.spark { width: 100%; height: 100%; overflow: visible; display: block; }
.kpi-delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--ink-2); white-space: nowrap; }
.kpi-delta.up { background: var(--brand-50); color: var(--brand-600); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend.wrap { flex-wrap: wrap; margin: 10px 0 0; gap: 6px 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cols { display: flex; align-items: stretch; gap: 2px; height: 150px; padding-top: 4px; }
.cols.hist { gap: 8px; height: 140px; }
.col, .dcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; position: relative; cursor: default; }
.col-bar { width: 72%; max-width: 44px; border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .12s; }
.col:hover .col-bar, .dcol:hover .dbar { opacity: .8; }
.col-val { font-size: 11px; font-weight: 700; color: var(--ink-2); line-height: 1.4; min-height: 15px; }
.col-label { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hist .col-label { white-space: normal; text-align: center; line-height: 1.2; min-height: 26px; }
.dcols { display: flex; gap: 2px; height: 180px; }
.dcol { justify-content: stretch; }
.dhalf { flex: 1 1 0; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
.dhalf.top { justify-content: flex-end; border-bottom: 1px solid #94a3b8; }
.dhalf.bottom { justify-content: flex-start; }
.dbar { width: 66%; max-width: 40px; min-height: 0; }
.dhalf.top .dbar { border-radius: 4px 4px 0 0; }
.dhalf.bottom .dbar { border-radius: 0 0 4px 4px; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hb-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; color: inherit; text-decoration: none !important; border-radius: 6px; }
.hb-row.with-icon { grid-template-columns: 28px minmax(90px, 150px) 1fr auto; }
a.hb-row:hover .hb-label { color: var(--brand); }
.hb-icon { width: 28px; height: 20px; display: grid; place-items: center; }
.hb-icon img { max-width: 28px; max-height: 20px; object-fit: contain; }
.hb-icon .ini { font-size: 10px; font-weight: 800; color: var(--brand-600); background: var(--brand-50); border-radius: 4px; padding: 2px 4px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 10px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hb-val { white-space: nowrap; font-size: 12px; min-width: 64px; text-align: right; }
.share { display: flex; gap: 2px; height: 14px; border-radius: 99px; overflow: hidden; }
.share span { min-width: 3px; }
.meter { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.meter-track { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.meter-track div { height: 100%; background: var(--brand); border-radius: 99px; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.fn-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.fn-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fn-track { height: 20px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.fn-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #5b8cff); border-radius: 6px; }
.fn-val { min-width: 70px; text-align: right; white-space: nowrap; }
.viz-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow-lg); display: none; max-width: 280px; }
.attn { display: flex; flex-direction: column; }
.attn a { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.attn a:first-child { border-top: 0; }
.attn a:hover { background: var(--bg); }
.attn .attn-n { min-width: 34px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: var(--brand-50); color: var(--brand-600); }
.attn .attn-n.warn { background: var(--warn-50); color: #92400e; }
.attn .attn-n.zero { background: var(--bg); color: var(--muted); }
.attn .attn-t { flex: 1; font-size: 14px; }
.attn .attn-t small { display: block; color: var(--muted); font-size: 12px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h3 { margin: 0; font-size: 17px; }
@media (max-width: 560px) {
  .kpi-spark { width: 80px; }
  .hb-row { grid-template-columns: 90px 1fr auto; }
  .hb-row.with-icon { grid-template-columns: 24px 80px 1fr auto; }
  .fn-row { grid-template-columns: 96px 1fr auto; }
  .cols { height: 120px; } .dcols { height: 150px; }
  .col-label { font-size: 9px; }
}
.big-num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.mt0 { margin-top: 0; }

/* Боковое меню: «Ещё» в разделах */
.nav-more { display: none; }
.nav-more.open { display: block; }
.nav-group-toggle { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; font-family: inherit; cursor: pointer; text-align: left; border-radius: var(--radius-sm); }
.nav-group-toggle:hover { color: #cbd5e1; }
.nav-group-toggle .nav-group-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-toggle .chev { font-size: 10px; opacity: .7; }
.nav-group-toggle .count { background: #1e3a8a; color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; letter-spacing: 0; }
.nav-group-toggle:focus-visible { outline: 2px solid #4f6bb8; outline-offset: -2px; }

/* Заказчики: строки во всю ширину и проекты с логотипами */
.client-list { display: flex; flex-direction: column; gap: 12px; }
.client-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 20px 14px 14px; color: inherit; text-decoration: none !important; transition: box-shadow .15s; }
.client-row:hover { box-shadow: var(--shadow-lg); }
.client-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.client-row .cc-name { font-weight: 700; font-size: 16px; line-height: 1.25; }
.client-row .cc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cr-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cr-stats { display: flex; gap: 28px; font-size: 13px; color: var(--ink-2); }
.cr-stats b { display: block; font-size: 18px; color: var(--ink); }
.pj-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pj-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 4px; font-size: 12px; background: #fff; }
.pj-chip b { color: var(--muted); font-weight: 600; }
.pj-logo { width: 34px; height: 22px; border-radius: 6px; background: #fff; display: inline-grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.pj-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pj-logo .ini { font-size: 9px; font-weight: 800; color: var(--brand-600); background: var(--brand-50); border-radius: 5px; padding: 3px 4px; }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 12px 16px 16px; }
.pj-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pj-card .logo-box .ini { font-size: 22px; }
.link-btn { border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; padding: 0 4px; text-decoration: underline; }
@media (max-width: 760px) {
  .client-row { grid-template-columns: 110px 1fr; gap: 12px; padding: 12px; }
  .cr-stats { grid-column: 1 / -1; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
}
/* Редактор логотипа: рамка как в карточке, шахматка показывает прозрачный фон */
.logo-edit { cursor: grab; touch-action: none; background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 0 0 / 16px 16px; }
.logo-edit:active { cursor: grabbing; }
.logo-edit canvas { width: 100%; height: 100%; display: block; }

/* Документы работника: удостоверение и обучение */
.id-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 20px; }
.id-grid > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.id-grid span:first-child { font-size: 12px; color: var(--muted); }
.id-grid b { font-weight: 600; overflow-wrap: anywhere; }
.text-danger { color: var(--danger); }
.doc-files { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; }
.doc-file { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.tr-list { display: flex; flex-direction: column; margin-top: 10px; }
.tr-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.tr-row:first-child { border-top: 0; }
.tr-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 12px; background: var(--bg); border-radius: 10px; }
.tr-form .field { margin: 0; }
.tr-form input { min-width: 150px; }

/* Меню «⋯» второстепенных действий */
.menu-wrap { position: relative; display: inline-flex; }
.more-btn { padding-left: 12px; padding-right: 12px; font-size: 18px; line-height: 1; }
.menu { display: none; position: fixed; z-index: 900; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu.open { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); text-align: left; padding: 9px 12px; border-radius: 8px; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.menu-item:hover { background: var(--bg); }
.menu-item.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.count-pill { margin-left: 6px; background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.table .more-btn { padding: 4px 10px; font-size: 16px; }

/* Настройки */
.nav-sep { border-top: 1px solid #1e293b; margin: 12px 10px 8px; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.setup-tile { display: flex; gap: 14px; align-items: flex-start; color: inherit; text-decoration: none !important; transition: box-shadow .15s, transform .15s; }
.setup-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.setup-tile > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.setup-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }

/* ---------- Телефон: компактная шапка, нижняя панель, фильтры ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  .topbar { flex-wrap: nowrap; }
  .page-back { width: 40px; height: 40px; padding: 0; font-size: 20px; flex-shrink: 0; }
  #page-actions { width: auto; flex-shrink: 0; overflow: visible; }
  #page-actions.more { -webkit-mask-image: none; mask-image: none; }
  #page-actions .btn { padding: 8px 12px; }
  .fab-plus { width: 42px; height: 42px; padding: 0 !important; border-radius: 50%; font-size: 24px; font-weight: 500; line-height: 1; }
  #page-actions .seg button { padding: 4px 8px; }
  /* Нижняя панель с главными разделами */
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px calc(4px + var(--safe-right)) calc(4px + var(--safe-bottom)) calc(4px + var(--safe-left)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none !important; border-radius: 10px; cursor: pointer; min-height: 50px; justify-content: center; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active .tb-ico { background: var(--brand-50); }
  .tb-ico { position: relative; font-size: 17px; line-height: 1; width: 44px; height: 26px; display: grid; place-items: center; border-radius: 99px; }
  .tb-count { position: absolute; top: -4px; right: 2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 5px; line-height: 1.3; }
  .content { padding-bottom: calc(84px + var(--safe-bottom)); }
  .toasts { bottom: calc(76px + var(--safe-bottom)); }
  /* Фильтры: поиск во всю ширину, списки — по два в ряд */
  .row:has(> input[type=search]), .filters { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .row:has(> input[type=search]) > input[type=search], .filters > input[type=search] { grid-column: 1 / -1; max-width: none !important; }
  .row:has(> input[type=search]) > *, .filters > * { max-width: none !important; min-width: 0; width: 100%; }
  .row:has(> input[type=search]) > .small, .row:has(> input[type=search]) > .check { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .table td.empty-cell { display: none !important; }
}
@media (max-width: 900px) {
  .topbar:has(#page-actions.stacked) { flex-wrap: wrap; }
  #page-actions.stacked { width: 100%; justify-content: flex-end; }
  #page-actions.stacked > .btn:last-child { flex: 1; }
}
a.oc-head, a.oc-head:hover, .oc-team a, .oc-team a:hover { text-decoration: none !important; }
@media (max-width: 640px) {
  /* Галочки выбора для удаления — на компьютере; в карточке строки первым идёт имя */
  .table th:has(> input[data-pick-all]), .table td:has(> input[data-pick]) { display: none !important; }
  .table td:has(> input[data-pick]) + td[data-label] { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .table td:has(> input[data-pick]) + td[data-label]::before { display: none; }
}

@media (max-width: 640px) {
  /* Карточки строк: ячейка из нескольких строк (имя + подпись, заказчик + контракт) — подпись сверху, значение под ней */
  .table td[data-label]:not(:first-child):has(> div, > br, > .small) { flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
  /* Ячейка с кнопками — кнопки переносятся, ничего не уходит за край */
  .table td[data-label]:has(> .btn, > button, > a.btn) { flex-wrap: wrap; justify-content: flex-start; gap: 8px; text-align: left; }
  .table td[data-label=""]:has(.btn, button) { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
  .table td .btn { white-space: normal; }

  /* Оргструктура на телефоне: древо сверху вниз с отступами вместо широкой схемы */
  .oc-tools [data-zoom], .oc-tools [data-zoom-label], .oc-tools > .small { display: none; }
  .oc-viewport { overflow: visible; max-height: none; min-height: 0; background: none; border: 0; cursor: default; }
  .oc-canvas { zoom: 1 !important; padding: 0; width: auto; min-width: 0; }
  .orgchart, .orgchart ul { display: block; padding: 0; }
  .orgchart ul { margin-left: 14px; padding-left: 14px; border-left: 2px solid #c9d6ea; }
  .orgchart li { display: block; padding: 10px 0 0; }
  .orgchart li::before { display: block !important; content: ''; position: absolute; left: -14px; top: 34px; width: 14px; height: 0; border: 0 !important; border-top: 2px solid #c9d6ea !important; border-radius: 0 !important; }
  .orgchart li::after, .orgchart ul::before { display: none !important; }
  .orgchart > li::before { display: none !important; }
  .oc-card, .oc-card.oc-root { width: 100%; box-sizing: border-box; }
}
@media (max-width: 640px) {
  /* Любая ячейка с кнопками в карточке строки: перенос, кнопки слева, ничего не выходит за край */
  .table td:has(> .btn), .table td:has(> button) { display: flex !important; flex-wrap: wrap; gap: 8px; justify-content: flex-start !important; text-align: left !important; white-space: normal !important; }
  .table td:has(> .btn)::before, .table td:has(> button)::before { width: 100%; }
  .table td > .btn { white-space: normal; max-width: 100%; }
}
/* Вкладки листаются пальцем, но без полосы прокрутки */
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* Значок-кнопка в строке таблицы и действия в одну линию */
.icon-btn { width: 34px; padding: 4px 0 !important; justify-content: center; }
.table td.right.nowrap { white-space: nowrap; }
.table td.right.nowrap > * { vertical-align: middle; margin-left: 4px; }
.table td .menu-wrap { vertical-align: middle; }

/* Мобилизация: наряд-заказы и чек-лист готовности */
.wo-list { display: flex; flex-direction: column; gap: 10px; }
.wo-row { display: grid; grid-template-columns: 48px 1fr 220px; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; color: inherit; text-decoration: none !important; transition: box-shadow .15s; }
.wo-row:hover { box-shadow: var(--shadow-lg); }
.wo-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wo-side { display: flex; flex-direction: column; gap: 6px; }
.wo-photo { width: 48px; flex-shrink: 0; }
.wo-photo .photo34 { border-radius: 8px; }
.wo-photo .ini { font-size: 16px; }
.card .wo-photo { width: 64px; }
.wo-bar .progress { margin-top: 4px; }
.wo-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.wo-plan { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; color: inherit; text-decoration: none !important; }
.wo-plan:hover { box-shadow: var(--shadow-lg); }
.wo-hint { margin: 0; padding: 0 20px 8px; }
.wo-check { display: grid; grid-template-columns: 20px 1fr 240px; gap: 12px; align-items: start; padding: 10px 20px; border-top: 1px solid var(--line); }
.wo-check > input[type=checkbox] { width: 18px; height: 18px; margin-top: 2px; }
.wo-check.done .wo-check-main > div:first-child { color: var(--muted); }
.wo-check-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wo-check .check { margin-top: 4px; }
.wo-note { width: 100%; padding: 6px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: inherit; }
.wo-note-ro { color: var(--ink-2); }
.wo-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }
.wo-signs > .small { grid-column: 1 / -1; }
.wo-sign { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.wo-sign.signed { border-style: solid; border-color: var(--ok); }
.wo-sign.signed b { color: var(--ok); }
.wo-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wo-events li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; font-size: 14px; }
@media (max-width: 900px) {
  .wo-row { grid-template-columns: 44px 1fr; gap: 12px; padding: 12px; }
  .wo-side { grid-column: 1 / -1; }
  .wo-check { grid-template-columns: 20px 1fr; padding: 10px 14px; }
  .wo-check .wo-note, .wo-check .wo-note-ro { grid-column: 2; }
  .wo-signs { grid-template-columns: 1fr; padding: 12px 14px; }
  .wo-events li { grid-template-columns: 1fr; gap: 0; }
}
.wo-docs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.card.tr-missing { border-color: var(--danger); }
.mx-wrap { max-height: 70vh; }
.table.mx th.mx-head { text-transform: none; letter-spacing: 0; white-space: normal; min-width: 128px; max-width: 150px; font-size: 12px; text-align: center; vertical-align: bottom; }
.table.mx td.mx-cell { text-align: center; }
.table.mx td.mx-cell input { width: 18px; height: 18px; }
.table.mx td.mx-pos { min-width: 220px; }
.table.mx thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.mx-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.mx-person { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none !important; }
.mx-person > span { display: flex; flex-direction: column; }
.mx-person .wo-photo { width: 36px; }
.mx-person .wo-photo .ini { font-size: 13px; }

/* График вахт */
.wo-tabs { overflow-x: auto; scrollbar-width: none; }
.wo-tabs button { white-space: nowrap; }
.wo-toolbar { margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.rot-row { display: grid; grid-template-columns: 28px 1fr auto auto auto; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); }
.rot-row.done, .rot-row.cancelled { opacity: .65; }
.rot-n { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.rot-row.on_site .rot-n { background: var(--ok); color: #fff; }
.rot-main { display: flex; flex-direction: column; min-width: 0; }
.rot-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.rot-checks .wo-check { padding: 10px 0; }
.gantt { overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 240px 1fr; min-width: 820px; border-top: 1px solid var(--line); color: inherit; text-decoration: none !important; }
a.gantt-row:hover { background: var(--bg); }
.gantt-head { border-top: 0; }
.gantt-name { padding: 8px 16px; display: flex; flex-direction: column; min-width: 0; }
.gantt-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; min-height: 44px; margin-right: 16px; }
.gantt-head .gantt-track { min-height: 32px; }
.gantt-week { position: absolute; top: 9px; font-size: 11px; color: var(--muted); transform: translateX(2px); }
.gantt-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.gantt-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); z-index: 1; }
.gantt-bar { position: absolute; top: 14px; height: 16px; border-radius: 4px; background: #c7d7fe; }
.gantt-bar.on { background: var(--ok); }
.gantt-bar.done { background: #cbd5e1; }
.gantt-bar.due { background: #fbbf24; }
.gantt-demob { position: absolute; top: 10px; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 5px; z-index: 2; }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); }
.gantt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend .gantt-bar { position: static; display: inline-block; width: 22px; height: 10px; }
@media (max-width: 900px) {
  .rot-row { grid-template-columns: 28px 1fr auto; padding: 10px 14px; }
  .rot-row > .rot-check, .rot-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .gantt-row { grid-template-columns: 150px 1fr; }
}

/* Кабинет Заказчика */
.c-hero { display: flex; align-items: center; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 16px; }
.c-hero img { height: 44px; max-width: 160px; object-fit: contain; }
.c-line { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.c-line:hover { background: var(--bg); }
.c-line .grow { display: flex; flex-direction: column; min-width: 0; }
.c-ring { position: relative; border-radius: 50%; flex-shrink: 0; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e8edf5 0); display: grid; place-items: center; }
.c-ring::before { content: ''; position: absolute; inset: 5px; background: var(--surface); border-radius: 50%; }
.c-ring span { position: relative; font-weight: 700; font-size: 13px; }
.c-hires { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 12px 20px 16px; }
.c-hire { display: flex; gap: 10px; align-items: center; }
.c-hire > span { display: flex; flex-direction: column; min-width: 0; }
.c-list { display: flex; flex-direction: column; gap: 10px; }
.c-vac { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; color: inherit; text-decoration: none !important; flex-wrap: wrap; }
.c-vac:hover { box-shadow: var(--shadow-lg); }
.c-vac .grow { min-width: 220px; }
.c-steps { display: flex; gap: 6px; }
.c-steps span { display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 6px 8px; background: var(--bg); border-radius: var(--radius-sm); font-size: 11px; color: var(--muted); }
.c-steps b { font-size: 17px; color: var(--ink); }
.c-steps .hot { background: #fff7ed; } .c-steps .hot b { color: #c2410c; }
.c-cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.c-cand { display: flex; flex-direction: column; gap: 12px; }
.c-cand.shared { border-color: #fdba74; }
.c-cand.rejected { opacity: .7; }
.c-cand-head { display: flex; gap: 14px; align-items: center; }
.c-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.c-stages > div { display: flex; flex-direction: column; gap: 3px; }
.c-bar { height: 6px; background: #eef2f7; border-radius: 3px; overflow: hidden; }
.c-bar i { display: block; height: 100%; border-radius: 3px; }
.c-event { font-size: 14px; background: var(--bg); border-radius: var(--radius-sm); padding: 6px 12px; }
.c-note { background: #eff6ff; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; }
.c-pc { display: flex; flex-direction: column; gap: 2px; }
.c-pc .pro { color: #15803d; } .c-pc .con { color: #b45309; }
.c-exp { margin: 6px 0 0; padding-left: 18px; }
.c-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.c-emp { cursor: default; }
@media (max-width: 900px) {
  .c-cands { grid-template-columns: 1fr; }
  .c-steps { width: 100%; } .c-steps span { flex: 1; min-width: 0; }
  .c-hero { padding: 12px 14px; } .c-hero img { height: 32px; }
  .c-actions .grow { display: none; }
  .c-actions .btn { flex: 1 1 auto; justify-content: center; }
  .c-actions .btn.success { order: -1; flex-basis: 100%; }
}

.wo-pdf { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }

/* ЭЦП, сроки Заказчика, подсказки hh.kz */
.signature.eds { border-style: solid; word-break: normal; overflow-wrap: anywhere; }
.sla-mini { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.sla-mini .badge { font-size: 11px; }
.suggest-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff); margin-top: 4px; max-height: 220px; overflow: auto; }
.suggest-list button { text-align: left; border: 0; background: none; padding: 7px 10px; cursor: pointer; font: inherit; }
.suggest-list button:hover { background: var(--brand-50, #eef4ff); }
.suggest-list > span { padding: 7px 10px; }

/* Табель, логистика, оценки */
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.ts-wrap { max-height: 70vh; }
.ts-table { font-size: 12px; }
.ts-table th, .ts-table td { padding: 6px 4px; }
.ts-table .ts-name { position: sticky; left: 0; background: var(--card, #fff); z-index: 1; min-width: 190px; max-width: 220px; }
.ts-table th.ts-name { z-index: 2; }
.ts-day { text-align: center; min-width: 30px; }
.ts-day.off { color: var(--danger, #dc2626); }
.ts-cell { text-align: center; cursor: pointer; user-select: none; font-weight: 700; border-left: 1px solid var(--line); }
.ts-cell sub { font-weight: 400; font-size: 9px; margin-left: 1px; }
.ts-cell.off { background-image: linear-gradient(rgba(148, 163, 184, .12), rgba(148, 163, 184, .12)); }
.c-W { color: #166534; background-color: #dcfce7; }
.c-T { color: #1e40af; background-color: #dbeafe; }
.c-R { color: #64748b; }
.c-S { color: #9a3412; background-color: #ffedd5; }
.c-V { color: #6b21a8; background-color: #f3e8ff; }
.c-A { color: #991b1b; background-color: #fee2e2; }
.ts-palette { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ts-brush { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 700; cursor: pointer; }
.ts-brush span { font-weight: 400; font-size: 12px; }
.ts-brush.active { outline: 2px solid var(--brand); outline-offset: 1px; }
.ts-brush.c-none { background: #fff; }
.trip-day { display: flex; gap: 12px; align-items: baseline; padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.stars { display: flex; gap: 4px; }
.stars label { cursor: pointer; font-size: 26px; color: #cbd5e1; line-height: 1; }
.stars label.on { color: #f59e0b; }
.stars input { position: absolute; opacity: 0; width: 0; }
.rating-num { font-weight: 800; padding: 1px 8px; border-radius: 6px; margin-left: 4px; }
.rating-num.ok { background: var(--ok-50); color: #166534; }
.rating-num.warn { background: var(--warn-50); color: #92400e; }
.rating-num.danger { background: var(--danger-50); color: #991b1b; }
.text-danger { color: #b91c1c; }
#offline-bar { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 90; background: #1e293b; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 24px rgba(15, 23, 42, .25); max-width: calc(100vw - 32px); }
@media (min-width: 900px) { #offline-bar { bottom: 20px; } }
.cov-wrap { max-height: 72vh; }
.cov-table { font-size: 12px; }
.cov-table .cov-name { position: sticky; left: 0; background: var(--card, #fff); z-index: 1; min-width: 230px; }
.cov-day { padding: 4px 0 !important; min-width: 14px; font-weight: 500; font-size: 10px; }
.cov-cell { padding: 0 !important; min-width: 14px; height: 30px; position: relative; border-left: 1px solid rgba(255, 255, 255, .5); }
.cov-cell.a { background: #bbf7d0; }
.cov-cell.b { background: #bfdbfe; }
.cov-cell.gap { background: #fecaca; }
.cov-cell i { position: absolute; top: 4px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #f59e0b; }
.cov-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.cov-dot.a { background: #22c55e; }
.cov-dot.b { background: #4f6bb8; }
.inc-people { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }

/* Контроль рабочего времени в табеле */
.ts-cell.ts-viol { box-shadow: inset 0 0 0 2px var(--danger); }
.wt-bad { border-color: var(--danger); }
.wt-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.wt-list li { margin: 2px 0; }

/* Панель руководителя */
.big-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.fin-bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.fin-bar > div { width: 100%; }
tr.sep td { border-top: 2px solid var(--border); }

/* Онлайн-инструктаж */
.course-text { font-size: 15px; line-height: 1.6; }
.q-item { border: 0; padding: 0; margin: 0 0 14px; }
.q-item legend { margin-bottom: 6px; }
.q-item.q-wrong legend { color: var(--danger); }
.q-card .field { margin-bottom: 6px; }

/* Выбор языка на странице входа */
.lang-switch { display: flex; justify-content: center; gap: 4px; margin-top: 14px; }
.lang-switch button { background: transparent; border: 1px solid rgba(255,255,255,.18); color: rgba(255,255,255,.75); border-radius: 999px; padding: 5px 12px; font: 500 13px Inter, sans-serif; cursor: pointer; }
.lang-switch button.active { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.text-ok { color: var(--ok); }
.lang-select { margin-top: 8px; width: 100%; background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.lang-select option { color: #111; }
.portal-lang { margin: 0 0 0 auto; }
.portal-lang button { padding: 4px 10px; font-size: 12px; }

/* ---- Визуальная доводка: компактнее и аккуратнее ---- */
/* Без фото — мягкий аватар с инициалами вместо высокой цветной плашки */
.photo34.nophoto { background: var(--brand-50, #eef3ff); color: var(--brand); }
.person-card .photo34.nophoto { aspect-ratio: auto; width: 56px; height: 56px; border-radius: 50%; }
.person-card .photo34.nophoto .ini { font-size: 18px; }
.wo-photo .photo34.nophoto, .emp-photo .photo34.nophoto { aspect-ratio: 1; border-radius: 50%; }
.emp-photo .photo34.nophoto .ini { font-size: 22px; }
/* Меню: подписи в одну строку */
.nav a .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Карточки воронки: длинные кнопки не вылезают */
.kcard .badge { white-space: normal; max-width: 100%; text-align: left; line-height: 1.3; }
.empty.small { padding: 20px; }
@media (max-width: 900px) {
  .kpi .value { white-space: nowrap; font-size: clamp(18px, 5.4vw, 24px); }
  .stat .label, .kpi .label { font-size: 12.5px; }
  .card { padding: 16px; }
  .card.flush { padding: 0; }
  h3 { font-size: 16px; }
}
@media (max-width: 560px) {
  .emp-hero .row { flex-wrap: nowrap; align-items: flex-start; }
  .emp-hero h2 { font-size: 18px !important; line-height: 1.25; }
  .emp-hero .muted { font-size: 13px; }
  .emp-hero .emp-photo { width: 56px; }
  .client-head h2, .client-head .title { font-size: 20px; }
}
@media (max-width: 560px) {
  .c-hero h2 { font-size: 19px; line-height: 1.25; }
  .c-hero img { max-width: 96px; }
  .tabs { scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* Журнал действий: «было → стало» */
.audit-diff { list-style: none; margin: 6px 0; padding: 0; font-size: 13px; }
.audit-diff li { margin: 2px 0; overflow-wrap: anywhere; }
.audit-diff s { color: #9a3412; }

/* Двухфакторный вход */
.radio-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; font-weight: 400; }
.radio-card:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.radio-card.disabled { opacity: .55; cursor: not-allowed; }
.radio-card input { margin-top: 3px; }
.tfa-setup { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.tfa-qr svg { width: 200px; height: 200px; display: block; border-radius: 8px; border: 1px solid #e2e8f0; }
.tfa-key { font-size: 13px; word-break: break-all; user-select: all; }
.tfa-code { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tfa-codes code { font-size: 15px; padding: 6px 10px; background: #f1f5f9; border-radius: 6px; text-align: center; }
.sec-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef2f7; }
.danger-text { color: var(--danger) !important; }
@media (max-width: 640px) { .tfa-setup { grid-template-columns: 1fr; justify-items: center; } }

/* Быстрый поиск (Ctrl+K) */
.nav-search { display: flex; align-items: center; gap: 10px; width: calc(100% - 4px); margin: 4px 2px 10px; padding: 8px 10px; border: 1px solid #1e293b; background: #0f172a; color: #8da2c0; border-radius: var(--radius-sm); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.nav-search:hover { border-color: #334155; color: #e2e8f0; }
.nav-search .ico { width: 18px; text-align: center; }
.nav-search .grow { flex: 1; }
.nav-search kbd, .search-input kbd { font-family: inherit; font-size: 11px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 4px; border: 1px solid #334155; color: #8da2c0; }
.search-btn { display: none; font-size: 20px; padding: 4px 10px; }
.search-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.search-box { width: 100%; max-width: 640px; background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(15, 23, 42, .35); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.search-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search-input .ico { font-size: 20px; color: #64748b; }
.search-input input { flex: 1; border: 0; outline: 0; font-size: 17px; padding: 6px 0; background: none; box-shadow: none; }
.search-input kbd { border-color: #cbd5e1; color: #64748b; }
.search-results { overflow-y: auto; padding: 6px; }
.search-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; font-weight: 700; padding: 10px 10px 4px; }
.search-item { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; color: inherit; }
.search-item .ico { width: 22px; text-align: center; color: #64748b; }
.search-item .grow { min-width: 0; display: flex; flex-direction: column; }
.search-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item.active, .search-item:hover { background: #eff6ff; }
.search-hint { color: #64748b; padding: 14px 10px; margin: 0; font-size: 14px; }
@media (max-width: 900px) {
  .search-btn:not(.hidden) { display: inline-flex; }
  .nav-search { display: none !important; }
  .search-backdrop { padding-top: calc(8px + var(--safe-top, 0px)); }
  .search-box { max-height: 85vh; }
  .search-input kbd { display: none; }
}

/* Расчётный листок */
.payslip-card { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.payslip-card .grow { flex: 1; }
.payslip-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.payslip-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.payslip-table td { padding: 6px 4px; border-bottom: 1px solid #eef2f7; }
.payslip-table .sec td { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #64748b; padding-top: 14px; border-bottom: 0; }
.payslip-table .total td { font-weight: 600; }
.payslip-table .grand td { font-weight: 700; font-size: 16px; border-top: 2px solid #0f172a; border-bottom: 0; }

/* Подпись ЭЦП: выбор способа и eGov Mobile */
.eds-choice { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; border: 1px solid #e2e8f0; background: #fff; border-radius: var(--radius-sm); padding: 14px; font: inherit; cursor: pointer; color: inherit; }
.eds-choice:hover { border-color: #2563eb; background: #eff6ff; }
.eds-ico { font-size: 26px; }
.egov-sign { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.egov-qr { width: 240px; height: 240px; align-self: center; image-rendering: pixelated; border: 1px solid #e2e8f0; border-radius: 8px; display: block; margin: 8px auto; }

/* Проверка подлинности документа по QR */
.verify-head { display: flex; flex-direction: row; gap: 16px; align-items: center; }
.verify-head.ok { border-color: #16a34a; background: #f0fdf4; }
.verify-head.bad { border-color: #dc2626; background: #fef2f2; }
.verify-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; flex: none; }
.verify-head.ok .verify-icon { background: #16a34a; }
.verify-head.bad .verify-icon { background: #dc2626; }
.verify-qr { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.verify-qr img { width: 92px; height: 92px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; flex: none; }
#verify { display: flex; flex-direction: column; gap: 12px; }
#verify .badge { white-space: normal; line-height: 1.35; display: inline-block; }

/* Пакетное подписание документов */
.table th.pick, .table td.pick { width: 36px; padding-right: 0; }
.table td.pick input, .table th.pick input { width: 18px; height: 18px; cursor: pointer; }
.batch-bar { position: sticky; top: 70px; z-index: 5; display: flex; align-items: center; gap: 10px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; }
@media (max-width: 640px) { .batch-bar { top: 56px; flex-wrap: wrap; } }

/* =====================================================================
   Мобильная версия: аккуратная шапка, компактное меню, карточки-блоки
   ===================================================================== */
.page-tools { display: none; }
@media (max-width: 900px) {
  /* Шапка: значки по 38 px, заголовок до двух строк — не обрезается до «За…» */
  .topbar { flex-wrap: wrap; align-items: center; gap: 6px; min-height: 56px; padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(8px + var(--safe-left)); box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
  .search-btn:not(.hidden) { font-size: 24px !important; color: var(--ink-2); }
  .menu-btn, .search-btn:not(.hidden), .page-back { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 12px; font-size: 19px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
  .topbar h1 { flex: 1 1 0; min-width: 0; font-size: 17px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em;
    white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  #page-actions { gap: 6px; flex-shrink: 0; flex-wrap: nowrap; align-items: center; }
  #page-actions .menu-wrap > .btn, #page-actions .menu-wrap > button { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 12px; }
  .fab-plus { width: 38px !important; height: 38px; min-height: 38px; border-radius: 12px !important; font-size: 22px; box-shadow: 0 6px 16px rgba(37, 99, 255, .28); }
  /* Длинное главное действие — отдельной строкой, аккуратно, не на весь экран громоздко */
  .topbar:has(#page-actions.stacked) { flex-wrap: wrap; }
  #page-actions.stacked { width: 100%; order: 20; justify-content: stretch; }
  #page-actions.stacked > .btn:last-child { flex: 1; min-height: 40px; font-size: 14px; border-radius: 12px; }
  #page-actions.stacked > .menu-wrap { order: 2; }
  /* Поля в шапке (месяц, Заказчик, вид) — своей строкой под заголовком */
  .page-tools:not(.hidden) { display: flex; order: 30; width: 100%; gap: 8px; flex-wrap: wrap; align-items: center; }
  .page-tools > * { flex: 1 1 140px; min-width: 0; max-width: none !important; }
  .page-tools input, .page-tools select { min-height: 40px; font-size: 15px; width: 100%; }
  .page-tools .seg { flex: 1 1 100%; display: flex; }
  .page-tools .seg button { flex: 1; }

  /* Меню: компактный блок пользователя — имя не заслоняет разделы */
  .sidebar { display: flex; flex-direction: column; overflow-y: auto; }
  .sidebar .logo { margin-bottom: 8px; }
  .sidebar .user { position: static; margin-top: 12px; padding: 12px 6px 0; display: grid; grid-template-columns: 1fr; gap: 2px; }
  .sidebar .user b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar .user #user-role { font-size: 12px; color: #8da2c0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar .user .row { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 6px; margin-top: 8px; }
  .sidebar .user .row .btn { min-height: 34px; padding: 4px 8px; font-size: 13px; border-radius: 10px; }
  .sidebar .lang-select { margin-top: 6px; min-height: 34px; font-size: 14px; }

  /* Вкладки: прокрутка с затуханием у края, а не обрезанное слово */
  .tabs { margin-left: -16px; margin-right: -16px; padding: 0 16px; gap: 2px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); scroll-padding: 0 16px; }
  .tabs button, .tabs a { padding: 10px 12px; font-size: 14px; }

  /* Кнопки: текст переносится внутри кнопки, кнопки переносятся в ряду и не выходят за блок */
  .btn { white-space: normal; text-align: center; line-height: 1.25; max-width: 100%; }
  .row { flex-wrap: wrap; }
  .card .row > .btn, .modal .row > .btn { min-width: 0; }
  .badge { max-width: 100%; white-space: normal; line-height: 1.35; overflow-wrap: anywhere; vertical-align: middle; }
  input, select, textarea { max-width: 100%; }
  select { text-overflow: ellipsis; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .content { padding-top: 14px; }
  /* Блоки: мягкие карточки с ровными отступами */
  .card { border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05); }
  .card + .card, .card + .grid, .grid + .card { margin-top: 12px; }
  .card h3 { font-size: 16px; }
  .card-head { padding: 14px 16px; }
  .card-head h3 { font-size: 15px; }
  .grid { gap: 12px; }
  .grid.c4 { gap: 10px; }
  /* Показатели: подпись и значение без переполнения */
  .kpi .label, .stat .label { font-size: 12px; line-height: 1.3; }
  .kpi .value, .stat .value { font-size: clamp(17px, 5.2vw, 22px); letter-spacing: -.02em; white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
  /* Мини-график — под числом, а не рядом: число не сжимается в столбик */
  .kpi-main { min-width: 0; flex-direction: column; align-items: stretch !important; gap: 4px; }
  .kpi-spark { width: 100%; max-width: none; height: 24px; }
  .kpi-spark svg { width: 100%; height: 22px; }
  .kpi .hint, .stat .hint { font-size: 11.5px; line-height: 1.35; overflow-wrap: anywhere; }

  /* Пары «подпись — значение»: в две колонки, компактно, как блок */
  .dl { grid-template-columns: minmax(92px, 38%) 1fr; gap: 6px 12px; font-size: 14px; }
  .dl dt { font-size: 12.5px; padding-top: 1px; }
  .dl dd { margin-bottom: 0; }

  /* Таблицы-карточки: длинные значения переносятся, логотипы маленькие */
  .table tr { padding: 14px 16px; }
  .table td[data-label] { align-items: baseline; }
  .table td[data-label] > * { min-width: 0; }
  .table td[data-label] { overflow-wrap: anywhere; }
  .table td img { max-height: 16px; width: auto; vertical-align: middle; }
  /* Логотип Заказчика в карточке строки лишний — название рядом */
  .table td[data-label] > img.client-mini { display: none; }
  .table td[data-label] > .badge { flex: 0 1 auto; min-width: 0; max-width: 64%; white-space: normal; text-align: right; }
  /* Длинная подпись столбца («Подразделение / Заказчик») переносится и не отнимает место у значения */
  .table td[data-label]::before { flex-shrink: 1 !important; max-width: 50%; font-size: 11.5px !important; overflow-wrap: normal; }
  .table td[data-label] > .badge { max-width: 58%; }
  .table td .badge { white-space: normal; }
  .table tr.click:active { background: var(--brand-50); }

  /* Нижнее меню: значки ровно, подписи не обрезаются */
  .tabbar a, .tabbar button { font-size: 10.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* График вахт: бейдж проверки и кнопки — своей строкой, без наложения */
  .rot-row { grid-template-columns: 28px 1fr auto; row-gap: 6px; }
  .rot-row > .rot-check, .rot-row > .rot-actions { grid-column: 2 / -1; justify-self: start; }
  .rot-row > .rot-check:empty, .rot-row > span:empty { display: none; }

  /* Модальные окна: кнопки в подвале — равные, текст переносится */
  .modal-foot { gap: 8px; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 calc(50% - 4px); }
  .modal-head h3 { font-size: 17px; line-height: 1.25; }
}
@media (max-width: 380px) {
  .grid.c4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 14px; }
  .topbar h1 { font-size: 16px; }
}

@media (max-width: 640px) {
  /* Кабинет кандидата: язык — второй строкой, название не сжимается в столбик */
  .portal-top { flex-wrap: wrap; row-gap: 8px; }
  .portal-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .portal-brand { min-width: 0; flex: 1 1 auto; }
}
@media (max-width: 640px) {
  .table td.chev-cell { display: none; }
}

/* Вход из Telegram */
.tg-entry { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: var(--navy-deep); color: #fff; text-align: center; }
.tg-status { margin: 0; font-size: 16px; color: #cbd5e1; max-width: 320px; line-height: 1.45; }
.tg-status.err { color: #fecaca; }

/* ---------- Гид по сайту и база знаний ---------- */
.guide { max-width: 820px; }
.guide-search { width: 100%; margin-bottom: 12px; }
.guide-list { display: grid; gap: 10px; }
.guide-item { padding: 0; }
.guide-item > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.guide-item > summary::-webkit-details-marker { display: none; }
.guide-item > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.guide-item[open] > summary::after { content: '▴'; }
.guide-item ol { margin: 0; padding: 0 18px 4px 40px; line-height: 1.55; }
.guide-item ol li { margin-bottom: 6px; }
.guide-item > a { display: inline-block; margin: 0 18px 14px; }
.guide-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft, #eef3ff); display: inline-grid; place-items: center; font-size: 15px; flex: none; }
.kb-alert { display: flex; flex-direction: column; gap: 2px; border-left: 4px solid var(--warn, #f59e0b); margin-bottom: 14px; }
.kb-list { display: grid; gap: 8px; }
.kb-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.kb-item:hover { border-color: var(--brand, #2563eb); }
.kb-ico { font-size: 22px; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); display: grid; place-items: center; }
.kb-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.kb-main b { overflow-wrap: anywhere; }
.kb-sum { color: var(--text-2, #475569); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kb-state { flex: none; }
.kb-filters { gap: 10px; flex-wrap: wrap; }
.kb-drafts { display: grid; gap: 8px; }
.kb-draft { display: grid; grid-template-columns: auto minmax(180px, 2fr) minmax(120px, 1fr) minmax(140px, 1.2fr) auto auto; gap: 8px; align-items: center; }
.kb-up { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.kb-up li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.kb-up li span:first-child { overflow-wrap: anywhere; }
.kb-acks { display: grid; gap: 4px; max-height: 260px; overflow: auto; margin-top: 8px; }
.ok-text { color: var(--ok, #16a34a); }
@media (max-width: 760px) {
  .kb-draft { grid-template-columns: auto 1fr; }
  .kb-draft > :not(:first-child):not(.kb-title) { grid-column: 2; }
  .kb-draft .kb-title { grid-column: 2; }
}

.kb-ask { margin-bottom: 14px; }
.kb-answer { margin-top: 12px; padding: 12px 14px; background: var(--bg, #f8fafc); border-radius: var(--radius-sm, 10px); }
.kb-answer-text { white-space: pre-wrap; line-height: 1.55; }
.kb-src { display: inline-block; margin: 6px 12px 0 0; }

.attr-item { padding: 14px 16px; }
.attr-reasons { margin: 8px 0; padding-left: 18px; line-height: 1.5; }
.attr-advice { margin-top: 8px; padding: 10px 12px; background: var(--bg, #f8fafc); border-radius: var(--radius-sm, 10px); white-space: pre-wrap; line-height: 1.5; }

.ai-meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.ai-meter > span { display: block; height: 100%; border-radius: 99px; }
.ai-bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.ai-bars > span { flex: 1; min-width: 3px; background: var(--brand, #2563eb); border-radius: 2px 2px 0 0; opacity: 0.85; }
/* Поля, заполненные ИИ: подсветка до проверки человеком */
.ai-filled { background: color-mix(in srgb, #8b5cf6 8%, transparent); border-color: color-mix(in srgb, #8b5cf6 45%, var(--border, #ccc)); }
.ai-box { border: 1px dashed color-mix(in srgb, #8b5cf6 45%, var(--border, #ccc)); border-radius: 10px; padding: 10px 12px; background: color-mix(in srgb, #8b5cf6 4%, transparent); }
.ai-answer { white-space: pre-line; }
/* База знаний: материалы по шагам, тест, ознакомление */
.kb-step { margin-bottom: 12px; }
.kb-step textarea, .kb-step input:not([type]) { width: 100%; }
.kb-step-n { font-weight: 600; }
.kb-video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; margin-top: 8px; }
.kb-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.kb-video-file { width: 100%; max-height: 70vh; border-radius: 10px; background: #000; }
.kb-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-thumb { position: relative; width: 110px; height: 80px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border, #e5e7eb); background: var(--surface-2, #f8fafc); display: inline-flex; align-items: center; justify-content: center; }
.kb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.kb-thumb .oc-btn { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.9); }
.kb-thumb.add { cursor: pointer; color: var(--muted, #64748b); font-size: 13px; }
.kb-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kb-gallery img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--border, #e5e7eb); }
.kb-read { margin-bottom: 12px; }
.kb-progress { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-progress-step { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2, #f1f5f9); color: var(--muted, #64748b); }
.kb-progress-step.done { background: color-mix(in srgb, var(--ok, #16a34a) 14%, transparent); color: var(--ok, #16a34a); font-weight: 600; }
.kb-done { border-color: var(--ok, #16a34a); }
.kb-reader, .kb-editor { max-width: 900px; }
.risk-level i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.risk-n { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.risk-top { border-top: 1px solid var(--line); }
.risk-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.risk-row:last-child { border-bottom: 0; padding-bottom: 0; }
.risk-row:hover b { color: var(--brand); }

/* Таблица кандидатов: все столбцы помещаются по ширине, сортировка по заголовку */
.cand-table { table-layout: fixed; width: 100%; }
.cand-table td, .cand-table th { vertical-align: middle; overflow: hidden; padding-left: 10px; padding-right: 10px; }
.cand-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cand-table .clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-table .clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cand-table th { letter-spacing: .02em; font-size: 11px; }
.cand-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; text-overflow: ellipsis; }
.cand-table th.sortable:hover, .cand-table th.sorted { color: var(--text, inherit); }
.cand-table th.sortable:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: -2px; }
.cand-table .sort-ico { margin-left: 4px; font-size: 10px; opacity: .35; }
.cand-table th.sorted .sort-ico { opacity: 1; }
@media (min-width: 641px) and (max-width: 760px) { .cand-table { table-layout: auto; min-width: 680px; } }

/* Кандидаты: метки, массовые действия, подборка ИИ поиска */
.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-chip { border: 1px solid var(--line); background: #f1f5f9; color: var(--text, #0f172a); border-radius: 999px; padding: 1px 8px; font-size: 11px; line-height: 18px; cursor: pointer; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip:hover { border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px; background: #eef4ff; border: 1px solid #c7d7fe; }
.cand-ai { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 14px; border-radius: 10px; background: #f5f3ff; border: 1px solid #ddd6fe; }
.cand-table td.pick, .cand-table th.pick { padding-left: 12px; padding-right: 0; text-overflow: clip; }

#cand-saved { width: auto; min-width: 180px; max-width: 320px; }

/* Сравнение кандидатов в шорт-листе для Заказчика */
.cmp-table th[scope=row] { position: sticky; left: 0; z-index: 1; background: #fafbfd; min-width: 150px; max-width: 190px; white-space: normal; text-transform: none; letter-spacing: 0; font-size: 13px; }
.cmp-table td { min-width: 180px; vertical-align: top; font-size: 13px; }
.cmp-table td.num { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.cmp-table td.best { background: #ecfdf5; color: #047857; }

.bar { height: 8px; background: #eef1f6; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* Сортировка списка кандидатов на телефоне (заголовков столбцов там нет) */
.cand-sort-m { display: none; }
@media (max-width: 640px) {
  .cand-sort-m { display: block; max-width: 220px; }
  /* Строка кандидата — карточка: галочка справа сверху, имя крупно, данные парами «подпись — значение» */
  .cand-table tr { position: relative; }
  .table.cand-table td.pick:has(> input[data-pick]) { display: block !important; position: absolute; top: 12px; right: 14px; width: auto; padding: 0; }
  .cand-table td.pick input { width: 24px; height: 24px; }
  .cand-table td.pick + td { padding-right: 40px; }
  .cand-table .clip { white-space: normal; }
  .cand-table td.num { text-align: right; }
  /* Панель массовых действий — внизу экрана, кнопки прокручиваются */
  .bulk-bar { position: fixed; left: 8px; right: 8px; bottom: calc(74px + var(--safe-bottom, 0px)); top: auto; z-index: 60; margin: 0; flex-wrap: nowrap; overflow-x: auto; box-shadow: 0 8px 30px rgba(15, 23, 42, .25); }
  .bulk-bar > * { flex-shrink: 0; }
  #cand-saved { max-width: none; flex: 1 1 100%; }
}

/* Лента уведомлений: колокольчик в шапке, всплывающие окна, список */
.inbox-btn { position: relative; font-size: 18px; padding: 6px 10px; }
.inbox-btn .count-pill { position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger, #dc2626); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
#inbox-pops { position: fixed; top: 72px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.inbox-pop { position: relative; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; padding: 12px 34px 12px 14px; box-shadow: 0 12px 32px rgba(15, 23, 42, .18); cursor: pointer; animation: inbox-in .25s ease-out; }
.inbox-pop:hover { border-color: var(--brand); }
.inbox-pop-t { font-weight: 600; }
.inbox-pop-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; }
@keyframes inbox-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.inbox-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.inbox-item { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 6px; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.inbox-item:hover { background: #f8fafc; }
.inbox-item.unread { background: #eef4ff; }
.inbox-item.unread .inbox-pop-t::before { content: '● '; color: var(--brand); }
@media (max-width: 640px) { #inbox-pops { top: auto; bottom: 84px; right: 8px; } }

/* Настройки компании: вкладки, интеграции строками, сохранение */
.set-wrap { display: flex; flex-direction: column; gap: 16px; }
.set-wrap .form-grid, #match-form .form-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.set-save { display: flex; }
#match-form { margin-top: 0; }
.set-integ { border-bottom: 1px solid var(--line); }
.set-integ:last-child { border-bottom: 0; }
.set-integ > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.set-integ > summary::-webkit-details-marker { display: none; }
.set-integ > summary:hover { background: #f8fafc; }
.set-integ-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.set-integ-head b::after { content: ' ›'; color: var(--muted); }
.set-integ[open] .set-integ-head b::after { content: ' ⌄'; }
.set-integ-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.set-status { display: flex; gap: 10px; align-items: flex-start; }
.set-status > span { font-size: 20px; line-height: 1.2; }
.ok-text { color: var(--ok, #059669); }

/* Журнал версий вакансии */
.ver-list { display: flex; flex-direction: column; gap: 12px; max-height: 65vh; overflow: auto; }
.ver { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.ver.bad { border-color: var(--danger); background: var(--danger-50); }
.ver-diff td { vertical-align: top; padding: 6px 8px; }
.ver-diff td:first-child { width: 160px; }
.ver-was { color: #b91c1c; text-decoration: line-through; white-space: pre-wrap; }
.ver-new { color: #047857; white-space: pre-wrap; }

/* Выбор компании (юрлица) после входа и переключение */
.company-list { display: flex; flex-direction: column; gap: 10px; }
.company-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid #e3e7ee; border-radius: 14px; background: #fff; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.company-item:hover { border-color: #b9c4dd; box-shadow: 0 10px 24px -14px rgba(16, 24, 40, .35); transform: translateY(-1px); }
.company-item:active { transform: none; }
.company-item.last { border-color: var(--brand); background: linear-gradient(180deg, #fff, #f6f8fd); box-shadow: 0 0 0 3px rgba(30, 58, 138, .08); }
.company-item:disabled { cursor: default; opacity: .6; transform: none; box-shadow: none; }
.company-item.busy { opacity: 1; }
.company-item.busy .ci-arrow { animation: ci-spin .8s linear infinite; }
@keyframes ci-spin { to { transform: rotate(360deg); } }
.company-item .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.company-item .grow b { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ci-role { font-size: 12px; font-weight: 600; color: #475467; background: #f1f3f7; border-radius: 999px; padding: 2px 9px; }
.ci-note { font-size: 12px; font-weight: 600; color: var(--brand); display: inline-flex; align-items: center; gap: 5px; }
.ci-note::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #c8a24a; }
.ci-arrow { flex: none; fill: none; stroke: #98a2b3; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s, stroke .15s; }
.company-item:hover .ci-arrow { stroke: var(--brand); transform: translateX(3px); }
.company-ini { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(145deg, #1e3a8a, #3b5bb5); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 15px; letter-spacing: .02em; flex-shrink: 0; box-shadow: 0 6px 14px -8px rgba(16, 24, 40, .6); }
.company-ini[data-tone="1"] { background: linear-gradient(145deg, #101828, #3a4660); }
.company-ini[data-tone="2"] { background: linear-gradient(145deg, #33405e, #5b6b8c); }
.company-ini[data-tone="3"] { background: linear-gradient(145deg, #2c4a9e, #6f86c9); }
.pick-other { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
.pick-other:hover { color: var(--brand); }
.pick-other svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.company-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.company-switch:hover { background: rgba(255, 255, 255, .12); }

.company-ini.logo { background: #fff; border: 1px solid var(--line); overflow: hidden; padding: 2px; }
.company-ini.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.company-switch #company-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.company-switch #company-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switch .company-ini { width: 28px; height: 28px; border-radius: 7px; font-size: 11px; }

/* Новая версия сайта, а пользователь что-то набирает — предложение обновить вместо перезагрузки */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 300; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.update-bar .btn { flex: none; }
[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
@media (max-width: 720px) { .update-bar { bottom: calc(72px + env(safe-area-inset-bottom)); } }

/* Переключатель связанных страниц (отпуска: заявления, календарь, график) */
.seg-nav { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 16px; padding: 4px; background: var(--surface-2, #eef1f6); border-radius: 10px; width: fit-content; max-width: 100%; }
.seg-nav a { padding: 7px 14px; border-radius: 8px; color: inherit; text-decoration: none; font-size: 14px; white-space: nowrap; }
.seg-nav a.active { background: var(--surface, #fff); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; }
@media (max-width: 720px) { .seg-nav { width: 100%; } .seg-nav a { flex: 1; text-align: center; padding: 9px 8px; } }

/* Иконки набора Witstaff (public/js/icons.js): линейные, цвет текста */
svg.i { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.ic { display: inline-flex; vertical-align: middle; line-height: 1; }
.ic { margin-right: 0.25em; }
.btn .ic, .menu-item .ic { margin-right: 0.35em; }
.btn .ic svg.i, .menu-item .ic svg.i { width: 1.1em; height: 1.1em; vertical-align: -0.18em; }
.nav a .ico { display: grid; place-items: center; }
.nav a .ico svg.i { width: 19px; height: 19px; }
.setup-ico svg.i { width: 22px; height: 22px; }
.tb-ico svg.i { width: 21px; height: 21px; }
.search-item .ico svg.i, .nav-search .ico svg.i { width: 18px; height: 18px; }

/* Мультивыбор: панель действий для выбранных — у нижнего края экрана (public/js/bulk.js) */
.sel-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 250; display: flex; align-items: center; gap: 10px; background: var(--ink, #0f172a); color: #fff; border-radius: 14px; padding: 8px 8px 8px 16px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28); max-width: calc(100vw - 32px); }
.sel-bar.hidden { display: none; }
.sel-bar .sel-count { white-space: nowrap; font-size: 14px; }
.sel-bar .sel-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sel-bar .btn { display: inline-flex; align-items: center; gap: 6px; }
.sel-bar .btn.secondary { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.18); }
.sel-bar .btn.secondary:hover { background: rgba(255, 255, 255, 0.18); }
.sel-bar .btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.sel-bar .sel-clear { color: #cbd5e1; padding: 6px 8px; }
.sel-bar .sel-clear:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
body.has-sel-bar #view { padding-bottom: 96px; }
@media (min-width: 721px) { .sel-bar { left: calc(50% + 124px); } }
@media (max-width: 720px) {
  .sel-bar { left: 8px; right: 8px; transform: none; bottom: calc(68px + env(safe-area-inset-bottom)); max-width: none; flex-wrap: wrap; padding: 10px 12px; }
  .sel-bar .sel-actions { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .sel-bar .sel-actions .btn { flex: none; }
  .sel-bar .sel-clear { margin-left: auto; }
}
/* База знаний: галочка рядом с документом */
.kb-row { display: flex; align-items: center; gap: 8px; }
.kb-row .kb-item { flex: 1; }
.kb-pick { display: grid; place-items: center; width: 36px; height: 44px; cursor: pointer; flex: none; }
.kb-pick input { width: 18px; height: 18px; }

/* Телефон: позвонить и быстрые чаты WhatsApp / Telegram */
.phone-links { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.phone-links > a:first-child { margin-right: 4px; }
.msg-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted, #64748b); text-decoration: none; }
.msg-link svg.i { width: 18px; height: 18px; }
.msg-link.wa:hover, .msg-link.wa:focus-visible { color: #128c4b; background: #e8f7ee; }
.msg-link.tg:hover, .msg-link.tg:focus-visible { color: #1c86c4; background: #e7f3fb; }
@media (max-width: 720px) { .msg-link { width: 36px; height: 36px; } .msg-link svg.i { width: 20px; height: 20px; } }
.msg-link.ol:hover, .msg-link.ol:focus-visible { color: #0f6cbd; background: #e8f1fb; }
.msg-link.gm:hover, .msg-link.gm:focus-visible { color: #c5221f; background: #fdecea; }
.mail-links > a:first-child { overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
body.no-salary [data-salary] { display: none !important; }

/* Мастер первого запуска («Первые шаги») */
.setup-wizard { border-color: var(--brand-200, #c7d7fe); }
.wiz-bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.wiz-bar i { display: block; height: 100%; background: var(--brand-600, #2563eb); border-radius: 99px; }
.wiz-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wiz-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; }
.wiz-steps li .grow { display: flex; flex-direction: column; min-width: 0; }
.wiz-steps li.next { background: var(--brand-50); }
.wiz-steps li.done b { color: var(--muted, #64748b); text-decoration: line-through; text-decoration-thickness: 1px; }
.wiz-mark { width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; flex: none; border: 1.5px solid var(--line); color: var(--line); }
.wiz-steps li.done .wiz-mark { background: #16a34a; border-color: #16a34a; color: #fff; }
.wiz-steps li.next .wiz-mark { border-color: var(--brand-600, #2563eb); color: var(--brand-600, #2563eb); }
.wiz-mark svg.i { width: 14px; height: 14px; }

/* Скан документов с телефона */
.scan-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.scan-page { margin: 0; border: 1px solid var(--border, #ddd); border-radius: 8px; overflow: hidden; background: var(--surface, #fff); }
.scan-thumb { aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; background: #f3f4f6; }
.scan-thumb canvas { max-width: 100%; max-height: 100%; }
.scan-page figcaption { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 2px 8px; }

/* История в группе компаний */
.group-timeline { list-style: none; margin: 8px 0 12px; padding: 0 0 0 14px; border-left: 2px solid var(--border, #e5e7eb); }
.group-timeline li { position: relative; padding: 6px 0 10px 10px; }
.group-timeline li::before { content: ''; position: absolute; left: -21px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface, #fff); border: 2px solid var(--muted, #9ca3af); }
.group-timeline li.current::before { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); }

/* Документы из eGov: выбор видов */
.egov-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 8px 0; max-height: 260px; overflow: auto; }

/* Кнопки «из eGov»: фирменный синий и знак «e» */
.btn.btn-egov { background: #1565d8; border-color: #1565d8; color: #fff; display: inline-flex; align-items: center; gap: 8px; }
.btn.btn-egov:hover { background: #0f55bb; border-color: #0f55bb; color: #fff; }
.btn.btn-egov:focus-visible { outline: 3px solid color-mix(in srgb, #1565d8 40%, transparent); outline-offset: 2px; }
.btn.btn-egov .egov-mark { width: 18px; height: 18px; flex: none; color: #1565d8; }
.btn.sm.btn-egov .egov-mark { width: 16px; height: 16px; }

/* Вкладка «Документы» карточки работника */
.docs-tab { display: grid; gap: 14px; margin-bottom: 18px; }
.doc-issues { border-radius: 12px; padding: 12px 16px; border: 1px solid; }
.doc-issues.danger { background: color-mix(in srgb, var(--danger, #dc2626) 7%, var(--surface, #fff)); border-color: color-mix(in srgb, var(--danger, #dc2626) 35%, transparent); }
.doc-issues.warn { background: color-mix(in srgb, #d97706 8%, var(--surface, #fff)); border-color: color-mix(in srgb, #d97706 35%, transparent); }
.doc-issues.ok { background: color-mix(in srgb, #16a34a 7%, var(--surface, #fff)); border-color: color-mix(in srgb, #16a34a 30%, transparent); }
.doc-issues-head { font-weight: 600; }
.doc-issues.danger .doc-issues-head { color: var(--danger, #dc2626); }
.doc-issues.ok .doc-issues-head { color: #15803d; }
.doc-issues ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.doc-issues li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; font-size: 14px; }
.doc-issues li::before { content: '•'; margin-right: -4px; }
.doc-issues li.danger::before { color: var(--danger, #dc2626); }
.doc-issues li.warn::before { color: #d97706; }
.doc-issues li span { flex: 1; }
.docs-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-id-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.doc-id-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 14px 0 0; }
.doc-id-grid dt { font-size: 12px; color: var(--muted, #6b7280); }
.doc-id-grid dd { margin: 2px 0 0; font-weight: 600; }
.doc-id-files { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border, #e5e7eb); }
.docs-table td { vertical-align: middle; }
.docs-table .doc-group td { background: var(--surface-2, #f8fafc); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); padding-top: 8px; padding-bottom: 8px; }
.docs-table .doc-missing td:first-child { box-shadow: inset 3px 0 0 var(--danger, #dc2626); }
.docs-table .doc-older td { color: var(--muted, #6b7280); }
.doc-req { font-size: 11px; color: var(--muted, #6b7280); border: 1px solid var(--border, #e5e7eb); border-radius: 6px; padding: 0 5px; margin-left: 4px; }
.docs-foot { padding: 10px 16px; border-top: 1px solid var(--border, #e5e7eb); }

/* Списки документов (обучение, eGov): строка — название и подробности слева, статус и действия справа */
.doc-list { display: flex; flex-direction: column; }
.doc-list-cat { padding: 10px 20px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border, #e5e7eb); }
.doc-list-cat + .doc-item { border-top: 0; }
.doc-item.missing { box-shadow: inset 3px 0 0 var(--danger, #dc2626); }
.doc-item-main { flex: 1; min-width: 0; }
.doc-item-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-item-meta { font-size: 13px; color: var(--muted, #6b7280); margin-top: 2px; }
.doc-item-meta .link-btn { font-size: 13px; }
.doc-item-hist { font-size: 13px; color: var(--muted, #6b7280); margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--border, #e5e7eb); display: grid; gap: 2px; }
.doc-item-act { display: flex; align-items: center; gap: 4px; }
@media (max-width: 640px) {
  .doc-item { flex-wrap: wrap; padding: 12px 16px; }
  .doc-item-main { flex-basis: 100%; }
  .doc-item-act { margin-left: auto; }
}

/* Шапка карточки работника: фото, имя и статус, главные факты сеткой */
.emp-hero2 { display: flex; gap: 22px; align-items: flex-start; margin-bottom: 16px; }
.emp-hero-photo { position: relative; width: 112px; flex-shrink: 0; }
.emp-hero-photo .photo34 { width: 112px; }
.emp-hero-photo .photo34.nophoto { aspect-ratio: 1; border-radius: 50%; }
.emp-hero-photo .photo34.nophoto .ini { font-size: 30px; }
.emp-photo-tools { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.emp-hero-photo:hover .emp-photo-tools, .emp-hero-photo:focus-within .emp-photo-tools { opacity: 1; }
@media (hover: none) { .emp-photo-tools { opacity: 1; } }
.emp-photo-tools .icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(15, 23, 42, .72); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.emp-photo-tools .icon-btn:hover { background: rgba(15, 23, 42, .9); }
.emp-photo-tools .icon-btn svg { width: 16px; height: 16px; }
.emp-hero-body { flex: 1; min-width: 0; }
.emp-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.emp-hero-top h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.emp-hero-sub { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 4px; }
.emp-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 20px; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border, #e5e7eb); }
.emp-facts dt { font-size: 12px; color: var(--muted, #6b7280); margin-bottom: 2px; }
.emp-facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .emp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .emp-hero2 { gap: 14px; }
  .emp-hero-photo, .emp-hero-photo .photo34 { width: 76px; }
  .emp-hero-top { flex-direction: column; gap: 4px; }
  .emp-hero-top h2 { font-size: 18px; }
  .emp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-left: -90px; }
}
.emp-facts .phone-links { max-width: 100%; }
.emp-facts .mail-links > a:first-child { min-width: 0; max-width: none; }
.emp-facts .phone-links > a:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 760px) { .emp-facts > .wide-m { grid-column: span 2; } }

/* Блок «Добавить в личное дело»: выбор категории, файл, загрузка и eGov */
.upload-card { margin-bottom: 16px; }
.upload-card .file-upload { margin-top: 12px; padding: 0; border: 0; background: none; }

/* Метка «eGov» у файлов из госбазы */
.egov-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 7px 1px 3px; border-radius: 999px; background: #1565d8; color: #fff; font-size: 11px; font-weight: 600; vertical-align: middle; }
.egov-tag .egov-mark { width: 14px; height: 14px; color: #1565d8; }
.text-warn { color: #b45309; }

/* Кнопки вкладки «Документы» — справа, компактно */
.docs-toolbar { justify-content: flex-end; }
.docs-toolbar .btn { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }

/* Разбор личного дела из архива */
.pd-progress { margin-top: 12px; }
.pd-bar { height: 8px; border-radius: 4px; background: var(--border, #e5e7eb); overflow: hidden; margin: 8px 0; }
.pd-bar span { display: block; height: 100%; width: 0; background: var(--primary, #2563eb); transition: width 0.3s; }
.pd-doc { align-items: flex-start; gap: 10px; }
.pd-doc .check { margin-top: 6px; }
.pd-title { width: 100%; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; margin-left: -6px; background: transparent; font: inherit; }
.pd-title:hover, .pd-title:focus { border-color: var(--border, #d1d5db); background: var(--surface, #fff); }
.pd-cat { max-width: 220px; }
.pd-train { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.pd-val { width: 100%; min-width: 160px; }
@media (max-width: 720px) { .pd-doc { flex-wrap: wrap; } .pd-cat { max-width: none; width: 100%; } }
.pd-train select { width: auto; max-width: 300px; }

/* Сведения из госбаз в карточке */
.gov-card .doc-item { align-items: flex-start; gap: 10px; }
.gov-lines { display: grid; gap: 4px; margin-top: 6px; font-size: 13px; }
.gov-line { display: flex; gap: 8px; align-items: baseline; }
.gov-line .badge { flex: none; }
.gov-wait { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted, #6b7280); }
.gov-wait .spinner { width: 16px; height: 16px; border: 2px solid var(--border, #d1d5db); border-top-color: var(--primary, #2563eb); border-radius: 50%; animation: gov-spin 0.8s linear infinite; }
@keyframes gov-spin { to { transform: rotate(360deg); } }
.pd-who { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-left: 4px solid var(--primary, #2563eb); }
.pd-who.new { border-left-color: #16a34a; }
.pd-who h3 a { color: inherit; }
