/* Облік особового складу (HRIS) — мінімалістичний щільний інтерфейс (на кшталт Linear / Notion).
   Колір лише для змісту (стани, помилки) і одного акценту; поруч завжди значок або текст. */

:root {
  --bg: #fafafa; --surface: #ffffff; --surface-2: #f4f4f5; --hover: #f4f4f5; --selected: #eef0ff;
  --border: #e4e4e7; --border-strong: #d4d4d8;
  --text: #18181b; --text-2: #3f3f46; --muted: #71717a; --faint: #a1a1aa;
  --accent: #4f46e5; --accent-hover: #4338ca; --accent-soft: #eef0ff; --accent-text: #ffffff;
  --ok: #15803d; --ok-soft: #ecfdf3; --warn: #b45309; --warn-soft: #fffbeb; --error: #dc2626; --error-soft: #fef2f2;
  --radius: 6px; --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --shadow-pop: 0 12px 32px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --row: 34px; --control: 30px; --sidebar: 224px;
  color-scheme: light;
}
:root[data-density="compact"] { --row: 28px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e; --surface: #141417; --surface-2: #1b1b1f; --hover: #1f1f24; --selected: #23233a;
    --border: #26262b; --border-strong: #34343b;
    --text: #ececef; --text-2: #c4c4cc; --muted: #8b8b95; --faint: #5f5f69;
    --accent: #8b8cf8; --accent-hover: #a5a6fa; --accent-soft: #23233a; --accent-text: #0c0c0e;
    --ok: #4ade80; --ok-soft: #0f2418; --warn: #fbbf24; --warn-soft: #2a2108; --error: #f87171; --error-soft: #2a1213;
    --shadow: none; --shadow-pop: 0 12px 32px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e; --surface: #141417; --surface-2: #1b1b1f; --hover: #1f1f24; --selected: #23233a;
  --border: #26262b; --border-strong: #34343b;
  --text: #ececef; --text-2: #c4c4cc; --muted: #8b8b95; --faint: #5f5f69;
  --accent: #8b8cf8; --accent-hover: #a5a6fa; --accent-soft: #23233a; --accent-text: #0c0c0e;
  --ok: #4ade80; --ok-soft: #0f2418; --warn: #fbbf24; --warn-soft: #2a2108; --error: #f87171; --error-soft: #2a1213;
  --shadow: none; --shadow-pop: 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { letter-spacing: -0.01em; }
h1 { font-size: 15px; font-weight: 600; margin: 0; }
h2 { font-size: 13px; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
h3 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
p { margin: 0 0 8px; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Каркас ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
:root[data-sidebar="collapsed"] { --sidebar: 52px; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border-right: 1px solid var(--border); padding: 10px 8px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px; margin-bottom: 8px;
  font-weight: 600; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.brand .grow { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.search-trigger { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--muted);
  cursor: pointer; font: inherit; white-space: nowrap; width: 100%; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger kbd { margin-left: auto; }
kbd { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 4px; background: var(--surface); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a, .nav .nav-soon { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px;
  border-radius: var(--radius); color: var(--text-2); white-space: nowrap; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current] { background: var(--selected); color: var(--text); font-weight: 500; }
.nav a[aria-current] .icon { color: var(--accent); }
.nav .nav-soon { color: var(--faint); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px;
  border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px; white-space: nowrap; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-2); flex: none; }
.me-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.foot-row { display: flex; gap: 2px; padding: 0 2px; }
:root[data-sidebar="collapsed"] .hide-collapsed { display: none; }
:root[data-sidebar="collapsed"] .search-trigger { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .nav a, :root[data-sidebar="collapsed"] .nav .nav-soon { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .brand { justify-content: center; padding: 0; }
:root[data-sidebar="collapsed"] .foot-row { flex-direction: column; align-items: center; }
:root[data-sidebar="collapsed"] .me { justify-content: center; padding: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 48px;
  padding: 8px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { color: var(--faint); }
.crumbs h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.content { padding: 16px 24px 48px; min-width: 0; }
.content.narrow { max-width: 760px; }

/* ---------- Елементи керування ---------- */
input, select, textarea { font: inherit; color: var(--text); }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="number"],
input[type="file"], input:not([type]), select, textarea {
  width: 100%; height: var(--control); padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .12s, box-shadow .12s; }
input[type="file"] { padding: 4px 6px; height: auto; }
textarea { height: auto; padding: 6px 10px; resize: vertical; }
select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin: 14px 0 4px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control);
  padding: 0 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent);
  color: var(--accent-text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-secondary, button.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.btn-secondary:hover, button.btn-secondary:hover { background: var(--hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.link-btn { height: auto; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; }
.link-btn:hover { background: none; text-decoration: underline; }
.btn-danger { background: var(--surface); color: var(--error); border-color: var(--border); }
.btn-danger:hover { background: var(--error-soft); border-color: var(--error); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
form.inline { display: inline; margin: 0; }
.form .errors, .errors { color: var(--error); font-size: 12px; margin: 4px 0 0; padding-left: 16px; }
.form ul.errors { padding-left: 16px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.error-text { color: var(--error); }
.check, label.check, div.check { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13px;
  font-weight: 400; color: var(--text); }
div.check label { margin: 0; font-size: 13px; font-weight: 400; color: var(--text); }
.check input { width: 14px; }
.help, .form .muted.small { margin-top: 4px; }

/* ---------- Поверхні ---------- */
.card, .pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.pane.flush { padding: 0; }
.pane.flush > :first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.pane.flush table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.pane.flush table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card + .card, .pane + .pane, .card + h2, .pane + h2 { margin-top: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: 16px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split > .card-pane, .split-wide > .card-pane { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.form.card, .form-card { max-width: 560px; }
.auth { max-width: 360px; margin: 14vh auto 0; }
.auth .brand { justify-content: center; margin-bottom: 20px; font-size: 15px; }
.empty { display: grid; place-items: center; gap: 6px; padding: 40px 16px; color: var(--muted); text-align: center; }
.empty .icon { width: 28px; height: 28px; color: var(--faint); }

dl.fields { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; margin: 12px 0 0; }
dl.fields dt { color: var(--muted); }
dl.fields dd { margin: 0; overflow-wrap: anywhere; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12px;
  font-weight: 500; white-space: nowrap; line-height: 1; }
.badge.off { background: transparent; border-style: dashed; color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--error-soft); color: var(--error); border-color: transparent; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.warn { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius); padding: 8px 12px; margin: 12px 0; }

/* ---------- Таблиці ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 0 10px; height: var(--row); border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); white-space: nowrap; }
td { color: var(--text); }
tbody tr:hover td { background: var(--hover); }
tbody tr:last-child td { border-bottom: 0; }
table.dense td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
table.dense td.wrap, table td.wrap { white-space: normal; max-width: none; padding-top: 6px; padding-bottom: 6px; height: auto; }
table.sticky thead th { position: sticky; top: 48px; z-index: 5; box-shadow: 0 1px 0 var(--border); border-bottom: 0; }
tr.selected td { background: var(--selected) !important; }
tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
tr.inactive td { color: var(--muted); }
td a.row-link { color: var(--text); font-weight: 500; }
td a.row-link:hover { color: var(--accent); text-decoration: none; }
a.sort { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
a.sort:hover { color: var(--text); text-decoration: none; }
.table-scroll { overflow-x: auto; }
.pane > table:first-child, .pane > .table-scroll:first-child { margin-top: -4px; }
.table-meta { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--muted); font-size: 12px;
  border-bottom: 1px solid var(--border); }
.table-meta .grow { flex: 1; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pager a { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); background: var(--surface); }
.pager a:hover { background: var(--hover); text-decoration: none; }
.pane.flush .pager { border-top: 1px solid var(--border); }
table.matrix td, table.matrix th { max-width: none; }
table.matrix tfoot th { color: var(--text); font-weight: 600; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
table.matrix td.num a, table.matrix th.num a { color: var(--text); font-weight: 500; }
table.matrix td.num a:hover { color: var(--accent); }

/* ---------- Панель фільтрів ---------- */
.toolbar, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filters input[name="q"], .search-field { flex: 1 1 220px; min-width: 180px; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-field input { padding-left: 30px; }
.filters select { width: auto; max-width: 240px; }
.filters input[type="date"] { width: auto; }
.filters .check, .filters label.check { margin: 0; height: var(--control); padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: 13px; color: var(--text-2); }
.filters .check:hover { border-color: var(--border-strong); }
.filters .check:has(input:checked) { background: var(--selected); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); color: var(--text); }
.filters button { margin: 0; }
.filters .reset { color: var(--muted); font-size: 12px; }

/* ---------- Вкладки й кроки ---------- */
.tabs { display: flex; gap: 2px; margin: -4px 0 16px; border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }
.subtabs { border-bottom: 0; margin-top: -8px; }
.subtabs a { height: 28px; border: 1px solid transparent; border-radius: var(--radius); margin: 0; }
.subtabs a[aria-current] { border-color: var(--border); background: var(--surface); border-bottom-color: var(--border); }
.steps { display: flex; flex-wrap: wrap; gap: 0; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 0 14px 0 0; margin-right: 14px; color: var(--muted);
  font-size: 12px; position: relative; }
.steps li:not(:last-child)::after { content: ""; width: 24px; height: 1px; background: var(--border-strong); margin-left: 6px; }
.steps li.done { color: var(--ok); }
.steps li.bad { color: var(--error); }
.steps li.current, .steps li[aria-current] { color: var(--text); font-weight: 500; }

/* ---------- Повідомлення ---------- */
.messages { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.msg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-lg);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); animation: toast .18s ease-out; }
.msg-error { background: var(--error); color: #fff; }
.msg .link-btn { color: inherit; text-decoration: underline; font-weight: 600; margin-left: auto; }
.msg form { margin-left: auto; }
.msg .close { margin-left: 4px; color: inherit; opacity: .7; }
@keyframes toast { from { transform: translateY(6px); opacity: 0; } }

/* ---------- Дерево ---------- */
ul.tree, ul.tree ul, ul.results { list-style: none; margin: 0; padding: 0; }
ul.tree ul { padding-left: 12px; margin-left: 10px; border-left: 1px solid var(--border); }
a.node { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: var(--radius);
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.node:hover { background: var(--hover); text-decoration: none; }
a.node.selected { background: var(--selected); box-shadow: inset 2px 0 0 var(--accent); font-weight: 500; }
a.node.inactive { color: var(--muted); }
ul.results li { display: flex; align-items: center; gap: 8px; }
ul.results li a.node { flex: 1; }

/* ---------- Звіти, імпорт ---------- */
details.rules { margin: 0 0 12px; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details summary::before { content: "▸"; font-size: 10px; transition: transform .12s; }
details[open] summary::before { transform: rotate(90deg); }
details summary:hover { color: var(--text); }
details.rules ul { margin: 8px 0; padding-left: 18px; color: var(--text-2); }
details.card summary { color: var(--text); font-weight: 500; font-size: 13px; }
.mapping { display: flex; flex-direction: column; gap: 6px; }
.mapping div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mapping strong { margin-right: 4px; font-weight: 500; }
h3.kind { display: flex; align-items: center; gap: 6px; }
h3.kind-error { color: var(--error); }
.card.apply { margin-top: 20px; border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.password-once { font: 18px var(--mono); padding: 10px 14px; background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius); user-select: all; margin: 8px 0; }
.grant-form ul, .grant-form div:has(> div > label > input[type="checkbox"]) { list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 4px 16px; }
.grant-form ul li label, .grant-form div > div > label:has(input[type="checkbox"]) { display: flex; gap: 6px; align-items: center;
  margin: 4px 0; font-weight: 400; font-size: 13px; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat a { color: inherit; }

/* ---------- Пошук Ctrl+K ---------- */
.palette[hidden] { display: none; }
.palette { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start;
  padding-top: 12vh; background: rgba(0,0,0,.28); }
.palette-box { width: min(560px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); }
.palette-input input { border: 0; box-shadow: none !important; height: 46px; padding: 0; font-size: 14px; background: transparent; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow: auto; }
.palette-list li a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius);
  color: var(--text); }
.palette-list li a:hover, .palette-list li a[aria-selected="true"] { background: var(--selected); text-decoration: none; }
.palette-list .kind { font-size: 11px; color: var(--muted); width: 72px; flex: none; }
.palette-list .sub { margin-left: auto; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.palette-empty { padding: 18px; color: var(--muted); text-align: center; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

/* ---------- Адаптивність: десктоп насамперед, на вузьких — перегляд ---------- */
@media (max-width: 1100px) {
  .split, .split-wide { grid-template-columns: 1fr; }
  .split > .card-pane, .split-wide > .card-pane { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; }
  .sidebar .brand { margin: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .search-trigger { width: auto; margin: 0; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; flex-direction: row; }
  #sidebar-toggle { display: none; }
  .topbar { padding: 8px 16px; position: static; }
  .content { padding: 12px 16px 40px; }
  dl.fields { grid-template-columns: 1fr; gap: 2px 0; }
  dl.fields dd { margin-bottom: 8px; }
  table.sticky thead th { top: 0; position: static; }
  .pane.flush, .pane { overflow-x: auto; }
}
@media print {
  .sidebar, .topbar .top-actions, .filters, .messages, .palette { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
}

/* ---------- Історія змін ---------- */
ol.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 1px solid var(--border); }
ol.timeline li { position: relative; padding: 0 0 14px 4px; }
ol.timeline li::before { content: ""; position: absolute; left: -19px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tl-time { margin-left: auto; }
.tl-body { margin-top: 4px; color: var(--text-2); font-size: 12px; }
.tl-body s { text-decoration-color: var(--faint); }
.stat-link { color: var(--text); transition: border-color .12s, transform .12s; }
.stat-link:hover { border-color: var(--border-strong); text-decoration: none; }
.stat-link .icon { width: 18px; height: 18px; color: var(--accent); }
.stat .small-value { font-size: 14px; font-weight: 600; margin-top: 8px; letter-spacing: 0; }
.palette-list li a > span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.palette-list .sub { max-width: 45%; flex-shrink: 1; }
ul.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.files li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
ul.files .grow { flex: 1; }
.upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.upload-row select { width: auto; }
.upload-row input[type="file"] { flex: 1 1 200px; width: auto; }

/* ---------- Звіт за бланком ---------- */
.form-report .table-scroll { max-height: calc(100vh - 220px); overflow: auto; }
table.form-table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.form-table th, table.form-table td { height: 30px; padding: 0 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
table.form-table thead th { position: sticky; z-index: 3; background: var(--surface-2); color: var(--text-2); text-align: center;
  font-weight: 500; white-space: normal; line-height: 1.2; vertical-align: middle; }
table.form-table thead tr:nth-child(1) th { top: 0; }
table.form-table thead tr:nth-child(2) th { top: 30px; }
table.form-table thead tr:nth-child(3) th { top: 60px; }
table.form-table thead th.leaf { min-width: 44px; max-width: 72px; font-size: 11px; }
table.form-table thead th[title] { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
table.form-table .sticky-col { position: sticky; left: 0; z-index: 4; background: var(--surface); text-align: left;
  min-width: 160px; white-space: nowrap; font-weight: 500; box-shadow: 1px 0 0 var(--border); }
table.form-table thead .sticky-col { z-index: 6; background: var(--surface-2); }
table.form-table td.zero { color: var(--faint); }
table.form-table td a { color: var(--text); font-weight: 500; }
table.form-table td a:hover { color: var(--accent); }
table.form-table tfoot th, table.form-table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border-strong);
  position: sticky; bottom: 0; z-index: 3; }
table.form-table tfoot .sticky-col { z-index: 5; background: var(--surface-2); }
table.form-table tbody tr:hover td, table.form-table tbody tr:hover th { background: var(--hover); }
table.form-table thead th.group { text-align: left; padding-left: 8px; }
.table-meta { min-height: 46px; }
.table-meta .add-inline { height: 28px; padding: 0 12px; font-size: 13px; }
table.dense td.status-cell { max-width: 240px; }
.badge { max-width: 100%; }
.badge .badge-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand-login { gap: 10px; }
.brand-login > span:last-child { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 600; }
.brand-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
.person-head { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.person-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.badge.accent { background: var(--selected); color: var(--accent); border-color: transparent; text-transform: uppercase;
  font-size: 10px; letter-spacing: .04em; }

/* ---------- Реєстр: групи й бічна картка ---------- */
tr.group-row td { background: var(--surface-2); height: 30px; font-weight: 600; border-top: 1px solid var(--border); }
tr.group-row:hover td { background: var(--surface-2); }
.group-label { color: var(--text); }
.group-count { float: right; }
.people-table td.status-cell { max-width: 260px; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.18); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 45; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); overflow-y: auto; padding: 14px 20px 32px;
  animation: drawer .16s ease-out; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
@keyframes drawer { from { transform: translateX(16px); opacity: .6; } }

/* ---------- Форма картки людини ---------- */
.person-form { max-width: 880px; }
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 14px 16px 18px; margin-bottom: 12px; }
.form-section > h2 { margin: 0 0 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; } .form-grid .span-6 { grid-column: span 6; }
.form-grid .field label { display: flex; align-items: center; gap: 6px; }
.form-grid .field.has-error input, .form-grid .field.has-error select, .form-grid .field.has-error textarea { border-color: var(--error); }
.req { color: var(--error); }
.form-bar { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; margin-top: 4px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.form-bar .grow { flex: 1; }
.error-summary { border: 1px solid var(--error); background: var(--error-soft); color: var(--text); border-radius: var(--radius-lg);
  padding: 10px 14px; margin-bottom: 12px; }
.error-summary ul { margin: 6px 0 0; padding-left: 18px; }
.error-summary a { color: var(--error); }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3, .form-grid .span-4, .form-grid .span-6 { grid-column: 1; }
}

/* ---------- Вибір із пошуком, швидка зміна, попередження про дубль ---------- */
.picker { position: fixed; z-index: 90; max-width: min(520px, calc(100vw - 24px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: 6px; }
.picker input { margin-bottom: 4px; }
.picker-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.picker { display: flex; flex-direction: column; overflow: hidden; }
.picker-list { flex: 1; min-height: 0; }
.picker-group { padding: 8px 8px 2px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.picker-item { padding: 6px 8px; border-radius: var(--radius); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-item.nested { padding-left: 16px; }
.picker-item[aria-selected="true"] { background: var(--selected); }
.picker-item.current { font-weight: 600; }
.picker-item.current::after { content: " ✓"; color: var(--accent); }
.picker-empty { padding: 10px; color: var(--muted); text-align: center; }
button.quick-place { cursor: pointer; font: 500 12px var(--font); height: 22px; color: var(--text-2); }
button.quick-place:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
button.quick-place .caret { font-size: 9px; opacity: .55; margin-left: 2px; }
button.quick-place.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
button.quick-place:disabled { opacity: .6; }
.select-btn { width: 100%; height: var(--control); justify-content: flex-start; padding: 0 28px 0 10px; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 400; position: relative;
  overflow: hidden; text-overflow: ellipsis; display: block; line-height: calc(var(--control) - 2px); }
.select-btn { white-space: nowrap;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
/* Загальне button:hover скидає фон повністю (shorthand) — тут відновлюємо фон і стрілку цілком,
   інакше стрілка-градієнт розтягується на всю кнопку й ховає текст (особливо в темній темі). */
.select-btn:hover, .select-btn:focus { background-color: var(--surface); color: var(--text);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.select-btn.placeholder:hover { color: var(--text-2); }
.select-btn:hover { border-color: var(--border-strong); }
.select-btn:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.select-btn.placeholder { color: var(--muted); }
.has-error .select-btn { border-color: var(--error); }
.similar-warn { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); font-size: 13px; }
.similar-warn ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Звіт: підсумок, діаграма, панель підрозділу ---------- */
.bars { padding: 12px 16px 14px; position: relative; }
.bars-title { margin-bottom: 4px; }
.bars-scale { position: relative; height: 14px; margin-left: 150px; margin-right: 76px; font-size: 10px; color: var(--muted); }
.bars-scale span { position: absolute; transform: translateX(-50%); }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 76px; align-items: center; height: 22px; color: var(--text); }
.bar-row:hover { background: var(--hover); text-decoration: none; border-radius: 4px; }
.bar-label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; text-align: right; color: var(--text-2); }
.bar-track { position: relative; height: 12px; background: var(--surface-2); border-radius: 3px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.bar-fill.low { background: var(--error); } .bar-fill.mid { background: var(--warn); } .bar-fill.high { background: var(--ok); }
.bar-mark { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px dashed var(--border-strong); }
.bar-value { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
a.row-open { color: var(--text); }
a.row-open:hover { color: var(--accent); }
.panel-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.panel-kpis > div { grid-column: span 2; }
.panel-kpis > div:nth-child(n+4) { grid-column: span 3; }
.panel-kpis div { background: var(--surface-2); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.panel-kpis .label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.panel-kpis strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.panel-kpis .ok strong { color: var(--ok); } .panel-kpis .warn strong { color: var(--warn); }
details.panel-group { border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px; }
details.panel-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  color: var(--text); font-weight: 500; font-size: 13px; }
details.panel-group .count { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.dot-label::before { content: "●"; margin-right: 6px; }
.dot-label.bank_left::before { content: "◧"; color: var(--accent); }
.dot-label.bank_right::before { content: "◨"; color: var(--accent); }
.dot-label.in_nobank::before { content: "○"; color: var(--muted); }
.dot-label.out_total::before { content: "▣"; color: var(--warn); }
ol.people-mini { margin: 0; padding: 0 12px 10px 34px; max-height: 360px; overflow-y: auto; }
ol.people-mini li { padding: 5px 0; border-top: 1px solid var(--border); }
.pm-name a { color: var(--text); font-weight: 500; }
details.panel-group summary::-webkit-details-marker { display: none; }
.bars-list { max-height: 320px; overflow-y: auto; }

/* ---------- Звіт: шапка, вибір дати, вигляд колонок ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.report-head { flex: none; }
.datebar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.datebar input[type=date] { width: auto; height: 30px; }
.segs { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segs .seg { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; color: var(--text-2); font-size: 13px;
  border-right: 1px solid var(--border); }
.segs .seg:last-child { border-right: 0; }
.segs .seg:hover { text-decoration: none; background: var(--hover); }
.segs .seg.on { background: var(--accent-soft, var(--surface-2)); color: var(--accent); font-weight: 600; }
.date-pick { display: inline-flex; align-items: center; gap: 2px; }
.date-pick .icon-btn { font-size: 18px; line-height: 1; }
.icon-btn.disabled { opacity: .35; pointer-events: none; }
.view-switch { margin-left: auto; }
.notice { margin: 0 0 8px; }
.sumline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 22px; margin: 2px 0 6px; }
.sum { display: inline-flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 13px; }
.sum strong { color: var(--text); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sum.low strong { color: var(--error); } .sum.mid strong { color: var(--warn); } .sum.high strong { color: var(--ok); }
details.chart-toggle { position: static; }
.sumline { position: relative; }
details.chart-toggle > summary { list-style: none; cursor: pointer; font-size: 13px; }
details.chart-toggle > summary::-webkit-details-marker { display: none; }
details.chart-toggle > summary::after { content: " ▾"; }
details.chart-toggle[open] > summary::after { content: " ▴"; }
.chart-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(680px, 80vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, var(--shadow)); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.low b { color: var(--error); }
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }
table.form-table td.pct { min-width: 60px; text-align: right; white-space: nowrap; }
/* таблиця на всю висоту: прокручується лише вона, шапка й колонка підрозділів закріплені */
.main:has(> .content.fill) { height: 100vh; }
.content.fill { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 16px; }
.content.fill > .tabs { flex: none; }
.content.fill .form-report { flex: 1; min-height: 220px; display: flex; flex-direction: column; overflow: hidden; }
.content.fill .form-report .table-scroll { flex: 1; min-height: 0; max-height: none; margin-top: 0; }
@media (max-height: 560px), (max-width: 760px) {
  .main:has(> .content.fill) { height: auto; }
  .content.fill { display: block; }
  .content.fill .form-report .table-scroll { max-height: calc(100vh - 120px); }
  .view-switch { margin-left: 0; }
}
/* меню «Ще» */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 360px; max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, var(--shadow)); padding: 4px; }
details.menu-section > summary { list-style: none; cursor: pointer; padding: 8px 10px; border-radius: var(--radius); font-weight: 500; }
details.menu-section > summary::-webkit-details-marker { display: none; }
details.menu-section > summary:hover { background: var(--hover); }
details.menu-section[open] { background: var(--surface-2); border-radius: var(--radius); padding-bottom: 8px; }
details.menu-section > :not(summary) { margin-left: 10px; margin-right: 10px; }
.menu-list { list-style: none; padding: 0; margin: 0 10px; }
.menu-list li { padding: 3px 0; }
.rules-list { padding-left: 18px; margin-top: 0; }
details.menu > summary::before, details.chart-toggle > summary::before { content: none; }
.breakdown { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 12px 8px; }
table.form-table.view-main thead th.leaf { min-width: 40px; max-width: 52px; }
table.form-table.view-main td.pct { min-width: 54px; }
table.form-table.view-main th, table.form-table.view-main td { padding: 0 4px; }
.content.fill { padding-left: 16px; padding-right: 16px; }
/* мінімальна шапка звіту */
table.form-table td.pct.mid { color: var(--text-2); }
table.form-table td.pct.low { color: var(--error); font-weight: 600; }
table.form-table td.pct.high { color: var(--ok); }
details.chart-toggle > summary.sum { cursor: pointer; }
details.chart-toggle > summary.sum:hover strong, details.chart-toggle > summary.sum:hover { color: var(--accent); }
details.chart-toggle > summary::after { content: ""; }
details.seg-more { position: relative; padding: 0; }
details.seg-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; height: 28px; padding: 0 11px; }
details.seg-more > summary::before, details.seg-more > summary::-webkit-details-marker { content: none; display: none; }
.date-pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; display: inline-flex; align-items: center; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, var(--shadow)); }
.segs { overflow: visible; }
details.seg-more > summary { color: var(--text-2); font-size: 13px; font-weight: 400; }
details.seg-more > summary:hover { background: var(--hover); }
table.form-table.view-main thead th.pct-col { max-width: none; min-width: 54px; }
/* список: додаткові фільтри у випадному блоці */
details.more-filters { position: relative; }
details.more-filters > summary { list-style: none; cursor: pointer; }
details.more-filters > summary::before, details.more-filters > summary::-webkit-details-marker { content: none; display: none; }
details.more-filters .count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; }
.filters-pop { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: 280px; display: flex; flex-direction: column; gap: 6px;
  padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg, var(--shadow)); }
.filters-pop label { font-size: 12px; color: var(--muted); }
.filters-pop select { max-width: none; width: 100%; }
.filters-pop label.check { color: var(--text); margin-top: 4px; border: 0; padding: 0; height: auto; }
/* список: довгі значення обрізаються, повний текст — у підказці; таблиця не ширша за екран */
.people-table { width: 100%; }
.people-table td.note { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.people-table td.rank { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.people-table td.status-cell .badge-text { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* звіт за районом виконання: шапка й колонка підрозділів закріплені */
.form-report table.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.form-report table.matrix tfoot th { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); }
.readonly-note { margin: 8px 0 0; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); }
.demo-badge { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.demo-note { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn);
  font-size: 13px; text-align: center; }
/* ---------- Картка людини ---------- */
.person-name { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 2px 0 4px; }
.person-sub { color: var(--text-2); font-size: 14px; }
.place-block { margin: 14px 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface-2); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.place-block.outside { background: var(--warn-soft); border-color: transparent; }
.place-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.badge.place-big { font-size: 14px; height: auto; min-height: 28px; padding: 4px 10px; white-space: normal; text-align: left; max-width: 100%; }
.badge.place-big .badge-text { white-space: normal; overflow: visible; }
button.quick-place.place-big .caret { font-size: 11px; opacity: .7; margin-left: 6px; white-space: nowrap; }
.card-actions { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.card-actions details.menu > summary { min-width: 34px; padding: 0 10px; }
.menu-item { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--text); }
.menu-item:hover { background: var(--hover); text-decoration: none; }
.menu-item.danger { color: var(--error); }
.card-actions .menu-pop { width: 240px; left: 0; right: auto; }
.empty-fields { margin: 10px 0 0; }
.card-section { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.card-section h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
details.add-doc > summary, details.more-history > summary { list-style: none; cursor: pointer; font-size: 13px; margin-top: 6px; }
details.add-doc > summary::before, details.more-history > summary::before,
details.add-doc > summary::-webkit-details-marker, details.more-history > summary::-webkit-details-marker { content: none; display: none; }
details.add-doc[open] > summary, details.more-history[open] > summary { display: none; }
.card-nav { display: inline-flex; align-items: center; gap: 2px; }
.card-nav .icon-btn { font-size: 15px; }
/* єдиний випадний список: обгортка з «×» для фільтрів */
.select-wrap { position: relative; display: block; min-width: 0; }
.filters .select-wrap { display: inline-block; width: 240px; max-width: 240px; }
.filters-pop .select-wrap { width: 100%; max-width: none; }
.select-wrap.clearable .select-btn { padding-right: 46px; }
.select-clear { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1; }
.select-clear:hover { background: var(--hover); color: var(--text); }
.picker-item:hover { background: var(--hover); }
.picker-item[aria-selected="true"]:hover { background: var(--selected); }
/* клітинки, які можна змінити просто в списку */
td.editable { cursor: pointer; position: relative; }
td.editable:hover, td.editable:focus { outline: none; box-shadow: inset 0 0 0 1px var(--border-strong); background: var(--surface-2); }
td.editable:hover::after, td.editable:focus::after { content: "▾"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); }
td.editable.saving { opacity: .5; }
.cell-edit { padding: 8px; }
.cell-edit input, .cell-edit textarea { width: 100%; }
.cell-edit-hint { margin-top: 4px; }
.access-meta { padding: 0 0 8px; }
.access-action { white-space: nowrap; text-align: right; }
.password-inline { display: inline-block; padding: 2px 8px; margin-right: 6px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--text); font-weight: 600; letter-spacing: .02em; }
/* звіт за званнями: підсумки категорій виділені */
table.ranks-table td.subtotal, table.ranks-table th.subtotal { background: var(--surface-2); font-weight: 600; }
table.ranks-table thead th.leaf { max-width: 90px; white-space: normal; line-height: 1.2; }
