* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: #222; background: #f7f7f5; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.site-header { background: #1e5631; color: #fff; position: relative; z-index: 100; }

/* Заголовок (повна офіційна назва) — окремий блок над слайдером */
.site-title-bar { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.15); }
.site-title {
    display: block;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.35;
    text-align: center;
}

/* Слайдер-стрічка під заголовком (контейнери поки порожні, картинки — TODO).
   Ширина/висота/позиція кожної картки виставляються інлайново з
   js/hero-slider.js (position:absolute, left у px) — навмисно НЕ через
   flex+відсотки, див. map.txt розділ 5.2 чому. */
.hero-slider { background: #16432a; padding: 14px 0; }
.hero-slider-viewport { position: relative; overflow: hidden; width: 100%; }
/* height:100% — щоб .hero-slide { height:100% } нижче мала від чого
   рахуватись: .hero-slide — position:absolute, тож containing block
   для неї — САМЕ .hero-slider-track (найближчий positioned предок,
   ближче за .hero-slider-viewport), а track сам по собі не має
   висоти (усі діти — absolute, у звичайному потоці порожньо). Без
   цього .hero-slide завжди мала фактичну висоту 0 — картинки не
   показувались і по слайдах не можна було клікнути (нульова площа),
   просто це не впадало в очі, поки плейсхолдери були порожні. */
.hero-slider-track { position: relative; height: 100%; }
.hero-slide {
    position: absolute;
    top: 0;
    background: rgba(255,255,255,.15);
    border: 1px dashed rgba(255,255,255,.35);
    border-radius: 4px;
    box-sizing: border-box;
    overflow: hidden;
}
/* Підпис під картинкою (розділ 31 map.txt) — фіксована висота
   (js/hero-slider.js: CAPTION_HEIGHT_PX, те саме число тут і там),
   щоб усі слайди лишались однакової загальної висоти незалежно від
   довжини тексту підпису; довгий текст обрізається "…" по 2 рядках. */
.hero-slide-link { display: flex; flex-direction: column; width: 100%; height: 100%; color: #fff; text-decoration: none; }
.hero-slide-img-wrap { flex: 1 1 auto; display: block; overflow: hidden; min-height: 0; }
.hero-slide-link img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-slide-caption {
    flex: 0 0 40px; height: 40px; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    padding: 3px 6px 0; font-size: 0.72rem; line-height: 1.2; text-align: center;
}

.nav-bar { background: #1e5631; }
.nav-bar-inner { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; }

/* Плаваючий прозорий блок "Увійти"/нік (розділ 33-36 map.txt) —
   окремий рядок під меню (розділ 32) виявився незручним через довге
   меню, власник попросив непомітний плаваючий блок там, де в статей
   зазвичай нема тексту. .user-float-row — дочірній елемент
   .site-header (не main.wrap — розділ 34: так ближче до меню),
   `top:100%` рівно на нижньому краю шапки + `margin-top:5px` — точний
   5px відступ від меню (розділ 36 map.txt: раніше було `bottom:-22px`,
   не давало точно передбачити відступ, бо залежало ще й від власної
   висоти рядка); розтягнута на всю ширину (як і .nav-bar), а вкладена
   .wrap ЦЕНТРУЄ вміст так само, як .nav-bar-inner, — тому правий край
   блока збігається з правим краєм меню, а не з краєм екрана (розділ 35
   map.txt, був баг на широких екранах). pointer-events:none на самому
   рядку — щоб порожній простір зліва від бейджа (весь інший widths
   .wrap) не перехоплював кліки по контенту під ним; auto повертається
   назад на сам бейдж. Колір темно-зелений (фірмовий) — блок завжди
   опиняється над світлим тлом (проміжок між шапкою і контентом або сам
   контент), не над темним фоном хедера. */
.user-float-row { position: absolute; left: 0; right: 0; top: 100%; margin-top: 5px; z-index: 5; pointer-events: none; }
.user-float-row .wrap { display: flex; justify-content: flex-end; }
.user-float { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.auth-link { color: #1e5631; text-decoration: none; font-size: 1.1em; white-space: nowrap; opacity: .8; }
.auth-link:hover { opacity: 1; text-decoration: underline; }
.auth-user { color: #1e5631; font-size: 1.1em; white-space: nowrap; opacity: .8; }
/* Кнопка "Вийти" поруч із ніком — тепер SVG-іконка (розділ 36 map.txt,
   замінила emoji з розділу 35): stroke="currentColor" у самому SVG,
   тому колір керується звідси через CSS color, як і monochrome-гліф ✎
   в admin-edit-fab. */
.auth-logout-btn { background: none; border: 0; padding: 0; display: flex; cursor: pointer; color: #1e5631; opacity: .8; }
.auth-logout-btn:hover { opacity: 1; }
.icon-logout { width: 1.2em; height: 1.2em; }

/* ===== Сторінка логіну/реєстрації ===== */
.auth-section { display: flex; justify-content: center; padding: 20px 0; }
.auth-box { width: 100%; max-width: 380px; }
.auth-title { margin: 0 0 18px; text-align: center; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; margin-bottom: 4px; font-size: 0.9rem; color: #555; }
.auth-field input { width: 100%; padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; }
.auth-error { color: #c0392b; font-size: 0.9rem; min-height: 1.2em; margin-bottom: 10px; }
.cf-hint { color: #888; font-weight: normal; font-size: 0.85em; }
.btn-primary { width: 100%; padding: 11px; background: #1e5631; color: #fff; border: 0; border-radius: 4px; font-size: 1rem; cursor: pointer; }
.btn-primary:hover { background: #16432a; }
.btn-danger { padding: 11px; background: #c0392b; color: #fff; border: 0; border-radius: 4px; font-size: 1rem; cursor: pointer; }
.btn-danger:hover { background: #96291d; }
.btn-link { display: block; width: 100%; margin-top: 10px; padding: 8px; background: none; border: 0; color: #1e5631; text-decoration: underline; cursor: pointer; font-size: 0.9rem; }

/* ===== Особиста сторінка користувача (/<login>/) ===== */
.user-page { max-width: 560px; }
.profile-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee; }
.profile-label { width: 90px; flex-shrink: 0; color: #555; font-size: 0.9rem; }
.profile-value { flex: 1; }
.profile-input { flex: 1; padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; }
.profile-row button { padding: 6px 12px; border: 1px solid #1e5631; background: #fff; color: #1e5631; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.profile-row button:hover { background: #eef5ef; }
.profile-error { color: #c0392b; font-size: 0.9rem; margin-top: 8px; }

/* Адмін-панель: розгортається на всю ширину робочої області (не 560px) */
.user-page.is-admin-panel { max-width: none; }

.btn-back { display: inline-block; margin-bottom: 14px; padding: 5px 12px; font-size: 0.85rem; background: none; border: 1px solid #ccc; border-radius: 4px; color: #555; cursor: pointer; }
.btn-back:hover { background: #f0f0f0; }

.admin-panel { display: flex; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; min-height: 420px; }
.admin-panel-menu { width: 220px; flex-shrink: 0; background: #f5f5f3; border-right: 1px solid #ddd; padding: 10px 0; }
.admin-panel-menu ul { list-style: none; margin: 0; padding: 0; }
.admin-panel-menu li a { display: block; padding: 10px 18px; color: #333; text-decoration: none; font-size: 0.95rem; }
.admin-panel-menu li a:hover { background: #e9efe9; }
.admin-panel-menu li a.active { background: #1e5631; color: #fff; font-weight: 600; }
.admin-panel-content { flex: 1; padding: 20px; }

/* Адмін-панель → розділ "Меню" (js/user-page.js: up_admin_menu_render) */
.menu-editor-toolbar { display: flex; gap: 16px; margin-bottom: 14px; }
.menu-editor-toggle { display: flex; gap: 20px; margin-bottom: 16px; font-size: 0.9rem; }
.menu-editor-toggle label { cursor: pointer; }
.menu-editor-tree, .menu-editor-children { list-style: none; margin: 0; padding: 0; }
.menu-editor-children { padding-left: 24px; margin-top: 6px; display: none; }
.menu-editor-children.is-expanded { display: block; }
.menu-editor-item { border-bottom: 1px solid #eee; padding: 8px 0; }
.menu-editor-item.is-hidden > .menu-editor-row .menu-editor-name { color: #aaa; font-style: italic; }
.menu-editor-row { display: flex; align-items: center; gap: 10px; }
.menu-editor-name { flex: 1; }
.menu-editor-controls { display: flex; align-items: center; gap: 8px; white-space: nowrap; margin-left: auto; }
.menu-editor-controls button { padding: 5px 10px; border: 1px solid #1e5631; background: #fff; color: #1e5631; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.menu-editor-controls button:hover { background: #eef5ef; }
.menu-editor-publish { font-size: 0.85rem; color: #555; display: flex; align-items: center; gap: 4px; }
.menu-editor-publish input[type="checkbox"] { margin: 0; }
.btn-menu-up, .btn-menu-down { font-size: 1rem; padding: 4px 10px; }

/* Кнопка розгортання дітей — зліва від назви, лише у батьків;
   у листків її місце займає порожній спейсер тієї ж ширини (щоб назви
   всіх рівнів вирівнювались по одній лінії). */
.menu-editor-expand, .menu-editor-expand-spacer { flex-shrink: 0; width: 22px; height: 22px; }
.menu-editor-expand { display: flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; cursor: pointer; color: #555; }
.menu-editor-expand .chevron { width: 7px; height: 7px; }
.menu-editor-expand.is-open .chevron { transform: rotate(-135deg); }

/* Адмін-панель → розділ "Матеріали" (js/user-page.js: up_admin_materials_render) */
.materials-toolbar { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.materials-toolbar select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9rem; }
.materials-table { width: 100%; border-collapse: collapse; }
.materials-table th, .materials-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 0.9rem; }
.materials-table th:nth-child(2), .materials-table td:nth-child(2) { width: 130px; white-space: nowrap; }
.materials-table th:last-child, .materials-table td:last-child { width: 100px; text-align: right; }
.materials-empty { text-align: center; color: #888; padding: 20px 0; }
.material-title-btn { background: none; border: 0; padding: 0; font: inherit; color: #1e5631; cursor: pointer; text-align: left; }
.material-title-btn:hover { text-decoration: underline; }
/* justify-content:center стискає flex-елементи, коли їм разом бракує
   місця — без flex:0 0 auto лічильник "X–Y з Z" тиснуть сусідні кнопки
   і він переносить текст замість того, щоб узяти ширину вмісту. */
.materials-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; font-size: 0.85rem; color: #555; }
.materials-pagination span { flex: 0 0 auto; white-space: nowrap; }
.materials-pagination button:disabled { opacity: 0.4; cursor: default; }
.material-meta { margin: 10px 0 16px; padding: 10px 14px; background: #f7f7f5; border-radius: 4px; font-size: 0.85rem; color: #555; }
.material-meta div { padding: 2px 0; }
.field-hint { font-weight: normal; font-size: 0.85em; color: #888; }

/* Бургер скрыт по умолчанию (десктоп) */
.burger { display: none; flex-direction: column; justify-content: space-between; width: 26px; height: 20px; background: none; border: 0; padding: 0; cursor: pointer; }
.burger span { display: block; height: 3px; width: 100%; background: #fff; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.burger.open span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

.nav-overlay { display: none; }

.nav-item-row { display: flex; align-items: center; }
.submenu-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.chevron { display: block; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
.has-children.open > .nav-item-row .chevron { transform: rotate(-135deg); }

/* ============================================================
   ДЕСКТОП (> 900px): горизонтальное меню вдоль экрана,
   выпадающие списки по hover.
   ============================================================ */
@media (min-width: 901px) {
    .main-nav > ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
    .main-nav a { color: #fff; text-decoration: none; font-size: 0.95rem; padding: 8px 0; display: inline-block; }
    .main-nav a:hover { text-decoration: underline; }
    .main-nav .submenu-toggle { display: none; } /* раскрытие только по hover */

    .main-nav li { position: relative; }
    .main-nav .sub-nav {
        display: none;
        position: absolute;
        top: 100%; left: 0;
        z-index: 20; /* вище за .user-float-row (z-index:5) — інакше останній пункт меню
                        (випадає під .user-float-row) віддає ховер прозорій-але-вищій зоні
                        "Увійти"/ніку замість себе, хоча сам суцільний і візуально й так
                        поверх (розділ 56 map.txt) */
        background: #1e5631;
        list-style: none;
        margin: 0; padding: 8px;
        min-width: 260px;
        box-shadow: 0 6px 16px rgba(0,0,0,.2);
        flex-direction: column;
    }
    .main-nav li:hover > .sub-nav { display: flex; }
    /* подменю второго уровня разворачивается вправо от родителя */
    .main-nav .sub-nav .sub-nav { top: 0; left: 100%; }
    .main-nav .sub-nav a { padding: 6px 10px; white-space: nowrap; }
}

/* ============================================================
   МОБИЛА (<= 900px): бургер справа, панель меню,
   подменю — аккордеон (раскрывающиеся элементы).
   ============================================================ */
@media (max-width: 900px) {
    .burger { display: flex; }

    .nav-overlay {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.4);
        opacity: 0; pointer-events: none;
        transition: opacity .25s ease;
        z-index: 150;
    }
    .nav-overlay.visible { opacity: 1; pointer-events: auto; }

    .main-nav {
        position: fixed;
        top: 0; right: -300px;
        width: 280px; max-width: 85vw;
        height: 100%;
        background: #1e5631;
        overflow-y: auto;
        transition: right .3s ease;
        z-index: 200;
        padding-top: 60px;
    }
    .main-nav.open { right: 0; }

    .main-nav ul { list-style: none; margin: 0; padding: 0; }
    .main-nav a { color: #fff; text-decoration: none; display: block; padding: 12px 16px; font-size: 1rem; }
    .main-nav li { border-bottom: 1px solid rgba(255,255,255,.12); }

    .nav-item-row { display: flex; align-items: center; justify-content: space-between; }
    .nav-item-row a { flex: 1; }
    .submenu-toggle { display: flex; align-items: center; justify-content: center; color: #fff; width: 44px; height: 44px; }

    .main-nav .sub-nav {
        max-height: 0;
        overflow: hidden;
        list-style: none;
        margin: 0; padding: 0 0 0 14px;
        background: rgba(0,0,0,.15);
        transition: max-height .3s ease;
    }
    .has-children.open > .sub-nav { max-height: 1000px; }
}

/* ===== Layout ===== */
main.wrap { background: #fff; margin-top: 20px; margin-bottom: 20px; padding: 24px; border-radius: 6px; min-height: 50vh; }
/* Список статей (templates/article_cards.php — спільний партиал для
   /news/, menu_list.php і тизера на головній, розділ 46 map.txt) —
   стрічка 3 в ряд (розділ 52 map.txt). Спочатку заголовок, потім
   картинка на всю ширину картки (object-fit: cover в рамці 4:3, без
   floated-обгортання тексту), потім 4-5 рядків анонсу (line-clamp).
   Уся картка — суцільне посилання (<a class="news-card">, valid у
   HTML5 — flow content всередині <a>), клікабельна цілком. */
.news-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 16px; }
.news-card { display: block; padding-bottom: 14px; border: 1px solid #eee; border-radius: 6px; overflow: hidden; color: inherit; text-decoration: none; font-size: 0.8em; transition: box-shadow .15s ease, border-color .15s ease; }
.news-card:hover { border-color: #ccc; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.news-card-footer { display: block; padding: 14px 14px 10px; }
.news-card time { color: #888; font-size: 0.9em; }
.news-card h2 { margin: 2px 0 0; font-size: 1.2em; line-height: 1.3; min-height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.news-card-img-wrap { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #f2f2f2; }
.news-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card-text { display: -webkit-box; margin: 8px 14px 0; color: #555; font-size: 1em; line-height: 1.4; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
@media (max-width: 900px) {
    .news-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .news-list { grid-template-columns: 1fr; }
}
.cover { max-width: 100%; border-radius: 4px; margin: 12px 0; }
.attachments ul { padding-left: 20px; }
/* Вбудоване відео YouTube ([youtube]ID[/youtube] -> core/bbcode.php::parse_bbcode(),
   розділ 10.15 map.txt) — класичний прийом для чуйного 16:9-контейнера. */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 16px 0; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.back-to-list { display: inline-block; margin-bottom: 14px; font-size: 0.9rem; color: #1e5631; }
/* Прев'ю-список матеріалів розділу з кількома пунктами (templates/menu_list.php, розділ 10.14 map.txt) */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; font-size: 0.9rem; }
.pagination span { flex: 0 0 auto; white-space: nowrap; color: #555; }
.pagination-disabled { color: #bbb; }
.site-footer { background: #222; color: #ccc; padding: 20px 0; font-size: 0.9rem; }
.site-footer a { color: #9cf; }
.footer-heading { color: #fff; font-size: 1rem; margin: 0 0 10px; }
table.wym_table_a { border-collapse: collapse; width: 100%; margin: 12px 0; }
table.wym_table_a td { border: 1px solid #ddd; padding: 8px; }

/* Будь-яка таблиця в тілі матеріалу — і стара (wym_table_a вище), і
   НОВА, вставлена копіпастою з Word/Excel/LibreOffice (paste-обробник
   у js/wysiwyg.js навмисно знімає class при вставці, тож своєї стилі
   нема) — розділ 23.2 map.txt. */
.content table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.content table td, .content table th { border: 1px solid #ddd; padding: 8px; text-align: left; }

/* ================================================================
   WYSIWYG РЕДАКТОР — портовано БЕЗ ЗМІН з prom.kharkiv.ua (css/admin.css),
   пара до js/wysiwyg.js. Використовується у формі матеріалу (розділ
   10.13 map.txt).
   ================================================================ */
.wysiwyg-wrap { border: 1px solid #ccc; border-radius: 4px; overflow: hidden; }
.wysiwyg-wrap:focus-within { border-color: #2c2c2c; }

.wysiwyg-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap;
}

.wysiwyg-btn {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}
.wysiwyg-btn:hover  { background: #e8e8e8; border-color: #bbb; }
.wysiwyg-btn:active { background: #ddd; }
.wysiwyg-btn:disabled { opacity: 0.4; cursor: default; background: #fff; }

.wysiwyg-sep { width: 1px; height: 20px; background: #ddd; margin: 0 4px; }

.wysiwyg-editor {
    min-height: 120px;
    max-height: 500px;
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
    background: #fff;
}

.wysiwyg-editor.is-empty:before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
    display: block;
}

.wysiwyg-btn.active { background: #2c2c2c; color: #fff; border-color: #2c2c2c; }

/* Кнопка "HTML" (js/wysiwyg.js::_toggle_html_mode) — сире редагування
   bbcode/HTML напряму, головно для контенту з тегами поза WYSIWYG
   (напр. <table> у перенесених статтях), розділ 20 map.txt. */
.wysiwyg-html-source {
    display: block; width: 100%; min-height: 120px; max-height: 500px;
    padding: 12px 14px; border: 0; outline: none; resize: vertical;
    font: 13px/1.5 Consolas, Monaco, monospace; color: #333; background: #fff;
    box-sizing: border-box;
}

/* Плашка YouTube всередині contenteditable (js/wysiwyg.js::_insert_youtube) —
   НЕ живий iframe, лише нередагована позначка місця; сам iframe з'являється
   тільки на показі сторінки через parse_bbcode(). Розділ 10.15 map.txt. */
.wysiwyg-youtube-placeholder { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0; padding: 6px 12px; background: #f0f0f0; border: 1px dashed #999; border-radius: 4px; color: #555; font-size: 0.9rem; user-select: none; }
.wysiwyg-youtube-icon { color: #c00; }

/* Та сама плашка-заглушка, що й YouTube, але для [img=ID]
   (js/wysiwyg.js::insert_image_token, розділ 10.16 map.txt). Два рядки
   (прев'ю + контроли масштабу) — розділ 18 map.txt. */
.wysiwyg-image-placeholder { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0; padding: 8px 12px; background: #f0f0f0; border: 1px dashed #999; border-radius: 4px; color: #555; font-size: 0.9rem; user-select: none; }
.wysiwyg-image-icon { color: #1e5631; }
/* Клікнута/виділена плашка (для Ц/Del/Backspace, розділ 15/18) — без
   цього виділення було непомітне, розділ 19 map.txt. */
.wysiwyg-image-placeholder.is-selected { border-color: #1e5631; border-style: solid; box-shadow: 0 0 0 2px rgba(30, 86, 49, 0.25); }
.wysiwyg-image-preview-row { display: flex; align-items: center; gap: 6px; }
.wysiwyg-image-thumb { display: block; border-radius: 3px; object-fit: cover; aspect-ratio: 1 / 1; }
/* Кнопки переміщення плашки зображення в тексті — розділ 14 map.txt */
.wysiwyg-image-move { background: #fff; border: 1px solid #ccc; border-radius: 3px; color: #1e5631; font-size: 0.75rem; line-height: 1; padding: 3px 6px; cursor: pointer; }
.wysiwyg-image-move:hover { background: #eef5ef; }

/* Масштаб плашки зображення кроком 10% — розділ 18 map.txt */
.wysiwyg-image-controls { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #666; }
.wysiwyg-image-resize { width: 22px; height: 22px; line-height: 1; background: #fff; border: 1px solid #ccc; border-radius: 3px; color: #1e5631; font-size: 0.9rem; cursor: pointer; }
.wysiwyg-image-resize:hover:not(:disabled) { background: #eef5ef; }
.wysiwyg-image-resize:disabled { opacity: 0.4; cursor: default; }
.wysiwyg-image-scale { min-width: 3em; text-align: center; }
/* Підпис картинки видно прямо в плашці, не лише в окремому діалозі
   знизу форми (спостереження власника після Этапа 5, розділ 50 map.txt) */
.wysiwyg-image-caption-preview { max-width: 200px; font-size: 0.75rem; font-style: italic; color: #666; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Блок "Зображення матеріалу" внизу форми (лише в режимі редагування) —
   js/user-page.js: up_material_render_images_section, розділ 10.16 map.txt. */
.material-images { margin-top: 24px; }
.material-images h3 { margin-bottom: 10px; }
.material-images-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.material-image-thumb { width: 110px; text-align: center; }
.material-image-thumb img { width: 100px; height: 100px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; display: block; margin: 0 auto 6px; cursor: pointer; }
.material-image-thumb img:hover { border-color: #1e5631; }
.material-image-caption-preview { font-size: 0.75rem; color: #555; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-insert-image { width: 100%; padding: 4px 6px; font-size: 0.75rem; border: 1px solid #1e5631; background: #fff; color: #1e5631; border-radius: 4px; cursor: pointer; }
.btn-insert-image:hover { background: #eef5ef; }
.btn-upload-image { display: inline-block; padding: 8px 16px; border: 1px dashed #999; border-radius: 4px; color: #555; cursor: pointer; font-size: 0.9rem; }
.btn-upload-image:hover { background: #f5f5f3; }
.material-image-error { color: #c0392b; font-size: 0.9rem; margin-top: 8px; }

/* Розділ адмінки "Стрічка" — js/user-page.js: up_admin_feed_render,
   розділ 28 map.txt. */
.feed-slot-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eee; }
.feed-slot-preview { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; border: 1px solid #ddd; flex-shrink: 0; }
.feed-slot-preview-empty { display: inline-block; background: #f0f0ee; }
.feed-materials-list { display: flex; flex-direction: column; gap: 6px; }
.feed-material-item { text-align: left; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px; background: #fff; cursor: pointer; font-size: 0.9rem; }
.feed-material-item:hover { border-color: #1e5631; }
.feed-material-item.is-selected { border-color: #1e5631; background: #eef5ef; font-weight: 600; }
.feed-photo-thumb img { cursor: pointer; }
.feed-photo-thumb.is-selected img { border-color: #1e5631; border-style: solid; box-shadow: 0 0 0 2px rgba(30, 86, 49, 0.25); }

/* Діалог підпису знизу (клік по мініатюрі) — розділ 14 map.txt */
.material-image-caption-editor { margin-top: 16px; padding: 14px; background: #f7f7f5; border-radius: 6px; max-width: 420px; }
.material-image-caption-editor label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: #555; }
.material-image-caption-editor input { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95rem; }
.material-image-caption-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* Зображення, вставлені в текст матеріалу через [img=ID] (публічний
   показ, core/bbcode.php). */
.content-image { max-width: 100%; height: auto; border-radius: 4px; margin: 12px 0; display: block; }

/* Підпис під зображенням у тексті — attachments.caption, розділ 14 map.txt */
.content-figure { margin: 12px 0; }
.content-figure .content-image { margin: 0 0 6px; }
.content-figure figcaption { font-size: 0.85rem; color: #666; text-align: center; }

/* [center] bbcode (кнопка "Ц" у редакторі, розділ 15 map.txt).
   text-align центрує звичайний inline-текст, але .content-image і
   .content-figure — display:block, на них text-align не діє, тому
   додатково центруємо їх margin:auto. */
.content-center { text-align: center; }
.content-center .content-image,
.content-center .content-figure { margin-left: auto; margin-right: auto; }

/* ================================================================
   DATEPICKER — універсальний календарик (js/datepicker.js). Сітка/
   заголовок/дні тижня — за зразком з /home/alexey/work/web/simplestack
   (css/balance.css: .datepicker-*), додано .datepicker-time-row і
   .datepicker-footer під нову підтримку часу й керування (розділ 12
   map.txt).
   ================================================================ */
.datepicker-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; width: 100%; }
.datepicker-display { flex: 1; padding: 10px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; cursor: pointer; background: #fff; }
.datepicker-clear-x { display: none; background: none; border: 0; color: #999; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.datepicker-clear-x:hover { color: #c0392b; }

.datepicker-popup {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 5px 15px rgba(0,0,0,.2);
    border-radius: 8px;
    width: 280px;
    padding: 10px;
    user-select: none;
}
.datepicker-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.datepicker-title { font-weight: bold; }
.datepicker-nav { background: none; border: 0; cursor: pointer; font-size: 0.9rem; color: #1e5631; padding: 4px 8px; }
.datepicker-nav:hover { background: #f0f0f0; border-radius: 4px; }

.datepicker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.datepicker-day-name { text-align: center; font-size: 11px; color: #999; padding-bottom: 5px; }
.datepicker-day { text-align: center; padding: 8px 0; cursor: pointer; border-radius: 4px; font-size: 14px; }
.datepicker-day:hover { background-color: #eef5ef; }
.datepicker-day.today { background-color: #ffecb3; font-weight: bold; }
.datepicker-day.selected { background-color: #1e5631 !important; color: #fff; }
.datepicker-day.other-month { color: #ddd; cursor: default; }

.datepicker-time-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; font-size: 0.9rem; color: #555; }
.datepicker-time-row input { width: 50px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 4px; text-align: center; }
.datepicker-time-sep { font-weight: bold; }

.datepicker-footer { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; }
.datepicker-footer button { padding: 5px 10px; font-size: 0.8rem; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; color: #555; }
.datepicker-footer button:hover { background: #f0f0f0; }

/* ================================================================
   Карандаш редагування матеріалу прямо на публічній сторінці (для
   адмінів) + фрейм-оверлей з тією ж формою, що й в адмін-панелі
   (js/user-page.js: up_maybe_show_edit_fab/up_open_standalone_edit),
   розділ 16 map.txt. z-index оверлею (900) навмисно НИЖЧЕ за
   datepicker-popup (1000) — календарик у формі публікації має
   лишатись видимим поверх фрейму.
   ================================================================ */
.admin-edit-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 850;
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: #1e5631; color: #fff; font-size: 1.3rem; line-height: 1;
    cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.admin-edit-fab:hover { background: #164024; }

.admin-edit-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(0,0,0,.5);
    display: flex; align-items: flex-start; justify-content: center;
    overflow-y: auto; padding: 40px 16px;
}
.admin-edit-frame {
    /* Було max-width:720px — вузько для WYSIWYG-поля тексту статті,
       розділ 20 map.txt. 1000px ближче до .wrap (1100px), лишаючи
       трохи відступу з боків оверлею. */
    background: #fff; border-radius: 8px; padding: 24px;
    width: 100%; max-width: 1000px;
}

/* Розділ-категорія без власного вмісту — список дочірніх пунктів меню
   замість голої сторінки (templates/menu_children.php, розділ 27 map.txt). */
.menu-children-list { list-style: none; margin: 0; padding: 0; }
.menu-children-list li { border-bottom: 1px solid #eee; }
.menu-children-list a {
    display: block; padding: 14px 4px; font-size: 1.1rem;
    color: #1e5631; text-decoration: none;
}
.menu-children-list a:hover { text-decoration: underline; }
