/* TheraLink — Public auth pages (login, forgot-password, activate, OTP, activation states)
   Tokens: Physio primary #207FBF, success #4CAF93
   Background: soft wash + brand blobs + layered parallax "connection" motif

   Gradient variant: /login opts into the marketing blue-green gradient via
   body.auth-theme-gradient (see "Gradient theme" section below). All other
   auth pages keep the default pale wash.
*/

:root {
    --color-primary: #207FBF;
    --color-primary-hover: #1a6b9e;
    --color-primary-ring: rgba(32, 127, 191, 0.15);
    --color-primary-ring-strong: rgba(32, 127, 191, 0.25);
    --color-primary-soft: rgba(32, 127, 191, 0.08);
    --color-success: #4CAF93;
    --color-success-soft: rgba(76, 175, 147, 0.08);
    --color-danger: #c75b5b;
    --color-danger-soft: rgba(199, 91, 91, 0.08);
    --color-text: #1F2A37;
    /* Secondary/muted text — WCAG AA ≥4.5:1 on white (measured 5.98:1) */
    --color-text-muted: #5B6472;
    --color-border: #D1D5DB;
    --color-border-hover: #9CA3AF;
    --color-surface: #FFFFFF;
    --color-disabled: #9CA3AF;
    /* Softened corners — echoes organic background without pill shape */
    --radius-card: 22px;
    --radius-input: 8px;
    /* Blue-dominant brand glow: tight definition + soft ambient lift */
    --shadow-card:
        0 4px 14px rgba(32, 127, 191, 0.10),
        0 22px 52px rgba(32, 127, 191, 0.14);
    /* Logo-dashboards.png has generous canvas padding — crop via scale + overflow */
    --login-brand-logo-height: 2.5rem;
    --login-brand-logo-scale: 2.25;
    --login-brand-logo-crop-width: 12rem;
    --login-brand-logo-crop-height: 2.75rem;
}

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

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    /* Near-white wash — color depth comes from soft radial blobs below */
    background-color: color-mix(in srgb, var(--color-primary) 5%, white);
    -webkit-font-smoothing: antialiased;
}

/*
 * Soft brand blobs — oversized ellipses with multi-stop falloff so color
 * reaches transparency well before the shape edge (no perceptible disc rim).
 * Centers sit partly off-canvas; heavy blur + low peak opacity = ambient wash.
 */
body::before {
    content: "";
    position: fixed;
    inset: -55%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 90vw 80vw at -5% 5%,
            color-mix(in srgb, var(--color-primary) 12%, transparent) 0%,
            color-mix(in srgb, var(--color-primary) 7%, transparent) 22%,
            color-mix(in srgb, var(--color-primary) 3%, transparent) 45%,
            color-mix(in srgb, var(--color-primary) 1%, transparent) 62%,
            transparent 78%
        ),
        radial-gradient(
            ellipse 95vw 85vw at 105% 95%,
            color-mix(in srgb, var(--color-success) 11%, transparent) 0%,
            color-mix(in srgb, var(--color-success) 6%, transparent) 25%,
            color-mix(in srgb, var(--color-success) 2%, transparent) 48%,
            transparent 76%
        ),
        radial-gradient(
            ellipse 72vw 64vw at 78% -8%,
            color-mix(in srgb, var(--color-primary) 8%, transparent) 0%,
            color-mix(in srgb, var(--color-primary) 3%, transparent) 38%,
            transparent 70%
        ),
        radial-gradient(
            ellipse 64vw 58vw at 8% 105%,
            color-mix(in srgb, var(--color-success) 7%, transparent) 0%,
            color-mix(in srgb, var(--color-success) 2.5%, transparent) 40%,
            transparent 72%
        );
    filter: blur(160px);
    transform: translateZ(0);
}

/*
 * Back connection layer — larger scale, lowest opacity (~4–5%), slowest drift.
 * Fixed so it covers tall pages; sits behind .login-page stacking context.
 */
body::after {
    content: "";
    position: fixed;
    inset: -12%;
    z-index: 0;
    pointer-events: none;
    /* Large soft curves + sparse oversized nodes */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='960' height='720' viewBox='0 0 960 720' fill='none'%3E%3Cpath d='M-40 200 C120 40 280 340 420 180 S700 20 820 160 S980 340 1020 260' stroke='%23207FBF' stroke-width='1.6' stroke-opacity='0.05' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-20 420 C140 300 300 540 460 400 S720 280 880 420' stroke='%234CAF93' stroke-width='1.4' stroke-opacity='0.045' fill='none' stroke-linecap='round'/%3E%3Cpath d='M80 80 C240 160 360 20 520 100 S780 220 940 80' stroke='%23207FBF' stroke-width='1.2' stroke-opacity='0.04' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='420' cy='180' r='5' fill='%23207FBF' fill-opacity='0.055'/%3E%3Ccircle cx='820' cy='160' r='4' fill='%23207FBF' fill-opacity='0.045'/%3E%3Ccircle cx='460' cy='400' r='4.5' fill='%234CAF93' fill-opacity='0.05'/%3E%3Ccircle cx='520' cy='100' r='3.5' fill='%23207FBF' fill-opacity='0.04'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 960px 720px;
    background-position: 8% 12%;
    will-change: transform;
    animation: login-bg-drift-back 110s ease-in-out infinite alternate;
}

html:has(.login-page--fit-viewport),
body:has(.login-page--fit-viewport) {
    height: 100%;
    overflow: hidden;
}

.login-page {
    position: relative;
    z-index: 1;
    isolation: isolate;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-page--fit-viewport {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
}

.login-page--fit-viewport .login-card {
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
}

.login-page-home-btn {
    position: absolute;
    top: 1.25rem;
    left: 1rem;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    background: color-mix(in srgb, var(--color-surface) 90%, transparent);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.login-page-home-btn:hover {
    border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(32, 127, 191, 0.12);
}

.login-page-home-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-ring-strong);
}

.login-page-home-btn__icon {
    flex-shrink: 0;
}

/*
 * Mid connection layer — constellation with varied stroke/node weights.
 * Anchor nodes + thinner satellite links (not a uniform wallpaper tile).
 */
.login-page::before {
    content: "";
    position: absolute;
    inset: -8% -10%;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='540' viewBox='0 0 720 540' fill='none'%3E%3Cpath d='M-20 160 C80 60 180 260 290 150 S480 40 580 130 S720 260 760 200' stroke='%23207FBF' stroke-width='1.5' stroke-opacity='0.11' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-10 320 C90 250 190 400 310 330 S480 250 600 320 S700 400 750 360' stroke='%234CAF93' stroke-width='1.35' stroke-opacity='0.10' fill='none' stroke-linecap='round'/%3E%3Cpath d='M40 460 C150 400 240 510 370 450 S540 370 660 450' stroke='%23207FBF' stroke-width='0.9' stroke-opacity='0.07' fill='none' stroke-linecap='round'/%3E%3Cpath d='M60 70 C160 130 250 30 380 90 S540 170 680 70' stroke='%234CAF93' stroke-width='1.1' stroke-opacity='0.08' fill='none' stroke-linecap='round'/%3E%3Cpath d='M120 250 C220 200 280 310 400 250 S560 180 640 250' stroke='%23207FBF' stroke-width='0.85' stroke-opacity='0.06' fill='none' stroke-linecap='round'/%3E%3Cpath d='M290 150 L330 210 M580 130 L540 190 M310 330 L360 280 M400 250 L440 300' stroke='%23207FBF' stroke-width='0.7' stroke-opacity='0.05' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='290' cy='150' r='4.5' fill='%23207FBF' fill-opacity='0.14'/%3E%3Ccircle cx='580' cy='130' r='3.8' fill='%23207FBF' fill-opacity='0.12'/%3E%3Ccircle cx='310' cy='330' r='4.2' fill='%234CAF93' fill-opacity='0.13'/%3E%3Ccircle cx='600' cy='320' r='2.2' fill='%234CAF93' fill-opacity='0.09'/%3E%3Ccircle cx='370' cy='450' r='2.4' fill='%23207FBF' fill-opacity='0.09'/%3E%3Ccircle cx='380' cy='90' r='3.2' fill='%234CAF93' fill-opacity='0.11'/%3E%3Ccircle cx='400' cy='250' r='3.6' fill='%23207FBF' fill-opacity='0.12'/%3E%3Ccircle cx='330' cy='210' r='1.6' fill='%23207FBF' fill-opacity='0.08'/%3E%3Ccircle cx='540' cy='190' r='1.5' fill='%234CAF93' fill-opacity='0.07'/%3E%3Ccircle cx='360' cy='280' r='1.7' fill='%234CAF93' fill-opacity='0.08'/%3E%3Ccircle cx='440' cy='300' r='1.4' fill='%23207FBF' fill-opacity='0.07'/%3E%3Ccircle cx='180' cy='255' r='1.8' fill='%234CAF93' fill-opacity='0.07'/%3E%3Ccircle cx='500' cy='195' r='1.5' fill='%23207FBF' fill-opacity='0.06'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 720px 540px;
    background-position: 0 0;
    will-change: transform;
    animation: login-bg-drift-mid 90s ease-in-out infinite alternate;
}

/*
 * Front connection layer — sparse, slightly higher opacity, faster (still calm).
 */
.login-page::after {
    content: "";
    position: absolute;
    inset: -6% -8%;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='400' viewBox='0 0 520 400' fill='none'%3E%3Cpath d='M20 120 C100 40 180 200 280 110 S420 30 500 100' stroke='%23207FBF' stroke-width='1.3' stroke-opacity='0.09' fill='none' stroke-linecap='round'/%3E%3Cpath d='M40 280 C140 220 220 340 340 270 S460 220 510 290' stroke='%234CAF93' stroke-width='1.1' stroke-opacity='0.08' fill='none' stroke-linecap='round'/%3E%3Cpath d='M280 110 L310 160 M340 270 L300 230' stroke='%23207FBF' stroke-width='0.75' stroke-opacity='0.06' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='280' cy='110' r='3.5' fill='%23207FBF' fill-opacity='0.11'/%3E%3Ccircle cx='340' cy='270' r='3' fill='%234CAF93' fill-opacity='0.10'/%3E%3Ccircle cx='310' cy='160' r='1.5' fill='%23207FBF' fill-opacity='0.08'/%3E%3Ccircle cx='300' cy='230' r='1.4' fill='%234CAF93' fill-opacity='0.07'/%3E%3Ccircle cx='500' cy='100' r='2' fill='%23207FBF' fill-opacity='0.08'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 520px 400px;
    background-position: 40% 30%;
    will-change: transform;
    animation: login-bg-drift-front 70s ease-in-out infinite alternate;
}

@keyframes login-bg-drift-back {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-18px, 12px);
    }
}

@keyframes login-bg-drift-mid {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-28px, 18px);
    }
}

@keyframes login-bg-drift-front {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-36px, 22px);
    }
}

/* ═══ Gradient theme — /login only (body.auth-theme-gradient) ═══════════════
   Softened take on the marketing hero gradient ("The Handoff",
   public/css/filament/public/home.css --hero-gradient): same 135deg
   navy→blue→green direction, but lighter stops and lower contrast so the
   opaque white card stays visually dominant on a trust-critical page.
   Hero stops for reference: #0A1F2E → #0B4F8A → #207FBF → #4CAF93. */

body.auth-theme-gradient {
    --login-grad-1: #16455F;
    --login-grad-2: #2A6FA8;
    --login-grad-3: #4C99C9;
    --login-grad-4: #63BBA0;
    background: linear-gradient(
        135deg,
        var(--login-grad-1) 0%,
        var(--login-grad-2) 45%,
        var(--login-grad-3) 72%,
        var(--login-grad-4) 100%
    );
}

/* Replace the pale-page brand blobs: soft cream halo behind the card plus a
   green ambient lift toward the gradient's bright corner. Radials are already
   smooth — no heavy blur layer needed here. */
body.auth-theme-gradient::before {
    inset: 0;
    filter: none;
    background:
        radial-gradient(
            ellipse 60vw 48vw at 50% 44%,
            rgba(250, 249, 246, 0.12) 0%,
            rgba(250, 249, 246, 0.04) 45%,
            transparent 70%
        ),
        radial-gradient(
            ellipse 74vw 62vw at 106% 106%,
            rgba(95, 211, 174, 0.16) 0%,
            transparent 66%
        );
}

/* Connection motif layers — identical geometry, cream strokes so the threads
   still read (subtly) against the colored gradient. */
body.auth-theme-gradient::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='960' height='720' viewBox='0 0 960 720' fill='none'%3E%3Cpath d='M-40 200 C120 40 280 340 420 180 S700 20 820 160 S980 340 1020 260' stroke='%23FAF9F6' stroke-width='1.6' stroke-opacity='0.07' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-20 420 C140 300 300 540 460 400 S720 280 880 420' stroke='%23FAF9F6' stroke-width='1.4' stroke-opacity='0.065' fill='none' stroke-linecap='round'/%3E%3Cpath d='M80 80 C240 160 360 20 520 100 S780 220 940 80' stroke='%23FAF9F6' stroke-width='1.2' stroke-opacity='0.06' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='420' cy='180' r='5' fill='%23FAF9F6' fill-opacity='0.08'/%3E%3Ccircle cx='820' cy='160' r='4' fill='%23FAF9F6' fill-opacity='0.065'/%3E%3Ccircle cx='460' cy='400' r='4.5' fill='%23FAF9F6' fill-opacity='0.07'/%3E%3Ccircle cx='520' cy='100' r='3.5' fill='%23FAF9F6' fill-opacity='0.06'/%3E%3C/svg%3E");
}

body.auth-theme-gradient .login-page::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='720' height='540' viewBox='0 0 720 540' fill='none'%3E%3Cpath d='M-20 160 C80 60 180 260 290 150 S480 40 580 130 S720 260 760 200' stroke='%23FAF9F6' stroke-width='1.5' stroke-opacity='0.14' fill='none' stroke-linecap='round'/%3E%3Cpath d='M-10 320 C90 250 190 400 310 330 S480 250 600 320 S700 400 750 360' stroke='%23FAF9F6' stroke-width='1.35' stroke-opacity='0.13' fill='none' stroke-linecap='round'/%3E%3Cpath d='M40 460 C150 400 240 510 370 450 S540 370 660 450' stroke='%23FAF9F6' stroke-width='0.9' stroke-opacity='0.09' fill='none' stroke-linecap='round'/%3E%3Cpath d='M60 70 C160 130 250 30 380 90 S540 170 680 70' stroke='%23FAF9F6' stroke-width='1.1' stroke-opacity='0.10' fill='none' stroke-linecap='round'/%3E%3Cpath d='M120 250 C220 200 280 310 400 250 S560 180 640 250' stroke='%23FAF9F6' stroke-width='0.85' stroke-opacity='0.08' fill='none' stroke-linecap='round'/%3E%3Cpath d='M290 150 L330 210 M580 130 L540 190 M310 330 L360 280 M400 250 L440 300' stroke='%23FAF9F6' stroke-width='0.7' stroke-opacity='0.07' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='290' cy='150' r='4.5' fill='%23FAF9F6' fill-opacity='0.18'/%3E%3Ccircle cx='580' cy='130' r='3.8' fill='%23FAF9F6' fill-opacity='0.16'/%3E%3Ccircle cx='310' cy='330' r='4.2' fill='%23FAF9F6' fill-opacity='0.17'/%3E%3Ccircle cx='600' cy='320' r='2.2' fill='%23FAF9F6' fill-opacity='0.12'/%3E%3Ccircle cx='370' cy='450' r='2.4' fill='%23FAF9F6' fill-opacity='0.12'/%3E%3Ccircle cx='380' cy='90' r='3.2' fill='%23FAF9F6' fill-opacity='0.14'/%3E%3Ccircle cx='400' cy='250' r='3.6' fill='%23FAF9F6' fill-opacity='0.16'/%3E%3Ccircle cx='330' cy='210' r='1.6' fill='%23FAF9F6' fill-opacity='0.10'/%3E%3Ccircle cx='540' cy='190' r='1.5' fill='%23FAF9F6' fill-opacity='0.09'/%3E%3Ccircle cx='360' cy='280' r='1.7' fill='%23FAF9F6' fill-opacity='0.10'/%3E%3Ccircle cx='440' cy='300' r='1.4' fill='%23FAF9F6' fill-opacity='0.09'/%3E%3Ccircle cx='180' cy='255' r='1.8' fill='%23FAF9F6' fill-opacity='0.09'/%3E%3Ccircle cx='500' cy='195' r='1.5' fill='%23FAF9F6' fill-opacity='0.08'/%3E%3C/svg%3E");
}

body.auth-theme-gradient .login-page::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='400' viewBox='0 0 520 400' fill='none'%3E%3Cpath d='M20 120 C100 40 180 200 280 110 S420 30 500 100' stroke='%23FAF9F6' stroke-width='1.3' stroke-opacity='0.12' fill='none' stroke-linecap='round'/%3E%3Cpath d='M40 280 C140 220 220 340 340 270 S460 220 510 290' stroke='%23FAF9F6' stroke-width='1.1' stroke-opacity='0.11' fill='none' stroke-linecap='round'/%3E%3Cpath d='M280 110 L310 160 M340 270 L300 230' stroke='%23FAF9F6' stroke-width='0.75' stroke-opacity='0.08' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='280' cy='110' r='3.5' fill='%23FAF9F6' fill-opacity='0.14'/%3E%3Ccircle cx='340' cy='270' r='3' fill='%23FAF9F6' fill-opacity='0.13'/%3E%3Ccircle cx='310' cy='160' r='1.5' fill='%23FAF9F6' fill-opacity='0.10'/%3E%3Ccircle cx='300' cy='230' r='1.4' fill='%23FAF9F6' fill-opacity='0.09'/%3E%3Ccircle cx='500' cy='100' r='2' fill='%23FAF9F6' fill-opacity='0.10'/%3E%3C/svg%3E");
}

/* Card: swap the blue glow for a navy ambient shadow — reads as depth on the
   gradient instead of a colored halo. Card surface itself is unchanged. */
body.auth-theme-gradient .login-card {
    box-shadow:
        0 4px 14px rgba(10, 31, 46, 0.16),
        0 24px 56px rgba(10, 31, 46, 0.24);
}

/* Back-to-home pill sits on the darkest gradient corner — near-opaque white
   surface and a white focus ring keep it clearly legible there. */
body.auth-theme-gradient .login-page-home-btn {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 1px 3px rgba(10, 31, 46, 0.25);
}

body.auth-theme-gradient .login-page-home-btn:hover {
    border-color: #ffffff;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(10, 31, 46, 0.3);
}

body.auth-theme-gradient .login-page-home-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 1.75rem 1.5rem 1.25rem;
    animation: login-card-enter 0.4s ease forwards;
}

@keyframes login-card-enter {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card__header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.login-card__logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: min(100%, var(--login-brand-logo-crop-width));
    height: var(--login-brand-logo-crop-height);
    min-height: 0;
    margin-inline: auto;
    margin-bottom: 0.125rem;
    line-height: 0;
    overflow: hidden;
}

.login-card__logo {
    width: auto !important;
    height: var(--login-brand-logo-height) !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    margin: 0 !important;
    transform: scale(var(--login-brand-logo-scale));
    transform-origin: center center;
}

.login-card__title {
    margin: 0 0 0.35rem 0;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.login-card__tagline {
    position: relative;
    z-index: 1;
    margin: 0 0 0.2rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.login-card__context {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

.form-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input-wrap--password .form-input {
    padding-right: 2.75rem;
}

/* Functional field icons (mail/lock) — left-aligned input chrome, sized and
   weighted to match the back-to-home icon (18px, stroke-width 2, muted). */
.form-input-wrap--icon .form-input {
    padding-left: 2.625rem;
}

.form-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

/* Quiet affordance: tint only the active field's icon toward the brand blue */
.form-input-wrap--icon:focus-within .form-input-icon {
    color: var(--color-primary);
}

.form-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.form-input:hover {
    border-color: var(--color-border-hover);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    /* Stronger ring for WCAG 2.4.7 — clearly visible, not a faint border-only change */
    box-shadow: 0 0 0 4px var(--color-primary-ring-strong);
}

.form-input.form-input--error {
    border-color: var(--color-danger);
}

.form-input.form-input--error:focus {
    box-shadow: 0 0 0 4px var(--color-danger-soft);
}

.form-input-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
}

.form-input-toggle:hover {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.form-input-toggle__icon--hide {
    display: none;
}

.form-input-toggle.is-visible .form-input-toggle__icon--show {
    display: none;
}

.form-input-toggle.is-visible .form-input-toggle__icon--hide {
    display: block;
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form-row--forgot {
    align-items: center;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
    min-height: 0;
    flex: 1;
}

.form-error:not(:empty) {
    min-height: 1.2em;
}

.forgot-link {
    font-size: 0.875rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.forgot-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.forgot-link--button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.login-error {
    font-size: 0.9rem;
    color: var(--color-danger);
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--color-danger-soft);
    border-radius: var(--radius-input);
    border-left: 4px solid var(--color-danger);
}

.login-success {
    font-size: 0.9rem;
    color: var(--color-success);
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--color-success-soft);
    border-radius: var(--radius-input);
    border-left: 4px solid var(--color-success);
}

.turnstile-field {
    margin-top: 0;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.turnstile-field > div {
    display: flex;
    width: 100%;
    justify-content: center;
}

.turnstile-field .cf-turnstile {
    display: flex;
    width: 100%;
    justify-content: center;
}

.turnstile-field .cf-turnstile > div {
    margin-inline: auto;
}

/*
 * Cloudflare dummy site keys (1x… / 2x… / 3x…) append a red
 * "For testing only" strip below the widget. Clip it in local dev;
 * production site keys do not render the strip (no --dummy-key class).
 */
.turnstile-field--dummy-key .cf-turnstile {
    max-height: 70px;
    overflow: clip;
}

.turnstile-status-text {
    display: block;
    min-height: 0;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
}

.turnstile-status-text:not(:empty) {
    min-height: 1.25em;
}

.login-btn,
.login-button {
    position: relative;
    width: 100%;
    height: 46px;
    padding: 0 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-input);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 0;
}

.login-btn:hover,
.login-button:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.login-btn:active,
.login-button:active {
    transform: translateY(0);
}

.login-btn:focus,
.login-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-ring-strong);
}

.login-btn:disabled,
.login-button:disabled {
    background: var(--color-disabled);
    cursor: not-allowed;
    transform: none;
}

.login-button__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.login-button__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    transition: opacity 0.2s ease;
}

.login-button__pulse {
    flex-shrink: 0;
    display: block;
    overflow: visible;
    color: inherit;
}

.login-button__pulse--idle {
    width: 48px;
    height: 32px;
}

/* Full-width ECG strip — hidden until submit; spans the button surface */
.login-button__pulse--wide {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    width: 100%;
    height: 36px;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.login-button__pulse-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
}

.login-button__pulse--wide .login-button__pulse-underlay {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
}

/* Idle: quiet opacity pulse on the compact icon only */
.login-button:not(.is-loading) .login-button__pulse--idle .login-button__pulse-path {
    animation: login-pulse-idle 2.8s ease-in-out infinite;
}

/* Submitting: label fades out; full-width sweep becomes the sole loading indicator */
.login-button.is-loading .login-button__label {
    opacity: 0;
}

.login-button.is-loading .login-button__pulse--wide {
    opacity: 1;
}

.login-button.is-loading .login-button__pulse--wide .login-button__pulse-path {
    animation: login-pulse-draw 1.4s linear infinite;
}

.login-button.is-loading:disabled {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-success) 100%);
}

@keyframes login-pulse-idle {
    0%,
    100% {
        opacity: 0.78;
    }
    50% {
        opacity: 1;
    }
}

@keyframes login-pulse-draw {
    0% {
        stroke-dashoffset: 100;
        opacity: 0.45;
    }
    12% {
        opacity: 1;
    }
    78% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 0.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* Freeze each layer at a distinct offset so depth remains without motion */
    body::after {
        animation: none;
        will-change: auto;
        transform: translate(-12px, 8px);
    }

    .login-page::before {
        animation: none;
        will-change: auto;
        transform: none;
    }

    .login-page::after {
        animation: none;
        will-change: auto;
        transform: translate(14px, -8px);
    }

    .login-button__label,
    .login-button__pulse--wide {
        transition: none;
    }

    .login-button__pulse-path {
        animation: none !important;
        stroke-dashoffset: 0 !important;
        opacity: 1 !important;
    }

    /* Still swap to the full-width static line on submit — no sweep motion */
    .login-button.is-loading .login-button__pulse--wide .login-button__pulse-path {
        opacity: 1 !important;
    }
}

.login-footer {
    margin: 0.75rem 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
}

.login-footer__resend-form {
    display: inline;
}

.login-footer__link {
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.login-footer__link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.login-footer__link:focus-visible {
    outline: none;
    text-decoration: underline;
    box-shadow: 0 0 0 2px var(--color-primary-ring-strong);
    border-radius: 2px;
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem 1.25rem 1rem;
        border-radius: var(--radius-card);
    }

    /* Left field icons cost ~28px of text room — shrink placeholder (not the
       typed value) so long hints like the forgot-password example still fit. */
    .form-input::placeholder {
        font-size: 0.875rem;
    }

    .login-card__title {
        font-size: 1.5rem;
    }

    .login-card__tagline {
        font-size: 1.0625rem;
    }

    .login-card__context {
        font-size: 0.8125rem;
        letter-spacing: 0.035em;
    }

    .login-card__logo-wrap {
        margin-bottom: 0.125rem;
    }

    :root {
        --login-brand-logo-height: 2.25rem;
        --login-brand-logo-scale: 2.1;
        --login-brand-logo-crop-width: 11rem;
        --login-brand-logo-crop-height: 2.5rem;
    }

    .turnstile-field {
        margin-top: 0;
    }
}

@media (max-height: 720px) {
    .login-page--fit-viewport .login-card {
        padding: 1.25rem 1.25rem 0.875rem;
    }

    .login-page--fit-viewport .login-card__header {
        margin-bottom: 0.5rem;
    }

    .login-page--fit-viewport .login-card__logo-wrap {
        margin-bottom: 0.0625rem;
    }

    .login-page--fit-viewport {
        --login-brand-logo-height: 2.125rem;
        --login-brand-logo-scale: 2;
        --login-brand-logo-crop-width: 10.5rem;
        --login-brand-logo-crop-height: 2.375rem;
    }

    .login-page--fit-viewport .login-card__tagline {
        font-size: 1rem;
    }

    .login-page--fit-viewport .login-card__context {
        font-size: 0.75rem;
        line-height: 1.35;
    }

    .login-page--fit-viewport .login-form {
        gap: 0.625rem;
    }

    .login-page--fit-viewport .form-input {
        height: 42px;
        font-size: 0.9375rem;
    }

    .login-page--fit-viewport .login-button {
        height: 42px;
        font-size: 0.9375rem;
    }

    .login-page--fit-viewport .login-footer {
        margin-top: 0.5rem;
        font-size: 0.75rem;
        line-height: 1.35;
    }

    .login-page--fit-viewport .login-page-home-btn {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
    }
}

@media (max-height: 640px) {
    .login-page--fit-viewport .login-card {
        padding: 1rem 1.125rem 0.75rem;
    }

    .login-page--fit-viewport {
        --login-brand-logo-height: 2rem;
        --login-brand-logo-scale: 1.85;
        --login-brand-logo-crop-width: 10rem;
        --login-brand-logo-crop-height: 2.25rem;
    }

    .login-page--fit-viewport .login-card__tagline {
        font-size: 0.9375rem;
    }

    .login-page--fit-viewport .form-label {
        font-size: 0.8125rem;
    }

    .login-page--fit-viewport .form-input {
        height: 40px;
    }

    .login-page--fit-viewport .login-button {
        height: 40px;
    }
}
