/* EU Compass — стилі. Строгий стиль, близький до europa.eu (Europa Component Library): Arial, синій ЄС, жовтий акцент. */
:root {
  --blue: #004494;
  --blue-dark: #003776;
  --blue-deep: #002a5c;
  --blue-soft: #f3f6fc;
  --blue-line: #cfdaf5;
  --blue-hover: #e1e9f8;
  --yellow: #ffd617;
  --ink: #1f2330;
  --muted: #515560;
  --line: #d2d6dd;
  --bg: #ffffff;
  --bg-grey: #f5f5f5;
  --success: #467a39;
  --success-bg: #ecf3e8;
  --warning: #b05c00;
  --warning-bg: #fdf1e3;
  --error: #c4121f;
  --error-bg: #fbe9ea;
  --font: Arial, "Liberation Sans", Helvetica, sans-serif;
  --w: 1200px;
  --gutter: 16px;
  --radius: 2px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; font: 400 1rem/1.5 var(--font); color: var(--ink); background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; outline: none; }
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; box-shadow: 0 0 0 5px var(--blue-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 1.2rem + .6vw, 1.75rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code { font-size: .9em; background: var(--bg-grey); padding: 1px 4px; }
.container { max-width: var(--w); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding-top: 32px; padding-bottom: 48px; }
.narrow { max-width: 640px; }
.narrow-wide { max-width: 880px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mt { margin-top: 40px; }
.mt-s { margin-top: 20px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--yellow); color: #000; padding: 8px 16px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.inline { display: inline; }
.icon { vertical-align: -4px; flex: none; }
.req { color: var(--error); }

/* ---------- Шапка ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 84px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); }
.brand__logo { width: 52px; height: 52px; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-size: 1.35rem; font-weight: 700; color: var(--blue); letter-spacing: .01em; }
.brand__sub { font-size: .85rem; color: var(--muted); }
.site-header__tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.link-btn { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
.search-mini { display: flex; border: 1px solid var(--muted); }
.search-mini input { border: 0; padding: 8px 10px; font: inherit; width: 220px; min-width: 0; }
.search-mini button { border: 0; background: var(--blue); color: #fff; padding: 0 12px; cursor: pointer; }
.site-nav { background: var(--blue); }
.site-nav .container { display: flex; align-items: center; }
.site-nav__toggle { display: none; background: none; border: 0; color: #fff; font: inherit; font-weight: 700; padding: 12px 0; cursor: pointer; align-items: center; gap: 8px; }
.site-nav__list { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; width: 100%; }
.site-nav__list a { display: block; color: #fff; text-decoration: none; padding: 14px 16px; font-weight: 700; border-bottom: 4px solid transparent; }
.site-nav__list li:first-child a { padding-left: 0; }
.site-nav__list a:hover { background: var(--blue-dark); }
.site-nav__list a[aria-current] { border-bottom-color: var(--yellow); }
.site-nav__right { margin-left: auto; }
.site-nav__right a { font-weight: 400; }

/* ---------- Заголовок сторінки ---------- */
.page-head { background: var(--blue-soft); border-bottom: 1px solid var(--blue-line); padding: 24px 0 28px; }
.page-head--compact { padding: 16px 0 20px; }
.page-head h1 { margin-bottom: .3em; }
.page-head--compact h1 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem); }
.page-head__kicker { text-transform: uppercase; font-size: .8rem; font-weight: 700; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.page-head__lead { color: var(--muted); margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-head__progress { margin-top: 14px; max-width: 520px; }
.crumbs { font-size: .9rem; margin-bottom: 10px; color: var(--muted); }
.crumbs span { margin: 0 4px; }
.num-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; background: var(--blue); color: #fff; font-size: .7em; vertical-align: .15em; padding: 0 .3em; }

/* ---------- Кнопки й форми ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border: 2px solid var(--blue); background: #fff; color: var(--blue); font: 700 1rem/1.2 var(--font); text-decoration: none; cursor: pointer; border-radius: var(--radius); text-align: center; }
.btn:hover { background: var(--blue-hover); color: var(--blue-dark); text-decoration: none; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn--yellow { background: var(--yellow); border-color: var(--yellow); color: #000; }
.btn--yellow:hover { background: #ffe25c; color: #000; }
.btn--on-dark { border-color: #fff; background: transparent; color: #fff; }
.btn--on-dark:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn--ghost { border-color: transparent; text-decoration: underline; font-weight: 400; }
.btn--small { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; color: var(--blue); cursor: pointer; border-radius: var(--radius); }
.icon-btn:hover { background: var(--blue-hover); }
.icon-btn--danger { color: var(--error); }
.form label { display: block; font-weight: 700; margin: 14px 0 6px; }
.form label .muted { font-weight: 400; }
.form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=url], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); padding: 10px 12px; border: 1px solid var(--muted); background: #fff; border-radius: 0; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--yellow); outline-offset: 0; border-color: var(--blue-dark); }
.form button[type=submit] { margin-top: 16px; }
.form--compact label { margin: 8px 0 2px; font-size: .9rem; }
.form--compact input, .form--compact select { min-height: 36px; padding: 6px 8px; }
.label-strong { display: block; font-weight: 700; margin: 18px 0 6px; }
.pw { position: relative; }
.pw input { padding-right: 48px; }
.pw__toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 44px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.hint { background: var(--blue-soft); border-left: 4px solid var(--blue); padding: 10px 14px; font-size: .95rem; }

/* ---------- Повідомлення ---------- */
.flashes { padding-top: 16px; }
.notice { padding: 12px 16px; border-left: 4px solid var(--blue); background: var(--blue-soft); margin: 0 0 12px; }
.notice--success { border-color: var(--success); background: var(--success-bg); }
.notice--warning { border-color: var(--warning); background: var(--warning-bg); }
.notice--error { border-color: var(--error); background: var(--error-bg); }
.notice--secret { border-color: var(--yellow); background: #fffbe6; font-size: 1.05rem; font-weight: 700; }
.notice.small { padding: 8px 12px; }

/* ---------- Картки, панелі, сітки ---------- */
.card { background: #fff; border: 1px solid var(--line); padding: 20px; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.panel { background: #fff; border: 1px solid var(--line); padding: 20px; margin-bottom: 24px; }
.panel__title { font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.two-col { display: grid; gap: 32px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; background: var(--blue); color: #fff; font-size: .8rem; font-weight: 700; text-align: center; border-radius: 1em; vertical-align: .1em; }
.topic-card { display: flex; flex-direction: column; border-top: 4px solid var(--blue); }
.topic-card h3 a { text-decoration: none; }
.topic-card__num { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.topic-card__next { margin-top: auto; margin-bottom: 0; padding-top: 8px; }
.list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.list__item { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.list__item.is-active { background: var(--blue-soft); padding-left: 8px; }
.kv { list-style: none; padding: 0; margin: 0 0 16px; }
.kv li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 8px 0; gap: 12px; }

/* ---------- Прогрес ---------- */
.pbar { display: block; width: 100%; height: 10px; }
.pbar__bg { fill: #e3e6ea; }
.pbar__approved { fill: var(--blue); }
.pbar__review { fill: var(--yellow); }
.pbar__draft { fill: #8fb0e3; }
.board { border-top: 2px solid var(--blue); }
.board__section { font-size: 1rem; margin: 0; padding: 14px 0 8px; color: var(--blue); display: flex; gap: 8px; }
.board__section span { font-weight: 700; min-width: 2em; }
.board__row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.board__topic { display: flex; gap: 12px; align-items: baseline; }
.board__num { flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: .9rem; border: 1px solid var(--blue-line); }
.board__author { display: block; font-size: .85rem; color: var(--muted); }
.board__stage { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.board__legend { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 12px; }
.lg { display: inline-block; width: 14px; height: 10px; margin-right: -8px; vertical-align: -1px; }
.lg--approved { background: var(--blue); } .lg--review { background: var(--yellow); } .lg--draft { background: #8fb0e3; } .lg--empty { background: #e3e6ea; }
.stats { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stats li { background: #fff; padding: 16px; }
.stats strong { display: block; font-size: 1.8rem; color: var(--blue); }
.stats span { font-size: .9rem; color: var(--muted); }

/* ---------- Позначки стану ---------- */
.badge { display: inline-block; padding: 2px 8px; font-size: .78rem; font-weight: 700; border: 1px solid var(--line); background: #fff; color: var(--muted); white-space: nowrap; }
.badge--empty { color: var(--muted); }
.badge--draft { background: #e8f0fb; border-color: #8fb0e3; color: var(--blue-dark); }
.badge--review { background: #fff6cc; border-color: #e6c200; color: #5c4a00; }
.badge--changes { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.badge--approved { background: var(--blue); border-color: var(--blue); color: #fff; }
.badge--dirty { background: #fff; border-color: var(--blue); color: var(--blue); }

/* ---------- Головна (вхід) ---------- */
.hero { background: var(--blue); color: #fff; padding: 40px 0; }
.hero h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3.2rem); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 40px; align-items: center; }
.hero__kicker { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--yellow); }
.hero__lead { font-size: 1.15rem; max-width: 46em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; }
.hero--guide { padding: 48px 0; background: linear-gradient(90deg, var(--blue-deep), var(--blue)); }
.login-card { color: var(--ink); border-top: 6px solid var(--yellow); }
.login-card h2 { font-size: 1.4rem; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.error-code { font-size: 4rem; font-weight: 700; color: var(--blue); margin: 0; }

/* ---------- Тема: кроки, план, статті ---------- */
.steps { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.steps li > a, .steps li > span { display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 700; height: 100%; }
.steps li + li { border-left: 1px solid var(--line); }
.steps li span span, .steps li a span { width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid currentColor; }
.steps .is-current { background: var(--blue-soft); box-shadow: inset 0 -4px 0 var(--blue); }
.steps .is-current a, .steps .is-current > span { color: var(--blue); }
.steps .is-done a, .steps .is-done > span { color: var(--success); }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex: none; }
.plan-list { list-style: none; padding: 0; margin: 20px 0 12px; counter-reset: plan; }
.plan-item { border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 12px; margin-bottom: 10px; background: #fff; }
.plan-item.is-new { border-left-color: var(--yellow); }
.plan-item__head { display: flex; gap: 8px; align-items: center; }
.plan-item__num { flex: none; width: 32px; height: 32px; background: var(--blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.plan-item__title { font-weight: 700; flex: 1; min-width: 0; }
.plan-item__tools { display: flex; gap: 4px; flex: none; }
.plan-item__summary { margin-top: 8px; font-size: .95rem; }
.plan-item.is-flash { animation: flash 1s; }
@keyframes flash { from { background: #fff6cc; } to { background: #fff; } }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; z-index: 5; }
.sticky-actions .btn { margin-top: 0; }
.plan-view li { margin-bottom: 10px; }
.chapter-list { list-style: none; padding: 0; margin: 16px 0 0; }
.chapter-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.chapter-row__num { flex: none; width: 32px; height: 32px; border: 2px solid var(--blue); color: var(--blue); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.chapter-row--approved .chapter-row__num { background: var(--blue); color: #fff; }
.chapter-row--review .chapter-row__num { background: var(--yellow); border-color: #e6c200; color: #000; }
.chapter-row--changes .chapter-row__num { border-color: var(--warning); color: var(--warning); }
.chapter-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chapter-row__title { font-weight: 700; text-decoration: none; }
.chapter-row__meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Коментарі й стрічка ---------- */
.comments { list-style: none; padding: 0; margin: 0 0 16px; }
.comment { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin-bottom: 14px; }
.comment--editor, .comment--admin, .comment--coordinator { border-left-color: var(--yellow); }
.comment__head { margin-bottom: 4px; }
.comment__body p { margin-bottom: .5em; }
.feed { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed__who { font-weight: 700; }
.feed__time { display: block; color: var(--muted); font-size: .8rem; }

/* ---------- Редактор статті ---------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-side { position: sticky; top: 12px; }
.plan-hint { background: var(--bg-grey); padding: 10px 14px; font-size: .95rem; margin-bottom: 0; }
.input-title { font-size: 1.25rem !important; font-weight: 700; }
.editor { background: #fff; }
.editor-page .ql-toolbar.ql-snow { border: 1px solid var(--muted); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 4; background: #fff; padding: 6px; font-family: var(--font); }
.editor-page .ql-container.ql-snow { border: 1px solid var(--muted); border-top: 0; font: 1.05rem/1.6 var(--font); }
.editor-page .ql-editor { min-height: 420px; padding: 16px 18px; }
.editor-page .ql-editor h2 { font-size: 1.45rem; margin: 1em 0 .4em; }
.editor-page .ql-editor h3 { font-size: 1.2rem; margin: 1em 0 .4em; }
.editor-page .ql-editor p { margin-bottom: .7em; }
.editor-page .ql-editor img { display: block; margin: 12px 0; max-height: 420px; }
.editor-page .ql-editor.ql-blank::before { color: #8a8f99; font-style: normal; left: 18px; }
.editor-page .ql-snow .ql-picker.ql-header { width: 165px; }
.editor-page .ql-editor:focus-visible { outline: none; box-shadow: none; }
.editor-page .ql-container.ql-snow:focus-within { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.editor-page .ql-snow .ql-picker.ql-header .ql-picker-label::before, .editor-page .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: 'Звичайний текст'; }
.editor-page .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, .editor-page .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: 'Підзаголовок'; }
.editor-page .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, .editor-page .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: 'Малий підзаголовок'; }
.editor-page .ql-snow .ql-tooltip { z-index: 6; }
.editor-page .ql-snow .ql-tooltip[data-mode=link]::before { content: 'Адреса посилання:'; }
.editor-page .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: 'Зберегти'; }
.editor-page .ql-snow .ql-tooltip::before { content: 'Перейти:'; }
.editor-page .ql-snow .ql-tooltip a.ql-action::after { content: 'Змінити'; }
.editor-page .ql-snow .ql-tooltip a.ql-remove::before { content: 'Прибрати'; }
.editor.is-readonly .ql-toolbar { display: none; }
.editor.is-readonly .ql-container { border-top: 1px solid var(--muted) !important; }
.savebar { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; position: sticky; bottom: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); z-index: 3; margin-bottom: 20px; }
.savebar__status { flex: 1; color: var(--success); font-weight: 700; font-size: .95rem; min-width: 160px; }
.savebar__status.is-pending { color: var(--muted); }
.savebar__status.is-error { color: var(--error); }
.savebar__words { color: var(--muted); font-size: .9rem; }
.fold > summary { cursor: pointer; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; list-style: none; flex-wrap: wrap; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: '+'; margin-left: auto; font-size: 1.5rem; line-height: 1; color: var(--blue); }
.fold[open] > summary::after { content: '−'; }
.fold[open] > summary { margin-bottom: 12px; }
.fold__hint { font-weight: 400; font-size: .9rem; color: var(--muted); }
.source-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1.4fr) 40px; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); align-items: end; }
.source-row label { font-size: .8rem; font-weight: 700; color: var(--muted); display: block; }
.map { height: 380px; border: 1px solid var(--line); background: var(--bg-grey); z-index: 0; }
.map--big { height: min(70vh, 640px); }
.map--edit { height: 340px; margin-top: 10px; }
.map-search { display: flex; gap: 8px; }
.map-search .btn { flex: none; }
.map-results { border: 1px solid var(--line); margin-top: 4px; max-height: 220px; overflow: auto; }
.map-results button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.map-results button:hover { background: var(--blue-hover); }
.places-list { margin-top: 12px; }
.place-row { border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 10px; margin-bottom: 8px; display: grid; grid-template-columns: 28px minmax(0, 1fr) 40px; gap: 8px; align-items: start; }
.place-row__n { width: 28px; height: 28px; background: var(--blue); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border: 0; font: inherit; }
.place-row textarea { margin-top: 6px; font-size: .95rem; }
.place-row__coords { font-size: .75rem; color: var(--muted); }
.chapter-nav { display: flex; flex-direction: column; gap: 10px; font-size: .95rem; }
.review-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 4px; }
.review-form .btn { margin-top: 8px; }
.dialog { border: 0; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(0, 20, 50, .55); }
.dialog form { padding: 20px 22px; margin: 0; }
.dialog h2 { font-size: 1.3rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.dialog__actions .btn { margin-top: 0 !important; }
.leaflet-marker-num { background: var(--blue); color: #fff; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--blue), 0 2px 6px rgba(0,0,0,.45); text-align: center; font: 700 13px/24px var(--font); }
.leaflet-marker-num span { display: block; }
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content { font-size: .95rem; }
.leaflet-popup-content h3 { font-size: 1rem; margin: 0 0 4px; }

/* ---------- Таблиця ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; background: var(--blue-soft); border-bottom: 2px solid var(--blue); padding: 10px; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr.is-muted { color: var(--muted); }
.inline-edit { display: inline-block; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] form { margin-top: 8px; padding: 10px; border: 1px solid var(--line); background: var(--bg-grey); min-width: 240px; }

/* ---------- Посібник ---------- */
.guide-section { margin-bottom: 48px; }
.guide-section__head { display: flex; gap: 20px; align-items: flex-start; border-top: 4px solid var(--blue); padding-top: 16px; margin-bottom: 20px; }
.guide-section__num { font-size: 2.6rem; font-weight: 700; color: var(--blue); line-height: 1; min-width: 1.6em; }
.guide-section__head h2 { margin-bottom: .2em; }
.guide-section__head p { margin: 0; }
.topic-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.topic-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 4px 14px; padding: 18px; border: 1px solid var(--line); border-bottom: 4px solid var(--blue); text-decoration: none; color: var(--ink); background: #fff; min-height: 130px; }
a.topic-tile:hover { background: var(--blue-soft); color: var(--ink); border-bottom-color: var(--yellow); }
.topic-tile__num { grid-row: 1 / 3; font-size: 1.8rem; font-weight: 700; color: var(--blue); line-height: 1; }
.topic-tile__title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
a.topic-tile .topic-tile__title { color: var(--blue); }
.topic-tile__meta { font-size: .85rem; color: var(--muted); }
.topic-tile.is-pending { background: var(--bg-grey); border-bottom-color: var(--line); }
.topic-tile.is-pending .topic-tile__num { color: #9aa0aa; }
.toc-list { list-style: none; padding: 0; margin: 0 0 24px; border-top: 1px solid var(--line); }
.toc-list a { display: flex; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.toc-list a:hover { background: var(--blue-soft); }
.toc-list__num { flex: none; width: 32px; height: 32px; background: var(--blue); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.toc-list__sum { display: block; color: var(--muted); font-size: .95rem; margin-top: 2px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 12px; }
.lead, .lead-prose p { font-size: 1.2rem; color: #3a3f4b; }
.reader { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; align-items: start; }
.reader__main { max-width: 760px; }
.reader__side { position: sticky; top: 12px; }
.side-toc > summary { font-weight: 700; padding: 10px 0; border-bottom: 2px solid var(--blue); cursor: pointer; list-style: none; }
.side-toc > summary::-webkit-details-marker { display: none; }
.side-toc ol { padding: 0; margin: 0; list-style: none; counter-reset: c; }
.side-toc li { counter-increment: c; }
.side-toc a, .side-toc span { display: flex; gap: 8px; padding: 9px 8px; border-bottom: 1px solid var(--line); text-decoration: none; font-size: .95rem; }
.side-toc a::before, .side-toc span::before { content: counter(c) '.'; color: var(--muted); }
.side-toc [aria-current] { background: var(--blue-soft); font-weight: 700; box-shadow: inset 4px 0 0 var(--blue); color: var(--ink); }
.in-toc { background: var(--blue-soft); padding: 14px 18px; margin-bottom: 24px; }
.in-toc p { font-weight: 700; margin-bottom: 6px; }
.in-toc ul { margin: 0; padding-left: 20px; }
.prose { font-size: 1.075rem; line-height: 1.65; }
.prose h2 { margin-top: 1.6em; font-size: 1.5rem; }
.prose h3 { margin-top: 1.3em; }
.prose blockquote { margin: 1.2em 0; padding: 12px 20px; border-left: 4px solid var(--yellow); background: var(--blue-soft); font-size: 1.1rem; }
.prose figure { margin: 1.5em 0; }
.prose figure img { display: block; width: 100%; }
.prose figcaption { font-size: .875rem; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .35em; }
.prose--boxed { border: 1px solid var(--line); padding: 16px; margin-bottom: 16px; }
.article-block { margin-top: 40px; }
.article-block h2 { font-size: 1.3rem; display: flex; gap: 8px; align-items: center; border-top: 2px solid var(--blue); padding-top: 12px; }
.sources ol { padding-left: 1.4em; font-size: .95rem; }
.sources li { margin-bottom: 6px; word-break: break-word; }
.article-meta { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.pager a:hover { background: var(--blue-soft); }
.pager span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.pager__next { text-align: right; grid-column: 2; }
.preview-bar { background: var(--yellow); padding: 10px 0; font-weight: 700; }
.search-big { display: flex; gap: 8px; max-width: 680px; margin-top: 8px; }
.search-big .btn { flex: none; }
.results { list-style: none; padding: 0; }
.results li { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.results p { margin: 4px 0 0; }
mark { background: #fff1a8; padding: 0 1px; }
.place-index { columns: 2 280px; padding-left: 1.2em; }
.place-index li { margin-bottom: 8px; break-inside: avoid; }

/* ---------- Інструкція ---------- */
.help { counter-reset: h; }
.help h2 { border-top: 2px solid var(--blue); padding-top: 16px; margin-top: 40px; }
.help .tip { background: #fffbe6; border-left: 4px solid var(--yellow); padding: 10px 14px; margin: 12px 0; }
.help-toc { background: var(--blue-soft); padding: 16px 20px; }
.help-toc ol { margin: 0; }
.help kbd { border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 5px; font: .85em var(--font); background: #fff; }
.help .shot { border: 1px solid var(--line); background: var(--bg-grey); padding: 12px; font-size: .9rem; }

/* ---------- Підвал ---------- */
.site-footer { background: var(--blue-deep); color: #fff; margin-top: 40px; font-size: .9rem; }
.site-footer a { color: #fff; }
.site-footer__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding-top: 32px; padding-bottom: 24px; }
.site-footer__title { font-size: 1.15rem; font-weight: 700; }
.site-footer__bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 14px; padding-bottom: 20px; border-top: 1px solid rgba(255,255,255,.25); }
.site-footer__disclaimer { font-size: .8rem; opacity: .85; margin-top: 12px; }
.eu-funding { display: inline-flex; align-items: center; gap: 12px; background: #fff; color: #000; padding: 8px 12px; font-weight: 700; font-size: .9rem; line-height: 1.2; }
.eu-funding--light { border: 1px solid var(--line); margin-bottom: 12px; }
.eu-flag { width: 66px; height: 44px; flex: none; display: block; }

/* ---------- Адаптивність ---------- */
@media (max-width: 1000px) {
  .reader { grid-template-columns: 1fr; gap: 16px; }
  .reader__side { position: static; }
  .side-toc:not([open]) > summary { border-bottom-width: 1px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .site-header__top { min-height: 0; }
  .brand__logo { width: 40px; height: 40px; }
  .brand__name { font-size: 1.1rem; }
  .brand__sub { display: none; }
  .search-mini { order: 3; width: 100%; }
  .search-mini input { width: 100%; }
  .user-chip__name { display: none; }
  .site-nav__toggle { display: inline-flex; }
  .site-nav__list { display: none; flex-direction: column; padding-bottom: 8px; }
  .site-nav__list.is-open { display: flex; }
  .site-nav__list a, .site-nav__list li:first-child a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.15); }
  .site-nav__list a[aria-current] { border-bottom-color: var(--yellow); }
  .site-nav__right { margin-left: 0; }
  .hero { padding: 28px 0; }
  .hero__grid { grid-template-columns: 1fr; gap: 20px; }
  .hero__lead { font-size: 1rem; }
  .layout-plain .login-card { order: -1; }
  .layout-plain .hero__text h1 { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .board__row { grid-template-columns: 1fr; gap: 6px; }
  .board__progress { padding-left: 40px; }
  .steps { grid-template-columns: 1fr; }
  .steps li + li { border-left: 0; border-top: 1px solid var(--line); }
  .panel { padding: 16px 14px; }
  .plan-item__head { flex-wrap: wrap; }
  .plan-item__title { flex-basis: calc(100% - 40px); }
  .plan-item__tools { margin-left: 40px; }
  .chapter-row { flex-wrap: wrap; }
  .chapter-row > .btn { margin-left: 44px; }
  .source-row { grid-template-columns: 1fr 40px; }
  .source-row > :nth-child(1), .source-row > :nth-child(2), .source-row > :nth-child(3) { grid-column: 1; }
  .source-row > :nth-child(4) { grid-column: 2; grid-row: 1; }
  .editor-page .ql-editor { min-height: 300px; padding: 12px; }
  .map { height: 300px; }
  .pager { grid-template-columns: 1fr; }
  .pager__next { grid-column: 1; }
  .site-footer__grid { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); margin-bottom: 12px; padding: 6px 10px; }
  .table td { border: 0; padding: 4px 0; }
  .table td::before { content: attr(data-label) ': '; font-weight: 700; color: var(--muted); }
  .guide-section__head { gap: 12px; }
  .guide-section__num { font-size: 2rem; }
  .search-big { flex-direction: column; }
}
