html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.bg-clip-text {
    -webkit-background-clip: text;
}

.text-transparent {
    -webkit-text-fill-color: transparent;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #fff;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
}

body {
    background: #f8fafc;
    font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#main-content {
    flex: 1 0 auto;
}

img, video, canvas, svg {
    max-width: 100%;
}

/* Modern Header Redesign */
.modern-nav {
    background: var(--navbar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 0;
}

.nav-scrolled {
    padding: 0.5rem 0;
}

.nav-scrolled {
    background: rgba(10, 15, 30, 0.98);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
}

.navbar-brand-text {
    font-family: 'Space Grotesk', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-brand {
    min-width: 0;
}

.navbar-brand .navbar-brand-text {
    min-width: 0;
    white-space: nowrap;
}

.nav-link-modern {
    color: rgba(255,255,255,0.7) !important;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link-modern:hover,
.nav-link-modern.active {
    color: #fff !important;
}

.nav-link-modern:focus-visible {
    outline: 2px solid rgba(255,255,255,0.75);
    outline-offset: 4px;
    border-radius: 0.75rem;
}

.nav-link-modern::after {
    content: '';
    position: absolute;
    bottom: -0.15rem;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.96), transparent);
    box-shadow: 0 0 10px rgba(255,255,255,0.28);
    transition: all 0.28s ease;
    transform: translateX(-50%);
    border-radius: 2px;
    opacity: 0;
}

.nav-link-modern:hover::after,
.nav-link-modern.active::after {
    width: 1.8rem;
    opacity: 1;
}

.nav-link-modern.active {
    text-shadow: 0 0 14px rgba(255,255,255,0.22);
}

.modern-nav .dropdown-toggle::after {
    display: none;
}

.nav-dropdown-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
    font-size: 0.62rem;
    opacity: 0.55;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.dropdown.show .nav-dropdown-caret {
    transform: rotate(180deg);
    opacity: 0.9;
}

/* Dropdown Styling */
.dropdown-menu-modern {
    background: #0f172a !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5) !important;
    padding: 0.75rem !important;
    margin-top: 1rem !important;
}

.dropdown-item-modern {
    color: rgba(255,255,255,0.7) !important;
    border-radius: 0.75rem !important;
    padding: 0.6rem 1rem !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-item-modern:hover {
    background: rgba(255,255,255,0.05) !important;
    color: #fff !important;
    transform: translateX(4px);
}

.dropdown-item-modern:focus-visible {
    outline: 2px solid rgba(255,255,255,0.65);
    outline-offset: 2px;
}

/* Buttons */
.btn-header-primary {
    background: var(--primary);
    color: #fff !important;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    border: none;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.3s ease;
}

.btn-header-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-header-outline {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff !important;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    transition: all 0.2s ease;
}

.btn-header-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

/* Shared Motion Utilities */
@keyframes aim-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes aim-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in,
.fade-in {
    animation: aim-fade-in 0.6s ease-out both !important;
    will-change: opacity, transform;
    backface-visibility: hidden;
}

.animate-slide-up {
    animation: aim-slide-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) both !important;
    will-change: opacity, transform;
    backface-visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }

    .animate-fade-in,
    .animate-slide-up,
    .fade-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        will-change: auto !important;
    }
}

/* Desktop: three-zone layout (A: brand | B: links | C: actions).
   .navbar-collapse is unwrapped via display:contents so its two
   children (links, actions) become direct flex items alongside
   brand in one row. A gets margin-right:auto (pushed left), C gets
   margin-left:auto (pushed right), which leaves B centered exactly
   between them with plain flex auto-margins, no manual offsets. */
@media (min-width: 1200px) {
    .modern-nav .container-fluid {
        display: flex;
        align-items: center;
        gap: 1.5rem;
    }

    .modern-nav .navbar-brand {
        margin-right: auto;
    }

    .modern-nav .navbar-collapse {
        display: contents;
    }

    .modern-nav .navbar-nav {
        display: flex;
        margin: 0 !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.25rem;
    }

    .modern-nav .navbar-nav .nav-item {
        display: flex;
        align-items: center;
    }

    .modern-nav .auth-actions {
        display: flex;
        align-items: center;
        margin-left: auto !important;
    }
}

@media (max-width: 1199.98px) {
    .modern-nav .container-fluid {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .navbar-brand {
        order: 1;
        flex: 1 1 auto;
        gap: 0.75rem !important;
        max-width: calc(100vw - 4.5rem);
    }

    .navbar-brand img,
    .navbar-brand .theme-brand-mark {
        flex: 0 0 auto;
        width: 2.25rem;
        height: 2.25rem;
    }

    .navbar-brand .navbar-brand-text {
        max-width: calc(100vw - 8rem);
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: clamp(1rem, 4vw, 1.2rem);
    }

    .navbar-toggler {
        order: 2;
        flex: 0 0 auto;
        margin-left: auto;
        padding: 0.25rem 0.35rem;
    }

    .navbar-collapse {
        order: 3;
        width: 100%;
        flex-basis: 100%;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.08);
        align-items: stretch;
        text-align: left;
    }

    .navbar-nav {
        width: 100%;
        align-items: stretch;
        text-align: left;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }

    .navbar-nav .nav-link-modern,
    .navbar-nav .dropdown-toggle {
        display: flex;
        width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .navbar-nav .dropdown {
        width: 100%;
    }

    .navbar-nav .nav-dropdown-caret {
        margin-left: auto;
    }

    .navbar-nav .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none !important;
        width: 100%;
        margin-top: 0.25rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100%;
    }

    .navbar-nav .dropdown-menu-modern {
        border-radius: 1rem !important;
        text-align: left;
        background: rgba(255,255,255,0.04) !important;
        border: 1px solid rgba(255,255,255,0.06) !important;
        box-shadow: none !important;
    }

    .navbar-nav .dropdown-item-modern {
        justify-content: flex-start;
        text-align: left;
        white-space: normal;
    }

    .auth-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
        margin-top: 0.75rem !important;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .auth-actions .nav-username {
        display: block !important;
        text-align: center;
        order: -1;
    }

    .auth-actions .btn-header-outline,
    .auth-actions .btn-header-primary,
    .auth-actions .nav-link-modern {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* Premium Footer */
.premium-footer { background: var(--bg-deep); color: #94a3b8; padding: 5rem 0 2rem; position: relative; }
.footer-heading { font-family: 'Space Grotesk', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; color: white; margin-bottom: 1.5rem; }
.footer-link { color: #94a3b8; text-decoration: none; transition: all 0.2s ease; display: flex; align-items: center; gap: 0.5rem; }
.footer-link:hover { color: var(--primary); transform: translateX(4px); }
.social-circle { width: 40px; height: 40px; background: rgba(255,255,255,0.03); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: all 0.3s; color: #94a3b8; }
.social-circle:hover { background: var(--primary); color: white; transform: translateY(-4px); }

.theme-brand-mark {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.theme-text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.theme-page-header {
    background: linear-gradient(135deg, #0a0c10 0%, #0f172a 45%, #111827 100%);
    position: relative;
    overflow: hidden;
    padding: 1.25rem 0 1.25rem;
}

.theme-page-header.animate-fade-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

.theme-page-header::before,
.theme-page-header::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
}

.theme-page-header::before {
    top: -35%;
    right: -10%;
    width: 24rem;
    height: 24rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--primary) 18%, transparent) 0%, transparent 70%);
}

.theme-page-header::after {
    bottom: -45%;
    left: -10%;
    width: 20rem;
    height: 20rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--secondary) 18%, transparent) 0%, transparent 72%);
}

.theme-surface-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    box-shadow: 0 18px 45px -28px rgba(15, 23, 42, 0.28);
}

.theme-surface-card-soft {
    background: linear-gradient(180deg, white 0%, var(--tertiary-soft) 100%);
    border: 1px solid color-mix(in srgb, var(--tertiary) 65%, #dbe4f0);
    border-radius: 1.25rem;
    box-shadow: 0 10px 28px -24px rgba(15, 23, 42, 0.35);
}

.theme-field,
.theme-select,
.theme-textarea {
    width: 100%;
    min-height: 3.25rem;
    padding: 0.8rem 1rem;
    border: 1.5px solid #dbe4f0;
    border-radius: 0.95rem;
    background: white;
    color: #0f172a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.theme-textarea {
    min-height: 8rem;
}

.theme-field:focus,
.theme-select:focus,
.theme-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.theme-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364758b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 1rem center;
    background-repeat: no-repeat;
    background-size: 1.1rem;
    padding-right: 2.8rem;
}

.theme-btn-primary,
.theme-btn-gradient {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 3.5rem;
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 1rem;
    font-weight: 700;
    text-decoration: none;
    color: white !important;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.theme-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--primary) 55%, transparent);
}

.theme-btn-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--secondary) 42%, transparent);
}

.theme-btn-primary:hover,
.theme-btn-gradient:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.theme-btn-primary:focus,
.theme-btn-gradient:focus {
    outline: none;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent),
        0 14px 30px -18px color-mix(in srgb, var(--primary) 55%, transparent);
}

.theme-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    padding: 0.8rem 1.2rem;
    border: 1px solid color-mix(in srgb, var(--tertiary) 68%, var(--primary));
    border-radius: 0.95rem;
    background: linear-gradient(180deg, white 0%, var(--tertiary-soft) 100%);
    color: var(--primary) !important;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-btn-ghost:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, white 0%, color-mix(in srgb, var(--tertiary) 82%, white) 100%);
}

.theme-action-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    background: transparent;
    color: var(--primary) !important;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-action-link:hover {
    background: linear-gradient(135deg, var(--tertiary-soft), color-mix(in srgb, var(--tertiary) 45%, white));
    color: var(--secondary) !important;
    transform: translateX(2px);
}

.theme-action-link-attention {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid color-mix(in srgb, var(--tertiary) 75%, var(--secondary));
    background: linear-gradient(135deg, var(--tertiary-soft), color-mix(in srgb, var(--secondary) 12%, white));
    color: #334155 !important;
    transition: filter 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.theme-action-link-attention:hover {
    filter: brightness(0.99);
    transform: translateX(2px);
    border-color: color-mix(in srgb, var(--secondary) 45%, #dbe4f0);
}

.theme-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--tertiary-soft), color-mix(in srgb, var(--tertiary) 86%, white));
    color: var(--primary);
    font-weight: 700;
}

.theme-icon-soft {
    background: linear-gradient(180deg, white 0%, var(--tertiary-soft) 100%);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--tertiary) 72%, #dbe4f0);
}

.text-blue-300, .text-blue-400, .text-blue-500, .text-blue-600, .text-blue-700, .text-blue-800, .text-blue-900,
.hover\:text-blue-300:hover, .hover\:text-blue-400:hover, .hover\:text-blue-600:hover, .hover\:text-blue-700:hover,
.focus\:text-blue-500:focus, .focus\:text-blue-600:focus {
    color: var(--primary) !important;
}

.text-indigo-300, .text-indigo-400, .text-indigo-600, .text-indigo-700,
.text-purple-300, .text-purple-400, .text-purple-500, .text-purple-600, .text-purple-700,
.hover\:text-indigo-700:hover, .hover\:text-purple-500:hover {
    color: var(--secondary) !important;
}

.bg-blue-50, .bg-blue-100, .bg-blue-200,
.hover\:bg-blue-50:hover, .hover\:bg-blue-100:hover {
    background-color: var(--tertiary-soft) !important;
}

.bg-blue-500\/10, .bg-blue-500\/20, .bg-blue-600\/10,
.hover\:bg-blue-50\/30:hover, .hover\:bg-blue-500\/20:hover {
    background-color: color-mix(in srgb, var(--primary) 14%, transparent) !important;
}

.bg-blue-500, .bg-blue-600,
.hover\:bg-blue-500:hover, .hover\:bg-blue-600:hover,
.focus\:bg-blue-600:focus {
    background-color: var(--primary) !important;
}

.bg-blue-700, .bg-blue-800,
.hover\:bg-blue-700:hover, .hover\:bg-blue-800:hover,
.focus\:bg-blue-700:focus {
    background-color: var(--primary-dark) !important;
}

.bg-indigo-50, .bg-purple-50 {
    background-color: var(--secondary-soft) !important;
}

.bg-indigo-500\/10, .bg-purple-500\/10, .bg-purple-500\/20, .bg-indigo-500\/20,
.hover\:bg-indigo-50\/30:hover {
    background-color: color-mix(in srgb, var(--secondary) 14%, transparent) !important;
}

.bg-indigo-600, .bg-purple-500, .bg-purple-600,
.hover\:bg-indigo-700:hover, .hover\:bg-purple-700:hover {
    background-color: var(--secondary) !important;
}

.bg-green-50, .bg-green-100, .bg-emerald-50, .bg-emerald-100,
.hover\:bg-green-50:hover, .hover\:bg-emerald-50:hover {
    background-color: var(--secondary-soft) !important;
}

.bg-green-500, .bg-green-600, .bg-emerald-500, .bg-emerald-600,
.hover\:bg-green-600:hover, .hover\:bg-emerald-600:hover {
    background-color: var(--secondary) !important;
}

.bg-green-500\/10, .bg-emerald-500\/10, .bg-emerald-500\/20 {
    background-color: color-mix(in srgb, var(--secondary) 14%, transparent) !important;
}

.text-green-600, .text-green-700, .text-green-800,
.text-emerald-600, .text-emerald-700, .text-emerald-800,
.text-emerald-400, .text-green-400,
.hover\:text-green-700:hover, .hover\:text-emerald-700:hover {
    color: var(--secondary) !important;
}

.border-blue-100, .border-blue-200,
.border-indigo-500\/20, .border-blue-500\/20, .border-emerald-500\/20 {
    border-color: color-mix(in srgb, var(--primary) 20%, #dbe4f0) !important;
}

.border-blue-400, .border-blue-500, .border-blue-600,
.focus\:border-blue-500:focus, .focus\:border-blue-600:focus {
    border-color: var(--primary) !important;
}

.border-green-500, .border-green-600, .border-emerald-500, .border-emerald-600 {
    border-color: var(--secondary) !important;
}

.from-blue-400, .from-blue-500, .from-blue-600, .from-blue-700 {
    --tw-gradient-from: var(--primary) var(--tw-gradient-from-position) !important;
    --tw-gradient-to: color-mix(in srgb, var(--primary) 0%, transparent) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

.to-blue-400, .to-blue-500, .to-blue-600, .to-blue-700 {
    --tw-gradient-to: var(--primary) var(--tw-gradient-to-position) !important;
}

.from-indigo-600, .from-purple-500, .from-purple-600,
.to-indigo-600, .to-indigo-700, .to-purple-500, .to-purple-600 {
    --tw-gradient-to: var(--secondary) var(--tw-gradient-to-position) !important;
}

.from-indigo-600, .from-purple-500, .from-purple-600 {
    --tw-gradient-from: var(--secondary) var(--tw-gradient-from-position) !important;
    --tw-gradient-to: color-mix(in srgb, var(--secondary) 0%, transparent) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

.focus\:ring-blue-500:focus, .focus\:ring-blue-600:focus {
    --tw-ring-color: color-mix(in srgb, var(--primary) 35%, transparent) !important;
}

