/* Токены по DESIGN.md: Radix gray + violet, статусы red/green, прямые углы, шаг 4 */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.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; }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/inter-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.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; }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/inter-cyrillic-500-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.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; }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/inter-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+2000-206F,U+2212; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }

:root {
  --gray-2: #f9f9f9; --gray-3: #f0f0f0; --gray-4: #e8e8e8; --gray-6: #d9d9d9; --gray-7: #cecece;
  --gray-9: #8d8d8d; --gray-10: #838383; --gray-11: #646464; --gray-12: #202020;
  --violet-3: #f4f0fe; --violet-4: #ebe4ff; --violet-6: #d4cafe; --violet-9: #6e56cf; --violet-10: #654dc4; --violet-11: #6550b9;
  --red-3: #feebec; --red-11: #c02a2f;     /* шаг 11, сдвинут на 8 % к 12 — контраст на подложке 3 > 4.5 */
  --green-3: #e6f6eb; --green-11: #1f7b53;

  --canvas: var(--gray-2); --block: #fff; --border: var(--gray-6); --field: var(--gray-7);
  --text: var(--gray-12); --text-2: var(--gray-11); --text-3: var(--gray-10);
  --accent: var(--violet-9); --accent-hover: var(--violet-10); --accent-text: var(--violet-11);
  --accent-soft: var(--violet-3); --accent-line: var(--violet-6);
  --shadow-card: 0 1px 2px rgb(0 0 0 / .05), 0 1px 1px rgb(0 0 0 / .03);
  --shadow-card-hover: 0 2px 6px rgb(0 0 0 / .08), 0 1px 2px rgb(0 0 0 / .05);
  --shadow-md: 0 6px 20px rgb(0 0 0 / .12), 0 2px 6px rgb(0 0 0 / .06);
  --radius: 0; --control: 30px; --control-sm: 28px;
  --pad: 16px; --gap: 12px; --panel-w: 480px; --side-w: 208px;
  --font: Inter, system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.45 var(--font); color: var(--text); background: var(--canvas); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; }
h1 { font-size: 18px; } h2 { font-size: 14px; } h3 { font-size: 13px; }
time, .mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-line); }

/* левое меню */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex: none; position: sticky; top: 0; height: 100vh; z-index: 20; display: flex; flex-direction: column;
  gap: 12px; padding: 16px 12px; background: var(--block); border-right: 1px solid var(--border); }
.side .brand { font-weight: 600; font-size: 14px; color: var(--text); padding: 0 8px; }
.side nav { display: flex; flex-direction: column; }
.side nav a, .side .link-btn { padding: 6px 8px; color: var(--text-2); text-align: left; border: 0; background: none; font: 13px var(--font); cursor: pointer; }
.side nav a:hover, .side .link-btn:hover { color: var(--accent-text); text-decoration: none; }
.side nav a[aria-current] { color: var(--text); font-weight: 500; box-shadow: inset 2px 0 0 var(--accent); }
.side .foot { margin-top: auto; }
.side .foot form { margin: 0; }
.side .who { padding: 6px 8px 0; color: var(--text-2); font-size: 12px; }
.side .picker .list { width: 320px; right: auto; }
.main { flex: 1; min-width: 0; }

/* контролы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control);
  padding: 0 12px; font: 500 12.5px var(--font); color: var(--text); background: var(--block);
  border: 1px solid var(--field); border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.btn:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { color: #fff; background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red-11); }
.btn.danger:hover { border-color: var(--red-11); background: var(--red-3); }
.btn.sm { height: var(--control-sm); padding: 0 8px; }
.btn.link { border-color: transparent; background: none; color: var(--accent-text); padding: 0 6px; }
.btn.link:hover { background: var(--accent-soft); border-color: transparent; }
.btn.icon { width: var(--control); padding: 0; }

input[type=text], input[type=password], input[type=search], input:not([type]), textarea {
  height: var(--control); width: 100%; padding: 0 8px; font: 13px var(--font); color: var(--text);
  background: var(--block); border: 1px solid var(--field); border-radius: var(--radius); }
textarea { height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-line); }
/* выбор файлов: системное поле скрыто, видна кнопка в стиле интерфейса */
.file { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.file input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.file input:focus-visible + .btn { box-shadow: 0 0 0 3px var(--accent-line); }
.file .file-names { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* флажки и переключатели — квадратные, акцентом при выборе */
input[type=checkbox], input[type=radio] { appearance: none; flex: none; width: 16px; height: 16px; margin: 0 6px 0 0;
  vertical-align: -3px; border: 1px solid var(--field); background: var(--block); display: inline-grid; place-content: center; cursor: pointer; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--accent); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::before { content: ""; width: 9px; height: 5px; margin-top: -2px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
input[type=radio]:checked::before { content: ""; width: 6px; height: 6px; background: #fff; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: 0 0 0 3px var(--accent-line); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label.chip { display: flex; align-items: center; }
label.field > span, .label { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form { display: flex; flex-direction: column; gap: var(--gap); }
.form .actions { display: flex; gap: 8px; }

/* сегментный выбор вместо select (DESIGN: без нативных виджетов) */
.seg { display: inline-flex; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { height: var(--control-sm); display: inline-flex; align-items: center; padding: 0 10px; cursor: pointer;
  border: 1px solid var(--field); margin: 0 -1px -1px 0; background: var(--block); font-size: 12.5px; }
.seg label:hover { color: var(--accent-text); }
.seg input:checked + label { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); position: relative; z-index: 1; }
.seg input:focus-visible + label { box-shadow: 0 0 0 3px var(--accent-line); }

/* поле с подсказкой */
.picker { position: relative; }
.picker .list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); background: var(--block);
  box-shadow: var(--shadow-md); max-height: 280px; overflow: auto; }
.picker .list:empty { display: none; }
.picker .opt { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; cursor: pointer; }
.picker .opt[aria-selected=true], .picker .opt:hover { background: var(--accent-soft); color: var(--accent-text); }
.picker .opt small { color: var(--text-2); font-family: var(--mono); font-size: 11px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker .opt > span { flex: none; }
.picker .opt.create { color: var(--accent-text); border-top: 1px solid var(--border); }
.picker.chosen input[type=text] { border-color: var(--accent); }
.picker.as-select input[type=text] { padding-right: 22px; cursor: pointer; }
.picker.as-select::after { content: "▾"; position: absolute; right: 8px; top: 7px; font-size: 10px; color: var(--text-3); pointer-events: none; }

/* выпадающий список */
.dd > .btn { gap: 4px; }
.dd .dd-arrow { color: var(--text-3); font-size: 10px; }
.dd > .items { left: 0; right: auto; min-width: 100%; }
.dd > .items [aria-selected=true] { color: var(--accent-text); box-shadow: inset 2px 0 0 var(--accent); }
.row.nowrap { flex-wrap: nowrap; }
.date-input { width: 116px !important; flex: none; font-family: var(--mono) !important; }

/* меню «⋯» */
.menu { position: relative; }
.menu > .items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 200px; background: var(--block);
  box-shadow: var(--shadow-md); padding: 4px 0; }
.menu > .items button, .menu > .items a { display: block; width: 100%; text-align: left; padding: 7px 12px; border: 0;
  background: none; font: 13px var(--font); color: var(--text); cursor: pointer; }
.menu > .items :is(button, a):hover { background: var(--accent-soft); color: var(--accent-text); text-decoration: none; }
.menu > .items .danger { color: var(--red-11); }

/* сообщения */
#toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: 560px; }
.toast-msg { padding: 10px 14px; background: var(--block); box-shadow: var(--shadow-md); border-left: 3px solid var(--accent); }
.toast-msg.error { border-left-color: var(--red-11); color: var(--red-11); background: var(--red-3); }
.notice { padding: 8px 10px; background: var(--green-3); color: var(--green-11); }
.error-line { padding: 8px 10px; background: var(--red-3); color: var(--red-11); }

/* страница со списком/содержимым */
.page { max-width: 1100px; margin: 0 auto; padding: 20px var(--pad) 48px; display: flex; flex-direction: column; gap: 16px; }
.block { background: var(--block); border: 1px solid var(--border); box-shadow: var(--shadow-card); padding: var(--pad); }
.head { display: flex; align-items: center; gap: 12px; }
.head .spacer { flex: 1; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-2); padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.list td { padding: 8px; border-bottom: 1px solid var(--gray-4); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }

/* вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; color: var(--text-2); }
.tabs a:hover { color: var(--accent-text); text-decoration: none; }
.tabs a[aria-current] { color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--accent); }

/* список людей */
table.people td.pic { width: 48px; padding-right: 0; }
table.people .pic img, table.people .pic .ph { display: block; width: 40px; height: 50px; object-fit: cover; background: var(--gray-3); }

/* древо: граф + правая панель */
.tree-view { height: 100vh; display: flex; }
#graph { flex: 1; position: relative; overflow: hidden; cursor: grab; background: var(--canvas); touch-action: none; }
#graph.dragging { cursor: grabbing; }
#graph svg { width: 100%; height: 100%; display: block; user-select: none; }
.g-edge { fill: none; stroke: var(--gray-9); stroke-width: 1.2; }
.g-edge.child { stroke: var(--gray-7); }
.g-edge.hl { stroke: var(--accent); stroke-width: 2.5; }  /* линии пары под курсором */
.g-fam { cursor: pointer; }
.g-node:focus, .g-fam:focus { outline: none; }  /* выбор показан акцентом карточки, системная рамка не нужна */
.g-node:focus-visible rect.box, .g-fam:focus-visible rect { stroke: var(--accent); stroke-width: 2; }
.g-fam rect { fill: var(--gray-3); stroke: var(--gray-7); stroke-width: 1; }
.g-fam:hover rect { stroke: var(--accent); }
.g-fam.selected rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.g-fam text { font: 400 10.5px var(--mono); fill: var(--text-2); text-anchor: middle; }
.g-node { cursor: pointer; }
.g-node rect.box { fill: var(--block); stroke: var(--border); stroke-width: 1; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .06)); }
.g-node:hover rect.box { stroke: var(--accent); }
.g-node.selected rect.box { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.g-node.found rect.box { stroke: var(--accent); stroke-width: 2; }
.g-node .ph { fill: var(--gray-3); }
.sil .sil-body { fill: var(--gray-6); }
.sil .sil-hair { fill: var(--gray-9); }
.g-node .nm { font: 600 13px var(--font); fill: var(--text); }
.g-node .gv { font: 400 12px var(--font); fill: var(--text); }
.g-node .yr { font: 400 10.5px var(--mono); fill: var(--text-2); }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; box-shadow: var(--shadow-card); }
.zoom .btn { margin-top: -1px; }
.empty-tree { position: absolute; inset: 0; display: grid; place-items: center; }
.empty-tree .block { width: 360px; }

#panel { width: var(--panel-w); flex: none; background: var(--block); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md); display: flex; flex-direction: column; min-height: 0; }
#panel:empty { display: none; }
.p-head { flex: none; display: flex; gap: 12px; align-items: flex-start; padding: 14px var(--pad) 12px; border-bottom: 1px solid var(--border); }
.p-head .avatar-btn { position: relative; flex: none; width: 64px; height: 80px; padding: 0; border: 0; background: var(--gray-3); cursor: pointer; }
.p-head .avatar-btn.readonly { cursor: default; }
.p-head .avatar { width: 64px; height: 80px; display: block; object-fit: cover; }
.p-head .avatar-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 0; font-size: 11px; text-align: center;
  color: #fff; background: rgb(0 0 0 / .55); opacity: 0; }
.p-head .avatar-btn:hover .avatar-hint, .p-head .avatar-btn:focus-visible .avatar-hint { opacity: 1; }
.p-head .who { flex: 1; min-width: 0; }
.p-head .kind { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-2); }
.p-head h1 { font-size: 16px; line-height: 1.3; }
.p-head .life { color: var(--text-2); margin-top: 2px; }
.p-body { flex: 1; overflow: auto; scrollbar-gutter: stable; }
.sec { padding: 12px var(--pad); }
.sec + .sec { border-top: 1px solid var(--gray-4); }
.sec-h { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-sm); margin-bottom: 4px; }
/* сворачиваемые разделы панели: заголовок — переключатель, кнопки «+ …» в нём раздел не сворачивают */
summary.sec-h { list-style: none; cursor: pointer; margin: -4px 0; padding: 4px 0; }
summary.sec-h::-webkit-details-marker { display: none; }
summary.sec-h .label::before { content: "▾"; display: inline-block; width: 14px; color: var(--text-3); transition: transform .12s; }
details.sec:not([open]) > summary.sec-h .label::before { transform: rotate(-90deg); }
details.sec:not([open]) > summary.sec-h { margin-bottom: -4px; }
details.sec[open] > summary.sec-h { margin-bottom: 4px; }
summary.sec-h:hover .label { color: var(--accent-text); }
.sec-h .label { margin: 0; }
.item { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.item .grow { flex: 1; min-width: 0; }
.item.line .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .tools { opacity: 0; display: flex; gap: 2px; }
.item:hover .tools, .item:focus-within .tools { opacity: 1; }
.item time { color: var(--text-2); margin-left: 4px; }
.ev-type { font-weight: 500; }
/* события — строки таблицы в одну линию: общие колонки (subgrid) — ширину задаёт самая длинная дата;
   щелчок по строке раскрывает подробности, документы и правку */
.ev-list { display: grid; grid-template-columns: max-content max-content minmax(0, 1fr) auto auto; column-gap: 12px; }
.ev { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; border-bottom: 1px solid var(--gray-3); }
.ev:last-child { border-bottom: 0; }
.ev-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; padding: 5px 0;
  border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ev-row > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-row time { color: var(--text-2); }
.ev-row::after { content: "▸"; color: var(--text-3); transition: transform .12s; }
.ev-row[aria-expanded="true"]::after { transform: rotate(90deg); }
.ev-row:hover .ev-type, .ev-row:hover .ev-where { color: var(--accent-text); }
.ev-docs { font-size: 11.5px; color: var(--text-2); text-align: right; }
.ev-body { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; row-gap: 4px; padding: 0 0 10px; }
.ev-body > * { grid-column: 2 / -1; }
.ev-body > .inline-form { grid-column: 1 / -1; }
.ev-body .row { display: flex; gap: 8px; }
.sub { padding-left: 12px; border-left: 2px solid var(--gray-4); margin: 4px 0 4px 4px; }
.place { color: var(--text-2); }
.chip { font-size: 11.5px; color: var(--text-2); }
.strip { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.thumb { padding: 0; border: 0; background: var(--gray-4); cursor: zoom-in; aspect-ratio: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { box-shadow: 0 0 0 2px var(--accent-line); }
.thumb.is-avatar { box-shadow: 0 0 0 2px var(--accent); }
.thumbs-foot { margin-top: 6px; font-size: 12px; }

/* просмотрщик фото — всплывающий слой поверх всего */
.viewer { position: fixed; inset: 0; z-index: 200; background: rgb(0 0 0 / .72); display: grid; place-items: center; padding: 24px; }
.v-box { background: var(--block); box-shadow: var(--shadow-md); display: flex; flex-direction: column; max-width: 100%; max-height: 100%; }
.v-top, .v-actions { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.v-top { border-bottom: 1px solid var(--border); }
.v-top .v-title { font-weight: 600; }
.v-top .v-date, .v-count { color: var(--text-2); }
.v-top .spacer { flex: 1; }
.v-actions { border-top: 1px solid var(--border); }
.v-main { display: flex; align-items: center; gap: 8px; padding: 12px; min-height: 0; background: var(--gray-2); }
.v-stage { cursor: default; }
.v-stage[data-edit] { cursor: crosshair; }
.v-stage img { max-width: calc(100vw - 180px); max-height: calc(100vh - 200px); }
.v-main .btn.icon { font-size: 18px; }
.strip img { width: 64px; height: 64px; object-fit: cover; display: block; background: var(--gray-4); }
.inline-form { margin-top: 8px; padding: 12px; background: var(--gray-2); }
.panel-empty { padding: var(--pad); color: var(--text-2); }

/* фото */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery a { display: block; background: var(--block); box-shadow: var(--shadow-card); border: 1px solid var(--border); color: var(--text); }
.gallery a:hover { box-shadow: var(--shadow-card-hover); text-decoration: none; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--gray-4); }
.gallery .cap { padding: 6px 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; cursor: crosshair; user-select: none; }
.stage img { max-width: 100%; max-height: calc(100vh - 160px); display: block; }
.stage .box { position: absolute; border: 2px solid #fff; outline: 1px solid rgb(0 0 0 / .45); }
.stage .box span { position: absolute; left: -2px; top: 100%; margin-top: 2px; line-height: 1.3; white-space: nowrap;
  padding: 1px 5px; font-size: 11.5px; background: rgb(0 0 0 / .72); color: #fff; }
.stage .box.hl { border-color: var(--violet-4); outline-color: var(--accent); }
.stage .draft { position: absolute; border: 2px dashed var(--accent); background: rgb(110 86 207 / .12); }
.tag-pop { position: absolute; z-index: 30; width: 260px; background: var(--block); box-shadow: var(--shadow-md); padding: 10px; line-height: 1.45; }

/* вход */
.login { min-height: 100%; display: grid; place-items: center; padding: var(--pad); }
.login .block { width: 340px; }

@media (max-width: 760px) {
  :root { --pad: 12px; }
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; flex-direction: row; align-items: center; gap: 4px; padding: 0 8px;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .side nav { flex-direction: row; }
  .side .search, .side .who { display: none; }
  .side .foot { margin: 0 0 0 auto; flex-direction: row; }
  .side nav a, .side .link-btn { min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }
  .side nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); }
  .tree-view { height: calc(100dvh - 45px); }
  #panel { position: fixed; inset: 45px 0 0 0; width: auto; z-index: 30; }
  .photo-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .btn, input:not([type=file]) { min-height: 44px; }
}

/* PDF документа — по страницам */
.pdf:focus-visible { box-shadow: none; }
.pdf-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pdf-bar .spacer { flex: 1; }
.pdf-pos { display: flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.pdf-bar .pdf-n { width: 4.5em; flex: none; height: var(--control-sm); text-align: center; }
.pdf-page { display: block; max-width: 100%; margin: 0 auto; background: var(--gray-3); min-height: 200px; }
.pdf.loading .pdf-page { opacity: .5; }
