@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
/* Іконки: локальний vendor часто відсутній у репозиторії — CDN гарантує відображення */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

/* LionTeam Platform — тепла золотисто-бурштинова палітра (преміум, добра читабельність) */
:root {
    --primary-50: #fffbeb;
    --primary-100: #fef3c7;
    --primary-200: #fde68a;
    --primary-300: #fcd34d;
    --primary-400: #fbbf24;
    --primary-500: #f59e0b;
    --primary-600: #d97706;
    --primary-700: #b45309;
    --primary-800: #92400e;
    --primary-900: #78350f;
    
    --secondary-50: #f8fafc;
    --secondary-100: #f1f5f9;
    --secondary-200: #e2e8f0;
    --secondary-300: #cbd5e1;
    --secondary-400: #94a3b8;
    --secondary-500: #64748b;
    --secondary-600: #475569;
    --secondary-700: #334155;
    --secondary-800: #1e293b;
    --secondary-900: #0f172a;
    
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;
    
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    
    /* Тіні */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Радіуси */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Анімації — мінімум для macOS / Safari (менше композитингу) */
    --transition-fast: 50ms ease;
    --transition: 60ms ease;
    --transition-slow: 100ms ease;
    /* Світла тема з теплим фоном */
    --bg-primary: #ffffff;
    --bg-secondary: #fffbf5;
    --bg-tertiary: #fff7ed;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --border: #e8dfd4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: auto;
}

body {
    font-family: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Сторінки з app-container: скрол лише в main — сайдбар залишається на місці */
html:has(.app-container),
body:has(.app-container) {
    height: 100%;
    overflow: hidden;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Сучасний контейнер */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "sidebar main";
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background-color: var(--bg-secondary);
    overflow: hidden;
    /* Короткий перехід сітки при закріпленні; без довгих ease */
    transition: grid-template-columns 0.1s ease;
}

.app-container.sidebar-collapsed {
    grid-template-columns: 72px 1fr;
}

/* Flyout: сітка лишається 72px + 1fr — основний контент не стрибає; панель розширюється поверх */
.app-container.sidebar-collapsed.sidebar-flyout {
    grid-template-columns: 72px 1fr;
}

/* Застарілий варіант сітки з хедером — лишаємо сумісність */
.app-container.mobile {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
}

/* Сучасний хедер */
.header {
    grid-area: header;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 100;
    transition: all var(--transition);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition);
}

.logo:hover {
    color: var(--primary-700);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(145deg, var(--primary-500), var(--primary-700));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* Смайл замість літери L — без градієнтної плашки */
.sidebar .logo-icon.logo-icon--emoji {
    background: transparent;
    color: inherit;
    font-size: 1.45rem;
    font-weight: normal;
    line-height: 1;
    user-select: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.support-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.support-trigger:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.support-tg-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
}

.support-tg-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

 .support-tg-link svg {
     width: 18px;
     height: 18px;
     display: block;
 }

.header-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.75rem;
    flex-wrap: wrap;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    background: transparent;
    transition: all var(--transition);
}

.header-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-link.active {
    background: var(--primary-50);
    color: var(--primary-700);
}

.notifications {
    position: relative;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.notifications:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--error-500);
    color: #fff;
    border-radius: 9999px;
    border: 2px solid var(--bg-primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.05rem 0.35rem;
    min-width: 18px;
    text-align: center;
}

.notifications-wrapper {
    position: relative;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    transition: background-color var(--transition);
}

.user-menu-trigger:hover {
    background: var(--bg-tertiary);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 180px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.user-dropdown a {
    display: block;
    padding: 0.52rem 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
}

.user-dropdown a:hover {
    background: var(--bg-tertiary);
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown--sidebar {
    min-width: 220px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.52rem 0.85rem;
    margin: 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}

.user-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.user-dropdown--sidebar a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-footer-user .user-dropdown {
    top: auto;
    bottom: calc(100% + 0.35rem);
    transform: none;
    z-index: 2100;
}

.sidebar-footer-user .user-dropdown.open {
    transform: none;
}

/* Згорнутий сайдбар: меню профілю збоку, не «вліва» під вузьку колонку */
.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer-user .user-dropdown {
    top: auto;
    bottom: 0;
    right: auto;
    left: calc(100% + 6px);
    transform: none;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer-user .user-dropdown.open {
    transform: none;
}

.user-dropdown--sidebar .sidebar-pin-btn.is-pinned {
    background: var(--primary-50);
    color: var(--primary-900);
}

.support-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1200;
}

.support-modal.open {
    display: flex;
}

.support-modal-content {
    width: min(520px, 92vw);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
}

.support-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.support-modal-body {
    padding: 1.25rem;
}

.support-modal-body textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
}

.support-chat {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    padding: 0.75rem;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
}

.support-msg {
    max-width: 92%;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--border);
    background: var(--bg-primary);
}

.support-msg-user {
    margin-left: auto;
    border-color: rgba(217, 119, 6, 0.28);
    background: rgba(251, 191, 36, 0.1);
}

.support-msg-admin {
    margin-right: auto;
    border-color: rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.08);
}

.support-msg-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.support-msg-body {
    white-space: pre-wrap;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.support-close {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-tertiary);
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 1000;
    overflow: hidden;
}

.notification-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.notification-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.notification-list {
    max-height: 280px;
    overflow-y: auto;
}

.notification-item {
    display: block;
    padding: 0.75rem 1rem;
    padding-right: 2.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition);
    position: relative;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.notification-dismiss {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    width: 1.35rem;
    height: 1.35rem;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 999px;
    padding: 0;
}

.notification-dismiss:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.notification-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.selection-box {
    position: fixed;
    border: 1px dashed var(--primary-500);
    background: rgba(245, 158, 11, 0.14);
    z-index: 9999;
    pointer-events: none;
}

.chat-box {
    max-height: 260px;
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    margin-bottom: 1rem;
}

.chat-message {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chat-message-system {
    border-left: 3px solid var(--primary-500);
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
}

.user-menu:hover {
    background-color: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-avatar.has-image {
    background-size: cover;
    background-position: center;
    color: transparent;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    line-height: 1;
}

/* Кнопка мобільного меню лише в сайдбарі */
.sidebar .mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .header-links {
        gap: 0.35rem;
        margin-right: 0.5rem;
    }

    .header-link {
        padding: 0.35rem 0.55rem;
        font-size: 0.78rem;
    }
    
    .header .user-info {
        display: none;
    }
    
    .sidebar .mobile-menu-toggle {
        display: inline-flex;
    }
}

/* Сучасна бічна панель */
.sidebar {
    grid-area: sidebar;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 28px rgba(120, 53, 15, 0.06);
    display: flex;
    flex-direction: column;
    /* Без transition ширини: анімація спричиняла блимання підписів і втрату hover на межі панелі */
    transition: none;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    box-sizing: border-box;
    /* У сітці main йде після sidebar — без z-index випадашки (сповіщення) опиняються «під» контентом */
    position: relative;
    z-index: 2;
}

/* Закріплене повне меню: дозволяємо випадашці сповіщень виходити вправо за межі колонки */
.app-container:not(.sidebar-collapsed) .sidebar {
    overflow: visible;
}

.app-container.sidebar-collapsed .sidebar {
    justify-self: start;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    overflow-x: hidden;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    box-shadow: 8px 0 32px rgba(120, 53, 15, 0.12);
    z-index: 150;
    overflow: visible;
}

@media (prefers-reduced-motion: reduce) {
    .app-container {
        transition: none;
    }

    .sidebar {
        transition: none;
    }
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-brand-logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    flex: 1;
    text-decoration: none;
    color: var(--primary-600);
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-brand-logo:hover {
    color: var(--primary-700);
}

.sidebar-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.sidebar-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--primary-50) 0%, #fff 100%);
    border-radius: var(--radius-lg);
    color: var(--primary-800);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 2px rgba(120, 53, 15, 0.08);
}

.sidebar-tool-btn:hover {
    background: var(--primary-100);
    color: var(--primary-900);
    border-color: var(--primary-300);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.sidebar-tool-btn i {
    font-size: 0.95rem;
}

.sidebar-pin-btn.is-pinned {
    color: var(--primary-900);
    background: var(--primary-100);
    border-color: var(--primary-400);
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.12);
}

/* Сповіщення у верхньому рядку сайдбару (замість закріплення) */
.sidebar-toolbar-notifications {
    position: relative;
}

.sidebar-toolbar-notifications .notifications.sidebar-tool-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    position: relative;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--primary-50) 0%, #fff 100%);
    border-radius: var(--radius-lg);
    color: var(--primary-800);
    box-shadow: 0 1px 2px rgba(120, 53, 15, 0.08);
}

.sidebar-toolbar-notifications .notifications.sidebar-tool-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-300);
}

/* Випадашка сповіщень — праворуч від дзвінка (не обрізається зліва у вузькій колонці) */
.sidebar-toolbar-notifications .notification-dropdown {
    right: auto;
    left: calc(100% + 8px);
    top: 0;
    width: min(320px, calc(100vw - 96px));
    z-index: 5000;
    transform: none;
}

.sidebar-toolbar-notifications .notification-dropdown.open {
    transform: none;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header-minor {
    padding: 0.75rem 1.5rem 0.25rem;
    border-bottom: none;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 0.6rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 1.35rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1.1rem;
    margin-bottom: 0.4rem;
}

/* Блоки меню у стилі TopTrend (секції + акцент), палітра LionTeam */
.sidebar-nav--tt .nav-section {
    margin-bottom: 1.15rem;
}
.sidebar-nav--tt .nav-section-title--tt {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 1.15rem;
    margin-bottom: 0.35rem;
    padding-top: 0.15rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}
.sidebar-nav--tt .nav-section-title--tt::before {
    content: '';
    position: absolute;
    left: 1.1rem;
    right: 1.1rem;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    opacity: 0.85;
    pointer-events: none;
}
.sidebar-nav--tt .nav-section-title--tt .sidebar-section-label {
    position: relative;
    z-index: 1;
    padding-right: 0.5rem;
    background: var(--bg-primary);
    margin-left: 0.35rem;
    padding-left: 0.35rem;
}
.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.12rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.48rem 1.1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background-color var(--transition), color var(--transition);
    position: relative;
}

.nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--primary-50);
    color: var(--primary-600);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary-600);
}

.nav-icon {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary-800);
    background: linear-gradient(145deg, var(--primary-100), var(--primary-50));
    border: 1px solid rgba(217, 119, 6, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.nav-link:hover .nav-icon {
    background: var(--primary-200);
    color: var(--primary-900);
    border-color: rgba(217, 119, 6, 0.35);
    transform: none;
}

.nav-link.active .nav-icon {
    color: #fff;
    background: linear-gradient(145deg, var(--primary-500), var(--primary-700));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

.nav-icon i {
    font-size: 0.88rem;
    line-height: 1;
    width: 1em;
    text-align: center;
    display: block;
}

.nav-link.active .nav-icon i {
    color: inherit;
}

/* Підменю в сайдбарі (групи / підгрупи, як у Business Dashboard) */
.lion-menu-group {
    margin-bottom: 0.12rem;
}
button.nav-link.lion-menu-group-toggle {
    width: 100%;
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
}
.lion-menu-chevron {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    opacity: 0.65;
    transition: transform var(--transition), opacity var(--transition);
}
.lion-menu-group.open .lion-menu-chevron {
    transform: rotate(-180deg);
    opacity: 0.95;
}
.lion-submenu {
    display: none;
    padding: 0.15rem 0 0.35rem;
}
.lion-menu-group.open .lion-submenu {
    display: block;
}
.lion-submenu .lion-submenu-item.nav-link {
    padding: 0.42rem 1.1rem 0.42rem 2.65rem;
    font-size: 0.78rem;
    font-weight: 500;
    gap: 0;
}
.lion-submenu .lion-submenu-item.nav-link .nav-icon {
    display: none;
}
.lion-submenu-item.nav-link.active {
    background-color: var(--primary-50);
    color: var(--primary-600);
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .lion-menu-chevron {
    display: none !important;
}
.app-container.sidebar-collapsed:not(.sidebar-flyout) .lion-submenu {
    display: none !important;
}
.app-container.sidebar-flyout .lion-menu-group.open .lion-submenu {
    display: block;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 0.65rem 0.65rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    overflow: visible;
}

.sidebar-footer-user .user-menu-trigger {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    border-radius: var(--radius-lg);
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    box-shadow: 0 1px 2px rgba(120, 53, 15, 0.05);
}

.sidebar-footer-user .user-menu-trigger:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
}

/* Згорнуто: текст не через display:none — без ривка; transition на тексті вимкнено */
.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-brand-name {
    display: inline-block !important;
    max-width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    vertical-align: middle;
    pointer-events: none;
    transition: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-brand-name {
    display: inline-block !important;
    max-width: 11rem;
    min-width: 0;
    opacity: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    transition: none !important;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-section-label {
    display: inline-block !important;
    max-width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-section-label {
    display: inline !important;
    max-width: none !important;
    opacity: 1;
    overflow: visible;
    transition: none !important;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .nav-label {
    display: block !important;
    max-width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 !important;
    margin: 0 !important;
    transition: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .nav-label {
    display: inline !important;
    max-width: none !important;
    min-width: 0 !important;
    opacity: 1;
    overflow: visible;
    transition: none !important;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .nav-section-title {
    max-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    border: none;
    transition: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .nav-section-title {
    max-height: none;
    opacity: 1;
    padding: 0 1.1rem;
    margin-bottom: 0.4rem;
    transition: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-brand-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0.75rem 0.6rem;
    gap: 0.45rem;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-brand-logo {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    width: auto;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-toolbar {
    width: auto;
    min-width: max-content;
    justify-content: flex-end;
    flex-shrink: 0;
    padding: 0;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-toolbar-notifications {
    flex-shrink: 0;
}

.app-container.sidebar-collapsed.sidebar-flyout .nav-link {
    justify-content: flex-start;
    gap: 0.55rem;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
}

.app-container.sidebar-collapsed .sidebar-brand-row {
    flex-direction: column;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.7rem 0.35rem 0.75rem;
}

/* Вузька смуга: логотип і дзвінок на одній вертикалі, однаковий розмір клітинок */
.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-brand-row {
    padding-left: 0;
    padding-right: 0;
    align-items: center;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-brand-logo {
    justify-content: center;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-brand-logo .logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-sizing: border-box;
}

.app-container.sidebar-collapsed .sidebar-brand-logo {
    flex: 0 0 auto;
    justify-content: center;
    width: 100%;
}

.app-container.sidebar-collapsed .sidebar-toolbar {
    width: 100%;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    padding: 0 0.1rem;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-toolbar {
    padding: 0;
    justify-content: center;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .notifications-wrapper.sidebar-toolbar-notifications {
    display: flex;
    justify-content: center;
    width: 100%;
}

.app-container.sidebar-collapsed .sidebar-tool-btn,
.app-container.sidebar-collapsed .sidebar-toolbar-notifications .notifications.sidebar-tool-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
}

.app-container.sidebar-collapsed .mobile-menu-toggle {
    display: none;
}

.app-container.sidebar-collapsed .nav-link {
    justify-content: center;
    gap: 0;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.app-container.sidebar-collapsed .nav-icon {
    width: 1.95rem;
    height: 1.95rem;
    min-width: 1.95rem;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.app-container.sidebar-collapsed .nav-link:hover .nav-icon {
    transform: none;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer-user .user-info {
    display: none !important;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-footer-user .user-info {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer-user .user-menu-trigger {
    gap: 0;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.4rem;
    box-sizing: border-box;
}

.app-container.sidebar-collapsed.sidebar-flyout .sidebar-footer-user .user-menu-trigger {
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0.55rem;
}

.app-container.sidebar-collapsed .sidebar-footer {
    align-items: stretch;
}

/* Приховуємо зайвий padding .user-menu у вузькій колонці — аватар по центру */
.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer-user.user-menu {
    padding: 0.35rem 0.2rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.app-container.sidebar-collapsed:not(.sidebar-flyout) .sidebar-footer {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

@media (max-width: 768px) {
    .app-container.sidebar-collapsed .mobile-menu-toggle {
        display: inline-flex;
    }
}

.nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    background-color: var(--primary-100);
    color: var(--primary-700);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

/* Сучасний основний контент */
.main-content {
    grid-area: main;
    background-color: var(--bg-secondary);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
    isolation: isolate;
}

.page-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-width: 0;
    box-sizing: border-box;
}

/* Згорнутий сайдбар — основний контент на всю ширину вікна */
.app-container.sidebar-collapsed .main-content .page-content {
    max-width: none !important;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.page-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1.5rem;
}

/* Сучасні кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(217 119 6 / 0.22);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-700);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-300);
}

.btn-success {
    background-color: var(--success-600);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-700);
}

.btn-danger {
    background-color: var(--error-600);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--error-700);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-600);
    border: 1px solid var(--primary-600);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-600);
    color: white;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius);
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Сучасні форми */
.form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-label.required::after {
    content: ' *';
    color: var(--error-600);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(217 119 6 / 0.18);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-control.error {
    border-color: var(--error-500);
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.form-error {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--error-600);
}

.form-hint {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-suffix {
    padding: 0.75rem 1rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Auth pages — статичний фон без анімації (краща продуктивність) */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
    background: linear-gradient(165deg, #fffbf5 0%, #fff7ed 45%, #fef3c7 100%);
}

.auth-layout {
    width: min(440px, 100%);
    min-height: auto;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.auth-layout--wide {
    width: min(980px, 100%);
    min-height: 600px;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
}

.auth-logo--top {
    justify-content: center;
    margin: 0 0 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--primary-900);
    font-size: 1.05rem;
    font-weight: 800;
    width: 100%;
    box-sizing: border-box;
}

.auth-logo--top .auth-logo-icon {
    background: linear-gradient(145deg, var(--primary-500), var(--primary-700));
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    font-style: normal;
    flex-shrink: 0;
}

.auth-logo--top .auth-logo-icon.auth-logo-icon--emoji {
    background: transparent;
    font-size: 1.65rem;
    line-height: 1;
    width: auto;
    min-width: 2.25rem;
    font-weight: normal;
}

/* Логотип у білій панелі: темний текст (не #fffbeb від .auth-logo) */
.auth-logo.auth-logo--top {
    display: flex;
    align-items: center;
    color: var(--primary-900);
}

.auth-logo.auth-logo--top:hover {
    color: var(--primary-700);
}

.auth-logo.auth-logo--top .auth-brand-text {
    color: inherit;
    text-align: left;
    line-height: 1.25;
    word-break: break-word;
    flex: 1;
    min-width: 0;
}

.auth-brand {
    background: linear-gradient(155deg, #292524 0%, #78350f 42%, #d97706 88%, #fbbf24 100%);
    color: #fffbeb;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #fffbeb;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
}

.auth-logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
}

.auth-brand h1 {
    font-size: clamp(1.5rem, 2vw, 2rem);
    line-height: 1.3;
}

.auth-brand p {
    color: #fde68a;
    max-width: 34ch;
}

.auth-panel {
    padding: 2rem 2rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    background: var(--bg-primary);
}

.auth-card {
    background-color: var(--bg-primary);
}

.auth-title {
    margin: 0 0 0.65rem;
    font-size: 1.375rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    line-height: 1.3;
}

.auth-subtitle {
    margin: 0 0 1.35rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.auth-card .form-group {
    margin-bottom: 1.15rem;
}

.auth-card .form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.auth-card .form-control {
    border-color: #d4c4b0;
}

.auth-card .form-control:focus {
    border-color: var(--primary-500);
}

.auth-title .fa-lock {
    color: var(--primary-600);
    font-size: 1.25rem;
}

.auth-form {
    margin-top: 0.5rem;
}

.auth-card .alert ul {
    margin: 0;
    padding-left: 1rem;
}

.auth-footer {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.auth-footer a,
.back-link a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover,
.back-link a:hover {
    text-decoration: underline;
}

/* Сучасні карточки */
.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Статистичні карточки */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success-600);
}

.stat-change.negative {
    color: var(--error-600);
}

/* Сучасні сповіщення */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: var(--success-50);
    border-color: var(--success-200);
    color: var(--success-800);
}

.alert-warning {
    background-color: var(--warning-50);
    border-color: var(--warning-200);
    color: var(--warning-800);
}

.alert-error {
    background-color: var(--error-50);
    border-color: var(--error-200);
    color: var(--error-800);
}

.alert-info {
    background-color: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-800);
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-message {
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-close {
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.alert-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Таблиці */
.table-container {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background-color: var(--bg-tertiary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

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

/* Пустий стан */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Прогрес бари */
.progress {
    width: 100%;
    height: 8px;
    background-color: var(--bg-tertiary);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

/* Бейджі */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    border: none;
    outline: none;
}

.badge-primary {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background-color: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background-color: var(--warning-100);
    color: var(--warning-700);
}

.badge-error {
    background-color: var(--error-100);
    color: var(--error-700);
}

.badge-secondary {
    background-color: var(--secondary-100);
    color: var(--secondary-700);
}

/* Стилі для головної сторінки */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
    border-radius: var(--radius-xl);
    margin-bottom: 4rem;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
    color: white;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.hero-stat {
    text-align: center;
}

.hero-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: 0.5rem;
}

.hero-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Секції */
.features-section {
    margin-bottom: 4rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.section-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
    transform: scaleX(0);
    transition: transform var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1.5rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.feature-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.feature-list li::before {
    content: '✓';
    color: var(--success-600);
    font-weight: 600;
}

/* CTA секція */
.cta-section {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    border-radius: var(--radius-xl);
    padding: 4rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.cta-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

.cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.cta-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.cta-description {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    line-height: 1.6;
}

.cta-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.cta-actions .btn {
    backdrop-filter: blur(10px);
}

.cta-actions .btn-outline {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.cta-actions .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.cta-features {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Сітки сайтів */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.site-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition);
}

.site-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.site-header h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.site-info {
    margin-bottom: 1rem;
}

.site-info p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.site-actions {
    display: flex;
    gap: 0.5rem;
}

/* Адаптивність */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-description {
        font-size: 1.125rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .cta-section {
        padding: 3rem 1.5rem;
    }
    
    .cta-title {
        font-size: 2rem;
    }
    
    .cta-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .cta-features {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .cta-section {
        padding: 2rem 1rem;
    }
}

/* Панель керування */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: #1f2937;
}

.stat-info p {
    color: #6b7280;
    font-size: 0.875rem;
}

.actions-section {
    text-align: center;
    margin-bottom: 2rem;
}

.sites-section h3 {
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.site-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.site-header h4 {
    margin: 0;
    color: #1f2937;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background-color: #dcfce7;
    color: #16a34a;
}

.status-inactive {
    background-color: #fef2f2;
    color: #dc2626;
}

.site-info p {
    margin-bottom: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.site-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.site-actions .btn {
    flex: 1 1 0;
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 480px) {
    .site-actions {
        flex-wrap: wrap;
    }
    .site-actions .btn {
        flex: 1 1 100%;
    }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Файловий менеджер */
.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.breadcrumb {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.breadcrumb a {
    color: var(--primary-600);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.fm-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.fm-action-group {
    display: flex;
    align-items: center;
}

.fm-form-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.fm-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.fm-table {
    width: 100%;
    border-collapse: collapse;
}

.fm-table th,
.fm-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.fm-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.fm-table tr:hover {
    background-color: #f9fafb;
}

.fm-folder {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.fm-folder:hover {
    text-decoration: underline;
}

.fm-up {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
}

.fm-up:hover {
    color: #374151;
}

.fm-actions-inline {
    display: flex;
    gap: 0.5rem;
}

.fm-empty {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.fm-footer {
    margin-top: 2rem;
}

/* Адміністрування */
.admin-section {
    margin-bottom: 3rem;
}

.admin-section h3 {
    margin-bottom: 1.5rem;
    color: #1f2937;
}


.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.admin-table tr:hover {
    background-color: #f9fafb;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.role-admin {
    background-color: #fef3c7;
    color: #d97706;
}

.role-user {
    background-color: var(--primary-100);
    color: var(--primary-800);
}

.site-link {
    color: var(--primary-600);
    text-decoration: none;
}

.site-link:hover {
    text-decoration: underline;
}

.domain-type {
    font-size: 0.875rem;
    color: #6b7280;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.admin-footer {
    margin-top: 2rem;
}

/* Модальні вікна */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Допоміжні стилі */
.text-muted {
    color: #6b7280;
    font-size: 0.875rem;
}

.back-link {
    text-align: center;
    margin-top: 2rem;
}

.back-link a {
    color: var(--primary-600);
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

small {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: block;
}

/* Адаптивність */
@media (max-width: 768px) {
    .app-container {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(300px, 92vw);
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: var(--shadow-xl);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        min-height: 100vh;
        margin-left: 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .fm-actions {
        flex-direction: column;
    }
    
    .fm-form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .admin-table {
        min-width: 600px;
    }

    .auth-page {
        padding: 1rem;
    }

    .auth-layout--wide {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-brand,
    .auth-panel {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .auth-card, .form-card {
        padding: 1.5rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
}

/* Form validation error state */
.form-control.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Toast notification animations */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

/* File loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-600);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark theme overrides (toggled via JS) */
.dark-theme {
    background-color: #1f2937;
    color: #f9fafb;
}

.dark-theme .header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.dark-theme .sidebar,
.dark-theme .auth-card,
.dark-theme .form-card,
.dark-theme .site-card,
.dark-theme .stat-card,
.dark-theme .feature,
.dark-theme .table-container,
.dark-theme .fm-table-container,
.dark-theme .modal-content {
    background-color: #374151;
    color: #f9fafb;
}

.dark-theme .form-control {
    background-color: #4b5563;
    border-color: #6b7280;
    color: #f9fafb;
}

.dark-theme .nav-link {
    color: #d1d5db;
}

.dark-theme .nav-link:hover {
    background-color: #4b5563;
    color: #f9fafb;
}

.dark-theme .lion-submenu-item.nav-link.active {
    background-color: rgba(217, 119, 6, 0.22);
    color: #fde68a;
}

/* ==================== Domain Type Selector ==================== */
.domain-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}
.domain-type-option {
    position: relative;
}
.domain-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.domain-type-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}
.domain-type-label:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}
.domain-type-option input[type="radio"]:checked + .domain-type-label {
    border-color: var(--primary-600);
    background: linear-gradient(135deg, var(--primary-50), #fff);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}
.domain-type-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}
.domain-type-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.domain-type-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}
.domain-type-desc {
    font-size: 0.8rem;
    color: #94a3b8;
}
@media (max-width: 640px) {
    .domain-type-selector {
        grid-template-columns: 1fr;
    }
}

/* Вкладки дашборду LionTeam */
.lion-panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.4rem;
    background: linear-gradient(180deg, #fff 0%, var(--primary-50) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(217, 119, 6, 0.18);
    box-shadow: 0 4px 18px rgba(120, 53, 15, 0.07);
}
.lion-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition), color var(--transition), transform var(--transition-fast);
}

.lion-tab i {
    font-size: 1rem;
    opacity: 0.92;
    color: var(--primary-700);
}

.lion-tab:hover i {
    color: var(--primary-900);
}

.lion-tab.is-active i {
    color: var(--primary-900);
}
.lion-tab:hover {
    color: var(--primary-800);
    background: rgba(245, 158, 11, 0.12);
}
.lion-tab.is-active {
    color: var(--primary-900);
    background: linear-gradient(135deg, var(--primary-100), #fff);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(217, 119, 6, 0.25);
}
.lion-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.lion-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-sm);
}
.lion-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.lion-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--primary-800);
}
.lion-muted {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* Порожній дашборд — акцентний блок із іконками */
.lion-dashboard-hero {
    text-align: center;
    padding: 2.5rem 1.75rem 2.75rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(217, 119, 6, 0.2);
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(251, 191, 36, 0.2), transparent 55%),
        linear-gradient(180deg, #fff 0%, var(--primary-50) 100%);
    box-shadow: 0 12px 40px rgba(120, 53, 15, 0.08);
}

.lion-dashboard-hero-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem;
    background: linear-gradient(145deg, var(--primary-400), var(--primary-700));
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 10px 28px rgba(217, 119, 6, 0.4);
}

.lion-dashboard-hero-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.lion-dashboard-hero-text {
    max-width: 42ch;
    margin: 0 auto 1.5rem;
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.55;
}

.lion-dashboard-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.lion-dashboard-hero-actions .btn i {
    margin-right: 0.4rem;
}

.header .logo .logo-icon {
    background: linear-gradient(145deg, var(--primary-400), var(--primary-800));
    color: #1c1917;
}

/* CRM (клієнти / товари / склад): компактні метрики та шапка */
.stats-grid.stats-grid--crm {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat-card.stat-card--crm-metric {
    padding: 1rem 1.25rem;
}
.stat-card.stat-card--crm-metric .stat-value {
    font-size: 1.5rem;
    margin-bottom: 0.15rem;
}
.stat-card.stat-card--crm-metric .stat-label {
    font-size: 0.8125rem;
}
.crm-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Заголовок сторінки: лише H1 + дії справа */
.page-header--title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.page-header--title-row .page-title {
    margin: 0;
}
.page-header--title-row .crm-toolbar {
    margin-bottom: 0;
}
.page-header-meta {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* CRM: дії зверху сторінки (без дубльованого H1 + опису) */
.crm-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.crm-toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.35rem;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}
.crm-toolbar .btn i {
    font-size: 0.88rem;
    opacity: 0.95;
}
.crm-reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.crm-report-open-btn {
    width: 100%;
    justify-content: center;
}
.sidebar .nav-link {
    border-radius: var(--radius-md);
}
.sidebar .nav-icon {
    border-radius: var(--radius-md);
}

/* Модалка замовлення — картки та підсумки (узгоджено з референсом Dashboard) */
#order-modal .order-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 1rem;
    align-items: start;
}
@media (max-width: 920px) {
    #order-modal .order-modal-grid {
        grid-template-columns: 1fr;
    }
}
#order-modal .order-modal-col {
    min-width: 0;
}
#order-modal .order-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow-md);
}
#order-modal .order-card--spaced {
    margin-top: 12px;
}
#order-modal .order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
#order-modal .order-card-title {
    font-weight: 700;
    font-size: 0.95rem;
}
#order-modal .order-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (max-width: 520px) {
    #order-modal .order-form-grid-2 {
        grid-template-columns: 1fr;
    }
}
#order-modal .order-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (max-width: 640px) {
    #order-modal .order-form-grid-3 {
        grid-template-columns: 1fr;
    }
}
#order-modal .order-totals {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: grid;
    gap: 6px;
}
#order-modal .order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 0.88rem;
}
#order-modal .order-total-label {
    color: var(--text-tertiary);
    font-weight: 600;
}
#order-modal .order-total-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
#order-modal .order-total-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-top: 0.15rem;
}
#order-modal .order-crm-hint.order-crm-hint--warn {
    color: var(--error-600);
    font-weight: 600;
}
#order-modal .order-meta-muted {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.65rem;
}
#order-modal .order-meta-label {
    color: var(--text-tertiary);
    font-size: 0.72rem;
}
#order-modal .order-mono {
    font-family: ui-monospace, monospace;
}
#order-modal .order-crm-hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin: 0 0 0.65rem;
    line-height: 1.45;
}
#order-modal .order-crm-note {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    margin: 0 0 0.65rem;
    line-height: 1.45;
}

/* Нативний <dialog>: центр viewport (обхід зсуву всередині .app-container / grid) */
dialog.crm-native-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    margin: 0;
    max-height: min(90vh, 920px);
    overflow: auto;
    box-sizing: border-box;
}

dialog.crm-native-dialog::backdrop {
    background: rgba(15, 23, 42, 0.5);
}
