/* ORVIX Web Admin — дизайн-система (Stage 5C-Web, 05.10.2026).
   Все цвета/отступы/шрифты — только через токены ниже. Фирменная палитра KLG
   подставляется заменой блока «Бренд» (временная нейтральная «сталь»).
   Компоненты: .btn, .field/.input/.select, .chip, .badge, .panel, .table,
   .tabs, .modal, .drawer, .toast, .menu, .empty-state, .loading, .error-state,
   .confirm (диалог подтверждения), .kpi, .meter (шкала совпадения). */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/plex-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/plex-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/plex-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/plex-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Бренд (временно, до ассетов KLG) */
  --brand: #2b5c8a; --brand-strong: #1f4870; --brand-soft: #e6edf5; --brand-on: #ffffff;
  --nav-bg: #1e2633; --nav-text: #c3cbd6; --nav-muted: #8e99a9; --nav-active: #2c3647; --nav-accent: #8fb4da;
  /* Нейтральные */
  --ink: #1e2633; --ink-2: #3b4556; --muted: #5e6878; --faint: #6c7586;
  --paper: #f2f3f1; --surface: #ffffff; --surface-2: #f7f8f7; --line: #dce0e4; --line-strong: #c5cbd3;
  /* Статусы (одни на Web, Mini App и отчёты) */
  --ok: #27703f; --ok-bg: #e4f1e8; --warn: #875a0b; --warn-bg: #faefd9;
  --bad: #a8362b; --bad-bg: #f7e3e0; --neutral: #5e6878; --neutral-bg: #eceef1;
  /* Ритм */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;
  --r-sm: 6px; --r-md: 10px; --r-pill: 999px;
  --shadow-pop: 0 4px 14px rgba(20, 28, 40, 0.12); --shadow-overlay: 0 16px 40px rgba(20, 28, 40, 0.22);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs-md: 0.875rem; --fs-lg: 1rem; --fs-xl: 1.25rem; --fs-2xl: 1.5rem;
  --nav-w: 236px; --topbar-h: 64px;
  /* совместимость с токенами Stage 5C (используются в разметке страниц) */
  --orvix-primary: var(--brand); --orvix-primary-soft: var(--brand-soft); --orvix-line: var(--line); --orvix-muted: var(--muted);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.45; color: var(--ink); background: var(--paper);
  font-feature-settings: "tnum" 1; }
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
h2 { font-size: var(--fs-lg); margin-bottom: var(--s3); }
h3 { font-size: var(--fs-md); margin: var(--s5) 0 var(--s2); color: var(--ink-2); }
a { color: var(--brand); }
small.muted, .muted { color: var(--muted); }
code { font-size: 0.92em; background: var(--neutral-bg); padding: 0 4px; border-radius: 4px; }
pre { background: var(--surface-2); border: 1px solid var(--line); padding: var(--s3); overflow-x: auto; font-size: var(--fs-xs); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Button ---------- */
button, .btn { font: inherit; font-size: var(--fs-md); font-weight: 500; min-height: 36px; padding: 0 var(--s4); display: inline-flex; align-items: center;
  justify-content: center; gap: var(--s2); border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; }
button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-strong); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary, button.btn-primary { background: var(--brand) !important; border-color: var(--brand) !important; color: var(--brand-on) !important; }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong) !important; }
.btn-confirm { background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; }
.btn-confirm:hover:not(:disabled) { filter: brightness(0.92); }
.review-card .openEmpLink { display: block; font-size: var(--fs-sm); margin-top: var(--s1); }
.btn-dismiss, .btn-danger { border-color: var(--bad) !important; color: var(--bad); }
.btn-dismiss:hover:not(:disabled), .btn-danger:hover:not(:disabled) { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm, .btn-sm.btn, button.btn-sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn-icon { width: 36px; padding: 0; }

/* ---------- Field / Input / Select ---------- */
input, select, textarea { font: inherit; font-size: var(--fs-md); min-height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); max-width: 100%; }
textarea { padding: var(--s2) var(--s3); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--brand); }
input[type=file] { padding: var(--s1) 0; border: 0; background: none; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input::placeholder { color: var(--faint); }
.field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); align-items: end; }
.form-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-top: var(--s3); }
.form-hint { font-size: var(--fs-sm); color: var(--muted); }
/* PAD: подтверждённый отрицательный результат - очередь проверки и детали события (Коля 11.11.2026) */
.pad-failed { color: var(--bad); font-weight: 700; margin: var(--s2) 0 0; }

/* ---------- Chip / Badge (статусы) ---------- */
.badge, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-sm);
  font-weight: 500; line-height: 1.5; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.badge.ok, .chip.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .chip.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad, .chip.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral, .chip.neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge.info, .chip.info { background: var(--brand-soft); color: var(--brand-strong); }
.count-pill { min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn);
  font-size: var(--fs-xs); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Panel ---------- */
.box, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); margin-bottom: var(--s5); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.panel-head h2 { margin: 0; }
.panel-flush { padding: 0; overflow: hidden; }
.hint-box { background: var(--warn-bg); border-radius: var(--r-sm); padding: var(--s3) var(--s4); font-size: var(--fs-sm); color: var(--warn); }

/* ---------- Table ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.scroll-y { max-height: calc(100vh - 290px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 500; font-size: var(--fs-sm);
  text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; font-size: var(--fs-md); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-soft); }
tr.clickable:focus-visible td { background: var(--brand-soft); }
td.num, th.num { text-align: right; }
.cell-main { font-weight: 500; }
.cell-sub { display: block; font-size: var(--fs-sm); color: var(--muted); }
.thumb { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; background: var(--neutral-bg); display: block; }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--fs-sm); }
.avatar.lg { width: 64px; height: 64px; flex-basis: 64px; font-size: var(--fs-xl); }
.person { display: flex; align-items: center; gap: var(--s3); min-width: 0; }

/* ---------- Toolbar / Pager ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s4); }
.toolbar .grow { flex: 1 1 200px; }
.toolbar .field input, .toolbar .field select { width: 100%; }
.toolbar .field:not(.grow) { flex: 0 1 150px; min-width: 120px; }
.toolbar > button { margin-left: auto; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.segmented button { border: 0; border-radius: 0; border-right: 1px solid var(--line); min-height: 34px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--brand); color: var(--brand-on); }
.pager { display: flex; gap: var(--s3); align-items: center; justify-content: flex-end; padding: var(--s3) var(--s4); border-top: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--muted); }
.filter-bar { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s4); }
.filter-bar label { display: flex; flex-direction: column; font-size: var(--fs-sm); color: var(--muted); gap: var(--s1); }
.period-bar { display: flex; gap: var(--s2); margin-bottom: var(--s5); align-items: center; flex-wrap: wrap; }
.period-bar button.active { background: var(--brand); color: var(--brand-on); border-color: var(--brand); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); min-height: 40px; padding: 0 var(--s4); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs button .count-pill { margin-left: var(--s1); }
.tab-panel[hidden] { display: none; }

/* ---------- Empty / Loading / Error ---------- */
.empty-state, .error-state, .loading { padding: var(--s7) var(--s5); text-align: center; color: var(--muted); }
.empty-state strong, .error-state strong { display: block; color: var(--ink); font-size: var(--fs-lg); margin-bottom: var(--s1); }
.error-state strong { color: var(--bad); }
.loading::before { content: ""; display: block; width: 22px; height: 22px; margin: 0 auto var(--s2); border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand); animation: orvix-spin 0.8s linear infinite; }
@keyframes orvix-spin { to { transform: rotate(360deg); } }

/* ---------- Modal / Confirm ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 28, 40, 0.45); display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: var(--s4); }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--r-md); padding: var(--s6); width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-overlay); }
.modal-box.wide { max-width: 760px; }
.modal-box h2 { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.modal-close { border: 0; background: none; color: var(--muted); min-height: 32px; width: 32px; padding: 0; font-size: 1.1rem; }
.confirm-text { white-space: pre-line; color: var(--ink-2); margin: 0 0 var(--s5); }

/* ---------- Drawer (карточка события справа) ---------- */
#eventDrawer:not(:empty) { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 900; overflow-y: auto;
  background: var(--surface); box-shadow: var(--shadow-overlay); }
#eventDrawer .drawer { padding: var(--s6); }
#eventDrawer .drawer h3:first-of-type { margin-top: 0; font-size: var(--fs-xl); color: var(--ink); }
.drawer-close { float: right; border: 0; background: none; color: var(--muted); min-height: 32px; }
.drawer-info { display: grid; gap: var(--s1); margin: var(--s3) 0 var(--s4); font-size: var(--fs-md); color: var(--ink-2); }
.split-view { display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center; margin: var(--s3) 0; }
.split-view img, .crop-img { width: 168px; height: 168px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--neutral-bg); }
.confidence-badge { font-size: var(--fs-lg); font-weight: 600; }
.canvas-wrap { max-width: 100%; overflow-x: auto; }
canvas.frame-canvas { max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); }

/* ---------- Toast ---------- */
#toastHost { position: fixed; right: var(--s4); bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 2000;
  max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--r-sm);
  padding: var(--s3) var(--s4); box-shadow: var(--shadow-pop); font-size: var(--fs-md); }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.error { border-left-color: var(--bad); }
.toast details { margin-top: var(--s1); font-size: var(--fs-xs); color: var(--muted); }
.toast .toast-close { float: right; border: 0; background: none; min-height: 0; padding: 0 0 0 var(--s2); color: var(--muted); }

/* ---------- Overflow menu ---------- */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 220px; z-index: 50; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-pop); padding: var(--s1); display: none; }
.menu.open { display: block; }
.menu button { width: 100%; justify-content: flex-start; border: 0; background: none; min-height: 34px; padding: 0 var(--s3); }
.menu button:hover:not(:disabled) { background: var(--surface-2); }
.menu button.danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: var(--s1) 0; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.app-nav { width: var(--nav-w); flex: 0 0 var(--nav-w); background: var(--nav-bg); color: var(--nav-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: var(--s5) var(--s5) var(--s4); }
.brand-name { display: block; color: #fff; font-size: var(--fs-xl); font-weight: 600; letter-spacing: 0.06em; }
.brand-sub { display: block; color: var(--nav-muted); font-size: var(--fs-sm); }
/* логотип в боковой панели (Коля 29.10.2026): прозрачный фон, цвет панели --nav-bg; ширина = панель минус отступы .brand */
.brand-logo { display: block; width: 196px; max-width: 100%; height: auto; }
nav.sidebar { padding: var(--s2) var(--s3) var(--s5); display: flex; flex-direction: column; gap: 2px; }
nav.sidebar .group-label { color: var(--nav-muted); font-size: var(--fs-xs); padding: var(--s4) var(--s3) var(--s1); }
nav.sidebar button { width: 100%; justify-content: flex-start; gap: var(--s3); border: 0; border-radius: var(--r-sm); background: none;
  color: var(--nav-text); min-height: 38px; padding: 0 var(--s3); font-weight: 400; }
nav.sidebar button svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.8; }
nav.sidebar button:hover:not(:disabled) { background: var(--nav-active); color: #fff; }
nav.sidebar button.active { background: var(--nav-active); color: #fff; font-weight: 500; box-shadow: inset 3px 0 0 var(--nav-accent); }
nav.sidebar button .count-pill { margin-left: auto; }
.app-nav :focus-visible, #loginScreen :focus-visible { outline-color: var(--nav-accent); }
.nav-foot { margin-top: auto; padding: var(--s4) var(--s5); color: var(--nav-muted); font-size: var(--fs-xs); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header.topbar { position: sticky; top: 0; z-index: 20; min-height: var(--topbar-h); display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s7); background: rgba(242, 243, 241, 0.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.page-head { flex: 1; min-width: 0; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.user-chip { display: flex; align-items: center; gap: var(--s3); font-size: var(--fs-sm); color: var(--ink-2); }
.user-chip .user-name { font-weight: 500; }
.role-badge { padding: 2px 8px; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-strong); font-size: var(--fs-xs); font-weight: 600; }
.nav-toggle { display: none; }
main.content { padding: var(--s6) var(--s7) var(--s8); width: 100%; max-width: 1480px; }
section.tab { display: none; }
section.tab.active { display: block; }

/* ---------- Dashboard ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4) var(--s5); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); min-height: 104px; }
.kpi .kpi-value { font-size: 2rem; font-weight: 600; line-height: 1.1; }
.kpi .kpi-label { color: var(--muted); font-size: var(--fs-sm); }
.kpi.warn .kpi-value { color: var(--warn); } .kpi.bad .kpi-value { color: var(--bad); } .kpi.good .kpi-value { color: var(--ok); }
.kpi:hover { border-color: var(--brand); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--s5); align-items: start; }
.quick-actions { display: grid; gap: var(--s2); }
.quick-actions button { justify-content: flex-start; min-height: 44px; }
.status-list { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.status-list li { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--fs-md); }
/* старые карточки 5C — для совместимости разметки */
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }

/* ---------- Employee profile ---------- */
.profile-head { display: flex; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; }
.profile-head .who { flex: 1; min-width: 240px; }
.profile-head .who h2 { font-size: var(--fs-2xl); margin: 0 0 var(--s2); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s2) var(--s5); margin: var(--s3) 0 0; }
.facts div { font-size: var(--fs-sm); color: var(--muted); }
.facts b { display: block; color: var(--ink); font-weight: 500; font-size: var(--fs-md); }
.profile-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.emp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); margin: var(--s5) 0 0; }
.emp-stats .stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
.emp-stats .stat b { display: block; font-size: var(--fs-xl); color: var(--ink); font-weight: 600; }
.ref-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--s4); }
.ref-card { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.ref-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--neutral-bg); display: block; }
/* REFMGMT R1: эталон в карточке открывается крупно */
.ref-open { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
.ref-open:focus-visible { outline-offset: -2px; }
.ref-card .ref-meta { padding: var(--s3); display: grid; gap: var(--s1); font-size: var(--fs-sm); color: var(--muted); }
.ref-card .ref-meta b { color: var(--ink); font-weight: 500; }
.ref-card .ref-actions { padding: 0 var(--s3) var(--s3); margin-top: auto; }

/* ---------- Review desk ---------- */
.review-desk { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.review-index { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); max-height: calc(100vh - 170px); overflow-y: auto;
  position: sticky; top: calc(var(--topbar-h) + var(--s4)); }
.review-index button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); text-align: left; border: 0;
  border-bottom: 1px solid var(--line); border-radius: 0; min-height: 0; padding: var(--s3) var(--s4); background: none; white-space: normal; }
.review-index button:hover { background: var(--surface-2); }
.review-index button.current { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.review-index .ri-time { font-weight: 500; color: var(--ink); }
.review-index .ri-sub { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#reviewList .review-card { display: none; }
#reviewList .review-card.is-current { display: grid; }
.review-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s6);
  grid-template-columns: minmax(0, 260px) minmax(0, 260px) minmax(220px, 1fr); grid-template-areas: "frame ref info" "actions actions actions"; gap: var(--s5); align-items: start; }
.review-card:focus { outline: none; }
.review-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.review-card > .crop-img:first-child { grid-area: frame; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.review-card > .crop-img:nth-child(2) { grid-area: ref; width: 100%; height: auto; aspect-ratio: 1 / 1; }
/* REVIEW-THUMB-FIX 28.10: эталон кандидата с подписью (снимок сравнения / не действует / действующий эталон) */
.ref-fig { margin: 0; display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.ref-fig > figcaption { font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; }
.ref-fig.ref-fig-note > figcaption { color: var(--warn); font-weight: 600; }
.split-view .ref-fig { width: 168px; }
.review-card > .ref-fig { grid-area: ref; }
.review-card > .ref-fig > .crop-img { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.review-card > .rc-info { grid-area: info; display: grid; gap: var(--s2); align-content: start; min-width: 0; }
.review-card > .review-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line); }
.review-card .review-actions button { min-height: 42px; }
.review-card .rc-label { font-size: var(--fs-xs); color: var(--muted); display: block; }
.review-card .rc-candidate { font-size: var(--fs-xl); font-weight: 600; }
.review-card .bind-box { display: flex; gap: var(--s2); flex-wrap: wrap; }
.review-card .bind-box input { flex: 1 1 220px; }
.review-nav { display: flex; align-items: center; gap: var(--s2); justify-content: space-between; margin-bottom: var(--s3); color: var(--muted); font-size: var(--fs-sm); }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; font-size: var(--fs-xs); background: var(--surface); }

/* Шкала совпадения: 0–60 «не распознан», 60–80 «требует проверки», 80–100 «распознан» */
.meter { position: relative; height: 10px; border-radius: var(--r-pill); background:
  linear-gradient(to right, var(--neutral-bg) 0 60%, var(--warn-bg) 60% 80%, var(--ok-bg) 80% 100%); margin: var(--s2) 0 var(--s4); }
.meter .meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-pill); background: var(--ink-2); opacity: 0.85; }
.meter .meter-fill.ok { background: var(--ok); } .meter .meter-fill.warn { background: var(--warn); } .meter .meter-fill.bad { background: var(--neutral); }
.meter .meter-tick { position: absolute; top: 14px; transform: translateX(-50%); font-size: var(--fs-xs); color: var(--faint); }
.meter-value { font-size: var(--fs-2xl); font-weight: 600; }

/* ---------- Locations / misc ---------- */
.geofence-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; margin-bottom: var(--s2); }
.geofence-toggle-btn { border: 0; border-radius: 0; border-right: 1px solid var(--line); min-height: 34px; background: var(--surface); }
.geofence-toggle-btn:last-child { border-right: 0; }
.geofence-toggle-btn.active { background: var(--brand); color: var(--brand-on); }
details.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { margin-bottom: var(--s4); }
.locked-note { color: var(--bad); font-size: var(--fs-sm); }
.profile-radio { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin-bottom: var(--s2); display: block; cursor: pointer; }
.profile-radio.selected { border-color: var(--brand); background: var(--brand-soft); }
.placeholder-card { border: 1px dashed var(--line-strong); border-radius: var(--r-md); padding: var(--s5); color: var(--muted); background: var(--surface); }
.reshoot-group { margin-bottom: var(--s5); }
.reshoot-group h3 { display: flex; justify-content: space-between; align-items: center; margin-top: 0; }
.metric-ok { color: var(--ok); } .metric-fail { color: var(--bad); font-weight: 600; }
.gauge { position: relative; height: 18px; border-radius: 9px; overflow: hidden; margin-top: var(--s1);
  background: linear-gradient(to right, var(--bad) 0 50%, var(--warn) 50% 65%, var(--ok) 65% 100%); }
.gauge-marker { position: absolute; top: -3px; width: 3px; height: 24px; background: var(--ink); }
.candidate-row { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }
.candidate-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2); text-align: center; width: 112px; }
.candidate-card img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--r-sm); }
.split-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s5); }
/* блок «Диагностика ДИТ»: шесть колонок бенчмарка влезают только в панель от 640 px - уже в одну колонку; на телефоне прокрутка внутри панели */
#tab-diagnostics .split-cols { grid-template-columns: repeat(auto-fit, minmax(min(640px, 100%), 1fr)); }
#diagStatus, #benchmarkContent { overflow-x: auto; }

/* ---------- Login ---------- */
#loginScreen { min-height: 100vh; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4); padding: var(--s7) var(--s4);
  background: var(--nav-bg); color: var(--nav-text); }
.login-card { background: var(--surface); color: var(--ink); border-radius: var(--r-md); padding: var(--s7); width: 100%; max-width: 400px;
  box-shadow: var(--shadow-overlay); display: grid; gap: var(--s4); }
.login-card .brand-name { color: var(--ink); font-size: var(--fs-2xl); }
.login-card .brand-sub { color: var(--muted); }
.login-card input { width: 100%; }
.login-card .btn-primary, .login-card #btnTelegramLogin { width: 100%; min-height: 44px; }
#btnTelegramLogin { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); background: var(--brand);
  color: #fff; text-decoration: none; font-weight: 500; }
.login-card details summary { cursor: pointer; color: var(--muted); }

/* ---------- Responsive ---------- */
/* ---------- Мелкие состояния (5C-Web) ---------- */
.photo-gone { display: flex; align-items: center; justify-content: center; text-align: center; padding: var(--s2);
  font-size: var(--fs-xs); color: var(--muted); background: var(--neutral-bg); border: 1px dashed var(--line-strong); }
.empty-state span, .error-state span { display: block; max-width: 52ch; margin: 0 auto; }
.text-bad { color: var(--bad); }
.confidence-badge.ok { color: var(--ok); } .confidence-badge.warn { color: var(--warn); }
.drawer-section { margin-top: var(--s5); }
.dit-details { margin-top: var(--s5); border-top: 1px solid var(--line); padding-top: var(--s3); }
.dit-summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); }
.nowrap { white-space: nowrap; }
.show-mobile { display: none; }
.filter-bar > label.check { flex-direction: row; align-items: center; gap: var(--s2); min-height: 36px; }
tr.selected td { background: var(--brand-soft); }
.cell-actions { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.menu-trigger { font-size: 1.1rem; line-height: 1; }
.menu-wrap .menu { text-align: left; }
#reviewIndex[hidden] { display: none; }

/* ---------- Объекты: рабочее место с картой (MAP UX REDESIGN) ---------- */
.map-ws { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--s4);
  height: calc(100vh - var(--topbar-h) - 72px); min-height: 520px; }
.map-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s4); gap: var(--s3); }
.map-side > #mapBrowse { display: flex; flex-direction: column; min-height: 0; flex: 1; gap: var(--s2); }
.map-side > #mapBrowse[hidden], #mapEditor[hidden] { display: none; }
.map-search { position: relative; }
.map-search input { width: 100%; min-height: 42px; padding-left: 36px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235e6878' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; }
.map-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1300; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: var(--shadow-overlay); max-height: 360px; overflow-y: auto; }
.map-suggest-head { padding: var(--s2) var(--s3) var(--s1); font-size: var(--fs-xs); color: var(--muted); }
.map-suggest-item { padding: var(--s2) var(--s3); cursor: pointer; display: grid; }
.map-suggest-item:hover, .map-suggest-item.active { background: var(--brand-soft); }
.map-side-head { display: flex; justify-content: space-between; align-items: center; }
.map-check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2); }
.map-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 calc(-1 * var(--s4)); border-top: 1px solid var(--line); }
.map-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s2); align-items: start;
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.map-item.current { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.map-item-main { display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 0; min-height: 0; white-space: normal; justify-content: stretch; }
.map-item-main:hover:not(:disabled) { background: none; }
.map-item-main:hover .cell-main { color: var(--brand); }
.map-item-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-top: var(--s2); }
.map-side-foot button { width: 100%; }
#mapEditor { display: flex; flex-direction: column; gap: var(--s3); overflow-y: auto; min-height: 0; }
/* «Сохранить» всегда на виду: на 1366x768 форма контура длиннее панели */
#mapEditor > .form-actions { position: sticky; bottom: 0; z-index: 1; margin: 0; padding: var(--s3) 0; background: var(--surface); border-top: 1px solid var(--line); }
.map-editor-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.map-editor-head h2 { margin: 0; font-size: var(--fs-lg); }
.map-type { display: flex; }
.map-type button { flex: 1; }
.map-range { display: flex; gap: var(--s3); align-items: center; }
.map-range input[type=range] { flex: 1; accent-color: var(--brand); }
.map-range input[type=number] { width: 96px; }
.map-geo-summary { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s2) var(--s3); }
.map-geo-summary.warn { color: var(--warn); background: var(--warn-bg); }
.map-danger { border-top: 1px solid var(--line); padding-top: var(--s3); }
.map-stage { position: relative; min-height: 0; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
#wsMap { position: absolute; inset: 0; }
.map-tools { position: absolute; right: var(--s3); top: var(--s3); z-index: 1000; display: flex; flex-direction: column; gap: var(--s2); }
.map-tool { min-height: 38px; background: var(--surface); box-shadow: 0 1px 4px rgba(20, 28, 40, 0.25); border: 0; gap: var(--s2); font-size: var(--fs-sm); }
.map-tool[aria-pressed="true"] { background: var(--brand); color: var(--brand-on); }
.map-pick { position: absolute; left: 50%; bottom: var(--s5); transform: translateX(-50%); z-index: 1000; display: flex; gap: var(--s3); align-items: center;
  background: var(--surface); border-radius: var(--r-md); padding: var(--s2) var(--s2) var(--s2) var(--s4); box-shadow: var(--shadow-overlay); max-width: calc(100% - 2 * var(--s4)); }
/* Leaflet: подписи объектов и ручки редактора */
.leaflet-tooltip.map-label { background: var(--surface); border: 0; border-radius: var(--r-sm); box-shadow: 0 1px 3px rgba(20, 28, 40, 0.3);
  font: 500 12px/1.3 var(--font); color: var(--ink); padding: 2px 6px; }
.leaflet-tooltip.map-label.current { background: var(--brand); color: var(--brand-on); }
.leaflet-tooltip-top.map-label::before { display: none; }
/* MAP UI (16.10.2026): подпись OSM - аккуратно в нижнем правом углу, читаемо, нейтрально */
.leaflet-container .leaflet-control-attribution { margin: 0 var(--s2) var(--s2) 0; padding: 2px 8px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.85); color: var(--ink-2); font: 11px/1.5 var(--font); box-shadow: 0 1px 2px rgba(20, 28, 40, 0.15); }
.leaflet-container .leaflet-control-attribution a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.geo-center, .geo-handle, .geo-vertex { border: 3px solid #c2410c; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.geo-center { border-radius: 50%; }
.geo-handle { border-radius: 3px; cursor: ew-resize; }
.geo-vertex { border-radius: 50%; border-width: 2px; }
.map-pin { border-radius: 50% 50% 50% 0; background: var(--bad); border: 3px solid #fff; transform: rotate(-45deg); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
/* Полный экран: карта поверх всего, поиск сверху, редактор - нижней панелью */
body.map-full .map-ws { position: fixed; inset: 0; z-index: 1150; height: auto; display: block; min-height: 0; }
body.map-full .map-stage { position: absolute; inset: 0; height: auto; border: 0; border-radius: 0; }
body.map-full .map-side { position: absolute; z-index: 1160; left: var(--s3); right: calc(var(--s3) + 150px); top: var(--s3); padding: 0; border: 0; background: none; max-width: 420px; }
body.map-full #mapBrowse { display: none; }
body.map-full #mapEditor:not([hidden]) { position: fixed; left: 0; right: 0; bottom: 0; max-height: 52vh; background: var(--surface);
  border-radius: var(--r-md) var(--r-md) 0 0; box-shadow: var(--shadow-overlay); padding: var(--s4); z-index: 1170; }
body.map-full .map-search input { box-shadow: var(--shadow-overlay); border: 0; }
body.map-full .leaflet-top.leaflet-left { top: 64px; }
/* редактор во весь экран занимает низ (до 52vh) - подпись OSM поднимается над ним, а не прячется под панелью */
body.map-full:has(#mapEditor:not([hidden])) .leaflet-bottom { bottom: 52vh; }
@media (max-width: 760px) {
  .map-ws { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .map-stage { height: 56vh; }
  .map-side { max-height: none; }
  .map-list { max-height: 30vh; }
  .map-tool span { display: none; }
  body.map-full .map-side { right: calc(var(--s3) + 56px); }
  body.map-full #mapEditor:not([hidden]) { max-height: 48vh; }
  body.map-full .map-tools { top: var(--s3); }
}

@media (max-width: 1440px) {
  .review-desk { grid-template-columns: 260px minmax(0, 1fr); gap: var(--s4); }
  .review-card { padding: var(--s5); gap: var(--s4); }
}
@media (max-width: 1280px) {
  main.content, header.topbar { padding-left: var(--s5); padding-right: var(--s5); }
}
@media (max-width: 1100px) {
  .app-nav { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1100; transform: translateX(-100%); transition: transform 0.2s ease; }
  body.nav-open .app-nav { transform: none; box-shadow: var(--shadow-overlay); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(20, 28, 40, 0.35); z-index: 1050; }
  .nav-toggle { display: inline-flex; }
  .dash-grid { grid-template-columns: 1fr; }
  .review-desk { grid-template-columns: 1fr; }
  .review-index { display: none; }
}
@media (max-width: 760px) {
  header.topbar { padding: var(--s2) var(--s4); gap: var(--s3); }
  .user-chip .user-name, .user-chip .role-badge { display: none; }
  main.content { padding: var(--s4) var(--s4) var(--s7); }
  .box, .panel { padding: var(--s4); border-radius: var(--r-sm); }
  .toolbar > *, .filter-bar > label { flex: 1 1 100%; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2) var(--s3); }
  .filter-bar > label { flex: none; min-width: 0; }
  .filter-bar > .grow, .filter-bar > .check, .filter-bar > button { grid-column: 1 / -1; }
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1 1 0; padding: 0 var(--s1); font-size: var(--fs-sm); }
  .show-mobile { display: inline-flex !important; margin-top: var(--s1); }
  td.nowrap { white-space: normal; }
  .filter-bar input[type=checkbox] { width: auto; }
  .panel.panel-flush { padding: 0; }
  .panel.panel-flush > div:first-child { padding: var(--s4) var(--s4) 0 !important; }
  th { white-space: normal; }
  .thumb { width: 34px; height: 34px; }
  div.show-mobile { display: block !important; }
  td .badge { white-space: normal; }
  .page-head { min-width: 0; }
  .page-head h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-lg); }
  .page-head p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .facts, .emp-stats { grid-template-columns: 1fr 1fr; }
  .profile-head .avatar.lg { display: none; }
  .profile-head .who h2 { font-size: var(--fs-xl); }
  .emp-stats .stat b { font-size: var(--fs-md); }
  .review-card { grid-template-columns: 1fr 1fr; grid-template-areas: "frame ref" "info info" "actions actions"; padding: var(--s4); gap: var(--s3); }
  .review-card > .crop-img:first-child, .review-card > .crop-img:nth-child(2) { width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .review-card .review-actions button { flex: 1 1 100%; }
  .kpi .kpi-value { font-size: 1.6rem; }
  .hide-mobile { display: none !important; }
  th, td { padding: var(--s2) var(--s3); }
}

/* ---------- Print (PILOT-01: печать из полного датасета) ---------- */
.print-only { display: none; }
@media print {
  body * { visibility: hidden; }
  #printReport, #printReport * { visibility: visible; }
  #printReport { display: block; position: absolute; top: 0; left: 0; width: 100%; font-family: var(--font); }
  .no-print { display: none !important; }
  .print-header h1 { font-size: 16pt; margin: 0 0 4pt; }
  .print-header p { font-size: 9pt; color: #555; margin: 0 0 8pt; }
  .print-filters { font-size: 9pt; margin-bottom: 8pt; }
  .print-summary-table { width: 100%; border-collapse: collapse; margin-bottom: 10pt; font-size: 9pt; }
  .print-summary-table th, .print-summary-table td { border: 1pt solid #999; padding: 3pt 6pt; text-align: center; position: static; }
  .print-events-table { width: 100%; border-collapse: collapse; font-size: 8pt; }
  .print-events-table thead { display: table-header-group; }
  .print-events-table tr { page-break-inside: avoid; }
  .print-events-table th, .print-events-table td { border: 1pt solid #ccc; padding: 2pt 4pt; text-align: left; position: static; }
  @page { size: A4 landscape; margin: 12mm; }
}

/* ---------- STAGE 5D: Интеграции → ЦБС ---------- */
.stat-link { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: var(--s1);
  width: 100%; height: auto; min-height: 0; text-align: left; white-space: normal; overflow-wrap: anywhere;
  cursor: pointer; font: inherit; line-height: 1.3; }
.emp-stats .stat-link b { margin-top: var(--s1); }
#cbs-overview .emp-stats { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat-link:hover, .stat-link:focus-visible { border-color: var(--brand); }
.cbs-cand { padding: var(--s2) 0; border-bottom: 1px solid var(--line); display: grid; gap: var(--s1); }
.cbs-cand:last-child { border-bottom: 0; }
.cbs-cand .btn-sm { justify-self: start; }
.cbs-compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s4); margin: var(--s4) 0; }
.cbs-compare figure { margin: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.cbs-compare img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: var(--neutral-bg); display: block; }
.cbs-compare figcaption { padding: var(--s2) var(--s3); font-size: var(--fs-sm); color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.clickable:focus-visible { background: var(--surface-2); }

.integration-card .facts { margin-bottom: var(--s3); }
#dashAlerts .status-list li { align-items: center; }

/* ---------- UI-0911 (директива Коли 09.11.2026): порядок очереди, просмотр фото, Диагностика ---------- */
.review-nav { flex-wrap: wrap; }
.review-card img.crop-img, #eventDrawer img.crop-img, #eventDrawer canvas.frame-canvas { cursor: zoom-in; }
#drawerZoom { margin-bottom: var(--s4); }
body.pv-open { overflow: hidden; }
.pv-box { background: var(--surface); border-radius: var(--r-md); width: min(1280px, 100%); max-height: 100%; overflow: auto; display: flex;
  flex-direction: column; gap: var(--s3); padding: var(--s4); box-shadow: var(--shadow-overlay); }
.pv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.pv-bar h2 { margin: 0 auto 0 0; }
.pv-zoom { display: inline-flex; align-items: center; gap: var(--s2); }
#pvZoomLabel { min-width: 3.5em; text-align: center; }
.pv-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
.pv-panes.pv-two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
/* «Лицо»: лицо события и эталона - панели одного размера (директива Коли 10.11.2026) */
.pv-panes.pv-two.pv-same { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pv-pane { margin: 0; display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.pv-pane > figcaption { font-size: var(--fs-sm); color: var(--muted); }
.pv-stage { position: relative; overflow: hidden; height: min(66vh, 640px); display: flex; align-items: center; justify-content: center;
  background: var(--nav-bg); border-radius: var(--r-sm); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.pv-stage:active { cursor: grabbing; }
/* фото вписано в окно целиком (и маленький кроп, и миниатюра эталона растягиваются до окна); масштаб и сдвиг - transform */
.pv-img { flex: none; width: 100%; height: 100%; object-fit: contain; transform-origin: 0 0; -webkit-user-drag: none; }
.pv-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.pv-legend li::before { content: ""; display: inline-block; width: 14px; height: 10px; margin-right: var(--s2); border: 3px solid; vertical-align: middle; }
.pv-legend [data-face-role="main"]::before { border-color: #0a7a2f; }
.pv-legend [data-face-role="other"]::before { border-color: #2563eb; }
.pv-legend [data-face-role="background"]::before { border-color: #c2580c; border-style: dashed; }
.pv-hint { margin: 0; }
@media (max-width: 720px) {
  .modal-overlay.pv-overlay { padding: 0; }
  .pv-box { border-radius: 0; height: 100%; }
  .pv-panes.pv-two, .pv-panes.pv-two.pv-same { grid-template-columns: minmax(0, 1fr); }
  .pv-stage { height: 40vh; }
}
.diag-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: var(--s5); }
.diag-head { padding: var(--s4) var(--s5) 0; margin-bottom: 0; }
.diag-integrations li { align-items: flex-start; }
td.cell-flush { padding: 0; }
#devPanel > summary { cursor: pointer; }

/* ---------- Уникальные сотрудники и «Статистика распознавания» (Коля 09.11.2026) ---------- */
.people-block .panel-head { margin-bottom: var(--s3); }
.people-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
a.kpi { color: var(--ink); text-decoration: none; }
a.kpi:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kpi .kpi-sub { color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; }
.kpi.metric-active, #statsTable .metric-active { box-shadow: inset 0 0 0 2px var(--brand); }
#statsTable td.cell-warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
#statsTable td.cell-bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.th-sort { border: 0; background: none; padding: 0; min-height: 0; color: inherit; font: inherit; text-decoration: underline dotted; }
.th-sort[aria-pressed="true"]::after { content: " ▾"; }
.stats-drill { border: 0; background: none; padding: 0; min-height: 0; color: var(--brand); font: inherit; text-decoration: underline; }
.stats-custom { display: inline-flex; gap: var(--s2); align-items: flex-end; flex-wrap: wrap; }

/* R3-PANEL: «Адаптивное распознавание (R3)» в «Настройках» (только ADMIN) */
#adaptivePanel h3 { margin: 0; }
.ad-modes { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); font-size: var(--fs-sm); color: var(--muted); }
.ad-modes li.current { color: inherit; background: var(--brand-soft); border-radius: var(--r-sm); padding: var(--s2) var(--s3); }
.ad-control { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin: var(--s4) 0 var(--s2); }
.ad-control .form-hint { flex-basis: 100%; margin: 0; }
.ad-reason { min-width: 260px; flex: 1; }
#adSwitch button:disabled:not(.active) { opacity: .45; cursor: not-allowed; }
.ad-history { margin: var(--s3) 0 var(--s5); }
.ad-history summary { cursor: pointer; color: var(--brand); }
.ad-period-head { margin-top: var(--s5); }
.ad-period-tools { display: inline-flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.ad-section { border-top: 1px solid var(--line); padding-top: var(--s4); margin-top: var(--s4); }
.ad-section-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.ad-section-head h4 { margin: 0; font-size: var(--fs-md); }
.ad-section .kpi-row { margin-bottom: var(--s3); }
.ad-chart { width: 100%; height: auto; max-height: 220px; display: block; }
.ad-chart .ad-axis { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.ad-chart text.ad-axis:first-child { text-anchor: start; }
.ad-s0 { fill: var(--brand); background: var(--brand); }
.ad-s1 { fill: var(--neutral); background: var(--neutral); }
.ad-s2 { fill: var(--ok); background: var(--ok); }
.ad-s3 { fill: var(--warn); background: var(--warn); }
.ad-legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s4); margin: var(--s2) 0 0; padding: 0; font-size: var(--fs-sm); color: var(--muted); }
.ad-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* Итоговые статусы карточки события (Коля 19.11.2026 16:00): заметны с первого взгляда; фоновое лицо при засчитанном основном - нейтрально */
.final-status { display: inline-flex; align-items: center; gap: var(--s2); padding: 2px var(--s3) 2px var(--s2); border-radius: var(--r-sm); font-weight: 700; }
.final-status .fs-icon { display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; border-radius: 50%; color: var(--surface); font-size: 0.8em; line-height: 1; }
.final-status.ok { background: var(--ok-bg); color: var(--ok); }
.final-status.ok .fs-icon { background: var(--ok); }
.final-status.warn { background: var(--warn-bg); color: var(--warn); }
.final-status.warn .fs-icon { background: var(--warn); }
.final-status.bad { background: var(--bad-bg); color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.final-status.bad .fs-icon { background: var(--bad); }
.drawer[data-face-role="background"][data-main-counted] .final-status.bad { background: var(--neutral-bg); color: var(--neutral); font-weight: 600; box-shadow: none; }
.drawer[data-face-role="background"][data-main-counted] .final-status.bad .fs-icon { background: var(--neutral); }
.bg-face-note { padding: var(--s2) var(--s3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); }
