/* Психологічна робота АБ3 — строгий службовий стиль. */
:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #d5dbe3;
  --line-2: #e6eaf0;
  --text: #16202c;
  --text-2: #4a5768;
  --muted: #6b7788;
  --navy: #14243b;
  --navy-2: #1f3554;
  --accent: #2b5a8c;
  --accent-ink: #ffffff;
  --gold: #b9975b;
  --focus: #2f7de1;

  --low: #2f7d4f;
  --low-bg: #dcefe3;
  --mid: #c79a1c;
  --mid-bg: #fbf0cc;
  --high: #b42f27;
  --high-bg: #f7d9d6;
  --none: #9aa5b3;
  --none-bg: #e9edf2;
  --missing: #d4dae2;

  --danger: #b42f27;
  --warn-bg: #fff6dc;
  --warn-line: #e6c868;
  --bad-bg: #fbe7e5;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 28, 45, .06), 0 1px 1px rgba(16, 28, 45, .04);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141c;
    --surface: #161e29;
    --surface-2: #1b2532;
    --line: #2c3a4c;
    --line-2: #233042;
    --text: #e3e8ef;
    --text-2: #b4bfcc;
    --muted: #8794a6;
    --navy: #0a1220;
    --navy-2: #15233a;
    --accent: #4b86c5;
    --low: #4fae76;
    --low-bg: #173727;
    --mid: #d9b23f;
    --mid-bg: #3b3115;
    --high: #e0605a;
    --high-bg: #44201f;
    --none: #6d7a8c;
    --none-bg: #253141;
    --missing: #2f3b4b;
    --danger: #e0605a;
    --warn-bg: #352c12;
    --warn-line: #7a6522;
    --bad-bg: #3a1d1c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1 { font-size: 22px; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.error { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: 8px; top: -40px; background: var(--surface); padding: 6px 10px; z-index: 100; border-radius: var(--radius); }
.skip:focus { top: 8px; }

/* ── Шапка ─────────────────────────────────────────── */
.top { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.top-inner { max-width: 1440px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 6px;
  background: var(--navy-2); border: 1.5px solid var(--gold); font-weight: 700; font-size: 14px; letter-spacing: .02em; color: #fff;
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 20px; background: var(--navy); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; font-weight: 650; }
.brand-text span { font-size: 12px; color: #c9d3e0; letter-spacing: .12em; }
.hist { display: flex; gap: 2px; flex-shrink: 0; }
.hist-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .22); background: transparent; border-radius: 5px; cursor: pointer; color: #d4dce7; padding: 0; }
.hist-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.hist-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav-link { color: #d4dce7; text-decoration: none; padding: 8px 12px; border-radius: 5px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .13); color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.nav-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .18); margin: 0 8px; }
.count { background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.who { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.who-link { color: #fff; text-decoration: none; display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.who-name { font-size: 14px; font-weight: 600; }
.who-role { font-size: 11px; color: #b7c3d3; text-transform: uppercase; letter-spacing: .08em; }
.top .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.top .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.nav-toggle { display: none; background: none; border: 1px solid rgba(255, 255, 255, .3); border-radius: 5px; width: 40px; height: 36px; padding: 8px; cursor: pointer; flex-direction: column; justify-content: space-between; }
.nav-toggle span { display: block; height: 2px; background: #fff; }

/* ── Сторінки ──────────────────────────────────────── */
.main { padding: 24px 20px 64px; }
.page { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-wide { max-width: 1440px; }
.page-narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-quiet { background: var(--surface-2); }
.card-quiet:empty { display: none; }
.card-accent { border-left: 4px solid var(--gold); }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin: 0; }
.card-head .input[type=search] { max-width: 360px; }
.card-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ── Кнопки і поля ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; min-height: 38px;
  border-radius: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: var(--danger); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 4px; font-size: 20px; line-height: 1; width: 32px; height: 32px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.input {
  font: inherit; font-size: 15px; width: 100%; padding: 8px 10px; min-height: 38px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text);
}
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input[aria-invalid=true], .input-bad { border-color: var(--danger); background: var(--bad-bg); }
.input-sm { min-height: 32px; padding: 4px 8px; font-size: 14px; width: auto; }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
select.input { padding-right: 28px; }
textarea.input { resize: vertical; line-height: 1.45; }
.raw { font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 13px; min-height: 280px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-err { font-size: 12px; color: var(--danger); min-height: 0; }
.field-err:empty { display: none; }
.field-wrap { display: flex; flex-direction: column; gap: 4px; }
.derived { font-size: 13px; color: var(--accent); font-weight: 600; }
.derived-bad { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.form-msg:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions-start { justify-content: flex-start; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; }

/* ── Вхід ──────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 56px 16px 32px; gap: 28px; background: linear-gradient(180deg, var(--navy) 0 200px, var(--bg) 200px); }
.auth-brand { display: flex; align-items: center; gap: 14px; color: #fff; }
.auth-title { font-size: 22px; font-weight: 650; }
.auth-sub { font-size: 13px; letter-spacing: .2em; color: #c9d3e0; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: 26px 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 8px 28px rgba(10, 20, 35, .14); }
.auth-card h1 { font-size: 20px; }
.auth-alt { font-size: 14px; color: var(--muted); text-align: center; margin: 0; }

/* ── Розбір вставки ────────────────────────────────── */
.parse-status { margin-top: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.st-ok { color: var(--low); font-weight: 650; }
.st-warn { color: var(--mid); font-weight: 650; }
.st-line { color: var(--text-2); }
.st-bad { color: var(--danger); }
.vals { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.vals-table { width: 100%; border-collapse: collapse; }
.vals-table th { text-align: left; font-weight: 500; font-size: 13px; padding: 3px 8px 3px 0; color: var(--text); }
.vals-table td { padding: 3px 0; }
.vals-table .input { width: 76px; min-height: 30px; padding: 3px 8px; font-size: 14px; }
.vals-lv { padding-left: 8px !important; width: 96px; }
.row-off th, .row-off .input { color: var(--muted); }
.warn-txt { font-size: 11px; color: var(--danger); }

/* ── Рівні ─────────────────────────────────────────── */
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; }
.badge.lv-low { background: var(--low-bg); color: var(--low); border-color: color-mix(in srgb, var(--low) 30%, transparent); }
.badge.lv-mid { background: var(--mid-bg); color: color-mix(in srgb, var(--mid) 80%, var(--text)); border-color: color-mix(in srgb, var(--mid) 35%, transparent); }
.badge.lv-high { background: var(--high-bg); color: var(--high); border-color: color-mix(in srgb, var(--high) 30%, transparent); }
.badge.lv-none, .badge.lv-off { background: var(--none-bg); color: var(--muted); font-weight: 500; }
.near { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.near-hot { color: var(--mid); font-weight: 650; }

.bar { position: relative; padding: 18px 0 18px; min-width: 200px; }
.bar-compact { padding: 4px 0; min-width: 80px; }
.bar-track { position: relative; height: 10px; border-radius: 2px; background: var(--none-bg); }
.bar-compact .bar-track { height: 6px; }
.bar-seg { position: absolute; top: 0; bottom: 0; }
.bar-seg.lv-low { background: var(--low); }
.bar-seg.lv-mid { background: var(--mid); }
.bar-seg.lv-high { background: var(--high); }
.bar-seg.lv-none, .bar-seg.lv-off { background: var(--none); opacity: .55; }
.bar-seg + .bar-seg { box-shadow: inset 1px 0 0 var(--surface); }
.bar-mark { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 1px; box-shadow: 0 0 0 1.5px var(--surface); }
.bar-mark-out { background: var(--danger); }
.bar-val { position: absolute; bottom: calc(100% + 1px); left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text); }
.bar-val-start { left: -1px; transform: none; }
.bar-val-end { left: auto; right: -1px; transform: none; }
.bar-val-lv { font-size: 13px; font-weight: 600; padding-bottom: 1px; }
.bar-val-lv b { font-size: 15px; font-weight: 750; }
.lvt-low { color: var(--low); }
.lvt-mid { color: color-mix(in srgb, var(--mid) 80%, var(--text)); }
.lvt-high { color: var(--high); }
.lvt-none, .lvt-off { color: var(--muted); }
.bar-ticks { position: relative; height: 14px; margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.bar-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.bar-ticks span:first-child { transform: none; }
.bar-ticks span:last-child { transform: translateX(-100%); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
i.lv-low, .dot.lv-low, .stack .lv-low { background: var(--low); }
i.lv-mid, .dot.lv-mid, .stack .lv-mid { background: var(--mid); }
i.lv-high, .dot.lv-high, .stack .lv-high { background: var(--high); }
i.lv-none, .dot.lv-none, .stack .lv-none { background: var(--none); }
i.lv-missing, .dot.lv-missing, .stack .lv-missing { background: var(--missing); }

/* ── Результати анкети ─────────────────────────────── */
.res-group + .res-group { margin-top: 22px; }
.res-table { width: 100%; border-collapse: collapse; }
.res-table th, .res-table td { border-bottom: 1px solid var(--line-2); padding: 6px 12px 6px 0; vertical-align: middle; text-align: left; }
.res-table thead th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.res-table tbody th { font-weight: 600; font-size: 14px; width: 30%; padding-right: 24px; }
.res-table .col-bar { padding-top: 10px; }
.res-table .num { text-align: right; width: 80px; padding-right: 20px; }
.res-table td.strong { font-size: 17px; }
.res-table .col-bar { padding-right: 18px; }
.row-missing { color: var(--muted); }

.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.info-grid-1 { grid-template-columns: 1fr; }
.info-item dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.info-item dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

.notice { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice-bad { background: var(--bad-bg); border-color: var(--danger); }
.notice-actions { display: flex; gap: 8px; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 150px 170px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.h-at { color: var(--muted); font-size: 13px; }
.h-act { font-weight: 600; }
.raw-details summary { cursor: pointer; font-weight: 650; }
.raw-pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--surface-2); padding: 12px; border-radius: 4px; margin: 12px 0 0; max-height: 360px; overflow: auto; }
.diff { width: 100%; border-collapse: collapse; font-size: 14px; }
.diff th, .diff td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line-2); }

/* ── Список ────────────────────────────────────────── */
.search-row .input { font-size: 16px; min-height: 44px; }
.filters { padding: 0; }
.filters > summary { padding: 12px 20px; cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::before { content: "▸"; margin-right: 8px; color: var(--muted); transition: transform .15s; }
.filters[open] > summary::before { transform: rotate(90deg); }
.flt-count { color: var(--accent); }
.filters[open] > summary { border-bottom: 1px solid var(--line-2); }
.flt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; padding: 14px 20px 6px; }
.flt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.flt .input-sm { width: 100%; }
.flt-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.flt-row { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding: 8px 20px; }
.flt-row:last-child { padding-bottom: 14px; }
.conds { display: flex; flex-direction: column; gap: 6px; }
.conds:empty { display: none; }
.cond { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.count-line { font-size: 14px; color: var(--text-2); font-weight: 600; }
.sort-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.sort-ctl select { max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface); }
.seg-btn { font: inherit; font-size: 14px; border: 0; background: transparent; padding: 6px 14px; cursor: pointer; color: var(--text-2); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed=true] { background: var(--navy); color: #fff; font-weight: 600; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.scard { display: flex; flex-direction: column; gap: 8px; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.scard:hover { border-color: var(--accent); }
.scard-req { border-left: 4px solid var(--warn-line); }
.scard-head { display: flex; justify-content: space-between; gap: 10px; }
.scard-title { font-weight: 650; font-size: 16px; }
.scard-sub { font-size: 13px; color: var(--text-2); }
.scard-date { font-size: 13px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.scard-units { font-size: 13px; color: var(--text-2); }
.scard-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.scard-flag { font-size: 12px; font-weight: 650; color: color-mix(in srgb, var(--mid) 75%, var(--text)); }
.dots { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 4px; border-top: 1px solid var(--line-2); }
.dots-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cards > li { min-width: 0; }
.dots-label { font-size: 11px; color: var(--muted); width: 72px; text-transform: uppercase; letter-spacing: .04em; }
.dot { width: 16px; height: 10px; border-radius: 2px; display: inline-block; }

/* таблиця як у Google */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.sheet th, .sheet td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 5px 9px; white-space: nowrap; background: var(--surface); }
.sheet thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 650; text-align: left; padding: 0; border-bottom: 1px solid var(--line); }
.sheet thead th.sticky-col { z-index: 3; }
.th-btn { font: inherit; background: none; border: 0; padding: 7px 9px; width: 100%; text-align: inherit; cursor: pointer; color: var(--text); display: flex; gap: 4px; justify-content: space-between; align-items: center; }
.sheet thead th.num .th-btn { justify-content: flex-end; }
.sort-ico { font-size: 10px; color: var(--accent); }
.sheet .num { text-align: right; }
.sheet tbody tr { cursor: pointer; }
.sheet tbody tr:hover td { background: var(--surface-2); }
.sheet tbody tr:focus-visible td { background: color-mix(in srgb, var(--focus) 12%, var(--surface)); }
.sticky-col { position: sticky; left: 0; z-index: 1; }
.sticky-col-2 { left: 124px; box-shadow: 1px 0 0 var(--line); }
.sheet .sticky-col:first-child { min-width: 124px; max-width: 124px; }
.sheet td.cell-low { background: var(--low-bg); }
.sheet td.cell-mid { background: var(--mid-bg); }
.sheet td.cell-high { background: var(--high-bg); color: var(--high); font-weight: 650; }
.sheet td.cell-none { color: var(--muted); }
.sheet tbody tr:hover td.cell-low, .sheet tbody tr:hover td.cell-mid, .sheet tbody tr:hover td.cell-high { filter: brightness(.96); }

.summary { display: flex; flex-direction: column; gap: 14px; }
.sum-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sum-table th, .sum-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line-2); text-align: left; }
.sum-table thead th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sum-table .num { text-align: right; white-space: nowrap; }
.sum-table tbody th { width: 22%; font-weight: 600; }
.strong-high { color: var(--high); font-weight: 650; }
.stack { display: flex; height: 14px; border-radius: 2px; overflow: hidden; background: var(--missing); min-width: 160px; }
.stack span { display: block; height: 100%; }

.modal-form { display: flex; flex-direction: column; gap: 12px; }
.card-tools .input[type=search] { width: 320px; max-width: 100%; }
.cols-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; }

/* ── Аналітика ─────────────────────────────────────── */
.dash-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dash-bar .count-line { margin-left: auto; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.dash { display: flex; flex-direction: column; }
.dash .dash-table { margin-top: auto; padding-top: 12px; }
.dash-wide { grid-column: 1 / -1; }
.dash-title { font-size: 16px; margin-bottom: 4px; }
.dash-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.dash-tools { margin-bottom: 12px; }
.dash-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mini-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin: 4px 0 8px; }
.dash-table { margin-top: 12px; font-size: 13px; }
.dash-table summary { cursor: pointer; color: var(--accent); }
.dash-table .table-wrap { margin-top: 8px; }
.data-sm th, .data-sm td { padding: 5px 10px 5px 0; font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-v { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--text); }
.tile-l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tile-high { border-left: 4px solid var(--high); }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hbar, .lv-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 10px; align-items: center; border-radius: 4px; padding: 2px 4px; }
.hbar:hover, .hbar:focus-visible { background: var(--surface-2); }
.hbar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; }
.hb-count { background: var(--accent); }
.hb-high { background: var(--high); }
.hbar-val { font-size: 13px; color: var(--text-2); white-space: nowrap; min-width: 60px; text-align: right; }
.lv-rows .mini-title { margin-top: 12px; }
.stack-lg { height: 14px; min-width: 0; gap: 2px; background: none; }
.stack-lg span { cursor: default; }
.stack-lg span:hover, .stack-lg span:focus-visible { filter: brightness(1.12); outline: none; }
.cols { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.col-bar-wrap { flex: 1; display: flex; align-items: flex-end; }
.col-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; }
.col:hover .col-bar, .col:focus-visible .col-bar { filter: brightness(1.15); }
.col-label { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; }
.scatter { width: 100%; height: auto; display: block; }
.sc-zone { fill: var(--high-bg); }
.sc-cut { stroke: var(--line); stroke-dasharray: 3 3; }
.sc-axis { stroke: var(--muted); }
.sc-tick { font-size: 10px; fill: var(--muted); }
.sc-axl { font-size: 11px; fill: var(--text-2); }
.sc-hit { fill: transparent; }
.sc-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.sc-pt { cursor: pointer; outline: none; }
.sc-pt:hover .sc-dot, .sc-pt:focus .sc-dot { fill: var(--navy-2); r: 6; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 13px; width: 100%; }
.heat th { text-align: left; font-weight: 600; padding: 4px 8px 4px 0; white-space: nowrap; }
.heat thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.heat .num { text-align: right; }
.heat-cell { background: color-mix(in srgb, var(--high) var(--p), var(--surface-2)); padding: 6px 8px; border-radius: 3px; min-width: 56px; }
.heat-dark { color: #fff; font-weight: 600; }
.near-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.tt { position: fixed; z-index: 70; background: var(--navy); color: #fff; padding: 7px 10px; border-radius: 5px; font-size: 12.5px; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 280px; }
.tt-v { font-size: 15px; font-weight: 700; }
.tt-l { color: #c9d3e0; }
@media (max-width: 900px) {
  .dash-grid, .dash-2 { grid-template-columns: minmax(0, 1fr); }
  .dash-bar .count-line { margin-left: 0; }
}

/* ── Таблиці адмінки ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th, .data td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.data thead th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; border-bottom: 1px solid var(--line); }
.data .num { text-align: right; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.status { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.st-active { background: var(--low-bg); color: var(--low); }
.st-pending { background: var(--mid-bg); color: color-mix(in srgb, var(--mid) 80%, var(--text)); }
.st-blocked { background: var(--high-bg); color: var(--high); }
.scales-table .input { width: 76px; }
.scales-table .col-bar { min-width: 260px; }
.scale-preview .bar { padding-top: 4px; }

/* ── Порожньо, завантаження, модальні, повідомлення ── */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 0; justify-content: center; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-back { position: fixed; inset: 0; background: rgba(8, 15, 26, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0, 0, 0, .3); border-top: 3px solid var(--gold); }
.modal:focus { outline: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 5px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); border-left: 4px solid var(--low); transition: opacity .4s, transform .4s; }
.toast-bad { border-left-color: var(--high); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ── Адаптивність ──────────────────────────────────── */
/* шапка: меню в кнопку, коли не вміщається в один рядок */
@media (max-width: 1180px) {
  .top-inner { flex-wrap: wrap; gap: 10px; padding: 8px 16px; }
  .nav-toggle { display: flex; margin-left: auto; order: 1; }
  .hist { order: 1; }
  .nav { display: none; order: 3; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .who { order: 2; }
}
@media (max-width: 520px) {
  .brand-text { display: none; }
  .hist-btn { width: 32px; }
}
@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .top-inner { flex-wrap: wrap; gap: 10px; padding: 8px 16px; }
  .nav-toggle { display: flex; margin-left: auto; }
  .hist { order: 1; }
  .nav-toggle { order: 1; }
  .who { order: 1; }
  .nav { display: none; order: 3; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav-sep { width: 100%; height: 1px; margin: 6px 0; }
  .who { order: 2; }
  .who-link { display: none; }
  .main { padding: 16px 16px 48px; }
  .vals { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr auto; }
  .h-who { grid-column: 1 / -1; }
  .res-table, .res-table tbody, .res-table tr { display: block; }
  .res-table thead { display: none; }
  .res-table tr { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .res-table th, .res-table td { border: 0; padding: 0; width: auto !important; }
  .res-table .col-bar { grid-column: 1 / -1; }
  .toolbar-end { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .stack { min-width: 110px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .dot { width: 12px; }
  .dots-label { width: 64px; }
  .sum-table tbody th { min-width: 110px; }
  .form-grid, .info-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
  .card { padding: 14px; }
  .brand-text strong { font-size: 14px; }
}

/* ── Друк ──────────────────────────────────────────── */
@media print {
  .top, .no-print, .toasts, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; padding: 10px 12px; }
  .page { gap: 8px; }
  .bar-seg.lv-low, .bar-seg.lv-mid, .bar-seg.lv-high, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
