.tg-nav {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    height: var(--nav-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(5, 14, 22, 0.11);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition:
        background 0.45s ease,
        backdrop-filter 0.45s ease,
        -webkit-backdrop-filter 0.45s ease,
        border-color 0.45s ease,
        box-shadow 0.45s ease;
}

.tg-nav.is-scrolled {
    background: rgba(5, 14, 22, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom-color: rgba(201, 166, 107, 0.18);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

html.light-theme .tg-nav {
    background: rgba(255, 255, 255, 0.92);
    border-bottom-color: rgba(26, 79, 140, 0.1);
}

html.light-theme .tg-nav.is-scrolled {
    background: rgba(255, 255, 255, 0.96);
    border-bottom-color: rgba(26, 79, 140, 0.14);
    box-shadow: 0 4px 20px rgba(18, 48, 80, 0.08);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(26, 79, 140, 0.14);
    border: 0.5px solid rgba(201, 166, 107, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.nav-logo-img img,
.nav-logo-img svg {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.nav-logo-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    font-family: var(--font-display);
}

html.light-theme .nav-logo-text strong {
    color: var(--text-main);
}

.nav-logo-text span {
    display: block;
    font-size: 10px;
    color: var(--brand-brick-light);
    letter-spacing: 0.06em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links > li {
    position: relative;
}

.nav-links a,
.nav-links .nav-parent {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: 0.2s;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

html.light-theme .nav-links a,
html.light-theme .nav-links .nav-parent {
    color: var(--text-muted);
}

html.light-theme .nav-links .nav-cta,
html.light-theme .nav-links .nav-cta:hover {
    color: #fff;
}

.nav-links a i,
.nav-links .nav-parent i {
    font-size: 14px;
    color: var(--brand-warm-light);
}

.nav-links .nav-caret {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s;
}

.nav-links a:hover,
.nav-links .nav-parent:hover,
.nav-links .has-mega.is-open > .nav-parent {
    color: #fff;
    background: rgba(26, 79, 140, 0.18);
}

html.light-theme .nav-links a:hover,
html.light-theme .nav-links .nav-parent:hover,
html.light-theme .nav-links .has-mega.is-open > .nav-parent {
    color: var(--text-main);
    background: rgba(26, 79, 140, 0.08);
}

.nav-links .has-mega.is-open .nav-caret {
    transform: rotate(180deg);
}

.mega-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 460px;
    max-width: min(680px, 94vw);
    padding: 12px;
    border-radius: 16px;
    background: rgba(7, 20, 32, 0.97);
    border: 1px solid rgba(201, 166, 107, 0.18);
    box-shadow: var(--shadow-soft, 0 18px 48px rgba(0, 0, 0, 0.28));
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 1100;
}

.nav-links .has-mega.is-open > .mega-panel,
.nav-links .has-mega:hover > .mega-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(210px, 1fr));
    gap: 6px;
}

.mega-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    color: rgba(255, 255, 255, 0.86) !important;
    text-decoration: none;
}

.mega-item:hover {
    background: rgba(26, 79, 140, 0.2) !important;
}

.mega-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(201, 166, 107, 0.12);
    color: var(--brand-brick-light);
    flex-shrink: 0;
}

.mega-txt strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

html.light-theme .mega-panel {
    background: #fff;
    border-color: rgba(26, 79, 140, 0.12);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

html.light-theme .mega-item {
    color: var(--text-main) !important;
}

.nav-links .nav-cta {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, var(--brand-warm) 100%);
    color: #fff;
    border-radius: 999px;
    border: 0.5px solid rgba(201, 166, 107, 0.25);
    box-shadow: 0 8px 20px rgba(13, 122, 111, 0.22);
}

.nav-links .nav-cta:hover {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 50%, var(--brand-warm-light) 100%);
    color: #fff;
}

.nav-links .nav-cta i {
    color: #fff;
}

.drawer-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-group-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: right;
}

.drawer-group-btn .drawer-caret {
    margin-right: auto;
    font-size: 11px;
    opacity: 0.7;
    transition: transform 0.2s;
}

.drawer-group.is-open > .drawer-group-btn {
    background: rgba(26, 79, 140, 0.16);
    color: #fff;
}

.drawer-group.is-open .drawer-caret {
    transform: rotate(180deg);
}

.drawer-sub {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 0 0.4rem 0.4rem 0.85rem;
}

.drawer-group.is-open > .drawer-sub {
    display: flex;
}

.drawer-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 14px;
}

.drawer-sublink:hover {
    background: rgba(26, 79, 140, 0.14);
    color: #fff;
}

.drawer-sublink i {
    color: var(--brand-warm-light);
    width: 1.1rem;
    text-align: center;
}

html.light-theme .drawer-group-btn,
html.light-theme .drawer-sublink {
    color: var(--text-main);
}

@media (max-width: 980px) {
    .nav-links {
        display: none;
    }

    .nav-menu-btn {
        display: flex;
    }
}

@media (min-width: 981px) {
    .nav-menu-btn {
        display: none;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--theme-toggle-size, 42px);
    height: var(--theme-toggle-size, 42px);
    border-radius: var(--theme-toggle-radius, 12px);
    background: var(--theme-toggle-bg, rgba(201, 166, 107, 0.12));
    border: 0.5px solid var(--theme-toggle-border, rgba(201, 166, 107, 0.22));
    color: var(--theme-toggle-fg, var(--brand-brick-light));
    font-size: 17px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        transform 0.2s ease,
        box-shadow 0.22s ease;
}

.theme-toggle:hover {
    background: var(--theme-toggle-bg-hover, rgba(201, 166, 107, 0.22));
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0) scale(0.96);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus-ring) 22%, transparent);
}

.theme-toggle__sun,
.theme-toggle__moon {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle__sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle__moon {
    opacity: 0;
    transform: rotate(-50deg) scale(0.7);
    pointer-events: none;
}

html.light-theme .theme-toggle__sun {
    opacity: 0;
    transform: rotate(50deg) scale(0.7);
    pointer-events: none;
}

html.light-theme .theme-toggle__moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .theme-toggle__sun,
    .theme-toggle__moon {
        transition: none;
    }

    .theme-toggle:hover,
    .theme-toggle:active {
        transform: none;
    }
}

.nav-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--theme-toggle-size, 42px);
    height: var(--theme-toggle-size, 42px);
    border-radius: var(--theme-toggle-radius, 12px);
    background: var(--theme-toggle-bg, rgba(201, 166, 107, 0.12));
    border: 0.5px solid var(--theme-toggle-border, rgba(201, 166, 107, 0.22));
    color: var(--theme-toggle-fg, var(--brand-brick-light));
    font-size: 20px;
    cursor: pointer;
    transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 9990;
    pointer-events: none;
}

.nav-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 20, 0.78);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.35s;
}

.nav-drawer-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(85vw, 320px);
    background: #071420;
    border-left: 0.5px solid rgba(201, 166, 107, 0.16);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-drawer.open {
    pointer-events: all;
}

.nav-drawer.open .nav-drawer-backdrop {
    opacity: 1;
}

.nav-drawer.open .nav-drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 0.5px solid rgba(201, 166, 107, 0.12);
}

.drawer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.drawer-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(26, 79, 140, 0.14);
    border: 0.5px solid rgba(201, 166, 107, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-logo strong {
    font-size: 13px;
    color: #fff;
    font-family: var(--font-display);
}

.drawer-logo span {
    font-size: 9px;
    color: var(--brand-brick-light);
}

.drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.drawer-close:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #fff;
}

.drawer-links {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    transition: 0.2s;
}

.drawer-link:hover {
    background: rgba(26, 79, 140, 0.16);
    color: #fff;
}

.drawer-link .dl-icon,
.drawer-group-btn .dl-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(201, 166, 107, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--brand-warm-light);
    flex-shrink: 0;
}

.drawer-footer {
    padding: 1rem;
    border-top: 0.5px solid rgba(201, 166, 107, 0.1);
}

.drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand-warm));
    color: #fff;
    text-decoration: none;
    border: 0.5px solid rgba(201, 166, 107, 0.25);
    transition: 0.2s;
}

.drawer-cta:hover {
    background: linear-gradient(135deg, var(--brand), var(--brand-warm-light));
}

html.light-theme .nav-drawer-panel {
    background: #ffffff;
    border-left-color: rgba(26, 79, 140, 0.1);
}

html.light-theme .drawer-logo strong {
    color: var(--text-main);
}

html.light-theme .drawer-link {
    color: var(--text-main);
}

html.light-theme .drawer-close {
    background: rgba(26, 79, 140, 0.08);
    color: var(--text-muted);
}

html.light-theme .drawer-close:hover {
    background: rgba(220, 53, 69, 0.14);
    color: #b91c1c;
}

@media (max-width: 980px) {
    .nav-links {
        display: none;
    }

    .nav-menu-btn {
        display: flex;
    }
}

@media (min-width: 981px) {
    .nav-menu-btn {
        display: none;
    }
}

@media (max-width: 768px) {
    .tg-nav {
        padding: 0 1rem;
    }

    .nav-logo-text strong {
        font-size: 12px;
    }

    .nav-logo-img {
        width: 40px;
        height: 40px;
    }
}
