/* ========================================= */
/* 1. ГЛОБАЛЬНІ СТИЛІ ТА ТЕМА (ТЕМНА / СВІТЛА) */
/* ========================================= */
:root {
    --accent: #4ade80;
    --accent-strong: #15803d;
    --accent-stronger: #166534;
    --bg-page: #000000;
    --bg-surface: #09090b;
    --bg-surface-2: #18181b;
    --border-subtle: #1c1c21;
    --border-default: #27272a;
    --border-strong: #3f3f46;
    --text-primary: #ffffff;
    --text-secondary: #d4d4d8;
    --text-tertiary: #a1a1aa;
    --text-muted: #71717a;
}

html[data-theme="light"] {
    --bg-page: #ffffff;
    --bg-surface: #f4f4f5;
    --bg-surface-2: #e4e4e7;
    --border-subtle: #e4e4e7;
    --border-default: #d4d4d8;
    --border-strong: #a1a1aa;
    --text-primary: #09090b;
    --text-secondary: #27272a;
    --text-tertiary: #52525b;
    --text-muted: #71717a;
}

html[data-theme="darkblue"] {
    --bg-page: #070b16;
    --bg-surface: #0d1424;
    --bg-surface-2: #16213a;
    --border-subtle: #182338;
    --border-default: #253352;
    --border-strong: #3a4c72;
    --text-primary: #f3f6fc;
    --text-secondary: #c4cee2;
    --text-tertiary: #8b98b8;
    --text-muted: #5f6c8c;
}

html[data-theme="beige"] {
    --bg-page: #f6f0e6;
    --bg-surface: #efe6d6;
    --bg-surface-2: #e4d7bf;
    --border-subtle: #e0d3b8;
    --border-default: #cdbb98;
    --border-strong: #a8916a;
    --text-primary: #2b2115;
    --text-secondary: #4a3c28;
    --text-tertiary: #6c5a3e;
    --text-muted: #8c7a5c;
}

html[data-theme="softlight"] {
    --bg-page: #eceff2;
    --bg-surface: #e1e4e9;
    --bg-surface-2: #d3d7dd;
    --border-subtle: #d1d5db;
    --border-default: #bdc2ca;
    --border-strong: #979fab;
    --text-primary: #14171c;
    --text-secondary: #383d45;
    --text-tertiary: #595f6a;
    --text-muted: #767d89;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    width: 100%;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-page);
}

/* ========================================= */
/* МОТИВАЦІЙНИЙ БАНЕР (над шапкою, на всіх сторінках) */
/* ========================================= */
.site-poster-bar {
    position: relative;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 9px 24px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.site-poster-text {
    flex: 1;
    text-align: center;
    word-break: break-word;
}

.site-poster-menu-wrap { position: relative; flex-shrink: 0; }

.site-poster-menu-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: inherit;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.site-poster-menu-btn:hover { background: rgba(255, 255, 255, 0.28); }

.site-poster-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 260px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    text-align: left;
    font-weight: 400;
}

.site-poster-menu.open { display: block; }

.site-poster-field { margin-bottom: 10px; }
.site-poster-field label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }

.site-poster-field textarea,
.site-poster-field select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
}

.site-poster-field input[type="color"] {
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-surface);
    cursor: pointer;
    padding: 2px;
}

.site-poster-field-row { display: flex; gap: 10px; }
.site-poster-field-row .site-poster-field { flex: 1; margin-bottom: 10px; }

.site-poster-field input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

.site-poster-photo-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
}

.site-poster-photo-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }

.site-poster-unavailable-hint {
    display: none;
    font-size: 11px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 6px;
}

.site-poster-unavailable-hint.visible { display: block; }

.site-poster-hide-btn {
    width: 100%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 2px;
    margin-bottom: 10px;
}

.site-poster-hide-btn:last-child { margin-bottom: 0; }

.site-poster-settings-panel {
    padding-top: 16px;
    margin-top: 4px;
    border-top: 1px solid var(--border-subtle);
}
.site-poster-hide-btn:hover { background: rgba(239, 68, 68, 0.18); }

/* Тост "скоро буде" — у стилі сайту, замість системного alert() */
.mf-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 340px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.mf-toast.visible { opacity: 1; transform: translateY(0); }
.mf-toast-icon { font-size: 20px; flex-shrink: 0; }
.mf-toast-body { flex: 1; min-width: 0; }
.mf-toast-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.mf-toast-text { font-size: 12px; color: var(--text-tertiary); line-height: 1.4; }
.mf-toast-close { background: none; border: none; color: var(--text-muted); font-size: 15px; cursor: pointer; flex-shrink: 0; padding: 0; }
.mf-toast-close:hover { color: var(--text-primary); }

/* Підтвердження дії — у стилі сайту, замість системного confirm() */
.mf-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mf-confirm-overlay.visible { opacity: 1; }

.mf-confirm-card {
    width: 320px;
    max-width: 90vw;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.96);
    transition: transform 0.2s ease;
}

.mf-confirm-overlay.visible .mf-confirm-card { transform: scale(1); }

.mf-confirm-message {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.mf-confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ========================================= */
/* 2. ВЕРХНЯ ШАПКА (TOP BAR)                 */
/* ========================================= */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 50;
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left-group h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.menu-btn {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
    padding: 0;
    overflow: hidden;
}

.menu-btn:hover {
    border-color: var(--border-strong);
}

.menu-btn .logo-layer {
    position: absolute;
    inset: 0;
    display: flex;
    border-radius: 7px;
    overflow: hidden;
    transition: opacity 0.2s ease-in-out;
}

.menu-btn .logo-layer span {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
}

.menu-btn .logo-m {
    background: var(--bg-page);
    color: var(--text-primary);
}

.menu-btn .logo-f {
    background: var(--text-primary);
    color: var(--bg-page);
}

.menu-btn .icon-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.menu-btn.menu-open .logo-layer {
    opacity: 0;
}

.menu-btn.menu-open .icon-layer {
    opacity: 1;
}

.header-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-gear-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-tertiary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.settings-gear-btn:hover,
.settings-gear-btn.active {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-surface-2);
}

.header-avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--border-default);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.2s;
}

.header-avatar-btn:hover,
.header-avatar-btn.active {
    border-color: var(--text-muted);
}

/* Верхня навігація — Дашборд/Лоджія/Хаб/Профіль/Налаштування простим текстом */
.top-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.top-nav-btn {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.top-nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.top-nav-btn.active {
    color: var(--text-primary);
    background: var(--bg-surface-2);
}

/* Дзвіночок сповіщень */
.notif-bell-wrap { position: relative; }

.notif-bell-btn svg { display: block; }

.notif-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid var(--bg-page);
    display: none;
}

.notif-dot.visible { display: block; }

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 60;
    display: none;
}

.notif-dropdown.open { display: block; }

.notif-dropdown-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.notif-clear-all {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.notif-clear-all:hover { color: var(--text-primary); background: var(--bg-surface); }

.notif-item {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 12px 30px 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-secondary);
}

.notif-item:last-child { border-bottom: none; }

.notif-item.unread { background: var(--bg-surface); }

.notif-item-icon { font-size: 16px; flex-shrink: 0; }

.notif-item-time {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.notif-item-dismiss {
    position: absolute;
    top: 10px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.notif-item-dismiss:hover { color: #f87171; background: rgba(239, 68, 68, 0.12); }

.notif-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================= */
/* 3. КОМПАКТНА ПАНЕЛЬ КЕРУВАННЯ (DRAWER)    */
/* ========================================= */
.sidebar {
    position: absolute;
    top: 65px;
    left: 24px;
    width: 180px;
    height: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 100;
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease-in-out;
}

.sidebar.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    display: block;
    padding: 10px 12px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: 0.2s;
}

.sidebar-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
}

.sidebar-nav a.active {
    color: var(--text-primary);
    background: var(--border-default);
    font-weight: 600;
}

.sidebar-nav-divider {
    height: 1px;
    background: var(--border-default);
    margin: 4px 4px;
}

.sidebar-logout-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.sidebar-logout-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ========================================= */
/* 4. ГНУЧКА СІТКА ДАШБОРДІВ (4 КОЛОНКИ)     */
/* ========================================= */
.main-content {
    flex: 1;
    padding: 24px 32px;
    transition: margin-right 0.25s ease;
}

/* БІЧНА ПАНЕЛЬ ПРОФІЛЮ (Lounge/Профіль) — контент зсувається ліворуч, коли панель відкрита */
body.profile-panel-open .main-content {
    margin-right: 400px;
}

.profile-side-panel {
    position: fixed;
    top: var(--header-offset, 65px);
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: calc(100vh - var(--header-offset, 65px));
    background: var(--bg-page);
    border-left: 1px solid var(--border-subtle);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 45;
    overflow-y: auto;
    padding: 20px;
}

.profile-side-panel.open {
    transform: translateX(0);
}

.profile-side-panel-close {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.profile-side-panel-close:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.profile-side-panel-banner {
    height: 90px;
    margin: 0 -20px 0 -20px;
    background: #ffffff;
    background-size: cover;
    background-position: center;
}

.profile-side-panel-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.profile-side-panel-header.has-banner {
    margin-top: -32px;
}

.profile-side-panel-header .profile-avatar-big {
    margin-bottom: 8px;
}

.profile-side-panel-header .btn-secondary {
    margin-top: 10px;
}

.profile-side-panel-posts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-panel-list-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-panel-back-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-panel-back-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }

.profile-following-stats {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}

.profile-following-stat {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.profile-following-stat strong { color: var(--text-primary); }
.profile-following-stat:hover { color: var(--text-primary); }

.following-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
}

.following-list-item:last-child { border-bottom: none; }

.following-list-info { display: flex; flex-direction: column; }
.following-list-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.following-list-handle { font-size: 12px; color: var(--text-muted); }

@media (max-width: 900px) {
    body.profile-panel-open .main-content {
        margin-right: 0;
    }
    .profile-side-panel {
        width: 100vw;
        max-width: 100vw;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    grid-auto-rows: minmax(160px, auto);
    /* dense — автоматично підтягує менші картки в порожні місця в сітці */
    grid-auto-flow: row dense;
}

/* КАРТКИ */
.dashboard-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

/* ЧОТИРИ РОЗМІРИ КАРТОК */
.dashboard-card.size-sm {
    grid-column: span 1; /* 1/4 ширини */
}

.dashboard-card.size-md {
    grid-column: span 2; /* 2/4 ширини */
}

.dashboard-card.size-lg {
    grid-column: span 3; /* 3/4 ширини (залишає місце під 1 S-картку в цьому ж рядку) */
}

.dashboard-card.size-xl {
    grid-column: span 4; /* 4/4 (повна ширина рядка) */
}

/* ШАПКА КАРТКИ ТА КНОПКИ УПРАВЛІННЯ */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.drag-handle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Візуальний фідбек під час перетягування картки */
.dashboard-card.dragging {
    opacity: 0.4;
}

.card-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Група кнопок вибору розміру S/M/L/XL */
.size-selector {
    display: flex;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 6px;
    padding: 2px;
    margin-right: 4px;
}

.size-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.15s;
}

.size-btn:hover {
    color: var(--text-primary);
}

.size-btn.active {
    background: var(--border-default);
    color: var(--text-primary);
}

.ctrl-btn {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-tertiary);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.ctrl-btn:hover {
    background: var(--border-default);
    color: var(--text-primary);
}

/* ВМІСТ КАРТОК */
.card-body {
    margin-top: 12px;
    flex: 1;
    display: flex;
    align-items: center;
}

.indicator-value {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 700;
}

.badge {
    font-size: 11px;
    background: var(--accent-strong);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.card-text {
    color: var(--text-tertiary);
    font-size: 14px;
}

.chart-placeholder {
    width: 100%;
    height: 120px;
    border: 1px dashed var(--border-default);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #52525b;
    font-size: 13px;
    font-weight: 500;
}

/* КНОПКА ДОДАТИ ДАШБОРД */
.add-dashboard-card {
    grid-column: span 2;
    border: 1px dashed var(--border-default);
    border-radius: 12px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: 0.2s;
    background: transparent;
}

.add-dashboard-card:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--bg-surface);
}

.add-icon {
    font-size: 20px;
    font-weight: bold;
}

/* ========================================= */
/* 5. ПОВНОЕКРАННИЙ РЕЖИМ КАРТКИ ДАШБОРДУ    */
/* ========================================= */
.fullscreen-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 900;
}

.fullscreen-backdrop.active {
    display: block;
}

.dashboard-card.card-fullscreen {
    position: fixed;
    inset: 24px;
    z-index: 901;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.dashboard-card.card-fullscreen .card-body {
    overflow: auto;
}

/* У повноекранному режимі лишаємо тільки кнопку закриття, видалення ховаємо */
.dashboard-card.card-fullscreen .ctrl-btn[title="Видалити"] {
    display: none;
}

body.has-fullscreen-card {
    overflow: hidden;
}

/* ========================================= */
/* 6. МОДАЛЬНЕ ВІКНО ВИБОРУ ШАБЛОНУ ДАШБОРДУ  */
/* ========================================= */
.template-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    z-index: 950;
    padding: 20px;
}

.template-modal-overlay.active {
    display: flex;
}

.template-modal {
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.template-modal-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
}

.template-option:hover {
    border-color: var(--border-strong);
    background: #1f1f23;
}

.template-option-icon {
    font-size: 20px;
}

.template-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.template-option-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.template-option-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* МОБІЛЬНА АДАПТИВНІСТЬ */
@media (max-width: 1024px) {
    .dashboard-card.size-lg {
        grid-column: span 4;
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-card.size-sm,
    .dashboard-card.size-md,
    .dashboard-card.size-lg,
    .dashboard-card.size-xl,
    .add-dashboard-card {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-card.size-sm,
    .dashboard-card.size-md,
    .dashboard-card.size-lg,
    .dashboard-card.size-xl,
    .add-dashboard-card {
        grid-column: span 1;
    }
}

/* ========================================= */
/* 7. СТОРІНКА НАЛАШТУВАНЬ                   */
/* ========================================= */
.settings-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.settings-nav {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 8px;
    position: sticky;
    top: 24px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}

.settings-nav-item:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--border-default);
    color: var(--text-primary);
}

.settings-nav-icon {
    font-size: 16px;
}

.settings-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.settings-section.active {
    display: flex;
}

.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 24px;
}

.settings-card-header {
    margin-bottom: 20px;
}

.settings-card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-card-header p {
    font-size: 13px;
    color: var(--text-tertiary);
}

.settings-card-header-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.settings-card-header-flex .btn-secondary { flex-shrink: 0; }

.settings-muted {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Профіль */
.profile-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--border-default);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-avatar-actions {
    display: flex;
    gap: 8px;
}

/* Форми */
.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.form-field input,
.form-field textarea {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: 0.2s;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--border-strong);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.settings-card-footer {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

/* Кнопки */
.btn-primary {
    background: var(--accent-strong);
    border: 1px solid var(--accent-stronger);
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--accent-stronger);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

.btn-secondary {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: var(--border-default);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-tertiary);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-danger-ghost {
    background: transparent;
    border: 1px solid var(--border-default);
    color: #ef4444;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-danger-ghost:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.btn-ghost-danger {
    background: transparent;
    border: 1px solid var(--border-default);
    color: #ef4444;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-ghost-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* Підписка / тарифи */
.plan-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.plan-current h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0 4px;
}

.plan-current-actions {
    display: flex;
    gap: 10px;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.plan-badge-discount {
    position: absolute;
    top: -10px;
    right: 16px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
}

.plan-card {
    position: relative;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-card.active {
    border-color: var(--accent);
}

.plan-current-tag {
    position: absolute;
    top: -10px;
    right: 16px;
    background: var(--accent-strong);
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
}

.plan-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.plan-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 0;
    margin: 0;
}

.plan-card ul li::before {
    content: "✓ ";
    color: var(--accent);
}

/* Таблиця історії платежів */
.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.settings-table th {
    text-align: left;
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.settings-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
}

.status-badge.success {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

/* Дизайн: колір профілю */
.color-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: 0.2s;
}

.color-swatch:hover {
    transform: scale(1.08);
}

.color-swatch.active {
    outline-color: var(--text-primary);
}

/* Акаунт: тип акаунту */
.account-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.account-type-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
}

.account-type-option:hover {
    border-color: var(--border-strong);
}

.account-type-option.active {
    border-color: var(--accent);
    background: #101a13;
}

.account-type-icon {
    font-size: 20px;
}

.account-type-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-type-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Постер профілю у Settings → Акаунт */
.settings-banner-preview {
    position: relative;
    height: 110px;
    border-radius: 12px;
    background: #ffffff;
    background-size: cover;
    background-position: center;
    margin-bottom: 16px;
    overflow: hidden;
}

/* Колір/градієнт постера профілю */
.banner-style-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.banner-style-group label {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.banner-swatch-row { display: flex; gap: 8px; }

.banner-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
    cursor: pointer;
    padding: 0;
    background-clip: padding-box;
}

.banner-swatch:hover, .banner-swatch.active { border-color: var(--text-primary); }

.banner-color-btn {
    position: relative;
    overflow: hidden;
    width: auto;
    height: auto;
    border-radius: 8px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface-2, var(--bg-surface));
    border: 1px solid var(--border-default);
    cursor: pointer;
}
.banner-color-btn:hover { border-color: var(--text-primary); }

.banner-color-btn input[type="color"] {
    position: absolute;
    inset: 0;
    border: none;
    cursor: pointer;
    opacity: 0;
    width: 100%;
    height: 100%;
}

.form-field-hint {
    font-size: 11px;
    margin-top: 4px;
    min-height: 14px;
}

.form-field-hint.error { color: #f87171; }
.form-field-hint.success { color: var(--accent); }

/* Пароль: картка, що згортається */
.settings-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

/* Той самий розмір, що й у звичайних заголовків карток (.settings-card-header h2) */
.settings-collapsible-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-collapsible-header p {
    font-size: 13px;
    color: var(--text-tertiary);
}

.settings-collapse-arrow {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.settings-collapsible-header.open .settings-collapse-arrow {
    transform: rotate(90deg);
}

.settings-collapsible-body {
    display: none;
    margin-top: 16px;
}

.settings-collapsible-body.open { display: block; }

.profile-avatar-wrap { position: relative; width: fit-content; }

/* Акаунт: додатковий перемикач (2FA) без нижньої лінії/паддінгу */
.settings-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

.toggle-row.no-border {
    padding-bottom: 0;
    border-bottom: none;
}

.settings-block-text {
    margin-bottom: 16px;
}

/* Боти */
.bot-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bot-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.bot-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bot-row-text {
    flex: 1;
    min-width: 180px;
}

.status-badge.soon {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    flex-shrink: 0;
}

/* Дизайн: тема оформлення */
.theme-option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.theme-preview {
    width: 72px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid var(--border-default);
    transition: 0.2s;
}

.theme-option.active {
    color: var(--text-primary);
}

.theme-option.active .theme-preview {
    border-color: var(--accent);
}

.theme-preview-dark {
    background: #0a0a0a;
}

.theme-preview-light {
    background: #e4e4e7;
}

.theme-preview-system {
    background: linear-gradient(135deg, #0a0a0a 50%, #e4e4e7 50%);
}

.theme-preview-darkblue {
    background: #070b16;
}

.theme-preview-beige {
    background: #f6f0e6;
}

.theme-preview-softlight {
    background: #eceff2;
}

/* Перемикачі (toggle switch) */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.privacy-select {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-row:first-child {
    padding-top: 0;
}

.toggle-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toggle-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-default);
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s;
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--text-primary);
    border-radius: 50%;
    transition: 0.2s;
}

.switch input:checked + .switch-slider {
    background: var(--accent-strong);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
}

/* Приватність: сесії */
.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.session-row:last-child {
    border-bottom: none;
}

.settings-note {
    font-size: 13px;
    color: var(--text-tertiary);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 16px;
}

/* МОБІЛЬНА АДАПТИВНІСТЬ НАЛАШТУВАНЬ */
@media (max-width: 900px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-nav {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        position: static;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .settings-form-grid {
        grid-template-columns: 1fr;
    }

    .account-type-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================= */
/* 8. НИЖНІЙ БАНЕР СПОНСОРІВ                  */
/* ========================================= */
.sponsor-bar-wrap {
    position: relative;
    flex-shrink: 0;
}

.sponsor-bar-handle {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 20px;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.sponsor-bar-handle:hover { color: var(--text-primary); }

.sponsor-bar {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-page);
    overflow: hidden;
    transition: height 0.25s ease;
    height: 96px;
}

.sponsor-bar.resizing { transition: none; } /* під час перетягування ручки — миттєво, без анімаційної затримки */
.sponsor-bar-handle { cursor: ns-resize; touch-action: none; } /* можна тягнути вгору/вниз, щоб змінити висоту */

.sponsor-bar-track {
    position: relative;
    width: 100%;
    height: 96px;
}

.sponsor-bubble {
    position: absolute;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-weight: 700;
    color: var(--text-secondary);
    user-select: none;
    touch-action: none;
}

.sponsor-bubble.dragging {
    cursor: grabbing;
    border-color: var(--border-strong);
    z-index: 5;
}

.sponsor-bubble.nudge {
    --nx: -5px;
    --ny: -6px;
    --nr: -6deg;
    animation: mf-bubble-nudge 0.4s ease;
    border-color: var(--border-strong);
}

@keyframes mf-bubble-nudge {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    35% { transform: translate(var(--nx), var(--ny)) scale(1.12) rotate(var(--nr)); }
    65% { transform: translate(calc(var(--nx) * -0.4), 2px) scale(1.05) rotate(calc(var(--nr) * -0.6)); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

.sponsor-bubble::after {
    content: attr(data-name);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 10;
}

.sponsor-bubble:hover {
    border-color: var(--border-strong);
}

.sponsor-bubble:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================= */
/* 9. ПЕРЕХІД МІЖ СТОРІНКАМИ (VIEW TRANSITIONS) */
/* ========================================= */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: mf-slide-out-left 0.28s ease-in-out both;
}

::view-transition-new(root) {
    animation: mf-slide-in-right 0.28s ease-in-out both;
}

@keyframes mf-slide-out-left {
    from { transform: translateX(0); }
    to { transform: translateX(-16%); opacity: 0.4; }
}

@keyframes mf-slide-in-right {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }
}

/* ========================================= */
/* 10. КІЛЬКА СТОРІНОК ПОРУЧ (ПАНЕЛІ)         */
/* ========================================= */
.panel-stack {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.page-panel {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    transition: flex-basis 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
}

.page-panel + .page-panel {
    border-left: 1px solid var(--border-subtle);
}

.page-panel.entering {
    opacity: 0;
    transform: translateX(24px);
}

.page-panel-root {
    overflow-y: auto;
}

.page-panel:not(.page-panel-root) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page-panel:not(.page-panel-root) iframe {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
    background: var(--bg-page);
}

.page-panel-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-page);
    flex-shrink: 0;
}

.page-panel-toolbar-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
}

.page-panel-toolbar-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.page-panel-toolbar-spacer {
    flex: 1;
}

/* Тулбар кореневої панелі — та сама смужка з лінією знизу, що й у бічних панелях, лише прилипає зверху при прокрутці */
.page-panel-root-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
}

.page-panel-hidden {
    display: none;
}

/* Сторінка, завантажена всередині панелі (iframe), ховає власну шапку й нижній банер — вони лишаються тільки в кореневій вкладці */
html.mf-embedded .top-bar,
html.mf-embedded .site-poster-bar,
html.mf-embedded .sponsor-bar-wrap,
html.mf-embedded .page-panel-root-toolbar {
    display: none !important;
}
