:root {
    color-scheme: light;

    --bg-app: #f3f6fb;
    --bg-app-alt: #ffffff;
    --surface-0: #ffffff;
    --surface-1: #f8fafd;
    --surface-glass: rgba(255, 255, 255, 0.72);
    --surface-glass-strong: rgba(255, 255, 255, 0.86);
    --surface-muted: rgba(99, 115, 139, 0.08);
    --text-strong: #0f172a;
    --text-main: #1e293b;
    --text-soft: #475569;
    --text-muted: #64748b;

    --line-soft: rgba(30, 41, 59, 0.1);
    --line-strong: rgba(30, 41, 59, 0.16);

    --brand-1: #2263ff;
    --brand-2: #6e3bf8;
    --brand-3: #2dd4ff;
    --brand-warm: #ff8a00;

    --hero-gradient: linear-gradient(135deg, #2263ff 0%, #6e3bf8 50%, #2dd4ff 100%);
    --button-gradient: linear-gradient(135deg, #2263ff 0%, #6e3bf8 70%, #2dd4ff 100%);

    --shadow-xs: 0 6px 18px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 25px 60px rgba(15, 23, 42, 0.16);
    --glow-brand: 0 0 0 1px rgba(34, 99, 255, 0.2), 0 16px 45px rgba(34, 99, 255, 0.32);

    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --sidebar-width: 256px;
    --sidebar-collapsed: 78px;
    --sidebar-icon-size: var(--header-action-size);
    --sidebar-icon-glyph: 20px;
    --sidebar-rail-padding: 0.75rem;
    --sidebar-item-gap: 0.34rem;
    --sidebar-top-gap: 0.95rem;
    --sidebar-nav-offset: 0.92rem;
    --sidebar-control-radius: 12px;
    --sidebar-tab-radius: 14px;
    --sidebar-profile-size: var(--header-action-size);
    --header-height: 72px;
    --header-action-size: 44px;
    --chat-vh: 100dvh;
    --global-chat-footer-lift: 0px;

    --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: 0.2s var(--ease-standard);
    --transition-base: 0.3s var(--ease-standard);
    --transition-slow: 0.42s var(--ease-standard);

    /* Consolidated SaaS token aliases */
    --saas-primary: var(--brand-1);
    --saas-secondary: var(--brand-3);
    --saas-light-bg: var(--bg-app);
    --saas-dark-bg: #0B0F19;
    --saas-surface: var(--surface-glass);
    --saas-surface-strong: var(--surface-glass-strong);
    --saas-border: var(--line-soft);
    --saas-text: var(--text-strong);
    --saas-text-soft: var(--text-soft);
    --saas-text-muted: var(--text-muted);
    --saas-shadow-sm: var(--shadow-sm);
    --saas-shadow-md: var(--shadow-md);
    --saas-shadow-lg: var(--shadow-lg);
    --saas-radius-sm: var(--radius-sm);
    --saas-radius-md: var(--radius-md);
    --saas-radius-lg: var(--radius-lg);
    --saas-radius-pill: var(--radius-pill);
}

body.dark-mode {
    color-scheme: dark;

    --bg-app: #0B0F19;
    --bg-app-alt: #11192a;
    --surface-0: #121a2c;
    --surface-1: #182238;
    --surface-glass: rgba(15, 24, 41, 0.7);
    --surface-glass-strong: rgba(18, 26, 44, 0.88);
    --surface-muted: rgba(148, 163, 184, 0.14);

    --text-strong: #eef4ff;
    --text-main: #dce6ff;
    --text-soft: #c1d0ef;
    --text-muted: #90a5cc;

    --line-soft: rgba(148, 163, 184, 0.2);
    --line-strong: rgba(148, 163, 184, 0.3);

    --brand-1: #5f88ff;
    --brand-2: #8b5bff;
    --brand-3: #18d2ff;
    --brand-warm: #ffb25b;

    --hero-gradient: linear-gradient(135deg, #5f88ff 0%, #8b5bff 50%, #18d2ff 100%);
    --button-gradient: linear-gradient(130deg, #5079ff 0%, #8b5bff 70%, #18d2ff 100%);

    --shadow-xs: 0 6px 18px rgba(2, 8, 23, 0.42);
    --shadow-sm: 0 12px 28px rgba(2, 8, 23, 0.48);
    --shadow-md: 0 20px 45px rgba(2, 8, 23, 0.55);
    --shadow-lg: 0 28px 70px rgba(2, 8, 23, 0.68);
    --glow-brand: 0 0 0 1px rgba(95, 136, 255, 0.44), 0 18px 52px rgba(78, 96, 255, 0.45);

    --saas-primary: var(--brand-1);
    --saas-secondary: var(--brand-3);
    --saas-light-bg: var(--bg-app-alt);
    --saas-dark-bg: var(--bg-app);
    --saas-surface: var(--surface-glass);
    --saas-surface-strong: var(--surface-glass-strong);
    --saas-border: var(--line-soft);
    --saas-text: var(--text-strong);
    --saas-text-soft: var(--text-soft);
    --saas-text-muted: var(--text-muted);
    --saas-shadow-sm: var(--shadow-sm);
    --saas-shadow-md: var(--shadow-md);
    --saas-shadow-lg: var(--shadow-lg);
    --saas-radius-sm: var(--radius-sm);
    --saas-radius-md: var(--radius-md);
    --saas-radius-lg: var(--radius-lg);
    --saas-radius-pill: var(--radius-pill);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    background: radial-gradient(circle at 15% -10%, rgba(111, 59, 248, 0.22), transparent 44%),
        radial-gradient(circle at 100% 0%, rgba(34, 99, 255, 0.18), transparent 38%),
        var(--bg-app);
    color: var(--text-main);
    letter-spacing: 0.01em;
    overflow-x: hidden;
    overflow-y: auto;
}

body.is-chat-route {
    height: var(--chat-vh);
    overflow: hidden;
}

html.chat-route-root,
html.chat-route-root body {
    height: var(--chat-vh);
    overflow: hidden;
}

body.is-chat-route .app-shell,
body.is-chat-route .main-wrapper {
    min-height: var(--chat-vh);
    height: var(--chat-vh);
}

body.is-chat-route .main-wrapper {
    overflow: hidden;
}

body.is-chat-route .main-content {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 0;
    height: calc(var(--chat-vh) - var(--header-height));
    overflow: hidden;
    padding: 0.92rem;
}

body.is-chat-route .main-header-bar {
    z-index: 1051;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-title,
.sidebar-brand-text,
.section-title,
.dashboard-title {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--text-strong);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--brand-1);
}

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

img,
video,
canvas,
svg {
    display: block;
    height: auto;
}

iframe {
    width: 100%;
    border: 0;
}

::selection {
    background: rgba(110, 59, 248, 0.35);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: color-mix(in srgb, var(--surface-0) 72%, transparent);
}

::-webkit-scrollbar-thumb {
    border-radius: 999px;
    border: 2px solid transparent;
    background: linear-gradient(180deg, var(--brand-1), var(--brand-2));
    background-clip: content-box;
}

:where(
    body,
    .sidebar,
    .main-header-bar,
    .public-navbar,
    .modern-footer,
    .card,
    .premium-card,
    .modal-content,
    .form-control,
    .form-select,
    .btn,
    .table,
    .alert,
    .accordion-item
) {
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.fade-in,
.reveal-in {
    animation: riseIn 0.55s var(--ease-standard) both;
}

.reveal-ready {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
}

.reveal-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@keyframes riseIn {
    0% {
        opacity: 0;
        transform: translateY(18px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientTravel {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulseGlow {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(110, 59, 248, 0.35);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(110, 59, 248, 0);
    }
}

@keyframes brandPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.45;
    }

    50% {
        transform: scale(1.18);
        opacity: 0.12;
    }
}

@keyframes sparkOrbit {
    0% {
        transform: rotate(0deg) translateX(22px) rotate(0deg);
    }

    100% {
        transform: rotate(360deg) translateX(22px) rotate(-360deg);
    }
}

@keyframes footerHeartBeat {
    0%,
    100% {
        transform: scale(1);
    }

    28% {
        transform: scale(1.22);
    }

    46% {
        transform: scale(0.96);
    }

    68% {
        transform: scale(1.14);
    }
}

/* Reduced motion mode controlled by Settings page */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

body.reduced-motion .reveal-ready,
body.reduced-motion .reveal-in,
body.reduced-motion .fade-in {
    opacity: 1 !important;
    transform: none !important;
}

/* Bootstrap overrides */
.btn {
    border-radius: var(--radius-pill);
    border-width: 1px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.64rem 1.2rem;
}

:where(
    button,
    .btn,
    a.btn,
    [role="button"],
    .sidebar-menu a,
    .header-icon-btn,
    .header-theme-toggle,
    .header-profile-icon,
    .header-hamburger-btn,
    .theme-toggle-sidebar
) {
    min-height: 44px;
}

:where(
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="tel"],
    select,
    textarea,
    .form-control,
    .form-select
) {
    font-size: 16px;
}

.btn:focus,
.btn:active,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(95, 136, 255, 0.2);
}

.btn-primary,
.btn-gradient-primary,
.btn-premium,
.btn-premium-primary,
.btn-premium-gradient,
.btn-generate,
.btn-save,
.btn-pricing-gradient,
.btn-auth-submit,
.btn-contact {
    color: #fff !important;
    border: 0;
    background: var(--button-gradient);
    background-size: 220% 220%;
    box-shadow: var(--glow-brand);
}

.btn-primary:hover,
.btn-gradient-primary:hover,
.btn-premium:hover,
.btn-premium-primary:hover,
.btn-premium-gradient:hover,
.btn-generate:hover,
.btn-save:hover,
.btn-pricing-gradient:hover,
.btn-auth-submit:hover,
.btn-contact:hover {
    transform: translateY(-2px);
    animation: gradientTravel 2.8s linear infinite;
}

.btn-outline-primary,
.btn-outline-premium,
.btn-premium-outline,
.btn-pricing-outline,
.btn-outline-secondary {
    border: 1px solid color-mix(in srgb, var(--brand-1) 65%, var(--brand-2));
    color: color-mix(in srgb, var(--brand-1) 70%, var(--text-main));
    background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-premium:hover,
.btn-premium-outline:hover,
.btn-pricing-outline:hover,
.btn-outline-secondary:hover {
    color: #fff !important;
    border-color: transparent;
    background: var(--button-gradient);
}

.btn-ghost,
.btn-link,
.btn-clear {
    border-radius: var(--radius-pill);
    color: var(--text-soft);
    border: 1px solid transparent;
    background: transparent;
}

.btn-ghost:hover,
.btn-link:hover,
.btn-clear:hover {
    color: var(--brand-1);
    border-color: var(--line-soft);
    background: var(--surface-muted);
}

.card,
.premium-card,
.profile-premium-card,
.notes-premium-card,
.prompt-card,
.pricing-card,
.timer-main-card,
.scheduler-main-card,
.contact-card,
.policy-content,
.payment-result-card,
.group-modal-content,
.status-card-modern,
.benefits-section-premium,
.feature-card,
.faq-item,
.engagement-chip {
    border: 1px solid var(--line-soft) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--surface-glass) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-sm);
}

.card:hover,
.premium-card:hover,
.profile-premium-card:hover,
.notes-premium-card:hover,
.prompt-card:hover,
.pricing-card:hover,
.feature-card:hover,
.engagement-chip:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--brand-1) 36%, var(--line-soft)) !important;
}

.table,
.table-premium,
.group-users-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-striped-bg: color-mix(in srgb, var(--surface-muted) 82%, transparent);
    --bs-table-hover-bg: color-mix(in srgb, var(--surface-muted) 88%, transparent);
    --bs-table-border-color: var(--line-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.table thead th,
.table-premium thead th,
.group-users-table th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.74rem;
    color: var(--text-muted);
    border-bottom-color: var(--line-soft);
}

.table td,
.table th,
.group-users-table td,
.group-users-table th {
    vertical-align: middle;
    color: var(--text-main);
}

.form-label,
.notes-form-label,
.form-label-modern {
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control,
.form-select,
.form-input-modern,
.notes-input,
.notes-select,
.chat-input,
.hub-input,
.scheduler-page input,
.scheduler-page select,
.scheduler-page textarea {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-soft);
    color: var(--text-main);
    background: color-mix(in srgb, var(--surface-0) 80%, transparent);
}

.form-control::placeholder,
.form-input-modern::placeholder,
.notes-input::placeholder,
.chat-input::placeholder,
.hub-input::placeholder {
    color: var(--text-muted);
}

.form-floating > .form-control,
.form-floating > .form-select {
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface-0) 82%, transparent);
}

.form-floating > label {
    color: var(--text-muted);
}

.accordion-item,
.accordion-button {
    background: transparent;
    color: var(--text-main);
    border-color: var(--line-soft);
}

.accordion-button:not(.collapsed) {
    color: #fff;
    background: var(--button-gradient);
}

.alert {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
}

.badge {
    border-radius: var(--radius-pill);
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* Public navbar */
.public-navbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-glass-strong) 78%, transparent);
}

.public-navbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1.2rem;
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.public-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: transparent;
    box-shadow: none;
    border: 1px solid transparent;
    padding: 0.16rem;
    position: relative;
    isolation: isolate;
    overflow: visible;
}

.public-brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.public-brand-logo,
.sidebar-brand-logo,
.footer-brand-logo {
    filter: contrast(1.08) saturate(1.08) drop-shadow(0 1px 2px rgba(15, 23, 42, 0.14));
    transform: translateZ(0);
}

body.dark-mode .public-brand-logo,
body.dark-mode .sidebar-brand-logo,
body.dark-mode .footer-brand-logo {
    filter: brightness(1.18) contrast(1.2) saturate(1.12) drop-shadow(0 2px 4px rgba(2, 8, 23, 0.52));
}

.animated-brand-mark .brand-mark-glow {
    position: absolute;
    width: 70%;
    height: 70%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
    z-index: 1;
    animation: brandPulse 2.8s ease-in-out infinite;
    display: none;
}

.animated-brand-mark .brand-mark-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    z-index: 3;
    animation: sparkOrbit 4s linear infinite;
    display: none;
}

.public-brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.public-brand-copy strong {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 1.02rem;
}

.public-brand-copy small {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
}

.public-brand-badge {
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    padding: 0.26rem 0.55rem;
    background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
    color: var(--text-soft);
    font-size: 0.63rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}

.public-brand:hover .public-brand-mark {
    transform: translateY(-1px) scale(1.02);
}

.public-brand:hover .public-brand-copy strong {
    color: var(--brand-1);
}

.public-nav-links {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 0.2rem;
}

.public-nav-links a {
    padding: 0.5rem 0.92rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    color: var(--text-soft);
}

.public-nav-links a:hover {
    background: var(--surface-muted);
    color: var(--brand-1);
}

.public-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

/* Auth shell */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    z-index: 1052;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-glass-strong) 86%, transparent), color-mix(in srgb, var(--surface-0) 94%, transparent));
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-right: 1px solid var(--line-soft);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition:
        width 0.42s var(--ease-standard),
        transform 0.42s var(--ease-standard),
        background-color 0.42s var(--ease-standard),
        box-shadow 0.42s var(--ease-standard),
        border-radius 0.42s var(--ease-standard);
}

.sidebar-section {
    min-width: 0;
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 0 var(--sidebar-rail-padding) 1rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sidebar-top-gap);
    border-bottom: 1px solid var(--line-soft);
}

.sidebar-brand {
    width: 100%;
    min-height: var(--header-height);
    border-radius: var(--sidebar-control-radius);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.86rem;
    padding: 0;
    color: var(--text-strong);
    transition: gap 0.28s var(--ease-standard), transform 0.28s var(--ease-standard), width 0.28s var(--ease-standard), opacity 0.28s var(--ease-standard);
}

.sidebar-brand-mark {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    border-radius: var(--sidebar-control-radius);
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--surface-0) 82%, transparent);
    box-shadow: none;
    border: 1px solid var(--line-soft);
    padding: 0;
    flex: 0 0 auto;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), border-radius var(--transition-fast);
}

.sidebar-brand-logo {
    width: calc(var(--sidebar-icon-size) - 8px);
    height: calc(var(--sidebar-icon-size) - 8px);
    object-fit: contain;
}

.sidebar-brand:hover .sidebar-brand-mark,
.sidebar-brand:focus-visible .sidebar-brand-mark {
    border-color: color-mix(in srgb, var(--brand-1) 40%, var(--line-soft));
    background: color-mix(in srgb, var(--surface-muted) 88%, transparent);
}

.sidebar-brand-text {
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: var(--sidebar-icon-size);
}

.sidebar-text,
.theme-text,
.sidebar-user-copy {
    max-width: 170px;
    white-space: nowrap;
    transition: opacity var(--transition-base), transform var(--transition-base), width var(--transition-base), max-width var(--transition-base), margin var(--transition-base), padding var(--transition-base);
}

.theme-toggle-sidebar {
    width: 100%;
    border: 1px solid var(--line-soft);
    border-radius: var(--sidebar-tab-radius);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.86rem;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface-0) 68%, transparent);
    min-height: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    transition: transform 0.34s var(--ease-standard), border-color 0.28s var(--ease-standard), background-color 0.28s var(--ease-standard), color 0.28s var(--ease-standard), width 0.34s var(--ease-standard), height 0.34s var(--ease-standard), padding 0.34s var(--ease-standard), border-radius 0.34s var(--ease-standard), gap 0.34s var(--ease-standard);
}

.theme-toggle-sidebar:hover {
    border-color: color-mix(in srgb, var(--brand-2) 34%, var(--line-soft));
    background: color-mix(in srgb, var(--surface-muted) 88%, transparent);
    color: var(--brand-1);
}

.theme-toggle-sidebar i {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--sidebar-icon-size);
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar-nav {
    padding: var(--sidebar-nav-offset) var(--sidebar-rail-padding) 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 100%;
    height: 100%;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--sidebar-menu-gap, var(--sidebar-item-gap));
    width: 100%;
}

.sidebar-menu li {
    min-width: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    border-radius: var(--sidebar-tab-radius);
    padding: 0;
    color: var(--text-soft);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-standard), background-color 0.26s var(--ease-standard), color 0.26s var(--ease-standard), box-shadow 0.26s var(--ease-standard), border-radius 0.3s var(--ease-standard), width 0.34s var(--ease-standard), min-height 0.34s var(--ease-standard), padding 0.34s var(--ease-standard), gap 0.34s var(--ease-standard);
}

.sidebar-menu a i {
    width: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    text-align: center;
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar-menu .logout-link i {
    width: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    text-align: center;
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar-menu a:focus-visible,
.theme-toggle-sidebar:focus-visible,
.sidebar-brand:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand-1) 74%, transparent);
    outline-offset: 2px;
}

.sidebar-menu a:hover {
    background: color-mix(in srgb, var(--surface-muted) 88%, transparent);
    color: var(--text-strong);
}

.sidebar-menu a.active {
    color: #fff;
    background: var(--button-gradient);
    box-shadow: var(--glow-brand);
}

.sidebar-menu a.active::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.34);
    pointer-events: none;
}

.sidebar-menu a.active::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 3px;
    height: 48%;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.86);
    transform: translateY(-50%);
    pointer-events: none;
}

.sidebar-menu .logout-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    color: #f97373;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-standard), background-color 0.26s var(--ease-standard), color 0.26s var(--ease-standard), box-shadow 0.26s var(--ease-standard), border-radius 0.3s var(--ease-standard), width 0.34s var(--ease-standard), min-height 0.34s var(--ease-standard), padding 0.34s var(--ease-standard), gap 0.34s var(--ease-standard);
}

.sidebar-menu .logout-form {
    margin: 0;
}

.sidebar-menu .logout-link:hover {
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.sidebar-menu .logout-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand-1) 74%, transparent);
    outline-offset: 2px;
}

.sidebar-footer {
    border-top: 1px solid var(--line-soft);
    flex: 0 0 auto;
    padding: var(--sidebar-rail-padding);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: var(--sidebar-profile-size);
    height: var(--sidebar-profile-size);
    flex: 0 0 var(--sidebar-profile-size);
    border-radius: var(--sidebar-control-radius);
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--surface-muted);
    border: 1px solid var(--line-soft);
    color: var(--text-soft);
}

.sidebar-user-avatar i {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 1.05rem;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-user-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.sidebar-user-copy strong {
    font-size: 0.88rem;
}

.sidebar-user-copy small {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header {
    padding-inline: calc((var(--sidebar-collapsed) - var(--sidebar-icon-size)) / 2);
    align-items: center;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    width: var(--sidebar-icon-size);
    height: var(--header-height);
    min-height: var(--header-height);
    padding: 0;
    border-radius: var(--sidebar-control-radius);
    margin-inline: auto;
}

.sidebar.collapsed .theme-toggle-sidebar {
    justify-content: center;
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    min-height: var(--sidebar-icon-size);
    padding: 0;
    border-radius: var(--sidebar-tab-radius);
    margin-inline: auto;
}

.sidebar.collapsed .sidebar-brand {
    gap: 0;
}

.sidebar.collapsed .sidebar-brand-mark {
    border-radius: var(--sidebar-control-radius);
}

.sidebar.collapsed .theme-toggle-sidebar i {
    width: var(--sidebar-icon-size);
    height: var(--sidebar-icon-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar.collapsed .sidebar-nav {
    padding-inline: calc((var(--sidebar-collapsed) - var(--sidebar-icon-size)) / 2);
    overflow-x: hidden;
}

.sidebar.collapsed .sidebar-menu {
    align-items: center;
    gap: var(--sidebar-menu-gap, var(--sidebar-item-gap));
}

.sidebar.collapsed .sidebar-menu a {
    width: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    min-height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    padding: 0;
    justify-content: center;
    gap: 0;
    border-radius: var(--sidebar-tab-radius);
}

.sidebar.collapsed .sidebar-menu a i {
    width: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    height: var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 var(--sidebar-menu-item-size, var(--sidebar-icon-size));
    text-align: center;
    font-size: 1.05rem;
    line-height: 1;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding-inline: calc((var(--sidebar-collapsed) - var(--sidebar-profile-size)) / 2);
}

.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .theme-text,
.sidebar.collapsed .sidebar-user-copy,
.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
    max-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transform: translateX(-8px);
}

.sidebar.collapsed .theme-toggle-sidebar {
    justify-content: center;
}

@media (min-width: 1025px) {
    .sidebar.collapsed .sidebar-header {
        gap: var(--sidebar-top-gap);
    }

    .sidebar.collapsed .sidebar-menu {
        height: 100%;
        min-height: 0;
    }
}

@media (min-width: 1025px) and (max-height: 980px) {
    .sidebar {
        --sidebar-item-gap: 0.3rem;
        --sidebar-rail-padding: 0.68rem;
        --sidebar-top-gap: 0.62rem;
        --sidebar-nav-offset: 0.7rem;
    }

    .sidebar-header {
        padding-block: 0 0.82rem;
    }

    .sidebar-nav {
        padding-top: var(--sidebar-nav-offset);
        padding-bottom: 0;
    }

    .sidebar-menu {
        min-height: 100%;
        justify-content: space-between;
    }

    .sidebar.collapsed .sidebar-menu {
        height: 100%;
        min-height: 0;
    }

    .sidebar-footer {
        padding-block: 0.68rem;
    }
}

@media (min-width: 1025px) and (max-height: 920px) {
    .sidebar {
        --sidebar-item-gap: 0.22rem;
        --sidebar-rail-padding: 0.58rem;
        --sidebar-top-gap: 0.48rem;
        --sidebar-nav-offset: 0.56rem;
    }

    .sidebar-header {
        padding-block: 0 0.68rem;
    }

    .sidebar-nav {
        padding-top: var(--sidebar-nav-offset);
        padding-bottom: 0;
    }

    .sidebar-menu,
    .sidebar.collapsed .sidebar-menu {
        gap: var(--sidebar-menu-gap, var(--sidebar-item-gap));
    }

    .sidebar-menu a,
    .sidebar.collapsed .sidebar-menu a {
        border-radius: var(--sidebar-tab-radius);
    }

    .sidebar-footer {
        padding-block: 0.58rem;
    }
}

@media (min-width: 1025px) and (max-height: 820px) {
    .sidebar {
        --sidebar-item-gap: 0.14rem;
        --sidebar-rail-padding: 0.48rem;
        --sidebar-top-gap: 0.38rem;
        --sidebar-nav-offset: 0.44rem;
    }

    .sidebar-header {
        padding-block: 0 0.56rem;
    }

    .sidebar-nav {
        padding-top: var(--sidebar-nav-offset);
        padding-bottom: 0;
    }

    .sidebar-menu,
    .sidebar.collapsed .sidebar-menu {
        gap: var(--sidebar-item-gap);
    }

    .sidebar-footer {
        padding-block: 0.48rem;
    }
}

.main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.42s var(--ease-standard), width 0.42s var(--ease-standard), background-color var(--transition-base);
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

.main-header-bar {
    position: sticky;
    top: 0;
    z-index: 1045;
    min-height: var(--header-height);
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-glass-strong) 80%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-content {
    min-height: var(--header-height);
    padding: 0.85rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-hamburger-btn,
.header-theme-toggle,
.header-profile-icon {
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 82%, transparent);
    color: var(--text-soft);
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.header-hamburger-btn,
.header-theme-toggle,
.header-profile-icon {
    width: var(--header-action-size);
    height: var(--header-action-size);
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: 0 0 var(--header-action-size);
}

.header-profile-icon {
    padding: 0;
    overflow: hidden;
}

.header-hamburger-btn:hover,
.header-theme-toggle:hover,
.header-profile-icon:hover {
    border-color: color-mix(in srgb, var(--brand-1) 40%, var(--line-soft));
    color: var(--brand-1);
    transform: translateY(-1px);
}

.header-hamburger-line {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    display: block;
}

.header-hamburger-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.global-search-wrap {
    position: relative;
    width: min(640px, 100%);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--button-gradient);
    box-shadow: var(--glow-brand);
    padding: 0.25rem;
}

.brand-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.profile-circle,
.profile-img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.profile-circle {
    display: block;
    overflow: hidden;
}

.profile-img {
    object-fit: cover;
    display: block;
}

.header-profile-icon .profile-icon {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: inherit;
    font-size: 1rem;
}

.profile-dropdown-container {
    position: relative;
}

.profile-dropdown-menu {
    min-width: 220px;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-soft);
    background: var(--surface-glass-strong);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    display: none;
    z-index: 1200;
}

.profile-dropdown-menu.show {
    display: block;
    animation: riseIn 0.25s var(--ease-standard);
}

.profile-dropdown-menu .dropdown-item {
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-soft);
    padding: 0.55rem 0.75rem;
}

.profile-dropdown-menu .dropdown-item:hover {
    color: var(--text-strong);
    background: var(--surface-muted);
}

.profile-dropdown-menu .dropdown-divider {
    height: 1px;
    background: var(--line-soft);
    margin: 0.4rem 0;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
    z-index: 1048;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.main-content {
    padding: 1.45rem;
    flex: 1;
}

.main-content > * {
    min-width: 0;
}

.row > [class*="col-"] {
    min-width: 0;
}

.public-wrapper {
    margin-left: 0;
    width: 100%;
}

.public-wrapper .main-content {
    padding: 0;
}

/* Footer */
.modern-footer {
    margin: 1.4rem auto 0;
    width: calc(100% - 2.8rem);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: var(--surface-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-sm);
    padding: 1.15rem 1.25rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: 1rem;
    row-gap: 1.05rem;
    padding-bottom: 1rem;
    align-items: flex-start;
    min-width: 0;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.footer-branding {
    max-width: min(420px, 100%);
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.footer-logo-circle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: transparent;
    box-shadow: none;
    border: 1px solid transparent;
    padding: 0.12rem;
}

.footer-brand-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

body.dark-mode .public-brand-mark,
body.dark-mode .footer-logo-circle {
    background: linear-gradient(145deg, rgba(19, 31, 59, 0.92), rgba(30, 55, 103, 0.84));
    border-color: color-mix(in srgb, var(--brand-3) 46%, var(--line-soft));
    box-shadow: 0 0 0 1px rgba(24, 210, 255, 0.14), 0 10px 26px rgba(5, 14, 35, 0.52);
}

.footer-title {
    margin: 0;
    font-size: 1rem;
}

.footer-heading {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}

.footer-description,
.footer-section a,
.footer-credits,
.footer-copyright,
.footer-student-line {
    color: var(--text-soft);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.footer-section a {
    display: flex;
    align-items: center;
    min-height: 24px;
}

.footer-section a:hover {
    color: var(--brand-1);
}

.footer-social {
    display: grid;
    grid-template-columns: repeat(4, 36px);
    gap: 0.45rem;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.footer-connect {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    align-items: center;
    text-align: center;
}

.footer-connect .footer-social {
    display: grid;
    grid-template-columns: repeat(4, 36px);
    width: 100%;
    justify-content: center;
    justify-items: center;
    margin-inline: auto;
}

.social-link {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-soft);
    color: var(--text-soft);
}

.social-link:hover {
    border-color: color-mix(in srgb, var(--brand-1) 42%, var(--line-soft));
    color: var(--brand-1);
    transform: translateY(-1px);
}

/* Keep footer social marks optically centered as one balanced group. */
.footer-connect .footer-social {
    display: flex;
    width: max-content;
    max-width: 100%;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 0.1rem auto 0;
}

.footer-connect .social-link {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.footer-connect .social-link i {
    display: block;
    width: 1em;
    line-height: 1;
    text-align: center;
}

.footer-bottom {
    border-top: 1px solid var(--line-soft);
    padding-top: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-copyright,
.footer-credits,
.footer-student-line {
    margin: 0;
}

.footer-student-line {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.footer-heart-bump {
    display: inline-flex;
    color: #ef4444;
    animation: footerHeartBeat 1.15s ease-in-out infinite;
    transform-origin: center;
}

.footer-heart-bump i {
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.38));
}

.public-footer {
    margin: 1rem;
}

.public-footer-branding {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    padding: 0 0 0.62rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid color-mix(in srgb, var(--brand-1) 18%, var(--line-soft));
}

.public-footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
}

.public-footer-tagline {
    margin: 0;
    text-align: center;
    max-width: min(360px, 100%);
    line-height: 1.36;
}

.public-footer-branding .footer-title {
    margin: 0;
}

.public-footer .footer-bottom {
    border-top: 0;
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

/* Shared component styles */
.dashboard-container,
.notes-premium-container,
.timer-premium-container,
.profile-premium-container,
.payment-premium-container,
.contact-page,
.policy-page,
.scheduler-page,
.error-page,
.quiz-loading-container,
.chat-premium-container {
    color: var(--text-main);
}

.empty-state-premium,
.media-empty-state,
.task-empty {
    text-align: center;
    padding: 1.8rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface-muted) 74%, transparent);
    color: var(--text-soft);
}

.empty-state-premium i,
.media-empty-state i {
    font-size: 2rem;
    color: var(--brand-1);
    margin-bottom: 0.65rem;
}

.skeleton-line {
    height: 12px;
    border-radius: 999px;
    margin-bottom: 0.45rem;
    background: linear-gradient(90deg, color-mix(in srgb, var(--surface-muted) 76%, transparent), color-mix(in srgb, var(--surface-muted) 38%, transparent), color-mix(in srgb, var(--surface-muted) 76%, transparent));
    background-size: 200% 100%;
    animation: gradientTravel 1.3s linear infinite;
}

.skeleton-line.short {
    width: 60%;
}

.copy-code-btn,
.msg-action-btn,
.btn-course-action,
.btn-course-edit,
.btn-course-save,
.btn-course-copy,
.btn-course-delete {
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.79rem;
    padding: 0.45rem 0.62rem;
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface-0) 86%, transparent);
}

.copy-code-btn:hover,
.msg-action-btn:hover,
.btn-course-action:hover,
.btn-course-edit:hover,
.btn-course-save:hover,
.btn-course-copy:hover,
.btn-course-delete:hover {
    color: #fff;
    border-color: transparent;
    background: var(--button-gradient);
}

.markdown-body,
.modal-markdown-content,
.message-bubble.markdown-content {
    color: var(--text-main);
}

.markdown-body pre,
.modal-markdown-content pre,
.message-bubble pre,
.code-block-wrapper {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-1) 86%, transparent);
}

.markdown-body code,
.modal-markdown-content code,
.message-bubble code {
    color: color-mix(in srgb, var(--brand-1) 72%, var(--text-main));
}

/* Modals */
.modal-backdrop.show {
    opacity: 1;
    background: rgba(2, 8, 23, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content,
.premium-auth-modal,
.modern-modal,
.group-modal-content,
.contact-modal-content {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: var(--surface-glass-strong);
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
}

.modal-header,
.modern-modal-header,
.contact-modal-header {
    border-bottom: 1px solid var(--line-soft);
}

.modal-footer,
.modern-modal-footer,
.contact-modal-footer {
    border-top: 1px solid var(--line-soft);
}

.btn-close {
    filter: none;
    opacity: 0.8;
}

body.dark-mode .btn-close {
    filter: invert(1);
}

/* Auth modal specific */
.premium-auth-modal {
    overflow: hidden;
}

.auth-banner-gradient {
    min-height: 100%;
    background: var(--hero-gradient);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-banner-gradient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.28), transparent 42%);
    pointer-events: none;
}

.auth-banner-content {
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.auth-icon-wrapper {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 1.8rem;
    animation: pulseGlow 2.2s ease-in-out infinite;
}

.auth-title,
.auth-banner-title {
    margin: 0;
}

.auth-description,
.auth-banner-subtitle,
.auth-footer-text,
.auth-feature-item,
.auth-submessage {
    color: color-mix(in srgb, var(--text-soft) 84%, #fff);
}

.auth-form-container {
    padding: 1.4rem;
}

.form-group-modern {
    margin-bottom: 1rem;
}

.input-wrapper-modern {
    position: relative;
}

.form-input-modern {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-soft);
    padding: 0.72rem 0.95rem;
    background: color-mix(in srgb, var(--surface-0) 86%, transparent);
    color: var(--text-main);
}

.password-toggle {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-muted);
}

.auth-progress-bar {
    margin-top: 0.7rem;
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 76%, transparent);
    overflow: hidden;
}

.auth-progress-bar .progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--button-gradient);
    transition: width var(--transition-base);
}

.btn-auth-submit.loading .btn-text {
    display: none;
}

.btn-auth-submit .btn-loading {
    display: none;
}

.btn-auth-submit.loading .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: rgba(255, 255, 255, 1);
    animation: spin 0.8s linear infinite;
}

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

.auth-message {
    margin-top: 0.65rem;
    border-radius: 10px;
    border: 1px solid transparent;
    padding: 0.62rem 0.75rem;
    display: none;
    font-size: 0.88rem;
    font-weight: 600;
}

.auth-message.show {
    display: block;
}

.auth-message.success {
    color: #eafff3;
    background: linear-gradient(135deg, #10b981, #059669);
}

.auth-message.error {
    color: #fff4f4;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.auth-message.info {
    color: #eef5ff;
    background: linear-gradient(135deg, #2263ff, #6e3bf8);
}

.input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.checkbox-error {
    color: #ef4444;
}

.btn-disabled {
    opacity: 0.55;
}

.password-strength {
    margin-top: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.strength-bars {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 4px;
}

.strength-bars .bar {
    width: 22px;
    height: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
}

.password-strength.password-medium .bar:nth-child(-n+2),
.password-strength.password-strong .bar:nth-child(-n+3),
.password-strength.password-very-strong .bar {
    background: var(--hero-gradient);
}

.strength-text {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.custom-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-soft);
}

.custom-checkbox input {
    accent-color: var(--brand-2);
}

/* Toast / utility overlays */
.toast {
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.success-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: color-mix(in srgb, var(--surface-0, #f3f6fb) 84%, transparent);
    backdrop-filter: blur(16px) saturate(1.12);
    -webkit-backdrop-filter: blur(16px) saturate(1.12);
    opacity: 0;
    transition: opacity 260ms ease;
}

.success-overlay.active {
    opacity: 1;
}

.ey-auth-success-card {
    width: min(100%, 420px);
    border: 1px solid color-mix(in srgb, var(--line-strong, #cbd5e1) 70%, transparent);
    border-radius: clamp(22px, 5vw, 32px);
    background: var(--surface-1, #fff);
    padding: clamp(24px, 6vw, 42px);
    text-align: center;
    box-shadow: 0 28px 90px rgba(34, 55, 100, .2);
    transform: translateY(16px) scale(.97);
    animation: ey-auth-card-in 520ms cubic-bezier(.2, .8, .2, 1) forwards;
}

.ey-auth-success-logo-frame {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(82px, 20vw, 112px);
    aspect-ratio: 1;
    margin: 0 auto 20px;
    border: 1px solid color-mix(in srgb, var(--brand-1, #4f46e5) 24%, transparent);
    border-radius: 30%;
    background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--brand-1, #4f46e5) 16%, transparent), transparent 72%);
    box-shadow: 0 12px 34px color-mix(in srgb, var(--brand-1, #4f46e5) 18%, transparent);
    animation: ey-auth-logo-float 2.2s ease-in-out infinite;
}

.ey-auth-success-logo-frame::before,
.ey-auth-success-logo-frame::after {
    position: absolute;
    inset: -7px;
    border: 1px solid color-mix(in srgb, var(--brand-1, #4f46e5) 25%, transparent);
    border-radius: 34%;
    content: "";
    animation: ey-auth-logo-orbit 2.4s ease-out infinite;
}

.ey-auth-success-logo-frame::after {
    animation-delay: 1.2s;
}

.ey-auth-success-logo-frame img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    image-rendering: auto;
}

.ey-auth-success-eyebrow {
    margin: 0 0 8px;
    color: var(--brand-1, #4f46e5);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
}

.ey-auth-success-title {
    margin: 0;
    color: var(--text-strong, #172033);
    font: 700 clamp(1.45rem, 5vw, 2rem)/1.2 "Space Grotesk", "Manrope", sans-serif;
    letter-spacing: -.035em;
}

.ey-auth-success-message {
    margin: 10px 0 22px;
    color: var(--text-soft, #64748b);
    font-size: clamp(.9rem, 3.5vw, 1rem);
    line-height: 1.55;
}

.ey-auth-success-progress {
    display: block;
    width: min(100%, 170px);
    height: 4px;
    overflow: hidden;
    margin: 0 auto;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand-1, #4f46e5) 12%, transparent);
}

.ey-auth-success-progress::after {
    display: block;
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-1, #4f46e5), var(--brand-2, #06b6d4));
    content: "";
    animation: ey-auth-progress 1.05s ease-in-out infinite;
}

@keyframes ey-auth-card-in {
    to { transform: translateY(0) scale(1); }
}

@keyframes ey-auth-logo-float {
    50% { transform: translateY(-5px) rotate(-2deg); }
}

@keyframes ey-auth-logo-orbit {
    0% { opacity: .55; transform: scale(.88) rotate(0); }
    100% { opacity: 0; transform: scale(1.18) rotate(16deg); }
}

@keyframes ey-auth-progress {
    0% { transform: translateX(-115%); }
    100% { transform: translateX(285%); }
}

@media (prefers-reduced-motion: reduce) {
    .ey-auth-success-card,
    .ey-auth-success-logo-frame,
    .ey-auth-success-logo-frame::before,
    .ey-auth-success-logo-frame::after,
    .ey-auth-success-progress::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
    }
}

.success-message {
    margin: 0;
    color: var(--text-soft);
}

.theme-change-effect {
    mix-blend-mode: screen;
}

/* Consolidated premium shell styles (migrated from saas.css) */
.is-hidden {
    display: none;
}

.progress-width-zero,
.progress-fill-zero {
    width: 0;
}

.page-transition-overlay {
    position: fixed;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 1200;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: color-mix(in srgb, var(--surface-0) 94%, transparent);
    transition: opacity 120ms ease, visibility 120ms ease;
    display: grid;
    place-items: center;
}

body.dark-mode .page-transition-overlay {
    background: color-mix(in srgb, var(--surface-0) 94%, transparent);
}

.page-transition-overlay.active {
    opacity: 1;
    visibility: visible;
    animation: pageTransitionBlink 120ms ease-out;
}

.ey-nav-transition-card {
    display: grid;
    justify-items: center;
    gap: 9px;
    color: #172033;
    opacity: 0;
    transform: translateY(10px) scale(.96);
    transition: opacity 160ms ease, transform 220ms cubic-bezier(.2, .8, .2, 1);
}

.page-transition-overlay.active .ey-nav-transition-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ey-nav-logo-orbit {
    display: grid;
    place-items: center;
    width: clamp(62px, 16vw, 86px);
    aspect-ratio: 1;
    border: 1px solid rgba(79, 70, 229, .2);
    border-radius: 28px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 14px 38px rgba(46, 69, 125, .16);
    animation: none;
}

.ey-nav-logo-orbit img {
    width: 78%;
    height: 78%;
    object-fit: contain;
}

.ey-nav-transition-wordmark {
    font: 700 1rem/1.2 "Space Grotesk", "Manrope", sans-serif;
    letter-spacing: -.03em;
}

.ey-nav-transition-caption {
    max-width: min(82vw, 340px);
    overflow: hidden;
    color: #64748b;
    font: 500 .82rem/1.4 "Manrope", sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark-mode .ey-nav-transition-card,
html[data-startup-theme="dark"] .ey-nav-transition-card {
    color: #eef4ff;
}

body.dark-mode .ey-nav-logo-orbit,
html[data-startup-theme="dark"] .ey-nav-logo-orbit {
    border-color: rgba(130, 150, 255, .28);
    background: rgba(18, 27, 45, .82);
    box-shadow: 0 14px 38px rgba(0, 0, 0, .32);
}

body.dark-mode .ey-nav-transition-caption,
html[data-startup-theme="dark"] .ey-nav-transition-caption {
    color: #a9b8d4;
}

@keyframes ey-nav-logo-bob {
    50% { transform: translateY(-4px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ey-nav-logo-orbit { animation-duration: 1ms !important; }
    .page-transition-overlay.active { animation-duration: 1ms !important; }
}

button:disabled,
.btn:disabled,
[role="button"][aria-disabled="true"] {
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

button[aria-busy="true"],
.btn[aria-busy="true"] {
    cursor: progress;
}

@keyframes pageTransitionBlink {
    0% {
        opacity: 0;
        transform: scale(0.995);
    }

    38% {
        opacity: 1;
    }

    58% {
        opacity: 0.86;
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.header-left-group {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 180px;
}

.header-context {
    display: grid;
}

.header-overline {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
}

.header-page-title {
    margin: 0;
    font-size: 1.02rem;
}

.global-search {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 88%, transparent);
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.38rem 0.75rem;
}

.global-search i {
    color: var(--text-muted);
}

.global-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    color: var(--text-main);
    background: transparent;
}

.global-search input::placeholder {
    color: var(--text-muted);
}

.search-shortcut {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 0.12rem 0.4rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
}

.global-search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: min(58vh, 340px);
    overflow-y: auto;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: var(--surface-glass-strong);
    box-shadow: var(--shadow-md);
    padding: 0.35rem;
    z-index: 1205;
}

.global-search-suggestion {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    padding: 0.5rem 0.62rem;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.global-search-suggestion:hover,
.global-search-suggestion.is-active {
    border-color: color-mix(in srgb, var(--brand-1) 35%, var(--line-soft));
    background: color-mix(in srgb, var(--brand-1) 12%, transparent);
    color: var(--text-main);
}

.global-search-suggestion-main {
    display: inline-flex;
    align-items: center;
    gap: 0.52rem;
    min-width: 0;
}

.global-search-suggestion-main i {
    color: color-mix(in srgb, var(--brand-1) 68%, var(--text-soft));
}

.global-search-suggestion-text {
    font-size: 0.84rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-suggestion-kind {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.global-search-empty {
    border: 1px dashed color-mix(in srgb, var(--brand-1) 24%, var(--line-soft));
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-icon-btn {
    width: var(--header-action-size);
    height: var(--header-action-size);
    border-radius: 12px;
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 84%, transparent);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    flex: 0 0 var(--header-action-size);
}

.header-icon-btn:hover {
    border-color: color-mix(in srgb, var(--brand-1) 42%, var(--line-soft));
    color: var(--brand-1);
    transform: translateY(-1px);
}

.header-search-toggle {
    display: none;
}

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: min(340px, 92vw);
    display: grid;
    gap: 0.55rem;
    z-index: 1201;
}

.toast-stack .toast {
    border: 1px solid var(--line-soft);
    background: var(--surface-glass-strong) !important;
    color: var(--text-main);
    border-radius: 14px;
}

.toast-stack .toast.toast-tone-success {
    border-color: color-mix(in srgb, #22c55e 45%, var(--line-soft));
    background: color-mix(in srgb, #22c55e 16%, var(--surface-glass-strong)) !important;
}

.toast-stack .toast.toast-tone-error {
    border-color: color-mix(in srgb, #ef4444 45%, var(--line-soft));
    background: color-mix(in srgb, #ef4444 15%, var(--surface-glass-strong)) !important;
}

.toast-stack .toast.toast-tone-warning {
    border-color: color-mix(in srgb, #f59e0b 45%, var(--line-soft));
    background: color-mix(in srgb, #f59e0b 18%, var(--surface-glass-strong)) !important;
}

.toast-stack .toast.toast-tone-info {
    border-color: color-mix(in srgb, var(--brand-1) 45%, var(--line-soft));
    background: color-mix(in srgb, var(--brand-1) 14%, var(--surface-glass-strong)) !important;
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.22), rgba(148, 163, 184, 0.38), rgba(148, 163, 184, 0.22));
    background-size: 220% 100%;
    animation: skeletonShift 1.6s linear infinite;
}

@keyframes skeletonShift {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -20% 0;
    }
}

.sortable-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.sortable-table th[data-sort]::after {
    content: "\f0dc";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 0.42rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.sortable-table th[data-sort].sort-asc::after {
    content: "\f0de";
    color: var(--brand-1);
}

.sortable-table th[data-sort].sort-desc::after {
    content: "\f0dd";
    color: var(--brand-1);
}

.dashboard-alert-host {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: min(320px, calc(100vw - 2rem));
    display: grid;
    gap: 0.45rem;
    z-index: 1204;
}

.global-chat-shell {
    position: fixed;
    right: 1.1rem;
    bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--global-chat-footer-lift));
    z-index: 1299;
    pointer-events: none;
    transition: bottom 260ms cubic-bezier(0.22, 1, 0.36, 1), transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms var(--ease-standard), visibility 220ms var(--ease-standard);
}

.global-chat-fab {
    pointer-events: auto;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    background: var(--button-gradient);
    box-shadow: var(--glow-brand);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: globalChatPulse 5.2s ease-in-out infinite;
}

.global-chat-label {
    display: none;
}

.global-chat-fab:hover {
    transform: translateY(-3px) scale(1.03);
    filter: saturate(1.08);
}

.global-chat-fab:active {
    transform: translateY(-1px) scale(0.98);
}

body.global-chat-open .global-chat-fab {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.92);
}

@keyframes globalChatPulse {
    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(34, 99, 255, 0.2), 0 14px 34px rgba(34, 99, 255, 0.22);
    }

    50% {
        box-shadow: 0 0 0 1px rgba(34, 99, 255, 0.26), 0 18px 38px rgba(34, 99, 255, 0.3);
    }
}

.global-chat-overlay {
    position: fixed;
    inset: 0;
    z-index: 1297;
    background: rgba(8, 14, 24, 0.45);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.global-chat-drawer {
    position: fixed;
    right: 1.1rem;
    bottom: calc(4.7rem + max(0px, env(safe-area-inset-bottom)) + var(--global-chat-footer-lift));
    z-index: 1298;
    width: min(420px, calc(100vw - 1.6rem));
    height: min(760px, calc(100vh - 7.1rem));
    max-height: min(760px, calc(100vh - 7.1rem));
    border-radius: 20px;
    border: 1px solid var(--line-soft);
    background: var(--surface-glass-strong);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 0.74rem;
    display: flex;
    flex-direction: column;
    gap: 0.64rem;
    transform: translateY(18px) scale(0.98);
    transform-origin: bottom right;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 260ms cubic-bezier(0.22, 1, 0.36, 1), transform 320ms cubic-bezier(0.18, 0.92, 0.32, 1.22), visibility var(--transition-fast);
}

body.global-chat-open .global-chat-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.global-chat-open .global-chat-drawer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.global-chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.global-chat-kicker {
    margin: 0;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    font-weight: 700;
}

.global-chat-head h2 {
    margin: 0.08rem 0 0;
    font-size: 1rem;
}

.global-chat-close {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--line-soft);
    color: var(--text-soft);
    background: color-mix(in srgb, var(--surface-0) 82%, transparent);
}

.global-chat-close:hover {
    color: var(--brand-1);
    border-color: color-mix(in srgb, var(--brand-1) 44%, var(--line-soft));
}

.global-chat-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.44rem;
}

.global-chat-tab {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-0) 82%, transparent);
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.48rem 0.56rem;
}

.global-chat-tab.is-active {
    border-color: color-mix(in srgb, var(--brand-1) 55%, var(--line-soft));
    color: var(--brand-1);
    background: color-mix(in srgb, var(--brand-1) 14%, transparent);
}

.global-chat-sync-state {
    margin: 0;
    align-self: flex-start;
    border-radius: 999px;
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 80%, transparent);
    color: var(--text-muted);
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.24rem 0.58rem;
}

.global-chat-sync-state.is-live {
    color: var(--brand-1);
    border-color: color-mix(in srgb, var(--brand-1) 42%, var(--line-soft));
    background: color-mix(in srgb, var(--brand-1) 13%, transparent);
}

.global-chat-sync-state.is-polling {
    color: var(--text-soft);
    border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line-soft));
}

.global-chat-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.56rem;
    overflow: hidden;
}

.global-chat-panel.is-hidden {
    display: none !important;
}

.global-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
    padding-right: 0.16rem;
}

.global-chat-msg {
    max-width: 88%;
    border-radius: 14px;
    padding: 0.54rem 0.62rem;
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 84%, transparent);
    color: var(--text-main);
    font-size: 0.83rem;
    line-height: 1.38;
}

.global-chat-msg p {
    margin: 0;
    overflow-wrap: anywhere;
}

.global-chat-contact-link {
    display: inline-flex;
    width: fit-content;
    margin-top: 0.42rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--brand-1) 42%, var(--line-soft));
    padding: 0.28rem 0.58rem;
    color: var(--brand-1);
    background: color-mix(in srgb, var(--brand-1) 10%, transparent);
    font-weight: 800;
}

.global-chat-contact-link:hover {
    color: #fff;
    background: var(--button-gradient);
}

.global-chat-msg.is-user {
    align-self: flex-end;
    border-color: color-mix(in srgb, var(--brand-1) 45%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand-1) 80%, #5f88ff 20%), color-mix(in srgb, var(--brand-2) 86%, #8b5bff 14%));
    color: #fff;
}

.global-chat-msg.is-agent {
    align-self: flex-start;
}

.global-chat-msg-meta {
    margin: 0 0 0.2rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.global-chat-msg.is-user .global-chat-msg-meta {
    color: rgba(255, 255, 255, 0.82);
}

.global-chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    max-height: 94px;
    overflow-y: auto;
    padding-right: 0.12rem;
}

.global-chat-quick-reply {
    border-radius: 999px;
    border: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--surface-0) 80%, transparent);
    color: var(--text-soft);
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.34rem 0.62rem;
}

.global-chat-quick-reply:hover {
    color: var(--brand-1);
    border-color: color-mix(in srgb, var(--brand-1) 42%, var(--line-soft));
    background: color-mix(in srgb, var(--brand-1) 12%, transparent);
}

.global-chat-no-faq {
    border: 1px dashed var(--line-soft);
    border-radius: 999px;
    padding: 0.34rem 0.62rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.global-chat-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.46rem;
    align-items: center;
    margin-top: auto;
}

.global-chat-input-row .form-control {
    min-height: 42px;
    border-radius: 12px;
}

.global-chat-input-row .btn {
    min-width: 74px;
    min-height: 42px;
}

.global-chat-empty-state {
    border: 1px dashed var(--line-soft);
    border-radius: 14px;
    padding: 0.82rem;
    text-align: center;
    color: var(--text-muted);
    display: grid;
    gap: 0.58rem;
}

.global-chat-empty-state p {
    margin: 0;
}

.global-chat-empty-state.is-hidden {
    display: none !important;
}

.global-chat-community-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.56rem;
    min-height: 0;
    overflow: hidden;
}

.global-chat-community-wrap.is-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .global-chat-shell {
        right: 0.82rem;
        bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--global-chat-footer-lift));
    }

    .global-chat-fab {
        width: 54px;
        height: 54px;
    }

    body.has-mobile-flow-chat #globalChatShell {
        position: relative;
        inset: auto;
        display: flex;
        justify-content: flex-end;
        width: 100%;
        box-sizing: border-box;
        padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
        margin: 0 auto;
        z-index: auto;
        pointer-events: auto;
    }

    body.has-mobile-flow-chat #globalChatFab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        width: auto;
        min-width: 54px;
        min-height: 48px;
        padding: 0 1rem;
        border-radius: 999px;
    }

    body.has-mobile-flow-chat .global-chat-label {
        display: inline;
        font-size: 0.88rem;
        font-weight: 650;
    }

    .global-chat-drawer {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100vw;
        height: min(82dvh, 700px);
        max-height: min(82dvh, 700px);
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
        transform-origin: bottom center;
        padding-bottom: max(0.74rem, env(safe-area-inset-bottom));
        transition: opacity 220ms var(--ease-standard), transform 300ms var(--ease-standard), visibility var(--transition-fast);
    }

    body.global-chat-open {
        overflow: hidden;
    }

    body.global-chat-open .global-chat-drawer {
        transform: translateY(0);
    }

    body.mobile-sidebar-open .global-chat-shell {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(8px) scale(0.96);
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    body.has-mobile-flow-chat #globalChatShell {
        position: relative;
        inset: auto;
        display: flex;
        justify-content: flex-end;
        width: 100%;
        box-sizing: border-box;
        padding: 0 1rem 1rem;
        margin: 0 auto;
        z-index: auto;
        pointer-events: auto;
    }

    body.has-mobile-flow-chat #globalChatFab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.55rem;
        width: auto;
        min-width: 54px;
        min-height: 48px;
        padding: 0 1rem;
        border-radius: 999px;
    }

    body.has-mobile-flow-chat .global-chat-label {
        display: inline;
        font-size: 0.88rem;
        font-weight: 650;
    }
}

@media (max-width: 360px) {
    body.page-index .global-chat-shell {
        right: 0;
        bottom: 0;
    }

    body.page-index .global-chat-fab {
        width: 44px;
        height: 44px;
    }
}

:where(
    .table-responsive,
    .table-wrap,
    .group-table-wrap,
    .scrollable-content,
    .courses-scroll-container,
    .chat-messages-area,
    .chat-history-list,
    .task-list
) {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: auto;
}

/* Generic utility classes preserved from older pages */
.btn-modern,
.btn-watch-video,
.btn-open-youtube,
.btn-empty-action,
.btn-quiz {
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-soft);
    font-weight: 700;
}

.btn-modern:hover,
.btn-watch-video:hover,
.btn-open-youtube:hover,
.btn-empty-action:hover,
.btn-quiz:hover {
    transform: translateY(-1px);
}

.top-navbar {
    display: none;
}

/* Responsive */
@media (max-width: 1320px) {
    .modern-footer {
        width: calc(100% - 2.2rem);
        margin-inline: auto;
    }

    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1024px) {
    /* Never render the persisted desktop icon rail as a narrow mobile drawer. */
    .sidebar.collapsed {
        width: min(76vw, 280px);
    }

    .sidebar.collapsed .sidebar-header {
        padding-inline: var(--sidebar-rail-padding);
        align-items: stretch;
    }

    .sidebar.collapsed .sidebar-brand {
        width: auto;
        height: auto;
        min-height: var(--header-height);
        padding: 0;
        margin-inline: 0;
        border-radius: var(--sidebar-control-radius);
        justify-content: flex-start;
        gap: 0.86rem;
    }

    .sidebar.collapsed .theme-toggle-sidebar {
        width: 100%;
        height: 42px;
        min-height: 42px;
        padding: 0 0.72rem;
        margin-inline: 0;
        border-radius: var(--sidebar-tab-radius);
        justify-content: flex-start;
    }

    .sidebar.collapsed .sidebar-nav {
        padding-inline: var(--sidebar-rail-padding);
    }

    .sidebar.collapsed .sidebar-menu {
        align-items: stretch;
    }

    .sidebar.collapsed .sidebar-menu a {
        width: auto;
        height: var(--sidebar-icon-size);
        min-height: var(--sidebar-icon-size);
        padding: 0 0.78rem;
        justify-content: flex-start;
        gap: 0.72rem;
        border-radius: var(--sidebar-tab-radius);
    }

    .sidebar.collapsed .sidebar-menu a i {
        width: var(--sidebar-icon-size);
        height: var(--sidebar-icon-size);
        flex: 0 0 var(--sidebar-icon-size);
    }

    .sidebar.collapsed .sidebar-footer {
        justify-content: flex-start;
        padding-inline: var(--sidebar-rail-padding);
    }

    .sidebar.collapsed .sidebar-text,
    .sidebar.collapsed .theme-text,
    .sidebar.collapsed .sidebar-user-copy,
    .sidebar.collapsed .sidebar-brand-text {
        opacity: 1;
        visibility: visible;
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: visible;
        transform: none;
    }

    .sidebar {
        --sidebar-icon-size: 38px;
        --sidebar-item-gap: 0.28rem;
        --sidebar-nav-offset: 0.72rem;
        --sidebar-top-gap: 0.7rem;
        transform: translate3d(calc(-100% - 2px), 0, 0);
        width: min(76vw, 280px);
        height: 100vh;
        height: 100dvh;
        border-radius: 0 18px 18px 0;
        overflow: hidden;
        box-shadow: 18px 0 40px rgba(15, 23, 42, 0.16);
        background: linear-gradient(180deg, color-mix(in srgb, var(--surface-glass-strong) 92%, transparent), color-mix(in srgb, var(--surface-0) 96%, transparent));
    }

    .sidebar-header {
        padding: 0 var(--sidebar-rail-padding) 0.84rem;
    }

    .sidebar-nav {
        padding: var(--sidebar-nav-offset) var(--sidebar-rail-padding) 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .sidebar-menu {
        justify-content: flex-start;
        gap: var(--sidebar-item-gap);
        min-height: auto;
    }

    .sidebar-menu a {
        height: var(--sidebar-icon-size);
        min-height: var(--sidebar-icon-size);
        gap: 0.72rem;
        font-size: 0.95rem;
    }

    .sidebar-menu a i,
    .theme-toggle-sidebar i {
        font-size: 0.96rem;
    }

    .sidebar-menu .logout-link i {
        font-size: 0.92rem;
    }

    .theme-toggle-sidebar {
        height: 42px;
        min-height: 42px;
        gap: 0.72rem;
    }

    .sidebar-footer {
        padding-block: 0.62rem;
    }

    .sidebar.active {
        transform: translate3d(0, 0, 0);
    }

    .main-wrapper,
    .sidebar.collapsed ~ .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .main-content {
        padding-inline: clamp(0.9rem, 2.2vw, 1.25rem);
    }

    .header-center {
        justify-content: flex-start;
    }

    .header-left-group {
        min-width: auto;
    }

    .brand-title {
        font-size: 1.02rem;
    }

    .global-search {
        width: 100%;
    }

    .global-search-wrap {
        width: min(460px, 100%);
    }

    .modern-footer {
        margin: 0.9rem auto;
        width: calc(100% - 1.8rem);
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    body.is-authenticated .main-content {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    body.is-chat-route.is-authenticated .main-content {
        padding: 0.7rem;
        padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
        height: calc(var(--chat-vh) - var(--header-height));
    }

    body.is-public .main-content {
        padding-bottom: 1rem;
    }

    .header-content {
        position: relative;
        min-height: 64px;
        padding: 0.56rem 0.72rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.46rem;
    }

    .header-left-group {
        flex: 1;
        min-width: 0;
        gap: 0.5rem;
    }

    .header-actions {
        flex-shrink: 0;
        gap: 0.32rem;
    }

    .header-center {
        position: absolute;
        left: 0.72rem;
        right: 0.72rem;
        top: calc(100% + 0.38rem);
        width: auto;
        z-index: 1206;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px) scale(0.98);
        pointer-events: none;
        transition: opacity var(--transition-fast), transform var(--transition-fast);
    }

    body.mobile-search-open .header-center {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .header-search-toggle {
        display: grid;
    }

    body.mobile-search-open .header-search-toggle {
        color: var(--brand-1);
        border-color: color-mix(in srgb, var(--brand-1) 44%, var(--line-soft));
        background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
    }

    .global-search-wrap {
        width: 100%;
    }

    .global-search {
        min-height: 44px;
        border-radius: 13px;
        padding-inline: 0.66rem;
        box-shadow: var(--shadow-sm);
    }

    .public-navbar-inner {
        padding: 0.6rem 0.85rem;
    }

    .public-brand-copy small {
        display: none;
    }

    .public-brand-badge {
        display: none;
    }

    .public-brand-mark {
        width: 48px;
        height: 48px;
        border-radius: 13px;
    }

    .public-brand-logo {
        width: 34px;
        height: 34px;
    }

    .public-actions .btn {
        padding-inline: 0.9rem;
    }

    .header-context,
    .search-shortcut {
        display: none;
    }

    .global-search-suggestions {
        border-radius: 12px;
        max-height: min(52vh, 290px);
    }

    .profile-dropdown-menu {
        right: 0;
        min-width: 200px;
    }

    .modern-footer {
        margin: 0.7rem auto;
        border-radius: 16px;
        max-width: calc(100% - 1.4rem);
        width: calc(100% - 1.4rem);
        padding: 0.94rem 0.88rem;
        background:
            linear-gradient(160deg, color-mix(in srgb, var(--brand-2) 11%, transparent), transparent 46%),
            linear-gradient(340deg, color-mix(in srgb, var(--brand-3) 8%, transparent), transparent 50%),
            var(--surface-glass);
        border-color: color-mix(in srgb, var(--brand-1) 24%, var(--line-soft));
    }

    .modern-footer .footer-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "branding branding"
            "platform support"
            "connect connect";
        gap: 0.58rem 0.66rem;
        padding-bottom: 0.72rem;
    }

    .modern-footer .footer-branding {
        grid-area: branding;
        grid-column: 1 / -1 !important;
        display: grid;
        justify-items: center;
        align-content: center;
        row-gap: 0.32rem;
        width: 100% !important;
        max-width: none !important;
        margin: 0 auto;
        padding: 0 0 0.68rem;
        border: 0;
        border-bottom: 1px solid color-mix(in srgb, var(--brand-1) 22%, var(--line-soft));
        border-radius: 0;
        background: transparent;
        text-align: center;
        align-items: center;
        justify-content: center;
    }

    .modern-footer .footer-branding .footer-brand {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: fit-content;
        max-width: 100%;
        margin-inline: auto;
        gap: 0.62rem;
    }

    .modern-footer .footer-branding .footer-title {
        margin: 0;
        font-size: 1.02rem;
        line-height: 1.12;
        letter-spacing: 0.01em;
        text-align: center;
    }

    .modern-footer .footer-branding .footer-description {
        margin: 0.02rem 0 0;
        width: 100%;
        max-width: min(340px, 100%);
        padding-inline: 0.2rem;
        text-align: center;
        margin-inline: auto;
        line-height: 1.44;
    }

    .modern-footer .footer-section {
        gap: 0.36rem;
        padding: 0.5rem 0 0.16rem;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .modern-footer .footer-platform {
        grid-area: platform;
        text-align: left;
        padding-right: 0.85rem;
    }

    .modern-footer .footer-support {
        grid-area: support;
        align-items: flex-end;
        text-align: right;
        position: relative;
        padding-left: 0.85rem;
    }

    .modern-footer .footer-support::before {
        content: "";
        position: absolute;
        left: -0.34rem;
        top: 0.24rem;
        bottom: 0.24rem;
        width: 1.5px;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(24, 210, 255, 0.08), rgba(96, 124, 255, 0.95), rgba(139, 91, 255, 0.9), rgba(24, 210, 255, 0.08));
        box-shadow: 0 0 8px rgba(99, 140, 255, 0.46), 0 0 15px rgba(24, 210, 255, 0.24);
    }

    .modern-footer .footer-connect {
        grid-area: connect;
        border-top: 1px solid color-mix(in srgb, var(--brand-1) 16%, var(--line-soft));
        padding-top: 0.58rem;
        align-items: center;
        text-align: center;
    }

    .modern-footer .footer-connect .footer-social {
        justify-content: center;
    }

    .modern-footer .footer-heading {
        font-size: 0.72rem;
        letter-spacing: 0.08em;
    }

    .modern-footer .footer-description,
    .modern-footer .footer-section a,
    .modern-footer .footer-credits,
    .modern-footer .footer-copyright,
    .modern-footer .footer-student-line {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .modern-footer .footer-social {
        gap: 0.34rem;
        flex-wrap: wrap;
    }

    .modern-footer .social-link {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .modern-footer .footer-bottom {
        gap: 0.34rem;
        padding-top: 0.72rem;
        border-top-color: color-mix(in srgb, var(--brand-1) 22%, var(--line-soft));
        width: 100%;
    }

    .modern-footer.public-footer .public-footer-branding {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: none !important;
        margin: 0 auto 0.42rem;
        padding: 0 0 0.68rem;
        border-bottom: 1px solid color-mix(in srgb, var(--brand-1) 18%, var(--line-soft));
        text-align: center;
        gap: 0.32rem;
    }

    .modern-footer.public-footer .public-footer-brand {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: fit-content;
        max-width: 100%;
        margin-inline: auto;
        gap: 0.62rem;
    }

    .modern-footer.public-footer .public-footer-tagline {
        margin: 0.02rem 0 0;
        max-width: min(340px, 100%);
        line-height: 1.44;
        padding-inline: 0.2rem;
        text-align: center;
    }

    .is-authenticated .modern-footer {
        margin-bottom: max(0.7rem, env(safe-area-inset-bottom));
    }

    :where(
        .dashboard-container,
        .dashboard-v2,
        .notes-premium-container,
        .profile-premium-container,
        .community-page,
        .scheduler-page,
        .policy-page,
        .payment-premium-container,
        .timer-premium-container,
        .contact-page,
        .chat-workspace
    ) {
        max-width: 100%;
        width: 100%;
    }

    .auth-form-container {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .public-actions .btn-outline-premium {
        display: none;
    }

    .header-theme-toggle,
    .header-profile-icon,
    .header-hamburger-btn,
    .header-icon-btn {
        width: 38px;
        height: 38px;
        min-height: 38px;
        flex-basis: 38px;
    }

    .logo-circle {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .public-brand-mark {
        width: 46px;
        height: 46px;
    }

    .public-brand-logo {
        width: 32px;
        height: 32px;
    }

    .brand-title {
        font-size: 0.94rem;
    }

    .modern-footer {
        border-radius: 15px;
        padding: 0.84rem;
        margin: 0.58rem auto;
        max-width: calc(100% - 1.16rem);
        width: calc(100% - 1.16rem);
    }

    .modern-footer .footer-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "branding branding"
            "platform support"
            "connect connect";
        gap: 0.55rem 0.58rem;
        padding-bottom: 0.62rem;
    }

    .modern-footer .footer-branding {
        row-gap: 0.3rem;
        padding: 0 0 0.58rem;
    }

    .modern-footer .footer-branding .footer-brand,
    .modern-footer.public-footer .public-footer-brand {
        gap: 0.56rem;
    }

    .modern-footer .footer-branding .footer-title,
    .modern-footer.public-footer .footer-title {
        font-size: 0.98rem;
    }

    .modern-footer .footer-branding .footer-description,
    .modern-footer.public-footer .public-footer-tagline {
        max-width: min(312px, 100%);
        line-height: 1.4;
    }

    .modern-footer .footer-section {
        padding: 0.44rem 0 0.14rem;
    }

    .modern-footer .footer-platform {
        padding-right: 0.72rem;
    }

    .modern-footer .footer-support {
        padding-left: 0.72rem;
    }

    .modern-footer .footer-support::before {
        left: -0.3rem;
        top: 0.22rem;
        bottom: 0.22rem;
        width: 1.25px;
    }

    .modern-footer .footer-connect {
        padding-top: 0.54rem;
    }

    .modern-footer .footer-social {
        flex-wrap: wrap;
    }

    .modern-footer .footer-bottom {
        gap: 0.24rem;
        padding-top: 0.62rem;
    }
}

@media (max-width: 420px) {
    .modern-footer {
        padding: 0.76rem;
    }

    .modern-footer .footer-branding {
        row-gap: 0.26rem;
        padding-bottom: 0.52rem;
    }

    .modern-footer .footer-branding .footer-brand,
    .modern-footer.public-footer .public-footer-brand {
        gap: 0.48rem;
    }

    .modern-footer .footer-branding .footer-title,
    .modern-footer.public-footer .footer-title {
        font-size: 0.92rem;
    }

    .modern-footer.public-footer .public-footer-branding {
        gap: 0.26rem;
        padding-bottom: 0.52rem;
        margin-bottom: 0.34rem;
    }

    .modern-footer.public-footer .public-footer-tagline {
        max-width: min(280px, 100%);
    }

    .modern-footer .footer-description,
    .modern-footer .footer-section a,
    .modern-footer .footer-credits,
    .modern-footer .footer-copyright {
        font-size: 0.78rem;
    }
}
