/* =========================================================
           School Login UI
           Refined design system: brand-faithful, modern, accessible.
           Brand: Navy #1a2a6c · Crimson #b21f1f
           ========================================================= */

        :root {
            --brand-navy: #1a2a6c;
            --brand-navy-deep: #111c52;
            --brand-navy-soft: #2a3d8f;
            --brand-crimson: #b21f1f;
            --brand-crimson-soft: #d94a4a;

            --ink-900: #0f172a;
            --ink-700: #334155;
            --ink-500: #64748b;
            --ink-400: #94a3b8;
            --line: #e6e8ef;
            --line-strong: #d4d8e3;
            --surface: #ffffff;
            --surface-muted: #f7f8fb;

            --success: #138a5a;
            --warning: #c2570a;
            --danger: #c81e1e;

            /* ----- Spacing tokens (compactness) ----- */
            --login-card-pad: 1.4rem 1.75rem 1.2rem;
            --login-logo-top: 0.1rem;
            --login-logo-bottom: 0.7rem;
            --login-heading-bottom: 0.35rem;
            --login-section-gap: 1rem;
            --login-section-pad-b: 0.85rem;
            --login-name-bottom: 0.2rem;
            --login-form-gap: 0.85rem;
            --login-label-bottom: 0.35rem;
            --login-input-pad: 0.65rem 0.85rem;
            --login-btn-pad: 0.7rem 1rem;
            --login-btn-top: 0.35rem;
            --login-error-bottom: 0.85rem;
            --login-error-pad: 0.7rem 0.9rem;
            --login-forgot-top: 0.8rem;

            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 22px;

            --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04),
                0 10px 30px rgba(15, 23, 42, 0.10),
                0 30px 60px -20px rgba(26, 42, 108, 0.35);
            --shadow-toast: 0 12px 40px rgba(15, 23, 42, 0.18),
                0 2px 6px rgba(15, 23, 42, 0.06);
            --ring: 0 0 0 4px rgba(26, 42, 108, 0.15);
        }

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

        html {
            -webkit-text-size-adjust: 100%;
            height: 100%;
        }

        body {
            font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            font-feature-settings: "cv02", "cv03", "cv04", "ss01";
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            color: var(--ink-900);
            height: 100vh;
            height: 100dvh;
            /* top padding leaves room for the fixed theme-toggle (40px + 8px gap) */
            padding: 48px 16px 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow-x: hidden;
            overflow-y: auto;

            /* Sophisticated brand backdrop: deep navy base with subtle
               radial accents — calm, professional, school-formal. */
            background-color: #0e1742;
            background-image:
                radial-gradient(1100px 700px at 12% -10%, rgba(178, 31, 31, 0.28), transparent 60%),
                radial-gradient(900px 600px at 100% 110%, rgba(42, 61, 143, 0.55), transparent 60%),
                radial-gradient(700px 500px at 50% 50%, rgba(255, 255, 255, 0.05), transparent 70%),
                linear-gradient(135deg, #0d1640 0%, #1a2a6c 55%, #2a1a4a 100%);
        }


        /* Subtle decorative grid — adds depth without noise. */
        body::before {
            content: "";
            position: fixed;
            inset: 0;
            pointer-events: none;
            background-image:
                linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
            background-size: 44px 44px;
            mask-image: radial-gradient(ellipse at center, #000 40%, transparent 80%);
            -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 80%);
        }

        /* =========================================================
           Card
           ========================================================= */
        .login-container {
            position: relative;
            background: var(--surface);
            padding: var(--login-card-pad);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-card);
            max-width: 410px;
            width: 100%;
            margin: auto;
            border: 1px solid rgba(255, 255, 255, 0.6);
            animation: card-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
        }

        @keyframes card-in {
            from {
                opacity: 0;
                transform: translateY(10px) scale(0.985);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Slim brand accent on top edge of the card */
        .login-container::before {
            content: "";
            position: absolute;
            top: 0;
            left: 24px;
            right: 24px;
            height: 3px;
            border-radius: 0 0 6px 6px;
            background: linear-gradient(90deg, var(--brand-navy), var(--brand-crimson));
            opacity: 0.9;
        }

        /* =========================================================
           Logo / header
           ========================================================= */
        .logo-section {
            text-align: center;
            margin-bottom: var(--login-section-gap);
            padding-bottom: var(--login-section-pad-b);
            border-bottom: 1px solid var(--line);
        }

        .school-logo {
            width: 60px;
            height: 60px;
            margin: var(--login-logo-top) auto var(--login-logo-bottom);
            border-radius: 50%;
            overflow: hidden;
            background: #fff;
            border: 1px solid var(--line-strong);
            box-shadow:
                0 0 0 3px #fff,
                0 0 0 4px rgba(26, 42, 108, 0.15),
                0 6px 16px -8px rgba(26, 42, 108, 0.45);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .school-logo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .school-logo-placeholder {
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, var(--brand-navy), var(--brand-crimson));
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.85rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.02em;
            font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
        }

        .school-name {
            color: var(--brand-navy);
            font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
            font-size: 0.95rem;
            font-weight: 700;
            margin-bottom: var(--login-name-bottom);
            text-transform: uppercase;
            letter-spacing: 0.07em;
            line-height: 1.2;
        }

        .school-motto {
            color: var(--ink-500);
            font-size: 0.75rem;
            font-style: italic;
            letter-spacing: 0.01em;
            line-height: 1.3;
        }

        /* =========================================================
           Login title
           ========================================================= */
        .login-title {
            text-align: center;
            margin-bottom: var(--login-section-gap);
        }

        .login-title h3 {
            color: var(--ink-900);
            font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
            font-size: 1.1rem;
            font-weight: 700;
            letter-spacing: -0.01em;
            margin-bottom: var(--login-heading-bottom);
        }

        .login-title p {
            color: var(--ink-500);
            font-size: 0.8rem;
            line-height: 1.4;
        }

        /* =========================================================
           Form
           ========================================================= */
        .form-group {
            margin-bottom: var(--login-form-gap);
        }

        .form-group label {
            display: block;
            margin-bottom: var(--login-label-bottom);
            font-weight: 600;
            font-size: 0.78rem;
            color: var(--ink-700);
            text-transform: uppercase;
            letter-spacing: 0.02em;
        }

        .form-group input {
            width: 100%;
            padding: var(--login-input-pad);
            border: 1px solid var(--line-strong);
            border-radius: var(--radius-sm);
            font-size: 0.88rem;
            font-family: inherit;
            color: var(--ink-900);
            transition: border-color 0.2s, background 0.15s, box-shadow 0.2s;
        }

        .form-group input:hover {
            border-color: #b5bfd4;
        }

        .form-group input:focus {
            outline: none;
            background: #fff;
            border-color: var(--brand-navy);
            box-shadow: var(--ring);
        }

        .btn {
            width: 100%;
            padding: var(--login-btn-pad);
            background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-navy-deep) 100%);
            color: #fff;
            border: none;
            border-radius: var(--radius-md);
            font-size: 0.92rem;
            font-weight: 600;
            font-family: inherit;
            letter-spacing: 0.02em;
            cursor: pointer;
            margin-top: var(--login-btn-top);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.12) inset,
                0 6px 16px -6px rgba(26, 42, 108, 0.55);
            transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
        }

        .btn:hover {
            filter: brightness(1.06);
            transform: translateY(-1px);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.15) inset,
                0 10px 22px -8px rgba(26, 42, 108, 0.65);
        }

        .btn:focus-visible {
            outline: none;
            box-shadow:
                0 0 0 4px rgba(26, 42, 108, 0.22),
                0 6px 16px -6px rgba(26, 42, 108, 0.55);
        }

        .btn:active {
            transform: translateY(0);
            filter: brightness(0.98);
        }

        /* =========================================================
           Alerts
           ========================================================= */
        .error {
            color: #8a1313;
            text-align: left;
            margin-bottom: var(--login-error-bottom);
            font-weight: 500;
            font-size: 0.82rem;
            padding: var(--login-error-pad);
            background-color: #fdecec;
            border-radius: var(--radius-sm);
            border-left: 4px solid var(--danger);
            line-height: 1.4;
        }

        .error.warning {
            color: #7a3b00;
            background-color: #fff4e5;
            border-left-color: var(--warning);
        }

        /* =========================================================
           Footer links
           ========================================================= */
        .forgot-password {
            text-align: center;
            margin-top: var(--login-forgot-top);
        }

        .forgot-password a {
            color: var(--brand-navy);
            text-decoration: none;
            font-size: 0.78rem;
            font-weight: 600;
            transition: color 0.2s;
        }

        .forgot-password a:hover {
            color: var(--brand-crimson);
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        /* =========================================================
           Password toggle
           ========================================================= */
        .password-wrapper {
            position: relative;
        }

        .password-wrapper input {
            padding-right: 2.7rem;
        }

        .toggle-password {
            position: absolute;
            right: 0.6rem;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: var(--ink-400);
            font-size: 0.9rem;
            background: none;
            border: none;
            padding: 0.3rem;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s, background 0.2s;
        }

        .toggle-password:hover {
            color: var(--brand-navy);
            background: rgba(26, 42, 108, 0.08);
        }

        /* =========================================================
           Flash / toast
           ========================================================= */
        .flash-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(10, 15, 40, 0.45);
            backdrop-filter: blur(2px);
            -webkit-backdrop-filter: blur(2px);
            z-index: 998;
        }

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

        .flash-toast {
            position: fixed;
            top: 1.2rem;
            /* leave room on the right for the fixed theme-toggle (40px + 16px + gap) */
            left: 50%;
            transform: translateX(-50%) translateY(-140px);
            z-index: 999;
            min-width: 0;
            max-width: min(480px, calc(100vw - 96px));
            width: calc(100% - 96px);
            background: #fff;
            border-radius: var(--radius-md);
            padding: 0.9rem 1rem 1.2rem;
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
            box-shadow: var(--shadow-toast);
            border: 1px solid var(--line);
            opacity: 0;
            overflow: hidden;
            transition: transform 0.45s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.35s ease;
        }

        .flash-toast.visible {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
        }

        .flash-toast.success {
            border-left: 4px solid var(--success);
        }

        .flash-toast.logout {
            border-left: 4px solid var(--brand-navy);
        }

        .flash-toast.timeout {
            border-left: 4px solid var(--warning);
        }

        .flash-icon {
            flex-shrink: 0;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.95rem;
            color: #fff;
            margin-top: 1px;
        }

        .flash-toast.success .flash-icon {
            background: var(--success);
        }

        .flash-toast.logout .flash-icon {
            background: var(--brand-navy);
        }

        .flash-toast.timeout .flash-icon {
            background: var(--warning);
        }

        .flash-body {
            flex: 1;
            min-width: 0;
        }

        .flash-body strong {
            display: block;
            font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
            font-size: 0.9rem;
            font-weight: 700;
            margin-bottom: 0.15rem;
            color: var(--ink-900);
            letter-spacing: -0.005em;
        }

        .flash-body span {
            font-size: 0.8rem;
            color: var(--ink-500);
            line-height: 1.4;
        }

        .flash-progress {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 4px;
            transform: scaleX(1);
            transform-origin: left center;
            opacity: 0.9;
        }

        .flash-toast.success .flash-progress {
            background: var(--success);
        }

        .flash-toast.logout .flash-progress {
            background: var(--brand-navy);
        }

        .flash-toast.timeout .flash-progress {
            background: var(--warning);
        }

        .flash-close {
            flex-shrink: 0;
            background: none;
            border: none;
            cursor: pointer;
            color: var(--ink-400);
            font-size: 0.95rem;
            padding: 4px;
            border-radius: 6px;
            line-height: 1;
            transition: color 0.2s, background 0.2s;
        }

        .flash-close:hover {
            color: var(--ink-700);
            background: var(--surface-muted);
        }

        /* =========================================================
           Responsive
           ========================================================= */
        @media (max-width: 768px) {
            body {
                padding: 44px 14px 10px;
            }

            .login-container {
                padding: 1.2rem 1.4rem 1rem;
            }

            .school-logo {
                width: 56px;
                height: 56px;
            }

            .school-name {
                font-size: 0.9rem;
                letter-spacing: 0.05em;
            }

            .login-title h3 {
                font-size: 1.05rem;
            }

            .flash-toast {
                top: 0.9rem;
                width: calc(100% - 80px);
                max-width: calc(100vw - 80px);
            }
        }

        @media (max-width: 576px) {
            body {
                padding: 44px 12px 8px;
                align-items: center;
            }

            .login-container {
                padding: 1.1rem 1.1rem 1rem;
                border-radius: 12px;
            }

            .school-logo {
                width: 54px;
                height: 54px;
            }

            .school-logo-placeholder {
                font-size: 1.5rem;
            }

            .school-name {
                font-size: 0.88rem;
                letter-spacing: 0.04em;
            }

            .school-motto {
                font-size: 0.73rem;
            }

            .login-title h3 {
                font-size: 1rem;
            }

            .login-title p {
                font-size: 0.78rem;
            }

            .form-group input {
                padding: 0.6rem 0.8rem;
                font-size: 0.88rem;
            }

            .form-group label {
                font-size: 0.76rem;
                margin-bottom: 0.28rem;
            }

            .btn {
                padding: 0.65rem;
                font-size: 0.9rem;
                margin-top: 0.3rem;
            }

            .flash-toast {
                padding: 0.75rem 0.8rem 1rem;
                top: 0.7rem;
                width: calc(100% - 72px);
                max-width: calc(100vw - 72px);
                gap: 0.65rem;
            }

            .flash-body strong {
                font-size: 0.85rem;
                margin-bottom: 0.12rem;
            }

            .flash-body span {
                font-size: 0.75rem;
            }

            .flash-icon {
                width: 32px;
                height: 32px;
                font-size: 0.85rem;
            }

            /* shrink the theme toggle slightly on phones (keeps icon + label fitting) */
            .theme-toggle {
                top: 10px;
                right: 10px;
                gap: 6px;
                padding: 5px 11px 5px 7px;
                font-size: 0.76rem;
            }
        }

        @media (max-width: 400px) {
            body {
                padding: 42px 10px 8px;
            }

            .login-container {
                padding: 0.95rem 0.9rem 0.9rem;
                border-radius: 10px;
            }

            .logo-section {
                margin-bottom: 0.8rem;
                padding-bottom: 0.7rem;
            }

            .school-logo {
                width: 50px;
                height: 50px;
                margin-bottom: 0.5rem;
            }

            .school-name {
                font-size: 0.82rem;
            }

            .login-title {
                margin-bottom: 0.8rem;
            }

            .login-title h3 {
                font-size: 0.95rem;
            }

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

            .form-group input {
                padding: 0.55rem 0.75rem;
                font-size: 0.86rem;
            }

            .form-group label {
                font-size: 0.74rem;
                margin-bottom: 0.24rem;
            }

            .btn {
                padding: 0.6rem;
                font-size: 0.88rem;
                margin-top: 0.25rem;
            }

            .forgot-password a {
                font-size: 0.76rem;
            }

            .password-wrapper input {
                padding-right: 2.3rem;
            }

            .toggle-password {
                font-size: 0.85rem;
                right: 0.5rem;
                padding: 0.25rem;
            }

            .flash-toast {
                width: calc(100% - 64px);
                max-width: calc(100vw - 64px);
                gap: 0.55rem;
                padding: 0.65rem 0.7rem 0.9rem;
            }

            .flash-icon {
                width: 30px;
                height: 30px;
                font-size: 0.8rem;
            }

            .error {
                font-size: 0.78rem;
                padding: 0.6rem 0.8rem;
                margin-bottom: 0.7rem;
            }
        }

        /* Short viewports (landscape phones, small laptops): never clip the card */
        @media (max-height: 640px) {
            body {
                align-items: center;
                padding-top: 44px;
                padding-bottom: 16px;
            }

            .school-logo {
                width: 50px;
                height: 50px;
            }

            .logo-section {
                margin-bottom: 0.75rem;
                padding-bottom: 0.65rem;
            }

            .login-title {
                margin-bottom: 0.75rem;
            }

            .login-title h3 {
                font-size: 1rem;
                margin-bottom: 0.25rem;
            }

            .login-title p {
                font-size: 0.75rem;
            }

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

            .form-group input {
                padding: 0.58rem 0.8rem;
                font-size: 0.84rem;
            }

            .btn {
                padding: 0.6rem;
                font-size: 0.88rem;
            }
        }

        @media (prefers-reduced-motion: reduce) {

            *,
            *::before,
            *::after {
                animation-duration: 0.001ms !important;
                transition-duration: 0.001ms !important;
            }
        }

        /* =========================================================
           Theme System — Auto + Manual override
           Resolution order (handled by the early head script):
             1. Saved choice in localStorage('theme') = 'light' | 'dark'
             2. Otherwise prefers-color-scheme
           The script sets <html data-theme="light|dark"> before paint,
           so all rules below simply key on [data-theme="dark"].
           No markup changes — toggle is injected at runtime.
           ========================================================= */
        :root[data-theme="dark"] {
            /* Re-tone brand for dark surfaces (slightly lifted) */
            --brand-navy: #6c84e6;
            --brand-navy-deep: #4f68c9;
            --brand-navy-soft: #8aa0ee;
            --brand-crimson: #ef6464;
            --brand-crimson-soft: #f48a8a;

            /* Inverted ink scale: text light on dark */
            --ink-900: #e6ecf5;
            --ink-700: #c2cad8;
            --ink-500: #94a3b8;
            --ink-400: #6b7790;

            /* Surfaces & lines for dark UI */
            --line: #2a3146;
            --line-strong: #394260;
            --surface: #1e2533;
            --surface-muted: #161b27;

            --success: #34d399;
            --warning: #fbbf24;
            --danger: #f87171;

            --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35),
                0 12px 32px rgba(0, 0, 0, 0.45),
                0 30px 60px -20px rgba(0, 0, 0, 0.6);
            --shadow-toast: 0 14px 44px rgba(0, 0, 0, 0.55),
                0 2px 6px rgba(0, 0, 0, 0.3);
            --ring: 0 0 0 4px rgba(108, 132, 230, 0.28);
        }

        :root[data-theme="dark"] body {
            background-color: #07091a;
            background-image:
                radial-gradient(1100px 700px at 12% -10%, rgba(178, 31, 31, 0.20), transparent 60%),
                radial-gradient(900px 600px at 100% 110%, rgba(42, 61, 143, 0.45), transparent 60%),
                radial-gradient(700px 500px at 50% 50%, rgba(255, 255, 255, 0.025), transparent 70%),
                linear-gradient(135deg, #05071a 0%, #0c1340 55%, #160d2a 100%);
            color: var(--ink-900);
        }

        :root[data-theme="dark"] body::before {
            background-image:
                linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
        }

        :root[data-theme="dark"] .login-container {
            background: var(--surface);
            border-color: rgba(255, 255, 255, 0.06);
        }

        :root[data-theme="dark"] .school-name {
            color: #cdd7f3;
        }

        :root[data-theme="dark"] .login-title h3 {
            color: var(--ink-900);
        }

        :root[data-theme="dark"] .school-logo {
            background: #0f1422;
            border-color: rgba(255, 255, 255, 0.08);
            box-shadow:
                0 0 0 4px #0f1422,
                0 0 0 5px rgba(108, 132, 230, 0.25),
                0 8px 22px -8px rgba(0, 0, 0, 0.7);
        }

        :root[data-theme="dark"] .form-group input:hover {
            border-color: #4a5475;
        }

        :root[data-theme="dark"] .form-group input:focus {
            background: #0f1422;
        }

        :root[data-theme="dark"] .btn {
            background: linear-gradient(180deg, #3b51a8 0%, #2a3d8f 100%);
            box-shadow:
                0 1px 0 rgba(255, 255, 255, 0.08) inset,
                0 6px 18px -6px rgba(0, 0, 0, 0.7);
        }

        :root[data-theme="dark"] .error {
            color: #fecaca;
            background-color: rgba(248, 113, 113, 0.12);
        }

        :root[data-theme="dark"] .error.warning {
            color: #fde68a;
            background-color: rgba(251, 191, 36, 0.12);
        }

        :root[data-theme="dark"] .flash-overlay {
            background: rgba(0, 0, 0, 0.55);
        }

        :root[data-theme="dark"] .flash-toast {
            background: #1e2533;
            border-color: rgba(255, 255, 255, 0.06);
        }

        :root[data-theme="dark"] .flash-body strong {
            color: var(--ink-900);
        }

        :root[data-theme="dark"] .flash-body span,
        :root[data-theme="dark"] .flash-close {
            color: var(--ink-500);
        }

        :root[data-theme="dark"] .flash-close:hover {
            color: var(--ink-700);
            background: var(--surface-muted);
        }

        :root[data-theme="dark"] .toggle-password:hover {
            color: var(--brand-navy);
            background: rgba(108, 132, 230, 0.12);
        }

        /* Hardcoded inline styles in markup — overridden without
           touching the HTML (attribute selectors + !important). */
        :root[data-theme="dark"] div[style*="border-top: 1px solid #eee"] {
            border-top-color: var(--line) !important;
        }

        :root[data-theme="dark"] div[style*="border-top: 1px solid #eee"] p[style*="color: #666"] {
            color: var(--ink-500) !important;
        }

        :root[data-theme="dark"] a[href="portal_login"][style*="background: #fdf2f2"] {
            background: rgba(239, 100, 100, 0.10) !important;
            color: var(--brand-crimson-soft) !important;
            border-color: var(--brand-crimson) !important;
        }

        /* =========================================================
           Theme Toggle (injected at runtime — matches admin_dashboard pill)
           ========================================================= */
        .theme-toggle {
            position: fixed;
            top: 14px;
            right: 14px;
            z-index: 1000;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: none;
            border: 1.5px solid rgba(255, 255, 255, 0.45);
            border-radius: 50px;
            padding: 6px 14px 6px 8px;
            cursor: pointer;
            font-size: 0.82rem;
            font-weight: 600;
            color: #fff;
            transition: all 0.25s ease;
            white-space: nowrap;
            letter-spacing: 0.2px;
            flex-shrink: 0;
            user-select: none;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.45);
        }

        .theme-toggle:hover {
            border-color: rgba(255, 255, 255, 0.7);
            background: rgba(255, 255, 255, 0.12);
            transform: translateY(-1px);
        }

        .theme-toggle:focus-visible {
            outline: none;
            box-shadow: 0 0 0 4px rgba(108, 132, 230, 0.45);
        }

        .theme-toggle .toggle-track {
            width: 34px;
            height: 18px;
            background: rgba(255, 255, 255, 0.35);
            border-radius: 50px;
            position: relative;
            transition: background 0.25s;
            flex-shrink: 0;
        }

        .theme-toggle .toggle-thumb {
            position: absolute;
            top: 2px;
            left: 2px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
            transition: transform 0.25s ease;
        }

        .theme-toggle .toggle-icon {
            font-size: 0.9rem;
            transition: transform 0.4s ease;
            display: flex;
            align-items: center;
        }

        :root[data-theme="dark"] .theme-toggle {
            border-color: rgba(147, 197, 253, 0.4);
            color: #93c5fd;
            background: rgba(59, 130, 246, 0.1);
        }

        :root[data-theme="dark"] .theme-toggle:hover {
            background: rgba(59, 130, 246, 0.2);
            border-color: #93c5fd;
            color: #bfdbfe;
        }

        :root[data-theme="dark"] .theme-toggle .toggle-track {
            background: #3b82f6;
        }

        :root[data-theme="dark"] .theme-toggle .toggle-thumb {
            transform: translateX(16px);
        }

        :root[data-theme="dark"] .theme-toggle .toggle-icon {
            transform: rotate(360deg);
        }