/* АУБ · Нормотворчий агент. Дизайн-система 2026-11 «Pine»: палітра Pine / Misty / Fluorescent / Frosty
   (референс власника, 24.11.2026), інклюзивні розміри: основний текст 17 px, кнопки й поля від 48 px,
   контраст WCAG 2.2 AA (перевірено: Pine на білому 11.7:1, Pine на Fluorescent 10.1:1, приглушений текст 6.8:1).
   Fluorescent — лише фон під темним текстом або акцент на Pine, ніколи текст на світлому. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-wght-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-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-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 {
  /* палітра */
  --pine: #00403D;          /* основний: кнопки, заголовки, навігація */
  --pine-strong: #002E2C;   /* наведення */
  --misty: #B3CFCD;
  --lime: #D9FF00;          /* Fluorescent: акцент лише під темним текстом */
  --lime-strong: #C6EA00;
  --frosty: #E4E9E9;
  /* поверхні й текст */
  --bg: var(--frosty);
  --surface: #FFFFFF;
  --surface-2: #F3F6F6;
  --pine-tint: #E6F0EF;
  --line: #D5DEDD;
  --line-strong: #6E8482;   /* межі полів: 4:1 на білому (WCAG 1.4.11) */
  --text: #0E1C1B;
  --text-2: #24413F;
  --muted: #48605E;         /* 6.8:1 на білому */
  --subtle: #5A706E;        /* 5.3:1 на білому */
  /* стани */
  --ok-bg: #DDF2E6;   --ok: #0A5A36;
  --warn-bg: #FFF0BF; --warn: #6B4A00; --warn-line: #F0D27A; --warn-surface: #FFF8DF;
  --bad-bg: #FDE3DA;  --bad: #A3260E;  --bad-line: #F4B49C; --bad-surface: #FFF4F0;
  --role-bg: #ECEBFB; --role: #3D3799;
  /* сумісність зі старими назвами */
  --accent: var(--pine); --accent-strong: var(--pine-strong); --accent-soft: var(--pine-tint); --accent-tint: var(--pine-tint);
  /* форма */
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 40, 38, 0.06), 0 4px 16px rgba(0, 40, 38, 0.05);
  --focus-ring: 0 0 0 3px var(--surface), 0 0 0 6px var(--pine);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* сітка: 12 колонок, ринва 24 px (телефон 16 px), крок відступів 8 px, рядок тексту кратний 4 px */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --gutter: 24px;
  --content-max: 1600px;   /* вміст займає всю робочу область до 1600 px; ширші екрани — по центру, з однаковими краями */
  --sidebar: 288px;
  --bottom-nav: 72px;
  /* шкала: розмір / висота рядка */
  --t-xs: 14px;  --lh-xs: 20px;
  --t-sm: 15px;  --lh-sm: 22px;
  --t-md: 17px;  --lh-md: 26px;
  --t-lg: 18px;  --lh-lg: 28px;
  --t-h3: 18px;  --lh-h3: 24px;
  --t-h2: 22px;  --lh-h2: 28px;
  --t-h1: 32px;  --lh-h1: 40px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Якір і фокус не ховаються під закріпленою верхньою панеллю (і нижньою навігацією на телефоні). */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: var(--t-md); line-height: var(--lh-md); font-feature-settings: "cv11", "ss01"; hyphens: manual; }
/* Переноси: абзаци без «висячих» слів, заголовки збалансовані, керувальні елементи не ламаються. */
p, li, dd, .lede, .hint, .notice span { text-wrap: pretty; }
.btn, .tab, .nav-link, .seg span, .role-pick, .bottom-nav span, .table th { white-space: nowrap; }
.mono, .case-meta, .crumbs { overflow-wrap: anywhere; }
::selection { background: var(--lime); color: var(--pine); }
* { scrollbar-color: var(--misty) transparent; scrollbar-width: thin; }
a { color: var(--pine); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--pine-strong); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; margin: 0; color: var(--text); }
h1 { font-size: var(--t-h1); line-height: var(--lh-h1); font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); line-height: var(--lh-h2); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: var(--t-h3); line-height: var(--lh-h3); font-weight: 650; }
p { margin: 0; }
legend { padding: 0; }
fieldset { min-width: 0; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); line-height: var(--lh-sm); }
.stack { display: flex; flex-direction: column; gap: var(--s5); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s3); }
.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
/* 12-колонкова сітка для складних екранів */
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: 1 / -1; }
.between { justify-content: space-between; }
.skip-link { position: absolute; left: 16px; top: -64px; background: var(--lime); color: var(--pine); padding: 12px 16px;
  border-radius: var(--radius-sm); z-index: 50; font-weight: 700; }
.skip-link:focus { top: 16px; }

/* ---------------------------------------------------------------- оболонка */
.page { min-height: 100vh; }
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; min-height: 64px; padding: 10px max(40px, calc((100% - var(--content-max)) / 2));
  background: rgba(228, 233, 233, 0.92);
  backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crumbs { font-size: 15px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.content { width: 100%; max-width: calc(var(--content-max) + 2 * 40px); margin: 0 auto; padding: var(--s2) 40px var(--s7);
  display: flex; flex-direction: column; gap: var(--s5); }
.content > * { width: 100%; max-width: var(--content-max); }
.lede { font-size: var(--t-md); line-height: var(--lh-md); color: var(--muted); max-width: 68ch; }
.page-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.page-head > .stack-sm { flex: 1 1 420px; }

/* бічна навігація (Pine) */
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--pine); color: var(--frosty);
  display: flex; flex-direction: column; gap: 24px; padding: 24px 16px; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 4px 8px 8px; color: #fff; text-decoration: none; }
.brand-row:hover { color: #fff; }
.logo-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--lime); color: var(--pine);
  font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name strong { font-size: 17px; line-height: 22px; white-space: nowrap; }
.brand-name span { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--misty); white-space: nowrap; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group-title { font-size: 14px; font-weight: 600; color: var(--misty); padding: 0 12px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--frosty); font-size: 16px; font-weight: 500; text-decoration: none; }
.nav-link svg { flex-shrink: 0; opacity: .9; }
.nav-link:hover { background: rgba(255, 255, 255, 0.09); color: #fff; text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--lime); color: var(--pine); font-weight: 700; }
.nav-link[aria-current="page"] svg { opacity: 1; }
.nav :focus-visible { outline-color: var(--lime); }
.nav-user { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07); }
.nav-user-row { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.nav-user-row:hover { color: #fff; }
.nav-user-row .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.nav-user-row .who strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-row .who span { font-size: 14px; color: var(--misty); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--misty); color: var(--pine);
  font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.btn-nav { background: transparent; border-color: rgba(255, 255, 255, 0.35); color: #fff; width: 100%; }
.btn-nav:hover { background: rgba(255, 255, 255, 0.1); border-color: #fff; color: #fff; }

/* телефон: верхня смуга й нижнє меню */
.mobile-bar, .bottom-nav { display: none; }
.menu-dialog { border: 0; padding: 0; margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(360px, 92vw);
  background: var(--pine); color: var(--frosty); }
.menu-dialog::backdrop { background: rgba(0, 20, 19, 0.55); }
.menu-dialog .nav { position: static; height: auto; min-height: 100%; }
.menu-close { align-self: flex-end; }

/* ---------------------------------------------------------------- елементи */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px; max-width: 100%;
  padding: 0 20px; border-radius: var(--radius-sm); border: 2px solid var(--pine); background: var(--surface);
  color: var(--pine); font: inherit; font-size: 16px; font-weight: 650; line-height: 1.2; text-decoration: none; cursor: pointer;
  text-align: center; transition: background-color .15s cubic-bezier(.16, 1, .3, 1), border-color .15s, color .15s; }
.btn:hover { background: var(--pine-tint); color: var(--pine-strong); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn-primary:hover { background: var(--pine-strong); border-color: var(--pine-strong); color: var(--lime); }
.btn-accent { background: var(--lime); border-color: var(--lime); color: var(--pine); }
.btn-accent:hover { background: var(--lime-strong); border-color: var(--lime-strong); color: var(--pine-strong); }
.btn-danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
.btn-danger:hover { background: var(--bad-surface); color: var(--bad); border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled], .btn[aria-disabled="true"] { background: #E3E8E8; border-color: #E3E8E8; color: var(--muted); cursor: not-allowed; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; min-height: 52px; font-size: 17px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 18px; border-radius: 14px; }
.htmx-request .btn-primary, .btn-primary.htmx-request { opacity: .75; cursor: progress; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .label { font-size: 16px; font-weight: 600; color: var(--text); }
.input, select.input, textarea.input { min-height: 52px; padding: 0 14px; border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm); font: inherit; font-size: 17px; color: var(--text); background: var(--surface); width: 100%; }
select.input { padding-right: 40px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2300403D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea.input { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.55; }
input[type="file"].input { padding: 10px 14px; }
.input::placeholder { color: var(--subtle); }
.input:hover { border-color: var(--pine); }
.input:focus-visible { outline: none; border-color: var(--pine); box-shadow: 0 0 0 4px var(--lime); border-radius: var(--radius-sm); }
.input[aria-invalid="true"] { border-color: var(--bad); }
/* Лише для читання: видно, що поле не редагується, але текст лишається контрастним. */
.input[readonly] { background: var(--surface-2); border-style: dashed; border-color: var(--line); cursor: default; }
.input[readonly]:hover { border-color: var(--line); }
.hint { font-size: 15px; color: var(--muted); line-height: 1.5; }
.error-text { font-size: 15px; color: var(--bad); font-weight: 600; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; color: var(--text-2); line-height: 1.5; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--pine); flex-shrink: 0; }
.check-lg { padding: 6px 0; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--pine); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: 1 / -1; }

/* Позначка стану: НЕ натискається. Прямокутна, без рамки й тіні, курсор звичайний — так її не сплутати з кнопкою. */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 650;
  padding: 3px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 0; cursor: default;
  max-width: 100%; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-accent { background: var(--pine-tint); color: var(--pine); box-shadow: inset 0 0 0 1px var(--misty); }
.chip-lime { background: var(--lime); color: var(--pine); }
.chip-role { background: var(--role-bg); color: var(--role); }
.chip-info { background: var(--pine-tint); color: var(--pine); }

.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column;
  gap: 16px; border: 0; box-shadow: var(--shadow); margin: 0; }
fieldset.panel { border: 0; }
.panel > legend { float: left; width: 100%; margin-bottom: 4px; }
.panel > legend + * { clear: both; }
label.panel { cursor: pointer; border: 2px solid transparent; }
label.panel:has(input:checked) { border-color: var(--pine); background: var(--pine-tint); }
label.panel:hover { border-color: var(--misty); }
.panel-quiet { background: var(--pine-tint); border-radius: var(--radius); padding: 18px 20px; }
/* Розгортний блок: стрілка праворуч показує, що його можна відкрити. */
summary { cursor: pointer; color: var(--pine); font-weight: 650; list-style: none; display: flex; align-items: center; gap: 10px;
  min-height: 44px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; flex-shrink: 0; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { text-decoration: underline; text-underline-offset: 3px; }
details.panel > summary { font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 700; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); font-size: 16px;
  line-height: 1.5; border: 2px solid; }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice-warn { background: var(--warn-surface); border-color: var(--warn-line); color: var(--warn); }
.notice-bad { background: var(--bad-surface); border-color: var(--bad-line); color: var(--bad); }
.notice-ok { background: #EEF8F2; border-color: #A9DABB; color: var(--ok); }
.notice-info { background: var(--pine-tint); border-color: var(--misty); color: var(--pine); }
/* усередині картки — без «картки в картці»: підказка стає рядком з іконкою, таблиця й панель дій — частинами картки */
.panel .notice { background: transparent; border: 0; padding: 4px 0; border-radius: 0; }
.panel .table-wrap { box-shadow: none; border-radius: 0; background: transparent; }
.panel .action-bar { box-shadow: 0 -1px 0 var(--line); border-radius: 0; padding: 14px 0; bottom: 0; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { min-height: 48px; padding: 0 20px; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650;
  color: var(--pine); text-decoration: none; border-radius: 999px; background: var(--surface); border: 2px solid var(--misty); cursor: pointer; }
.tab:hover { border-color: var(--pine); text-decoration: none; }
.tab[aria-current="page"] { background: var(--pine); color: #fff; }

.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; padding: 14px 16px; font-size: 15px; font-weight: 650; color: var(--text-2); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td, .table th[scope="row"] { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th[scope="row"] { background: transparent; font-weight: 500; color: var(--text); white-space: normal; }
.table tr:last-child td, .table tr:last-child th[scope="row"] { border-bottom: 0; }
.table-matrix { font-size: 15px; min-width: 980px; }

.list-row { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); flex-wrap: wrap; }
.initials { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: var(--misty);
  color: var(--pine); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.empty { background: var(--surface); border: 2px dashed var(--misty); border-radius: var(--radius-lg); padding: 40px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.empty strong { font-size: 20px; }
.empty p { color: var(--muted); max-width: 56ch; }

/* ---------------------------------------------------------------- кейс */
.case-head { display: flex; flex-direction: column; gap: 10px; }
.case-meta { font-size: 15px; color: var(--muted); }
.case-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; background: var(--surface);
  padding: 8px; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.case-nav a { display: flex; flex-direction: column; gap: 2px; justify-content: center; min-height: 64px; padding: 8px 14px;
  border-radius: 14px; text-decoration: none; color: var(--pine); }
.case-nav a:hover { background: var(--pine-tint); }
.case-nav a strong { font-size: 16px; line-height: 24px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.case-nav .t-sub { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--muted); font-weight: 500; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.case-nav .t-short { display: none; }
.case-nav a[aria-current="page"] { background: var(--pine); color: #fff; }
.case-nav a[aria-current="page"] .t-sub { color: var(--misty); }
.step-badge { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; background: var(--pine-tint); color: var(--pine); flex-shrink: 0; }
.case-nav a[aria-current="page"] .step-badge { background: var(--lime); color: var(--pine); }
.step-badge.done { background: var(--ok-bg); color: var(--ok); }
.next-step { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--pine); color: #fff; padding: 18px 22px; border-radius: var(--radius-lg); }
.next-step .what { display: flex; flex-direction: column; gap: 2px; flex: 1 1 320px; }
.next-step .what strong { font-size: 18px; }
.next-step .what span { color: var(--misty); font-size: 16px; }
.next-step .btn-accent:focus-visible { box-shadow: 0 0 0 3px var(--pine), 0 0 0 6px var(--lime); }
.next-step.calm { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.next-step.calm .what span { color: var(--muted); }
.check-item { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; }
.check-item .chip { padding: 4px 8px; justify-content: center; }
/* карта змін: чинний текст і пропозиція поруч, мета правки — окремою колонкою */
.map-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.map-item { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 24px;
  display: flex; flex-direction: column; gap: var(--s4); }
.map-head { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.map-code { font-size: var(--t-lg); line-height: var(--lh-lg); }
.map-place { font-weight: 600; color: var(--text-2); }
.map-src { font-size: var(--t-sm); color: var(--muted); }
.map-src.ok { color: var(--ok); } .map-src.bad { color: var(--bad); }
.map-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) minmax(0, 3fr); gap: var(--s5); }
.map-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.col-label { font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 650; color: var(--muted); }
.map-text { white-space: pre-wrap; overflow-wrap: break-word; }
.map-current { color: var(--text-2); }
.map-why { background: var(--pine-tint); border-radius: var(--radius-sm); padding: 12px 14px; align-self: start; }
.map-why .map-text { font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--pine); }
.map-edit { border-top: 1px solid var(--line); padding-top: 4px; }
/* що агент не зміг перевірити: спокійне попередження, а не помилка */
.gap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.search-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.search-log li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--s2); padding: var(--s2) 0;
  border-top: 1px solid var(--line); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.search-log li:first-child { border-top: 0; }
.search-log li.bad strong { color: var(--bad); }
.goal-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--s3); }
.goal-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 15px;
  line-height: 1.5; overflow-wrap: anywhere; }
.goal-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.goal-checks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--s2); padding: var(--s2) 0;
  border-top: 1px solid var(--line); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.goal-checks li:first-child { border-top: 0; }
.goal-checks li.ok .goal-check-icon { color: var(--ok); }
.goal-checks li.wait .goal-check-icon { color: var(--warn); }
.goal-checks li.bad .goal-check-icon, .goal-checks li.bad strong { color: var(--bad); }
.run-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--s3); margin: 0; }
.run-facts dt { font-size: var(--t-sm); color: var(--muted); }
.run-facts dd { margin: 0; font-size: var(--t-sm); }
.run-sources { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--s3); font-size: 15px;
  line-height: 1.5; overflow-wrap: anywhere; }
.pre-line { white-space: pre-line; }
details.fold > summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); min-height: 44px;
  cursor: pointer; }
details.fold > summary .fold-title { font-size: var(--t-h2); line-height: var(--lh-h2); font-weight: 700; flex: 1;
  min-width: min(100%, 240px); color: var(--text); }
details.fold > summary:hover .fold-title { text-decoration: underline; text-underline-offset: 4px; }
details.fold > summary .small { font-weight: 400; }
.doc-head { font-size: var(--t-md); line-height: var(--lh-md); font-weight: 650; margin-top: var(--s2); }
/* Зміни між версіями: не лише колір — закреслення й підкреслення (і підпис для читачів екрана). */
del.diff-del { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; }
ins.diff-ins { background: var(--ok-bg); color: var(--ok); text-decoration: underline; text-underline-offset: 3px; }
a.map-src { text-decoration: underline; text-underline-offset: 2px; }
.run-modes-title { font-size: var(--t-h3); line-height: var(--lh-h3); }
.run-modes-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.run-modes-row .btn { min-width: min(100%, 220px); }
.gap-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--s3); align-items: start;
  padding: 14px 0; border-top: 1px solid var(--line); }
.gap-item p { color: var(--text-2); }
.gap-icon { color: var(--warn); padding-top: 3px; }
.gap-done .gap-icon { color: var(--ok); }
.gap-done p { color: var(--muted); }
/* докази: згорнуті картки, розгорнуті лише ті, що чекають дії */
details.ev { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) 0; border-top: 1px solid var(--line); }
details.ev > summary { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; align-items: start; color: var(--text); }
details.ev > summary::before { margin-top: 8px; color: var(--pine); }
details.ev > summary strong { font-size: var(--t-md); line-height: var(--lh-md); }
details.ev > summary .small { display: block; font-weight: 400; }
details.ev[open] > summary { margin-bottom: 4px; }

/* старий степер (лишається для сторінок, які ще його використовують) */
.stepper { list-style: none; margin: 0; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px;
  background: var(--surface); border-radius: var(--radius); }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.stepper-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; border: 2px solid var(--line); color: var(--muted); }
.stepper .done { color: var(--text-2); }
.stepper .done .stepper-dot { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.stepper .current { color: var(--pine); font-weight: 700; }
.stepper .current .stepper-dot { background: var(--lime); border-color: var(--lime); color: var(--pine); }

.case-list { display: flex; flex-direction: column; gap: 10px; }
.case-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto 24px; gap: 16px; align-items: center; padding: 18px 22px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); text-decoration: none; color: inherit;
  border: 2px solid transparent; }
.case-row:hover { border-color: var(--pine); text-decoration: none; color: inherit; }
.case-row .go { color: var(--pine); }
.case-row strong { font-size: 18px; display: block; color: var(--text); }
.case-row .case-sub { font-size: 15px; color: var(--muted); font-weight: 400; }
.case-row .case-next { font-size: 15px; color: var(--pine); font-weight: 600; }
.case-row .tabular { font-size: 15px; font-weight: 600; color: var(--muted); }
.filter-bar { display: flex; gap: 12px 16px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .hint { padding-bottom: 14px; }
.filter-bar .field { flex: 0 1 280px; }

.dl { margin: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); row-gap: 12px; column-gap: 16px; font-size: 16px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; }
.quote { margin: 0; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 17px; line-height: 1.65;
  white-space: pre-wrap; max-width: 75ch; overflow-wrap: anywhere; }
.values-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--misty); border-top-color: var(--pine);
  animation: spin .9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.rec { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius); flex-wrap: wrap; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); }
.rec[data-state="idle"] .rec-dot { background: var(--misty); }
.rec strong { display: inline-flex; gap: 8px; align-items: center; }
.rec-more { flex-basis: 100%; }
.rec-more summary { cursor: pointer; font-weight: 600; color: var(--pine); min-height: 44px; display: inline-flex; align-items: center; }

/* дія внизу форми: завжди видно на довгих сторінках */
.action-bar { position: sticky; bottom: 12px; z-index: 4; display: flex; gap: 12px 16px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; padding: 14px 18px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0, 40, 38, 0.16); }
.action-bar .hint { flex: 1 1 260px; }

/* ---------------------------------------------------------------- ролі й права */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius); background: var(--surface-2);
  border: 2px solid transparent; cursor: pointer; }
.choice:hover { border-color: var(--misty); }
.choice:has(input:checked) { border-color: var(--pine); background: var(--pine-tint); }
.choice input { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }
.choice-body { display: flex; flex-direction: column; gap: 4px; }
.choice-title { font-weight: 700; font-size: 17px; line-height: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.choice-text { font-size: 15px; color: var(--muted); }
.perm-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.perm-group + .perm-group { margin-top: 12px; }
.perm-group h3 { padding-bottom: 4px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 140px; gap: 12px 16px; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--line); }
.perm-list > .perm-row:last-child { border-bottom: 0; }
.perm-row-simple { display: block; }
.perm-name { display: flex; flex-direction: column; gap: 4px; }
.perm-name strong { font-size: 17px; }
.perm-name .chip { align-self: flex-start; }
.perm-result { justify-self: end; }
.segmented { display: inline-flex; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 600;
  color: var(--text-2); white-space: nowrap; }
.seg input:hover + span { background: var(--pine-tint); }
.seg input:checked + span { background: var(--pine); color: #fff; }
.seg-deny input:checked + span { background: var(--bad); }
.seg-allow input:checked + span { background: var(--ok); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--lime); }
.role-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.role-pick { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 600; text-decoration: none; border: 2px solid transparent; }
.role-pick:hover { border-color: var(--misty); text-decoration: none; }
.role-pick[aria-current="page"] { background: var(--pine); color: #fff; }

/* ---------------------------------------------------------------- пошук документів */
.search-form { align-items: flex-end; }
.search-form > .field { flex: 1 1 420px; }
.hits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hit { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); }
.hit-title { font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 700; }
.hit-loc { font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--muted); font-weight: 600; }
.hit-excerpt { font-size: var(--t-md); line-height: var(--lh-md); color: var(--text-2); max-width: 75ch; overflow-wrap: break-word; }
.hit-excerpt mark { background: var(--lime); color: var(--pine); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.hit-meta { gap: 6px 12px; }
.text-status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 200px; }
.text-status-line { display: inline-flex; align-items: center; gap: 8px; }
.indexed { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: var(--t-sm); }

/* ---------------------------------------------------------------- шаблони з прикладу */
.tpl-blocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.tpl-block { margin: 0; min-width: 0; border: 0; border-radius: var(--radius-lg); padding: 20px; background: var(--surface);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: var(--s3); }
.tpl-block legend { float: left; width: 100%; padding: 0; font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 650; color: var(--muted); }
.tpl-block-bad { background: var(--bad-surface); box-shadow: inset 0 0 0 2px var(--bad-line); }
.tpl-block-drop .tpl-orig { text-decoration: line-through; color: var(--muted); }
.tpl-orig, .tpl-out { padding: 12px 14px; border-radius: var(--radius-sm); font-size: var(--t-md); line-height: var(--lh-md);
  white-space: pre-wrap; overflow-wrap: break-word; }
.tpl-orig { background: var(--surface-2); }
.tpl-out { border: 2px dashed var(--misty); background: var(--surface); }
.tpl-field { background: var(--lime); color: var(--pine); border-radius: 6px; padding: 1px 6px; font-weight: 650; }
.tpl-code { font-family: var(--mono); font-size: 14px; background: var(--surface-2); color: var(--text-2); border-radius: 6px; padding: 1px 6px; }
.tpl-errors { margin: 0; padding-left: 20px; color: var(--bad); font-size: var(--t-sm); font-weight: 600; }
textarea.tpl-textarea { min-height: 0; }

/* список шаблонів: велика назва, компактні дії, рідкісні дії — у меню «Ще» */
.btn-compact { min-height: 44px; padding: 0 14px; font-size: var(--t-sm); border-width: 1.5px; gap: 6px; }
.tpl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.tpl-item { display: flex; gap: var(--s4) var(--s5); align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 20px 24px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.tpl-main { display: flex; flex-direction: column; gap: 6px; flex: 1 1 420px; min-width: 0; }
.tpl-name { font-size: 22px; line-height: 28px; font-weight: 750; }
.tpl-meta { font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--muted); }
.tpl-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.tpl-actions form { margin: 0; }
details.more { position: relative; }
details.more > summary { list-style: none; }
details.more > summary::before { width: 7px; height: 7px; border-width: 2px; transform: rotate(45deg); margin: -4px 2px 0 0; order: 2; }
details.more[open] > summary::before { transform: rotate(-135deg); margin-top: 4px; }
details.more > summary:hover { text-decoration: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 280px; padding: 6px; background: var(--surface);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 40, 38, 0.18); display: flex; flex-direction: column; }
.more-menu form { margin: 0; }
.more-item { display: flex; width: 100%; min-height: 44px; align-items: center; padding: 0 14px; border-radius: 10px; border: 0; background: none;
  font: inherit; font-size: var(--t-sm); font-weight: 600; color: var(--pine); text-align: left; text-decoration: none; cursor: pointer; }
.more-item:hover { background: var(--pine-tint); text-decoration: none; }
.more-danger { color: var(--bad); }
.more-danger:hover { background: var(--bad-surface); }
.doc-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4); align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row strong { font-size: var(--t-md); line-height: var(--lh-md); font-weight: 600; }
.doc-row .tpl-actions { flex-wrap: nowrap; }

/* попередній перегляд документа: сторінка А4, поля підсвічено, повтори обведено */
.doc-page { background: #fff; color: #111; font-family: "Times New Roman", Times, serif; font-size: 18px; line-height: 1.45;
  padding: 64px 56px 64px 80px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 40, 38, .08); }
.doc-page p { margin: 0 0 10px; text-wrap: pretty; }
.doc-b { font-weight: 700; }
.doc-c { text-align: center; }
.doc-field { font-family: var(--font); font-size: .82em; font-weight: 650; background: var(--lime); color: var(--pine);
  border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.doc-loop { border: 2px dashed var(--misty); border-radius: 10px; padding: 26px 14px 6px; margin: 6px 0 12px; position: relative; }
.doc-loop-label { position: absolute; top: 4px; left: 12px; font-family: var(--font); font-size: 13px; font-weight: 650; color: var(--muted); }
.doc-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: .9em; }
.doc-table td { border: 1px solid #555; padding: 6px 8px; vertical-align: top; }
.doc-view { max-width: 860px; }
/* мініатюри у списку шаблонів */
.tpl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s5); }
.tpl-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; display: flex;
  flex-direction: column; gap: var(--s3); }
.tpl-thumb { display: block; height: 320px; overflow: hidden; border-radius: 12px; background: var(--surface-2); position: relative;
  border: 2px solid transparent; }
.tpl-thumb:hover { border-color: var(--pine); }
.tpl-thumb .doc-page { width: 560px; min-height: 792px; padding: 48px 40px 48px 56px; transform: scale(.42); transform-origin: top left;
  position: absolute; left: 50%; top: 14px; margin-left: -118px; pointer-events: none; }
.tpl-thumb::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(to bottom, rgba(243, 246, 246, 0), var(--surface-2)); }
.tpl-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tpl-card .tpl-name { font-size: var(--t-lg); line-height: var(--lh-lg); }
.tpl-card .tpl-name a { color: var(--text); text-decoration: none; }
.tpl-card .tpl-name a:hover { text-decoration: underline; }

/* повідомлення про помилку фонового запиту */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60; width: min(640px, calc(100vw - 32px));
  display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: var(--radius);
  background: var(--bad); color: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); font-size: var(--t-md); line-height: var(--lh-md); }
.toast .btn { flex-shrink: 0; background: #fff; border-color: #fff; color: var(--bad); }

/* ---------------------------------------------------------------- вхід і екрани без меню */
.auth-page { min-height: 100vh; padding: 24px; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 1040px; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; overflow: hidden; }
.auth-aside { flex: 1 1 380px; padding: 48px; background: var(--pine); color: var(--frosty);
  display: flex; flex-direction: column; gap: 28px; }
.auth-aside h1, .auth-aside h2, .auth-aside strong { color: #fff; }
.auth-aside .muted, .auth-aside .lede { color: var(--misty); }
.auth-aside a { color: var(--lime); }
.auth-main { flex: 1 1 380px; padding: 48px; display: flex; flex-direction: column; gap: 22px; }
.auth-narrow { max-width: 580px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--lime); color: var(--pine); font-size: 15px;
  font-weight: 800; display: flex; align-items: center; justify-content: center; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; font-size: 17px; }
.steps li { display: flex; gap: 12px; }
.steps b { color: var(--lime); }
.auth-main .steps b { color: var(--pine); }
.qr { width: 220px; height: 220px; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px; background: #fff; }

/* ---------------------------------------------------------------- планшет і телефон */
@media (max-width: 1100px) {
  .case-nav .t-long { display: none; }
  .case-nav .t-short { display: inline; }
  .map-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .map-why { grid-column: 1 / -1; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perm-row { grid-template-columns: minmax(0, 1fr); }
  .perm-result { justify-self: start; }
}
@media (max-width: 900px) {
  body { font-size: 17px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  .shell { display: block; }
  .shell > .nav { display: none; }
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; gap: 12px; min-height: 60px;
    padding: 8px 12px 8px 16px; background: var(--pine); color: #fff; }
  .mobile-bar .logo-mark { width: 40px; height: 40px; font-size: 14px; }
  .mobile-bar .title { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-bar .btn { min-height: 44px; border-color: rgba(255, 255, 255, .4); background: transparent; color: #fff; padding: 0 14px; }
  .mobile-bar :focus-visible { outline-color: var(--lime); }
  .topbar { display: none; }
  .content { padding: 16px 16px calc(var(--bottom-nav) + 28px); gap: 18px; }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    min-height: var(--bottom-nav); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface);
    box-shadow: 0 -4px 20px rgba(0, 40, 38, 0.12); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; border-radius: 14px; color: var(--pine); font: inherit; font-size: 13px; font-weight: 650; text-decoration: none;
    background: transparent; border: 0; cursor: pointer; padding: 0 2px; }
  .bottom-nav [aria-current="page"] { background: var(--lime); }
  .grid-2, .grid-3, .grid-4, .pair { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .dl dd { margin-bottom: 10px; }
  .values-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .panel { padding: 18px; border-radius: var(--radius); }
  .case-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px; }
  .case-nav a { min-height: 64px; padding: 6px 4px; align-items: center; }
  .case-nav a strong { flex-direction: column; gap: 4px; font-size: 14px; line-height: 18px; }
  .case-nav .t-long, .case-nav .t-sub { display: none; }
  .case-nav .t-short { display: inline; }
  .case-row { grid-template-columns: minmax(0, 1fr) 24px; gap: 6px 12px; padding: 16px; }
  .case-row > :not(.go) { grid-column: 1; }
  .case-row .go { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .case-row .chip { justify-self: start; }
  .action-bar { bottom: calc(var(--bottom-nav) + 8px); padding: 10px; }
  .action-bar .hint { display: none; }
  .action-bar > .row { width: 100%; flex-wrap: nowrap; gap: 8px; }
  .action-bar > .btn { width: 100%; }
  .action-bar .btn { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
  .action-bar .btn:not(.btn-primary) { flex: 0 1 auto; }
  .auth-page { padding: 0; align-items: stretch; }
  .auth-card { border-radius: 0; }
  .auth-aside, .auth-main { padding: 28px 20px; }
  .auth-aside { gap: 18px; }
  .page-head .btn { width: 100%; }
  .toast { bottom: calc(var(--bottom-nav) + 12px); }
  .tpl-item { padding: 16px; }
  .doc-page { padding: 28px 20px; font-size: 16px; }
  .tpl-thumb .doc-page { padding: 48px 40px 48px 56px; font-size: 18px; }
  .gap-item { grid-template-columns: 24px minmax(0, 1fr); }
  html { scroll-padding-top: 72px; scroll-padding-bottom: calc(var(--bottom-nav) + 16px); }
  .chip { white-space: normal; overflow-wrap: anywhere; }
  details.ev > summary { grid-template-columns: 14px minmax(0, 1fr); }
  details.ev > summary .chip { grid-column: 2; justify-self: start; }
  .map-cols { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .map-item { padding: 16px; }
  .gap-item form { grid-column: 2; }
  .tpl-name { font-size: 20px; }
  .tpl-actions { width: 100%; }
  .doc-row { grid-template-columns: minmax(0, 1fr); }
  .doc-row .tpl-actions { flex-wrap: wrap; }
  .more-menu { right: auto; left: 0; }
  .search-form > .field, .search-form > .btn { flex: 1 1 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
  .tabs .tab { flex-shrink: 0; padding: 0 16px; }
  .tpl-block { padding: 14px; }
  .tpl-help .dl { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .btn { white-space: normal; text-wrap: balance; padding-top: 10px; padding-bottom: 10px; }
  :root { --gutter: 16px; }
  .grid-12 > * { grid-column: 1 / -1; }
  .next-step .btn { width: 100%; }
  .segmented { display: flex; width: 100%; }
  .seg { flex: 1; }
  .seg span { justify-content: center; width: 100%; padding: 0 6px; font-size: 14px; }
  /* таблиці на телефоні — картками, якщо в комірках є data-label */
  .table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-cards td { border: 0 !important; padding: 6px 0 !important; text-align: left !important; }
  .table-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 14px; font-weight: 650; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .nav, .mobile-bar, .bottom-nav, .topbar, .action-bar { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
