
        :root{
            --main-color: #2563eb;
            --main-bg-color: #fafafa;
            --main-btn-bg-color: #2563eb;
            --secondary-btn-bg-color: #e5e7eb;
            --danger-color: #ef4444;
            --success-main-color: #10b981;
            --success-btn-color: #28a745;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            scroll-behavior: smooth;
            overflow-x: clip;
            height: 100%;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: var(--main-bg-color);
            color: #333;
            line-height: 1.6;
            overflow-x: clip;
            width: 100%;
            max-width: 100vw;
            padding-top: 60px;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        nav {
            min-height: 0;
        }
        /* Header Navigation */
        header {
            background: white;
            border-bottom: 1px solid #e0e0e0;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }

        aside {
            width: 250px;
            min-width: 200px;
            background: white;
            border-right: 1px solid #e0e0e0;
            padding: 1.5rem 0;

            display: flex;
            flex-direction: column;

            position: sticky;
            top: 60px;
            height: calc(100vh - 60px);

            overflow-y: auto; /* <-- головне */
            overflow-x: hidden;

            -webkit-overflow-scrolling: touch;
        }
        /* Main Content */
        main {
            display: flex;
            flex-direction: column;
            flex: 1;
            margin: 0 2rem;
            background: var(--main-bg-color);
            padding-top: 20px;
            height: auto;
            min-height: 0;
            width: calc(100% - 200px);
        }
        .header-container {
            margin: 0 auto;
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--main-color);
            text-decoration: none;
            transition: color 0.3s ease;
        }

        .logo:hover {
            color: #1d4ed8;
        }

        .logout-btn {
            padding: 0.5rem 1rem;
            background: var(--danger-color);
            color: white;
            border: none;
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            transition: background 0.3s ease;
            text-decoration: none;
        }

        .logout-btn:hover {
            background: #dc2626;
            color: white;
        }

        .secondary-btn {
            padding: 0.5rem 1rem;
            color: var(--main-btn-bg-color);
            border: 1px solid var(--main-btn-bg-color);
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            font-weight: 500;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
            background: transparent;
            width: fit-content;
        }

        .secondary-btn:hover {
            background: #eff6ff;
            color: #1d4ed8;
        }

        .register-btn {
            padding: 0.5rem 1.5rem;
            background: var(--main-btn-bg-color);
            color: white;
            border: none;
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            font-weight: 500;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
        }

        .register-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        }

        .dashboard-btn {
            padding: 0.5rem 1rem;
            background: var(--main-color);
            color: white;
            border: none;
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            font-weight: 500;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
            margin-right: 0.75rem;
        }

        .dashboard-btn:hover {
            background: var(--main-btn-bg-color);
            transform: translateY(-2px);
        }

        /* Header Navigation Links */
        .header-nav {
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        .header-nav-link {
            padding: 0.4rem 0.75rem;
            color: #4b5563;
            text-decoration: none;
            font-size: 0.875rem;
            font-weight: 500;
            border-radius: 0.375rem;
            transition: all 0.2s ease;
        }

        .header-nav-link:hover {
            color: var(--main-color);
            background: #eff6ff;
        }

        /* Burger Menu */
        .burger-menu {
            display: none;
            flex-direction: column;
            justify-content: space-between;
            width: 24px;
            height: 18px;
            cursor: pointer;
            z-index: 1001;
        }

        .burger-menu span {
            display: block;
            width: 100%;
            height: 2px;
            background: #1f2937;
            border-radius: 2px;
            transition: all 0.3s ease;
        }

        .burger-menu.active span:nth-child(1) {
            transform: rotate(45deg) translate(5px, 5px);
        }

        .burger-menu.active span:nth-child(2) {
            opacity: 0;
        }

        .burger-menu.active span:nth-child(3) {
            transform: rotate(-45deg) translate(6px, -6px);
        }

        .mobile-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
        }

        .mobile-overlay.active {
            display: block;
        }

        /* Mobile Nav for non-authenticated users */
        .mobile-nav {
            display: none;
            position: fixed;
            top: 0;
            right: -280px;
            width: 280px;
            height: 100vh;
            background: white;
            z-index: 1000;
            padding: 4.5rem 0 2rem;
            box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
            transition: right 0.3s ease;
            flex-direction: column;
        }

        .mobile-nav.active {
            right: 0;
        }

        .mobile-nav-close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            width: 32px;
            height: 32px;
            background: none;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.375rem;
            transition: background 0.2s;
        }

        .mobile-nav-close:hover {
            background: #f3f4f6;
        }

        .mobile-nav-close::before,
        .mobile-nav-close::after {
            content: '';
            position: absolute;
            width: 18px;
            height: 2px;
            background: #374151;
            border-radius: 2px;
        }

        .mobile-nav-close::before {
            transform: rotate(45deg);
        }

        .mobile-nav-close::after {
            transform: rotate(-45deg);
        }

        .mobile-nav a {
            display: block;
            padding: 0.875rem 1.5rem;
            color: #374151;
            text-decoration: none;
            font-size: 1rem;
            font-weight: 500;
            border-bottom: 1px solid #f3f4f6;
            transition: background 0.2s;
        }

        .mobile-nav a:hover {
            background: #f3f4f6;
            color: var(--main-color);
        }

        .mobile-nav .mobile-nav-actions {
            margin-top: auto;
            padding: 1rem 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            border-top: 1px solid var(--secondary-btn-bg-color);
        }

        .mobile-nav .mobile-nav-actions a {
            text-align: center;
            border-radius: 0.375rem;
            border-bottom: none;
            padding: 0.75rem 1rem;
        }

        .mobile-nav .mobile-nav-login {
            color: var(--main-color);
            border: 1px solid var(--main-color);
            background: transparent;
        }

        .mobile-nav .mobile-nav-register {
            color: white;
            background: var(--main-color);
            font-weight: 600;
        }

        /* Public burger (same style, positioned in header-right) */
        .public-burger {
            display: none;
            flex-direction: column;
            justify-content: space-between;
            width: 24px;
            height: 18px;
            cursor: pointer;
            z-index: 1001;
            background: none;
            border: none;
            padding: 0;
        }

        .public-burger span {
            display: block;
            width: 100%;
            height: 2px;
            background: #1f2937;
            border-radius: 2px;
            transition: all 0.3s ease;
        }

        .public-burger.active span:nth-child(1) {
            transform: rotate(45deg) translate(5px, 5px);
        }

        .public-burger.active span:nth-child(2) {
            opacity: 0;
        }

        .public-burger.active span:nth-child(3) {
            transform: rotate(-45deg) translate(6px, -6px);
        }

        /* Main Layout */
        .main-wrapper {
            display: flex;
            gap: 0;
            min-height: calc(100vh - 80px);
        }

        .nav-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            list-style: none;
        }

        .nav-bottom {
            padding-top: 1rem;
            border-top: 1px solid var(--secondary-btn-bg-color);
        }
        aside {
            display: flex;
            flex-direction: column;
        }
        aside > nav:first-child {
            flex: 1;
            overflow-y: auto;
        }
        .nav-item a {
            display: block;
            padding: 0.75rem 1.5rem;
            color: var(--main-color);
            text-decoration: none;
            transition: all 0.3s ease;
            border-left: 3px solid transparent;
        }

        .nav-item a:hover {
            background: #f3f4f6;
            border-left-color: var(--main-color);
        }

        .nav-item a.active {
            background: #eff6ff;
            border-left-color: var(--main-color);
            font-weight: 600;
        }

        /* Nav Dropdown */
        .nav-dropdown .nav-dropdown-toggle {
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
        }

        .dropdown-arrow {
            font-size: 0.85rem;
            transition: transform 0.2s ease;
        }

        .nav-dropdown.open > .dropdown-arrow,
        .nav-dropdown.open > .nav-dropdown-toggle > .dropdown-arrow {
            transform: rotate(90deg);
        }

        .nav-submenu {
            list-style: none;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
            padding: 0;
        }

        .nav-dropdown.open > .nav-submenu {
            max-height: 500px;
        }

        .nav-submenu .nav-item a {
            padding: 0.5rem 1.5rem 0.5rem 2.5rem;
            font-size: 0.9rem;
            color: #6b7280;
        }

        .nav-submenu .nav-item a:hover {
            color: var(--main-color);
            background: #f3f4f6;
        }

        /* Nested dropdown (Податки inside Облік фінансів) */
        .nav-submenu .nav-dropdown > .nav-dropdown-toggle {
            padding: 0.5rem 1.5rem 0.5rem 2.5rem;
            font-size: 0.9rem;
            color: #4b5563;
            background: #f9fafb;
            border-left: 3px solid #d1d5db;
            margin: 0.25rem 0;
            border-radius: 0 0.375rem 0.375rem 0;
            font-weight: 600;
        }

        .nav-submenu .nav-dropdown > .nav-dropdown-toggle:hover {
            color: var(--main-color);
            background: #eff6ff;
            border-left-color: var(--main-color);
        }

        .nav-submenu .nav-dropdown.open > .nav-dropdown-toggle {
            color: var(--main-color);
            border-left-color: var(--main-color);
            background: #eff6ff;
        }

        .nav-submenu .nav-submenu .nav-item a {
            padding: 0.5rem 1.5rem 0.5rem 3.5rem;
            font-size: 0.85rem;
        }
        /* Footer placed inside content (templates include footer.html). Ensure footer sits at bottom when content is short. */
        .site-footer {
            margin-top: auto !important;
            width: 100%;
        }

        .container {
            width: 100%;
        }

        /* No Sidebar Layout */
        body.no-sidebar .main-wrapper {
            display: block;
        }

        body.no-sidebar aside {
            display: none;
        }

        body.no-sidebar main {
            width: 100%;
            margin: 0;
        }

        /* Responsive */

        @media (max-width: 1250px){
            body.no-sidebar main {
                padding: 0 1.5rem;
            }
            main{
                margin: 0.25rem;
            }
}

        @media (max-width: 1000px){
            .header-nav {
                display: none;
            }

            .public-burger {
                display: flex;
            }

            .secondary-btn {
                display: none;
            }

            .mobile-nav {
                display: flex;
            }
}

        @media (max-width: 768px){
            .burger-menu {
                display: flex;
            }

            .main-wrapper {
                flex-direction: column;
            }
            main{
                margin: 0;
                padding: 1rem 1rem;
                min-height: calc(100vh - 60px);
                width: 100%;
            }
            aside {
                position: fixed;
                top: 0;
                left: -280px;
                width: 280px;
                height: 100vh;
                z-index: 1000;
                border-right: 1px solid #e0e0e0;
                padding: 1.5rem 0;
                flex-direction: column;
                justify-content: flex-start;
                transition: left 0.3s ease;
                box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
            }
            aside.active {
                left: 0;
            }

            aside nav {
                width: 100%;
            }

            .nav-list {
                flex-direction: column;
                padding: 0;
                gap: 0;
            }

            .nav-item a {
                border-left: 3px solid transparent;
                border-bottom: none;
                padding: 1.125rem 1.5rem;
                white-space: nowrap;
                font-size: 1.125rem;
            }

            .nav-item a:hover {
                border-left-color: var(--main-color);
                background: #f3f4f6;
            }

            .nav-item a.active {
                border-left-color: var(--main-color);
                background: #eff6ff;
            }

            .nav-submenu .nav-item a {
                padding: 0.75rem 1.5rem 0.75rem 2.5rem;
                font-size: 1rem;
            }

            .nav-submenu .nav-dropdown > .nav-dropdown-toggle {
                padding: 0.75rem 1.5rem 0.75rem 2.5rem;
                font-size: 1rem;
            }

            .nav-submenu .nav-submenu .nav-item a {
                padding: 0.75rem 1.5rem 0.75rem 3.5rem;
                font-size: 0.95rem;
            }

            .nav-bottom {
                border-top: 1px solid var(--secondary-btn-bg-color);
                border-left: none;
                margin-top: auto;
                margin-left: 0;
                padding-top: 1rem;
                padding-left: 0;
            }

            .nav-bottom .nav-list {
                padding: 0;
            }

            .nav-bottom .nav-item a {
                padding: 1.125rem 1.5rem;
                font-size: 1.125rem;
            }

            .header-container {
                padding: 0.75rem 1rem;
            }

            .logo {
                font-size: 1.25rem;
            }

            body.no-sidebar main {
                margin: 0;
                padding: 0 1rem;
            }
}

        @media (max-width: 480px){
            .nav-item a {
                padding: 1rem 1.5rem;
                font-size: 1rem;
            }

            .register-btn, .secondary-btn, .logout-btn, .dashboard-btn {
                padding: 0.375rem 0.75rem;
                font-size: 0.75rem;
            }

            main {
                margin: 0;
                padding: 0 0.75rem;
            }
}
