@font-face {
    font-family: Roboto;
    src: url(../fonts/RobotoFlex.woff2) format('woff2 supports variations'), url(../fonts/RobotoFlex.woff2) format('woff2-variations');
    font-weight: 100 1000;
    font-display: swap;
}

@font-face {
    font-family: 'Kurdish';
    src: url('../fonts/Kurdish-Bold.eot');
    src: url('../fonts/Kurdish-Bold.eot?#iefix') format('embedded-opentype'),url('../fonts/Kurdish-Bold.woff2') format('woff2'),url('../fonts/Kurdish-Bold.woff') format('woff'),url('../fonts/Kurdish-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap
}

@font-face {
    font-family: 'Kurdish';
    src: url('../fonts/Kurdish-Regular.eot');
    src: url('../fonts/Kurdish-Regular.eot?#iefix') format('embedded-opentype'),url('../fonts/Kurdish-Regular.woff2') format('woff2'),url('../fonts/Kurdish-Regular.woff') format('woff'),url('../fonts/Kurdish-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap
}

@font-face {
    font-family: 'Noto Naskh Arabic';
    src: url('../fonts/NotoNaskhArabic-Variable.ttf') format('truetype-variations');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

/* Government rule: Arabic-script text (Kurdish, Arabic) is set in Noto Kufi Arabic. Arabic letters only, so Latin text keeps the stack's own font. */
@font-face {
    font-family: 'Noto Kufi Arabic';
    src: url('../fonts/NotoKufiArabic-Variable.ttf') format('truetype-variations');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

html[dark-mode="true"] {
    --gl-background-color-default: #18171d;
    --theme-color: #be9e4e;
    --_shade-1: hsla(from var(--gl-background-color-default) h s l / 75%);
    --_shade-2: hsl(from var(--theme-color) h 15 20);
    --_shade-3: hsla(from var(--theme-color) calc(h + 30) s l / 70%);
    --_shade-4: hsla(from var(--theme-color) h s l / 100%);
    --_shade-5: hsla(from var(--theme-color) h s l / 55%);
    --theme-background-color: var(--gl-background-color-default);
    --super-sidebar-bg: #28272d;
    --mud-palette-appbar-background: rgba(0, 0, 0, 0);
    --mud-palette-drawer-background: rgba(0, 0, 0, 0);
    --mud-body-theme: #18171d;
    --mud-table-theme: #18171d;
    --mud-table-header-theme: #18171d;
    --mud-palette-action-default-hover: rgba(137, 136, 141, 0.4);

    --login-text:             #e4e2ef;
    --login-text-muted:       #9095a8;
    --login-text-disabled:    #5a5d6a;
    --login-primary:          #d3bd86;
    --login-primary-vivid:    #be9e4e;
    --login-primary-dark:     #887032;
    --login-primary-light:    #e2d3af;
    --login-primary-glow:     rgba(211, 189, 134, 0.18);
    --login-success:          #56c97a;
    --login-info-text:        #d3bd86;
    --login-card-bg:          #1e1d24;
    --login-card-border:      rgba(255, 255, 255, 0.07);
    --login-card-shadow:      0 4px 24px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.3);
    --login-input-bg:         #28272f;
    --login-input-border:     rgba(255, 255, 255, 0.1);
    --login-input-focus-bg:   #2f2e38;
    /* The captcha PNG is rendered server-side with fixed #be9e4e ink because
       the theme is only known client-side; the backdrop behind it must
       therefore stay the same dark plate in both themes (not follow
       --login-input-bg) so the ink stays legible. Same value in both blocks. */
    --login-captcha-plate:    #28272f;
    --login-toggle-bg:        rgba(255, 255, 255, 0.06);
    --login-toggle-border:    rgba(255, 255, 255, 0.1);
    --login-toggle-hover-bg:  rgba(211, 189, 134, 0.15);
    --login-divider-color:    rgba(255, 255, 255, 0.08);
    --login-surface:          #28272f;
    --login-surface-alt:      #1a191f;
    --login-link:             #d3bd86;
    --login-link-hover:       #e2d3af;
    --login-switch-label:     #c8c6d8;
    --login-ext-btn-border:   rgba(255, 255, 255, 0.12);
    --login-ext-btn-color:    #e4e2ef;

    --lp-brand-from:          hsl(from var(--theme-color) h s 8%);
    --lp-brand-mid:           hsl(from var(--theme-color) calc(h + 15) s 15%);
    --lp-brand-to:            hsl(from var(--theme-color) calc(h - 20) s 22%);
    --lp-brand-text:          rgba(255, 255, 255, 0.96);
    --lp-brand-sub:           rgba(255, 255, 255, 0.62);
    --lp-brand-mesh-a:        hsla(from var(--theme-color) h s 65% / 0.16);
    --lp-brand-mesh-b:        hsla(from var(--theme-color) calc(h - 25) s 50% / 0.22);
    --lp-brand-mesh-c:        hsla(from var(--theme-color) calc(h + 35) s 58% / 0.18);
    --lp-brand-shimmer:       rgba(255, 255, 255, 0.06);
    --lp-brand-ring:          rgba(255, 255, 255, 0.06);
    --lp-brand-ring-border:   rgba(255, 255, 255, 0.10);
    --lp-brand-sep:           rgba(255, 255, 255, 0.55);
    --lp-brand-feature-color: rgba(255, 255, 255, 0.65);
    --lp-brand-dot-color:     rgba(255, 255, 255, 0.48);

}

html[dark-mode="true"] body {
    background: linear-gradient(var(--_shade-1), var(--_shade-1)), radial-gradient(farthest-side at 50% 0%, var(--_shade-4), transparent 50vw), radial-gradient(farthest-side at 50% 0%, var(--_shade-3), transparent 65vw), linear-gradient(-10deg, var(--_shade-5), transparent), var(--_shade-2);
    background-color: var(--super-sidebar-bg);
    color: var(--login-text);
}

html[dark-mode="false"] {
    --gl-background-color-default: #fff;
    --theme-color: #be9e4e;
    --_shade-1: hsla(from var(--theme-color) h 25 93 / 95%);
    --_shade-2: hsl(from var(--theme-color) calc(h + 10) calc(s + 20) l);
    --_shade-3: hsl(from var(--theme-color) h calc(s + 10) l);
    --_shade-4: hsla(from var(--theme-color) calc(h + 20) calc(s + 20) l / 40%);
    --theme-background-color: var(--gl-background-color-default);
    --super-sidebar-bg: #f7f1e3;
    --mud-palette-appbar-background: rgba(0, 0, 0, 0);
    --mud-palette-drawer-background: rgba(0, 0, 0, 0);
    --mud-body-theme: #fff;
    --mud-table-theme: #fff;
    --mud-table-header-theme: #fff;

    /* ── Login standalone color tokens (no mud-palette deps) ── */
    --login-text:             #1a1a2e;
    --login-text-muted:       #5a6278;
    --login-text-disabled:    #a0a6b8;
    --login-primary:          #887032;
    --login-primary-vivid:    #be9e4e;
    --login-primary-dark:     #5c4b22;
    --login-primary-light:    #d4bf8a;
    --login-primary-glow:     rgba(190, 158, 78, 0.14);
    --login-success:          #2e9e54;
    --login-info-text:        #887032;
    --login-card-bg:          #ffffff;
    --login-card-border:      rgba(0, 0, 0, 0.07);
    --login-card-shadow:      0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
    --login-input-bg:         #fafafa;
    --login-input-border:     rgba(0, 0, 0, 0.14);
    --login-input-focus-bg:   #faf6ec;
    --login-captcha-plate:    #28272f;
    --login-toggle-bg:        rgba(255, 255, 255, 0.75);
    --login-toggle-border:    rgba(0, 0, 0, 0.1);
    --login-toggle-hover-bg:  rgba(190, 158, 78, 0.08);
    --login-divider-color:    rgba(0, 0, 0, 0.08);
    --login-surface:          #ffffff;
    --login-surface-alt:      #faf6ec;
    --login-link:             #887032;
    --login-link-hover:       #5c4b22;
    --login-switch-label:     #3a3f52;
    --login-ext-btn-border:   rgba(0, 0, 0, 0.14);
    --login-ext-btn-color:    #2a2f42;

    /* ── Brand panel ── */
    --lp-brand-from:          hsl(from var(--theme-color) h s 20%);
    --lp-brand-mid:           hsl(from var(--theme-color) calc(h + 15) s 30%);
    --lp-brand-to:            hsl(from var(--theme-color) calc(h - 20) s 36%);
    --lp-brand-text:          rgba(255, 255, 255, 1.0);
    --lp-brand-sub:           rgba(255, 255, 255, 0.80);
    --lp-brand-mesh-a:        hsla(from var(--theme-color) h s 68% / 0.10);
    --lp-brand-mesh-b:        hsla(from var(--theme-color) calc(h - 25) s 44% / 0.18);
    --lp-brand-mesh-c:        hsla(from var(--theme-color) calc(h + 35) s 55% / 0.13);
    --lp-brand-shimmer:       rgba(255, 255, 255, 0.09);
    --lp-brand-ring:          rgba(255, 255, 255, 0.09);
    --lp-brand-ring-border:   rgba(255, 255, 255, 0.16);
    --lp-brand-sep:           rgba(255, 255, 255, 0.72);
    --lp-brand-feature-color: rgba(255, 255, 255, 0.85);
    --lp-brand-dot-color:     rgba(255, 255, 255, 0.68);

    /* ── Orbs ── */
}

html[dark-mode="false"] body {
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 40vw), linear-gradient(var(--_shade-1), var(--_shade-1)), radial-gradient(farthest-side at 50% 0%, var(--_shade-3), transparent 50vw), radial-gradient(farthest-side at 50% 0%, var(--_shade-2), transparent 70vw), linear-gradient(-10deg, var(--_shade-4), transparent 70%), var(--gl-background-color-default);
    background-color: var(--super-sidebar-bg);
    color: var(--login-text);
}

/* ── MD3 Radius Scale ────────────────────────────────────────────────────── */
:root {
    --md3-border-radius-none: 0px;
    --md3-border-radius-xs: 4px;
    --md3-border-radius-sm: 8px;
    --md3-border-radius-md: 12px;
    --md3-border-radius-lg: 16px;
    --md3-border-radius-xl: 20px;
    --md3-border-radius-full: 9999px;
    --bs-body-font-family: 'Noto Kufi Arabic', Roboto, 'Noto Naskh Arabic', system-ui, -apple-system, sans-serif !important;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html {
    overflow-x: hidden;
}
body {
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.35s ease, color 0.35s ease;
    font-family: 'Noto Kufi Arabic', Roboto, 'Noto Naskh Arabic', system-ui, -apple-system, sans-serif;
}

/* Login layout fill */
.login-layout-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top bar (language + theme toggle) ──────────────────────────────────────
   Login.razor no longer uses this row (its theme toggle now lives in
   .lp-form-header — see below), but LoginWith2FA.razor, ResetPassword.razor,
   ForgotPassword.razor and others still render a `.lp-topbar` row from this
   shared stylesheet, so the rule stays. */
.lp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 0.5rem;
}

/* Language compact widget */
.lp-lang-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.lp-lang-globe {
    position: absolute;
    inset-inline-start: 9px;
    color: var(--login-text-muted);
    pointer-events: none;
    z-index: 1;
    display: flex;
    align-items: center;
}

.lp-lang-select {
    padding: 5px 26px 5px 30px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--login-text);
    background-color: var(--login-toggle-bg);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    border: 1px solid var(--login-toggle-border);
    border-radius: var(--md3-border-radius-full);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    outline: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lp-lang-select:hover { border-color: var(--theme-color); }
.lp-lang-select:focus { border-color: var(--theme-color); box-shadow: 0 0 0 3px var(--login-primary-glow); }
.lp-lang-select option { background: var(--login-surface); color: var(--login-text); }

/* Theme toggle pill */
.lp-theme-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 9px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--login-text);
    background: var(--login-toggle-bg);
    border: 1px solid var(--login-toggle-border);
    border-radius: var(--md3-border-radius-full);
    cursor: pointer;
    outline: none;
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.lp-theme-btn:hover {
    background: var(--login-toggle-hover-bg);
    border-color: var(--theme-color);
    color: var(--login-primary);
    box-shadow: 0 2px 12px rgba(190, 158, 78, 0.18);
}

.lp-theme-btn:active { transform: scale(0.96); }

.lp-theme-btn:focus-visible {
    outline: 2px solid var(--login-primary);
    outline-offset: 2px;
}

.lp-theme-icon { display: none; }
html[dark-mode="true"]  .lp-theme-sun  { display: block; }
html[dark-mode="false"] .lp-theme-moon { display: block; }
html:not([dark-mode])   .lp-theme-moon { display: block; }

.lp-theme-label { display: none; font-size: 0.78rem; line-height: 1; }
html[dark-mode="true"]  .lp-theme-dark-label  { display: block; }
html[dark-mode="false"] .lp-theme-light-label { display: block; }
html:not([dark-mode])   .lp-theme-light-label { display: block; }

/* ── Page ────────────────────────────────────────────────────────────────── */
.lp-page {
    flex: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.lp-card {
    display: flex;
    width: 670px;
    max-width: 100%;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--login-card-border);
    box-shadow: var(--login-card-shadow);
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

/* ── Brand Panel ─────────────────────────────────────────────────────────── */
.lp-brand {
    flex: 0 0 240px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Flat brand gold — same in light and dark mode, so no per-theme override is needed. */
    background-color: #be9e4e;
}


.lp-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 2rem;
}

/* Logo with glowing ring */
.lp-brand-logo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.75rem;
    width: 92px;
    height: 92px;
    background: #ffffff;
    border-radius: 22px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.lp-brand-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
    position: relative;
    z-index: 1;
    display: block;
}

.lp-brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lp-brand-text);
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.lp-brand-sub {
    font-size: 0.875rem;
    color: var(--lp-brand-sub);
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
    max-width: 210px;
}

/* Animated separator line */
.lp-brand-sep {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--lp-brand-sep), transparent);
    margin: 1.5rem auto 1.25rem;
    border-radius: 1px;
    opacity: 0.7;
}

/* Feature pills */
.lp-brand-features {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.lp-brand-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-size: 0.775rem;
    color: var(--lp-brand-feature-color);
    letter-spacing: 0.01em;
}

.lp-brand-feature-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--lp-brand-dot-color);
    flex-shrink: 0;
}

/* ── Form Panel ──────────────────────────────────────────────────────────── */
.lp-form-panel {
    flex: 1;
    min-width: 0;
    background: var(--login-card-bg);
    padding: 1.25rem;
    overflow-y: auto;
    transition: background 0.35s ease, color 0.35s ease;
    color: var(--login-text);
}

/* Title block left, theme toggle right (used to be its own .lp-topbar row). */
.lp-form-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    /* Deliberately nowrap: with wrap enabled the long subtitle's min-content
       pushed the toggle onto its own left-aligned row on narrow screens, which
       reads as a mistake. Letting the text block shrink instead keeps the
       toggle where it belongs (top-right) at every width. */
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.lp-form-header-text { min-width: 0; flex: 1 1 auto; }
.lp-form-header .lp-theme-btn { flex: 0 0 auto; }

.lp-form-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--login-text);
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.lp-form-sub {
    font-size: 0.875rem;
    color: var(--login-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Label ───────────────────────────────────────────────────────────────── */
.lp-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--login-text-muted);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

/* ── Input wrapper ───────────────────────────────────────────────────────── */
.lp-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.lp-field-icon {
    position: absolute;
    left: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    color: var(--login-text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.lp-input-wrap:focus-within .lp-field-icon {
    color: var(--login-primary);
}

/* ── Input ───────────────────────────────────────────────────────────────── */
.lp-input.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem !important;
    padding-left: 38px !important;
    direction: ltr;
    text-align: left;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--login-text) !important;
    background-color: var(--login-input-bg) !important;
    border: 1px solid var(--login-input-border) !important;
    border-radius: var(--md3-border-radius-sm) !important;
    outline: none;
    box-shadow: none !important;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.lp-input.form-control::placeholder {
    color: var(--login-text-disabled) !important;
    opacity: 1;
}

.lp-input.form-control:hover {
    border-color: var(--login-primary-light) !important;
}

.lp-input.form-control:focus {
    border-color: var(--login-primary) !important;
    background-color: var(--login-input-focus-bg) !important;
    box-shadow: 0 0 0 3px var(--login-primary-glow) !important;
    color: var(--login-text) !important;
}

.lp-input-has-toggle {
    padding-right: 44px !important;
}

/* ── Password Toggle ─────────────────────────────────────────────────────── */
.lp-pwd-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    padding: 4px 5px;
    color: var(--login-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.15s ease;
    outline: none;
    z-index: 5;
    line-height: 1;
}

.lp-pwd-toggle:hover {
    color: var(--login-primary);
    background: var(--login-primary-glow);
}

.lp-pwd-toggle:focus-visible {
    outline: 2px solid var(--login-primary);
    outline-offset: 1px;
}

/* ── Options Row ─────────────────────────────────────────────────────────── */
.lp-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Vertical rhythm between login form rows. */
.lp-gap { margin-bottom: 1rem; }
.lp-gap-lg { margin-bottom: 1.5rem; }

.lp-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.lp-check-input {
    width: 16px !important;
    height: 16px !important;
    border-radius: 4px !important;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--login-primary);
    border: 1.5px solid var(--login-input-border) !important;
    background: var(--login-input-bg) !important;
    margin: 0 !important;
}

.lp-check-label {
    font-size: 0.85rem;
    color: var(--login-switch-label);
    line-height: 1.3;
}

.lp-forgot {
    color: var(--login-link);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.lp-forgot:hover {
    color: var(--login-link-hover);
    text-decoration: none;
    opacity: 0.85;
}

/* ── Submit Button ───────────────────────────────────────────────────────── */
.lp-btn-primary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100%;
    padding: 0.7rem 1.5rem !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    letter-spacing: 0.015em !important;
    color: #fff !important;
    background: linear-gradient(135deg, var(--login-primary-vivid) 0%, var(--login-primary-dark) 100%) !important;
    border: none !important;
    border-radius: var(--md3-border-radius-full) !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease !important;
    box-shadow: 0 4px 20px var(--login-primary-glow), 0 1px 4px rgba(0,0,0,0.15) !important;
    text-decoration: none !important;
    outline-offset: 3px;
}

/* Shimmer sweep */
.lp-btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    animation: lp-btn-shimmer 3.5s ease-in-out infinite;
    border-radius: inherit;
    pointer-events: none;
}


.lp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px hsla(from var(--theme-color) h s l / 0.45), 0 2px 8px rgba(0,0,0,0.15) !important;
    filter: brightness(1.08) !important;
    color: #fff !important;
    text-decoration: none !important;
}

.lp-btn-primary:active  { transform: translateY(0); filter: brightness(0.96) !important; }
.lp-btn-primary:disabled { opacity: 0.60; cursor: not-allowed; transform: none !important; filter: none !important; }

.lp-btn-primary-icon {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.lp-btn-primary:hover .lp-btn-primary-icon {
    transform: translateX(3px);
}

/* RTL: flip arrow and nudge toward inline-start */
[dir="rtl"] .lp-btn-primary-icon           { transform: scaleX(-1); }
[dir="rtl"] .lp-btn-primary:hover .lp-btn-primary-icon { transform: scaleX(-1) translateX(-3px); }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.lp-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
}

.lp-divider::before,
.lp-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--login-divider-color);
}

.lp-divider-text {
    padding: 0 0.875rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--login-text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: inherit;
    white-space: nowrap;
}

/* ── External Providers ──────────────────────────────────────────────────── */
.lp-externals { display: flex; flex-direction: column; gap: 0.625rem; }

.lp-btn-external {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 0.575rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    color: var(--login-ext-btn-color) !important;
    background: transparent !important;
    border: 1px solid var(--login-ext-btn-border) !important;
    border-radius: var(--md3-border-radius-full) !important;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease !important;
    text-decoration: none !important;
}

.lp-btn-external:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    background: var(--login-primary-glow) !important;
    border-color: var(--login-primary-light) !important;
    color: var(--login-ext-btn-color) !important;
    text-decoration: none !important;
}

.lp-ext-icon { height: 20px; width: auto; border-radius: 4px; }

/* Passkey button — distinct from external providers */
.lp-btn-passkey {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    width: 100% !important;
    padding: 0.575rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    letter-spacing: 0.01em !important;
    color: var(--login-primary) !important;
    background: transparent !important;
    border: 1.5px solid var(--login-primary-light) !important;
    border-radius: var(--md3-border-radius-full) !important;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
    text-decoration: none !important;
}

.lp-btn-passkey::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, hsla(from var(--theme-color) h s l / 0.06) 0%, hsla(from var(--theme-color) h s l / 0.12) 100%);
    opacity: 0;
    transition: opacity 0.18s ease;
    border-radius: inherit;
    pointer-events: none;
}

.lp-btn-passkey:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 18px hsla(from var(--theme-color) h s l / 0.28) !important;
    border-color: var(--login-primary) !important;
    color: var(--login-primary) !important;
    text-decoration: none !important;
}

.lp-btn-passkey:hover::before { opacity: 1; }

.lp-btn-passkey:active { transform: translateY(0); }

.lp-btn-passkey-icon {
    flex-shrink: 0;
    color: var(--login-primary);
    transition: transform 0.22s ease;
}

.lp-btn-passkey:hover .lp-btn-passkey-icon {
    transform: scale(1.15);
}

/* ── Signup ──────────────────────────────────────────────────────────────── */
.lp-signup {
    text-align: center;
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--login-divider-color);
}

.lp-signup-text { font-size: 0.85rem; color: var(--login-text-muted); }

.lp-signup-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--login-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

.lp-signup-link:hover { color: var(--login-link-hover); text-decoration: none; }

/* ── Geolocation notice ──────────────────────────────────────────────────── */
.lp-geo-notice {
    font-size: 0.78rem;
    color: var(--login-text-muted);
    text-align: center;
    margin: 0 0 0.75rem;
}

.lp-geo-hint {
    font-size: 0.78rem;
    color: var(--login-text-muted);
    text-align: center;
    margin: 0 0 0.75rem;
}

.lp-geo-hint[hidden] { display: none; }

.lp-geo-retry {
    background: none;
    border: none;
    padding: 0;
    margin-left: 0.35rem;
    color: var(--login-link);
    font-weight: 600;
    font-size: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.lp-geo-retry:hover { color: var(--login-link-hover); }

/* ── Error / Footer ──────────────────────────────────────────────────────── */
.lp-error { margin-top: 1rem; animation: lp-slide-down 0.25s ease; }

.lp-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--login-divider-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--login-text-muted);
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes lp-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Progress bar (page load) ────────────────────────────────────────────── */
.pure-material-progress-linear {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    height: 3px;
    color: var(--theme-color);
    font-size: 16px;
    width: 100%;
    position: fixed;
    top: 0;
    z-index: 99999999;
}

.pure-material-progress-linear::-webkit-progress-bar  { background-color: transparent; }
.pure-material-progress-linear::-webkit-progress-value { background-color: currentColor; transition: all 0.2s; }
.pure-material-progress-linear::-moz-progress-bar     { background-color: currentColor; transition: all 0.2s; }
.pure-material-progress-linear::-ms-fill { border: none; background-color: currentColor; transition: all 0.2s; }

.pure-material-progress-linear:indeterminate {
    background-size: 200% 100%;
    background-image: linear-gradient(to right, transparent 50%, currentColor 50%, currentColor 60%, transparent 60%, transparent 71.5%, currentColor 71.5%, currentColor 84%, transparent 84%);
    animation: pure-material-progress-linear 2s infinite linear;
}

.pure-material-progress-linear:indeterminate::-moz-progress-bar { background-color: transparent; }
.pure-material-progress-linear:indeterminate::-ms-fill { animation-name: none; }

@keyframes pure-material-progress-linear {
    0%   { background-size: 200% 100%; background-position: left -31.25% top 0%; }
    50%  { background-size: 800% 100%; background-position: left -49%    top 0%; }
    100% { background-size: 400% 100%; background-position: left -102%   top 0%; }
}

/* ── Error alert box ─────────────────────────────────────────────────────── */
.lp-alert {
    padding: 0.625rem 0.875rem;
    border-radius: var(--md3-border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid;
}
.lp-alert-error {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.25);
    color: #dc3545;
}
.lp-alert-success {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.25);
    color: #198754;
}

/* ── Bootstrap focus ring reset ──────────────────────────────────────────── */
.lp-input.form-control:focus { outline: none; }

/* ── Responsive: hide brand panel on tablet ──────────────────────────────── */
@media (max-width: 768px) {
    .lp-brand { display: none; }

    .lp-card {
        border-radius: 20px;
        width: 480px;
    }

    .lp-form-panel { padding: 2rem 1.5rem; }

    .lp-page {
        padding: 1.25rem 0.75rem;
        align-items: flex-start;
        padding-top: max(2rem, env(safe-area-inset-top));
    }

    .lp-toggle { width: 36px; height: 36px; font-size: 1rem; top: 0.75rem; inset-inline-end: 0.875rem; }
}

/* ── Responsive: mobile ──────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .lp-card { border-radius: 18px; }
    .lp-form-panel { padding: 1.75rem 1.25rem; }
    .lp-options { flex-direction: column; align-items: flex-start; }
    .lp-language-select { font-size: 1rem; }
    .lp-form-title { font-size: 1.2rem; }
}

/* ── RTL ─────────────────────────────────────────────────────────────────── */
[dir="rtl"] .lp-language-select {
    background-position: left 12px center;
    padding: 7px 12px 7px 40px;
}

/* ── CAPTCHA ─────────────────────────────────────────────────────────────
   The PNG is rendered server-side on a transparent background with #be9e4e
   ink, because the theme (light/dark) is chosen client-side and the server
   cannot know it. The ink colour is therefore fixed and cannot adapt, so
   this box uses the theme-independent --login-captcha-plate backdrop
   (rather than --login-input-bg, which is near-white in light mode and
   drops the ink's contrast well below 3:1) to keep the ink legible under
   either theme. */
.lp-captcha-box {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem;
    background-color: var(--login-captcha-plate);
    border: 1px solid var(--login-input-border);
    border-radius: var(--md3-border-radius-sm);
    overflow: hidden;
}

.lp-captcha-img {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    max-height: 64px;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

/* ── Captcha refresh button placement ─────────────────────────────────────
   DefaultLoginView.razor deliberately places this button *after* the Sign In button in
   DOM order (see the comment above it there): as the first type="submit" it
   would become the form's implicit-submit default, so pressing Enter would
   re-roll the captcha instead of signing in. It still posts back via
   form="login" from its late spot, so it is not a descendant of the
   captcha .lp-field and cannot be positioned onto the label row by normal
   flow.
   Fix: #login becomes a single-column CSS Grid. Every direct child gets an
   explicit grid-row (enumerated below in DOM order), and the refresh button
   is assigned the *same* grid-row as the captcha .lp-field, then pulled to
   the top-right of that shared cell with justify-self/align-self — which
   visually lands it on the "Security Check" label row — while remaining
   physically after Sign In in the markup. Do not reorder the Sign In button
   back before it.

   #login's direct children, in DOM order (hidden <input type="hidden">
   fields are display:none by UA stylesheet, so they are not grid items and
   need no row assignment):
     .lp-field (#lp-username)  — always present            → row 1
     .lp-field (#lp-password)  — always present            → row 2
     .lp-field (#lp-captcha)   — only when captcha shown    → row 3
     .lp-captcha-refresh       — only when captcha shown    → row 3 (shared)
     .lp-options                                            → row 4
     .lp-geo-notice                                         → row 5
     .lp-geo-hint                                           → row 6
     .lp-btn-primary (Sign In)                              → row 7
     .lp-divider                                            → row 8
     .lp-externals                                          → row 9

   grid-auto-rows: min-content keeps an absent captcha row (3) from costing
   any height when captchaChallenge is null — nothing is placed in it, so it
   contributes zero size, and rows 4-9 simply sit directly under row 2. */
#login {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: min-content;
}

/* Force every child into the single explicit column. Without this, any child
   whose grid-row collides with another (the captcha field and its refresh
   button deliberately share row 3) gets auto-placed into an *implicit second
   column*, which steals width from the 1fr column and narrows every field on
   the form — visible only while the captcha is rendered. Placement here is by
   row alone; the shared cell is what puts the refresh button on the label row. */
#login > * { grid-column: 1; }

/* Tightened field/options spacing. Bootstrap's .mb-3/.mb-4 utilities ship
   with !important, so overriding them needs !important too — the extra
   #login scope keeps the override contained to this form instead of
   touching Bootstrap or other .mb-3/.mb-4 usages elsewhere. */
#login .lp-field { margin-bottom: .75rem !important; }
#login .lp-options { margin-bottom: 1rem !important; }

#login > .lp-field:has(#lp-username) { grid-row: 1; }
#login > .lp-field:has(#lp-password) { grid-row: 2; }
#login > .lp-field:has(#lp-captcha)  { grid-row: 3; }
/* grid-column: 1 is load-bearing, not decoration. Without it the button is
   auto-placed, which creates an *implicit second column* sized to the button
   and shrinks the 1fr column — every field on the form loses that width, but
   only while the captcha is rendered. Pinning it to column 1 makes it share
   the captcha field's cell, which is what puts it on the label row. */
#login > .lp-captcha-refresh         { grid-row: 3; grid-column: 1; justify-self: end; align-self: start; }
#login > .lp-options                 { grid-row: 4; }
#login > .lp-geo-notice              { grid-row: 5; }
#login > .lp-geo-hint                { grid-row: 6; }
#login > .lp-btn-primary             { grid-row: 7; }
#login > .lp-divider                 { grid-row: 8; }
#login > .lp-externals               { grid-row: 9; }

/* Sits in the same grid cell as the captcha field, pinned to the top-right
   corner (the "Security Check" label's row) via justify-self/align-self
   above — this replaces the old flex align-self: flex-end trick, but keeps
   the same inline-end placement, which still mirrors correctly under
   [dir="rtl"] because justify-self: end resolves against the inline axis. */
.lp-captcha-refresh {
    margin-top: -0.15rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: none;
    border: none;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--login-text-muted);
    cursor: pointer;
    outline: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.lp-captcha-refresh:hover {
    color: var(--login-primary);
    background-color: var(--login-primary-glow);
}

.lp-captcha-refresh:focus-visible {
    outline: 2px solid var(--login-primary);
    outline-offset: 1px;
}
