/* Docs — «Крафт і печатка». Токени (копія design/tokens.css), база, компоненти, друк.
   Розділам: спершу компоненти нижче; власні правила — лише в маркері свого розділу в кінці файлу. */

/* Шрифти вбудовані (OFL, public/assets/fonts/OFL.txt) — працює без інтернету. */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/onest-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: "Onest"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/onest-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: "Onest"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/onest-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: "Onest"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/onest-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: "Onest"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/onest-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: "Onest"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/onest-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: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/literata-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: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/literata-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: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/literata-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: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/literata-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; }

:root {
  --desk: #EFE3CF; --sheet: #FFFCF6; --paper: #FFFFFF;
  --kraft: #D4AC72; --kraft-deep: #4A2F10; --kraft-soft: #E5C998; --kraft-card: #F5E9D3;
  --ink: #2B221C; --pencil: #75685C; --rule: #E3D6C1; --rule-strong: #CDBB9E;
  --stamp: #4636A0; --stamp-tint: #ECE8F8;
  --redpen: #B4271B; --redpen-tint: #FBE9E5;
  --olive-ok: #3E6B2E; --olive-tint: #EAF1E4;
  --amber-warn: #8A5A00; --amber-tint: #FBF0D6;
  --m-hr: #3F6390; --m-vo: #5B6A2E; --m-nkek: #23716F; --m-corp: #7D3445; --m-contract: #A35E19; --m-other: #75685C;
  --font-ui: "Onest", "PT Sans", "Segoe UI", system-ui, sans-serif;
  --font-doc: "Literata", "PT Serif", Georgia, serif;
  --fs-s: 13px; --fs-m: 15px; --fs-l: 19px; --fs-xl: 28px;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 32px;
  --radius: 6px; --radius-sheet: 10px;
  --shadow-sheet: 0 1px 0 #D9C7A8, 0 8px 24px -12px rgba(92, 61, 23, .28);
  --focus: 0 0 0 3px var(--sheet), 0 0 0 5px var(--stamp);
}

/* ---------- База ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--ink); font: var(--fs-m)/1.5 var(--font-ui); }
h1, h2, h3 { font-family: var(--font-doc); font-weight: 600; line-height: 1.2; margin: 0 0 var(--s2); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-l); margin-top: var(--s4); }
h3 { font-size: 16px; margin-top: var(--s3); }
p { margin: 0 0 var(--s3); max-width: 75ch; }
a { color: var(--stamp); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }
small { font-size: var(--fs-s); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s4) 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: var(--s2); z-index: 10; background: var(--sheet); padding: var(--s2) var(--s3); border-radius: var(--radius); }
.skip:focus { left: var(--s3); }
.muted, .hint { color: var(--pencil); font-size: var(--fs-s); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.placeholder { color: var(--pencil); }

/* ---------- Каркас: бокова крафт-панель + аркуш ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--kraft); color: var(--kraft-deep); padding: var(--s3) 0; display: flex; flex-direction: column; gap: var(--s2);
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 2px, transparent 2px 5px); min-width: 0; }
.org { margin: 0 var(--s3) var(--s2); padding: var(--s2) var(--s3) var(--s3); background: var(--kraft-card); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 2px 0 #B98C4F; }
.org .code { font: 600 var(--fs-s)/1 var(--font-ui); color: #8A5F25; }
.org strong { display: block; margin: var(--s1) 0 var(--s2); font: 600 17px/1.25 var(--font-doc); color: var(--ink); }
.org strong a { color: inherit; text-decoration: none; }
.org summary { font-size: var(--fs-s); cursor: pointer; color: var(--kraft-deep); }
.org details form { margin: 0; }
.org details button { display: block; width: 100%; margin-top: var(--s1); text-align: left; font: var(--fs-s)/1.3 var(--font-ui); color: var(--ink);
  background: #FBF3E4; border: 1px solid #E3CFAE; border-radius: 4px; padding: 7px 8px; cursor: pointer; }
.side nav { display: flex; flex-direction: column; min-width: 0; }
.side nav h2 { margin: var(--s3) var(--s3) var(--s1); font: 500 var(--fs-s)/1 var(--font-ui); color: var(--kraft-deep); }
.side nav a { display: flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 6px var(--s3); color: var(--kraft-deep); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--kraft-soft); }
.side nav a[aria-current] { background: var(--sheet); color: var(--ink); border-radius: var(--radius) 0 0 var(--radius); margin-left: var(--s2); padding-left: var(--s2); }
.side .tab { width: 6px; height: 18px; border-radius: 2px; flex: none; background: var(--c, transparent); }
.side .count { margin-left: auto; font-size: var(--fs-s); font-weight: 600; background: var(--redpen); color: #fff; border-radius: 10px; padding: 0 7px; }
.side .bottom { margin-top: auto; padding: var(--s3) var(--s3) 0; font-size: var(--fs-s); display: flex; justify-content: space-between; align-items: center; }
.side .bottom a { color: var(--kraft-deep); }
.side .bottom form { margin: 0; }
.side .bottom button { font: inherit; color: var(--kraft-deep); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; min-height: 0; }
main { padding: var(--s4); min-width: 0; }
.sheet { background: var(--sheet); border-radius: var(--radius-sheet); box-shadow: var(--shadow-sheet); padding: var(--s4); max-width: 1180px; }
.sheet > h1:first-child { margin-bottom: var(--s3); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s3); }
.auth .sheet { width: 100%; max-width: 400px; }

/* Заголовок сторінки з діями */
.page-head { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); margin-bottom: var(--s4); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s1) 0 0; color: var(--pencil); }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--s2); }
.back { display: inline-block; margin-bottom: var(--s2); font-size: var(--fs-s); }

/* ---------- Кнопки ---------- */
button, .button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 38px; padding: 8px 16px;
  font: 500 var(--fs-m)/1.1 var(--font-ui); color: #fff; background: var(--stamp); border: 1px solid var(--stamp); border-radius: var(--radius);
  text-decoration: none; cursor: pointer; }
button:hover, .button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary, button.secondary, .button.secondary { color: var(--stamp); background: var(--sheet); }
.btn.quiet, button.quiet { color: var(--stamp); background: transparent; border-color: transparent; padding-inline: var(--s2); }
.btn.ok, button.ok { color: var(--olive-ok); background: var(--sheet); border-color: #C9D6BF; }
.btn.danger, button.danger { color: var(--redpen); background: var(--sheet); border-color: #E6B9B2; }
.btn.small, button.small { min-height: 30px; padding: 5px 10px; font-size: var(--fs-s); }
button:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }

/* ---------- Форми ---------- */
form { margin: 0; }
label { display: block; font-weight: 500; }
.form label, .field { display: block; margin-bottom: var(--s3); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { display: block; width: 100%; margin-top: var(--s1); }
input, select, textarea { font: var(--fs-m)/1.4 var(--font-ui); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 8px 10px; max-width: 100%; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { display: block; width: 100%; margin-top: var(--s1); }
.form input[type=date], .form input[type=number] { max-width: 220px; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--stamp); vertical-align: -3px; margin: 0 var(--s2) 0 0; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { font-weight: 400; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--stamp); }
.form .hint, .field .hint { display: block; margin-top: var(--s1); font-weight: 400; }
.invalid input, .invalid select, .invalid textarea, [aria-invalid="true"] { border-color: var(--redpen); background: #FFF8F6; }
.form small.error, .field .error { display: block; margin-top: var(--s1); font-weight: 500; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s3); margin: 0 0 var(--s3); }
legend { font: 600 16px/1.2 var(--font-doc); padding: 0 var(--s1); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.req::after { content: " *"; color: var(--redpen); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 var(--s3); }
.steps { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0; margin: 0 0 var(--s3); list-style: none; font-size: var(--fs-s); color: var(--pencil); }
.steps li[aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- Сповіщення ---------- */
.error { color: var(--redpen); }
p.error, div.error, .notice.error { color: var(--redpen); background: var(--redpen-tint); border-left: 3px solid var(--redpen); padding: var(--s2) var(--s3); border-radius: 0 var(--radius) var(--radius) 0; }
.warning, .notice { background: var(--amber-tint); border-left: 3px solid #D69A1D; padding: var(--s2) var(--s3); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink); margin: 0 0 var(--s3); }
.notice.ok { background: var(--olive-tint); border-left-color: var(--olive-ok); }
.notice ul, .warning ul { margin: var(--s1) 0 0; padding-left: 20px; }
.consequence { font-size: var(--fs-s); color: var(--pencil); margin: var(--s1) 0 0; }

/* ---------- Порожній стан ---------- */
.empty { padding: var(--s3); border: 1px dashed var(--rule-strong); border-radius: var(--radius); color: var(--pencil); margin: 0 0 var(--s3); }
.empty strong { display: block; color: var(--ink); font-weight: 500; }

/* ---------- Розділи (замість карток) ---------- */
.card { background: transparent; border-top: 1px solid var(--rule); padding: var(--s3) 0 var(--s2); margin: 0 0 var(--s3); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.form, form.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s3) var(--s3) var(--s2); }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s3); margin: 0 0 var(--s3); }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--s4); }
.cols > * { min-width: 0; }

/* Реквізити */
dl.card, dl.props { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: var(--s2) var(--s3); margin: 0 0 var(--s3); }
dt { color: var(--pencil); font-size: var(--fs-s); padding-top: 2px; }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Таблиці: книга реєстрації ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 var(--s3); }
table { width: 100%; border-collapse: collapse; margin: 0 0 var(--s3); font-variant-numeric: tabular-nums; }
caption { text-align: left; font: 600 16px/1.2 var(--font-doc); padding-bottom: var(--s2); }
th { text-align: left; font: 500 var(--fs-s)/1.3 var(--font-ui); color: var(--pencil); padding: var(--s2); border-bottom: 2px solid var(--rule-strong); vertical-align: bottom; }
td { padding: 10px var(--s2); border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:hover { background: #FBF4E8; }
td a { font-weight: 500; }
tr.void td, tr.muted td { color: var(--pencil); }
tr.void td a { color: var(--pencil); text-decoration: line-through; }
tr.late td:first-child { color: var(--redpen); font-weight: 600; }

/* Фільтри */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: end; margin: 0 0 var(--s3); padding: var(--s3); background: #F8F0E2; border-radius: var(--radius); }
.filters label { font-size: var(--fs-s); margin: 0; }
.filters input, .filters select { display: block; margin-top: var(--s1); }
.filters.card { border: 0; }

/* Вкладки (журнал, календар) */
.tabs { display: flex; flex-wrap: wrap; gap: var(--s1); border-bottom: 2px solid var(--rule-strong); margin: 0 0 var(--s3); }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--pencil); font-weight: 500; border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--stamp); background: var(--paper); }

/* ---------- Печатка: статус і номер документа ---------- */
.stamp { display: inline-block; font: 600 13px/1 var(--font-ui); color: var(--stamp); border: 1.5px solid currentColor; border-radius: 3px;
  padding: 5px 8px 4px; margin: 3px; transform: rotate(-2.5deg); white-space: nowrap; opacity: .92;
  box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3.5px currentColor; }
.stamp.draft { color: var(--pencil); border-style: dashed; transform: none; box-shadow: none; opacity: 1; }
.stamp.sent, .stamp.received { color: var(--olive-ok); transform: rotate(1.5deg); }
.stamp.archived { color: var(--pencil); }
.stamp.void { color: var(--redpen); transform: rotate(-4deg); }

/* Чип стану задачі / дрібних статусів */
.chip { display: inline-block; font: 500 var(--fs-s)/1 var(--font-ui); padding: 4px 8px; border-radius: 999px; background: #F1E8DA; color: var(--kraft-deep); white-space: nowrap; }
.chip.ok { background: var(--olive-tint); color: var(--olive-ok); }
.chip.late { background: var(--redpen-tint); color: var(--redpen); }
.chip.info { background: var(--stamp-tint); color: var(--stamp); }

/* Модуль: колір корінця папки */
.mod { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--pencil); white-space: nowrap; }
.mod::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--m-other)); }

/* ---------- Задача: аркуш відривного календаря ---------- */
.tasks { margin: 0 0 var(--s3); }
.tasks h3 { font: 500 var(--fs-s)/1 var(--font-ui); color: var(--pencil); margin: var(--s3) 0 var(--s2); }
.tasks.late h3 { color: var(--redpen); }
.task { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: 12px 0; border-top: 1px solid var(--rule); }
.task > div { min-width: 0; }
.leaf { text-align: center; border: 1px solid var(--rule); border-top: 4px solid var(--pencil); border-radius: 3px; background: var(--paper); padding: 2px 0 4px; }
.leaf b { display: block; font: 600 22px/1.1 var(--font-doc); }
.leaf span { display: block; font-size: 11px; line-height: 1.2; color: var(--pencil); }
.late .leaf { border-top-color: var(--redpen); }
.late .leaf b { color: var(--redpen); }
.task .title { font-weight: 500; color: var(--ink); text-decoration: none; }
.task .title:hover { color: var(--stamp); text-decoration: underline; }
.task p { margin: 2px 0 0; color: var(--pencil); font-size: var(--fs-s); max-width: 60ch; }
.task .mod { margin-right: var(--s2); }
.task .go { display: flex; flex-direction: column; align-items: end; gap: var(--s1); font-size: var(--fs-s); white-space: nowrap; padding-top: 2px; }

/* Документ у списку-стовпчику */
.doc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: center; padding: 10px 0; border-top: 1px solid var(--rule); }
.doc a { color: var(--ink); text-decoration: none; font-family: var(--font-doc); }
.doc a:hover { color: var(--stamp); text-decoration: underline; }
.doc small { display: block; color: var(--pencil); font: var(--fs-s)/1.4 var(--font-ui); }
.doc .due { color: var(--redpen); font-weight: 600; white-space: nowrap; }

/* Чеклист */
.checklist ul { list-style: none; padding: 0; margin: 0 0 var(--s2); }
.checklist li { padding: 6px 0; border-bottom: 1px dotted var(--rule); }
.checklist .progress { font-size: var(--fs-s); color: var(--pencil); }

/* Файли */
.files { list-style: none; padding: 0; margin: 0 0 var(--s3); }
.files li { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--rule); }

/* Небезпечна зона */
.danger-zone { margin-top: var(--s4); border: 1px solid #E6B9B2; border-radius: var(--radius); padding: var(--s3); }
.danger-zone > summary { cursor: pointer; color: var(--redpen); font-weight: 500; }

/* Технічні деталі */
details.tech { margin-top: var(--s3); font-size: var(--fs-s); color: var(--pencil); }
details.tech > summary { cursor: pointer; }

/* ---------- Адаптив ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { padding: var(--s2) 0 0; gap: var(--s2); }
  .side nav { flex-direction: row; overflow-x: auto; white-space: nowrap; }
  .side nav a { padding: 12px var(--s3); min-height: 44px; }
  .side nav a[aria-current] { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .side nav h2, .side .bottom { display: none; }
  main { padding: var(--s2); }
  .sheet { padding: var(--s3); border-radius: 0 0 var(--radius-sheet) var(--radius-sheet); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .page-head .actions { margin-left: 0; }
  .task { grid-template-columns: 52px minmax(0, 1fr); }
  .task .go { grid-column: 2; flex-direction: row; align-items: center; gap: var(--s3); }
  dl.card, dl.props { grid-template-columns: 1fr; gap: 0; }
  dd { margin-bottom: var(--s2); }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Друк ---------- */
@media print {
  .side, .page-head .actions, .no-print, .skip, .filters, button, .button, .btn, .danger-zone { display: none !important; }
  body, .sheet { background: #fff; }
  .app { display: block; }
  main, .sheet { padding: 0; box-shadow: none; max-width: none; }
  .print-head { display: block !important; font-size: 11px; color: #555; margin-bottom: 8px; }
  a { color: inherit; text-decoration: none; }
  .stamp { box-shadow: none; transform: none; }
  tbody tr:hover { background: none; }
}
.print-head { display: none; }

/* ===== Розділи: власні правила лише в своєму маркері ===== */
/* --- R-DOCS --- */
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.next-step .form-actions { margin-top: 0; }
.other-steps { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s3) 0; }
.other-steps form { max-width: 280px; }
.doc-tools { margin-top: var(--s3); }
.add-file > summary, .more-filters > summary, .journal-export > summary, .auto-fill > summary { cursor: pointer; color: var(--stamp); font-weight: 500; }
.add-file form { margin-top: var(--s2); }
ol.history { list-style: none; padding: 0; margin: 0 0 var(--s3); }
ol.history li { padding: 6px 0; border-bottom: 1px dotted var(--rule); }
ol.history time { color: var(--pencil); font-size: var(--fs-s); margin-right: var(--s2); }
.filters .year { width: 7em; }
.more-filters { flex-basis: 100%; order: 10; font-size: var(--fs-s); }
.filters-more { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-top: var(--s2); }
.doc-table td:first-child { width: 1%; white-space: nowrap; }
.tpl-group h2 .mod { font: 600 var(--fs-l)/1.2 var(--font-doc); color: var(--ink); gap: var(--s2); }
.tpl-group h2 .mod::before { width: 6px; height: 18px; }
.tpl-list { list-style: none; padding: 0; margin: 0; }
.tpl-list li { padding: 10px 0; border-top: 1px solid var(--rule); }
.tpl-list a { font-family: var(--font-doc); }
.tpl-list small { display: block; }
.auto-fill { margin: 0 0 var(--s3); }
.auto-fill > .hint { margin: var(--s2) 0; }
.journal-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--s2) var(--s3); border-bottom: 2px solid var(--rule-strong); margin: 0 0 var(--s3); }
.journal-bar .tabs { border-bottom: 0; margin: 0; }
.year-switch { display: flex; gap: var(--s3); align-items: baseline; padding-bottom: var(--s2); }
.journal td.ref { overflow-wrap: anywhere; max-width: 16ch; font-size: var(--fs-s); }
.journal-export { margin-top: var(--s3); }
.journal-export form { margin-top: var(--s2); }
.journal-print-title { display: none; }
@media (max-width: 960px) {
  .doc-table .opt { display: none; }
  .journal .wide { display: none; }
  .other-steps form { max-width: none; }
}
@media print {
  .journal-print-title { display: block; text-align: center; }
  .journal .wide { display: table-cell; }
  .journal th, .journal td { border: 1px solid #000; font-size: 10pt; }
  .journal-bar, .journal-export { display: none; }
}
/* --- R-PEOPLE --- */
/* Майстер прийняття: кроки-посилання, вибір «нова / наявна особа» (без :has обидва блоки видно — це прийнятно) */
.hire-steps { gap: var(--s2) var(--s3); }
.hire-steps a { color: var(--pencil); text-decoration: none; font-weight: 500; }
.hire-steps a:hover { color: var(--stamp); text-decoration: underline; }
.hire fieldset { scroll-margin-top: var(--s3); }
.hire-mode { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0 0 var(--s3); }
.hire-mode label { margin: 0; }
.hire:has(#mode-new:checked) .hire-existing, .hire:has(#mode-existing:checked) .hire-new { display: none; }
.hire details, .form.panel details { margin: 0 0 var(--s3); }
.hire details > summary, .form.panel details > summary { cursor: pointer; color: var(--stamp); font-weight: 500; margin-bottom: var(--s2); }
.hire-summary h2 { margin-top: 0; font-size: 16px; }
.hire-summary ul { margin: 0; padding-left: 20px; }
/* «Прийнято»: нумерований чекліст наступних кроків */
.next-steps { margin: 0; padding-left: 24px; }
.next-steps li { padding: var(--s2) 0; border-bottom: 1px dotted var(--rule); }
.next-steps li p { margin: 2px 0 0; }
/* ВО: чипи попереджень можуть переноситись; порожній стан-пояснення про наказ */
.vo-warn .chip { white-space: normal; line-height: 1.25; margin: 0 0 var(--s1); }
.vo-unlock { margin-bottom: var(--s3); }
.vo-unlock a { display: inline-block; margin-top: var(--s1); }
.tabs .muted { font-weight: 400; }
.checklist label { margin: 0; display: inline; }
/* Рядки штатного розпису у формі */
.staff-lines td { padding: 6px var(--s2); }
.staff-lines select { min-width: 200px; }
.staff-lines input.num { width: 8em; text-align: right; }
/* Друкована форма штатного розпису «як у бухгалтера» */
.staff-form { background: var(--paper); padding: var(--s4) var(--s4) var(--s3); font-family: "Times New Roman", var(--font-doc); border: 1px solid var(--rule); border-radius: var(--radius); }
.staff-form p { max-width: none; }
.staff-form .approved { margin-left: auto; width: 45%; min-width: 220px; }
.staff-form h2 { text-align: center; margin: var(--s4) 0 var(--s1); letter-spacing: .1em; font-family: inherit; }
.staff-form .period { text-align: center; margin-bottom: var(--s3); }
.staff-form table { border: 1px solid #000; margin: 0; }
.staff-form th, .staff-form td { border: 1px solid #000; padding: 5px 6px; vertical-align: top; color: var(--ink); font: inherit; }
.staff-form th { text-align: center; font-size: var(--fs-s); }
.staff-form tbody tr:hover { background: none; }
.staff-form .num { text-align: right; }
.staff-form .sign { margin-top: 40px; display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; }
@media print {
  @page staff { size: A4 landscape; margin: 15mm; }
  .staff-form { page: staff; padding: 0; border: 0; font-size: 12pt; }
  .staff-form .table-wrap { overflow: visible; }
}
/* --- R-COMPANY --- */
/* НКЕК: деталі виду діяльності — лише для позначених; перелік областей — лише для «окремих областей» */
.nkek-codes h3 { font: 500 var(--fs-s)/1 var(--font-ui); color: var(--pencil); margin: var(--s3) 0 var(--s1); }
.nkek-code { border-top: 1px solid var(--rule); padding: var(--s2) 0; }
.nkek-code > label { margin: 0; }
.nkek-code .detail { margin: var(--s2) 0 var(--s1) 26px; padding-left: var(--s3); border-left: 2px solid var(--stamp-tint); }
.nkek-code .detail label { margin-bottom: var(--s2); }
.nkek-code:not(.open):not(:has(> label input:checked)) .detail { display: none; }
.nkek-code:has(> label input:checked) > label { font-weight: 500; }
.territory:has(input[name=all_regions][value="1"]:checked) .regions { display: none; }
.regions { columns: 2 260px; margin: var(--s2) 0 var(--s3); }
.regions label { break-inside: avoid; margin-bottom: var(--s1); }
.regions small { color: var(--pencil); }
.nkek-summary { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s3); margin: 0 0 var(--s3); }
.nkek-summary h2 { margin-top: 0; }
/* Шапка документів — як на папері */
.paper-header { background: var(--paper); box-shadow: var(--shadow-sheet); border-radius: 2px; padding: var(--s4) var(--s4) var(--s3); max-width: 640px; margin: 0 0 var(--s3);
  font: 13px/1.45 var(--font-doc); text-align: center; }
.paper-header div { border-bottom: 1px solid var(--ink); padding-bottom: var(--s1); }
.paper-header p { margin: 0 auto; max-width: none; }
.paper-header p:first-child { font-weight: 600; font-size: 15px; }
/* Прогрес внесків, чеклисту */
progress { width: 100%; max-width: 360px; height: 10px; accent-color: var(--olive-ok); vertical-align: middle; }
.quiet-area { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px dashed var(--rule-strong); font-size: var(--fs-s); color: var(--pencil); }
.quiet-area p { margin-bottom: var(--s2); }
.transition { display: inline-flex; flex-wrap: wrap; gap: var(--s2); align-items: end; margin: 0 var(--s2) var(--s2) 0; }
/* --- R-DAILY --- */
/* Календар: панель навігації + фільтр */
.cal-bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: end; justify-content: space-between; margin: 0 0 var(--s3); }
.cal-bar .filters { margin: 0; padding: var(--s2) var(--s3); }
.cal-nav { display: flex; flex-wrap: wrap; gap: var(--s2); }
/* Сітка місяця */
table.calendar { table-layout: fixed; border: 1px solid var(--rule); }
table.calendar th { text-align: center; }
table.calendar abbr { text-decoration: none; }
table.calendar td { height: 92px; padding: 4px; border: 1px solid var(--rule); background: var(--paper); }
table.calendar tbody tr:hover { background: none; }
table.calendar td.out { background: transparent; }
table.calendar td.weekend { background: #FBF6EC; }
table.calendar td.today { box-shadow: inset 0 0 0 2px var(--stamp); }
table.calendar .d { display: block; font: 600 13px/1.4 var(--font-doc); color: var(--pencil); margin-bottom: 2px; }
table.calendar td.today .d { color: var(--stamp); }
.cal-task { display: block; margin: 0 0 3px; padding: 2px 6px; font-size: 12px; line-height: 1.3; color: var(--ink); text-decoration: none; font-weight: 400;
  background: var(--sheet); border-left: 3px solid var(--c, var(--m-other)); border-radius: 0 3px 3px 0; overflow-wrap: anywhere; }
.cal-task:hover { color: var(--stamp); text-decoration: underline; }
.cal-task.late { color: var(--redpen); background: var(--redpen-tint); font-weight: 500; }
.cal-task.closed { color: var(--pencil); text-decoration: line-through; }
.cal-list { display: none; }
@media (max-width: 960px) { table.calendar { display: table; } }
@media (max-width: 720px) {
  .cal-grid, table.calendar { display: none; }
  .cal-list { display: block; }
}
/* Правила строків */
.rules-list .rule { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s1) var(--s3); padding: 10px 0; border-top: 1px solid var(--rule); }
.rules-list .rule a.title { font-weight: 500; color: var(--ink); text-decoration: none; }
.rules-list .rule a.title:hover { color: var(--stamp); text-decoration: underline; }
.rules-list .rule p { margin: 2px 0 0; font-size: var(--fs-s); color: var(--pencil); }
.rules-list .rule .go { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: start; justify-content: end; }
.rules-list .rule.off a.title { color: var(--pencil); }
/* Налаштування: зміст розділів */
.toc { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); padding: 0; margin: 0 0 var(--s3); list-style: none; font-size: var(--fs-s); }
.ics-url { display: block; padding: var(--s2) var(--s3); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); overflow-wrap: anywhere; font-size: var(--fs-s); margin: 0 0 var(--s2); }
/* Вхід */
.auth .brand { font: 600 var(--fs-s)/1 var(--font-ui); color: var(--pencil); letter-spacing: .04em; text-transform: uppercase; margin-bottom: var(--s2); }
.auth .form button { width: 100%; }
@media (max-width: 720px) {
  .rules-list .rule { grid-template-columns: minmax(0, 1fr); }
  .rules-list .rule .go { justify-content: start; }
}
