.centered-background {
    --auth-text: #0f172a;
    --auth-muted: #6b7280;
    --auth-muted-soft: #94a3b8;
    --auth-panel: #ffffff;
    --auth-panel-subtle: #f8fafc;
    --auth-border: #e6e8ee;
    --auth-border-strong: #e2e6ee;
    --auth-border-hover: #cbd2dc;
    --auth-link: #4f46e5;
    --auth-link-hover: #3730a3;
    --auth-input-bg: #ffffff;
    --auth-value-text: #475569;
}

[data-bs-theme=dark] .centered-background {
    --auth-text: #dddddd;
    --auth-muted: #a1a1aa;
    --auth-muted-soft: #71717a;
    --auth-panel: #0000004a; 
    --auth-panel-subtle: #202024;
    --auth-border: #2f3036;
    --auth-border-strong: #343641;
    --auth-border-hover: #4b5060;
    --auth-link: #8b93ff;
    --auth-link-hover: #b5baff;
    --auth-input-bg: #18181b;
    --auth-value-text: #d4d4d8;
}

/* Light: jemný gradient pro hloubku za kartou. */
.centered-background:has(.auth-flow-window) {
    background:
        radial-gradient(ellipse 70% 55% at 50% 40%, rgba(79, 70, 229, 0.09), transparent 70%),
        radial-gradient(ellipse 90% 70% at 50% 100%, rgba(244, 114, 182, 0.05), transparent 65%),
        #fafbff;
}

/* Dark: mírně tlumená aurora — viditelná, ale nepřebíjí kartu. */
[data-bs-theme=dark] .centered-background:has(.auth-flow-window) {
    background:
        radial-gradient(ellipse 60% 50% at 28% 22%, rgba(99, 102, 241, 0.18), transparent 65%),
        radial-gradient(ellipse 55% 45% at 78% 28%, rgba(168, 85, 247, 0.14), transparent 65%),
        radial-gradient(ellipse 75% 55% at 50% 100%, rgba(236, 72, 153, 0.08), transparent 60%),
        #0a0a0f;
}

.auth-flow-window {
    padding: 40px 36px;
    border: 1px solid var(--auth-border);
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(79, 70, 229, .04);
}

[data-bs-theme=dark] .auth-flow-window {
    background: var(--auth-panel);
    box-shadow: none;
}

.auth-language {
    display: flex;
    justify-content: flex-end;
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 10;
}

.auth-corner-brand {
    position: fixed;
    top: 22px;
    left: 26px;
    z-index: 10;
    color: #808080;
    display:none;
    -font-family: "Special Gothic Expanded One", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size:.95rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.auth-language .text-end {
    margin: 0 !important;
}

/* Diskretni chip pro prepinac jazyka */
.auth-language .btn-link {
    padding: 8px 14px;
    border: 1px solid var(--auth-border);
    border-radius: 999px;
    background: var(--auth-panel);
    color: var(--auth-text) !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    text-decoration: none !important;
    transition: border-color 120ms ease, background 120ms ease;
}

.auth-language .btn-link:hover {
    border-color: var(--auth-border-hover);
    background: var(--auth-panel-subtle);
}

.auth-flow {
    margin: 0 auto;
    text-align: center;
}

.auth-title {
    margin: 0;
    color: var(--auth-text);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    margin: 8px 0 62px;
    color: var(--auth-muted-soft);
    font-size: 0.92rem;
    line-height: 1.5;
}

.auth-step {
    animation: auth-step-in 160ms ease-out;
    text-align: left;
}

.auth-step[hidden] {
    display: none !important;
}

/* Floating label — input s jemně zaoblenou spodní linkou (Google-style). */
.form-floating:has(.auth-input) {
    position: relative;
}

.auth-input {
    min-height: 56px;
    padding: 22px 12px 8px;
    border: 0;
    border-bottom: 1px solid var(--auth-border-strong);
    border-radius: 8px 8px 0 0;
    background: var(--auth-panel-subtle);
    color: var(--auth-text);
    font-size: 1rem;
    box-shadow: none;
    transition: border-color 160ms ease, background 160ms ease;
}

.auth-input:hover {
    border-bottom-color: var(--auth-border-hover);
    background: var(--auth-panel-subtle);
}

.auth-input:focus {
    border-bottom-color: #4f46e5;
    background: var(--auth-panel-subtle);
    box-shadow: none;
    outline: none;
}

/* Placeholder se zobrazí až při focusu — jinak vidíme pouze floating label. */
.auth-input::placeholder {
    color: transparent !important;
    opacity: 0 !important;
    transition: color 160ms ease, opacity 160ms ease;
}

.auth-input:focus::placeholder {
    color: var(--auth-muted-soft) !important;
    opacity: 0.5 !important;
}

/* Animovaná spodní linka — naroste pod inputem při focusu, respektuje zaoblení. */
.form-floating:has(.auth-input)::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #4f46e5;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 200ms ease;
    pointer-events: none;
    border-radius: 0 0 1px 1px;
}

.form-floating:has(.auth-input:focus)::after {
    transform: scaleX(1);
}

/* Floating label — vlevo uvnitř pole; po focusu/vyplnění se posune nahoru a zmenší. */
.form-floating > .auth-input ~ label {
    padding: 16px 12px;
    color: var(--auth-muted-soft);
    font-size: 1rem;
    font-weight: 400;
    transform-origin: 0 0;
    transition: color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.form-floating > .auth-input:focus ~ label,
.form-floating > .auth-input:not(:placeholder-shown) ~ label,
.form-floating > .auth-input:-webkit-autofill ~ label {
    color: var(--auth-muted-soft);
    opacity: 0.85;
    transform: scale(0.78) translateY(-0.65rem) translateX(0.15rem);
}

.auth-primary {
    min-height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: 10px;
    background: #4f46e5;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    transition: background 140ms ease, transform 80ms ease, box-shadow 140ms ease;
}

.auth-primary:hover,
.auth-primary:focus {
    background: #4338ca;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.auth-primary:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.auth-inline-alt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    margin: 32px 0 0;
    color: var(--auth-muted-soft);
    font-size: .85rem;
    text-align: center;
}

/* Jemné linky po stranách textu — klasický divider. */
.auth-inline-alt::before,
.auth-inline-alt::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--auth-border);
}

.auth-inline-alt-text {
    flex: 0 0 auto;
    letter-spacing: 0.02em;
}

.auth-inline-alt-action {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.auth-inline-alt-action form.form-horizontal,
.auth-inline-alt-action .ms-3 {
    display: inline-flex !important;
    margin-left: 0 !important;
    width: auto;
}

.auth-inline-alt-action .btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: #4285F4 !important;
    text-decoration: none !important;
    line-height: 1;
    transition: transform 120ms ease, opacity 120ms ease;
}

.auth-inline-alt-action .btn-link:hover {
    transform: translateY(-1px);
    opacity: 0.85;
}

.auth-inline-alt-action .btn-link i,
.auth-inline-alt-action .btn-link svg {
    margin: 0 !important; /* Prebije me-2/me-3 z ExternalLoginPicker. */
    font-size: 1.35rem;
}

.auth-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 28px;
    font-size: .92rem;
}

.auth-links a,
.auth-entered-value button,
.auth-back-button {
    color: var(--auth-link);
    text-decoration: none;
    font-weight: 500;
    transition: color 120ms ease;
}

.auth-links a:hover,
.auth-entered-value button:hover,
.auth-back-button:hover {
    color: var(--auth-link-hover);
    text-decoration: none;
}

.auth-entered-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    margin-bottom: 20px;
    padding: 10px 16px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    background: var(--auth-panel-subtle);
    color: var(--auth-value-text);
    font-size: .92rem;
}

.auth-entered-value span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-entered-value button {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
}

.auth-button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 6px;
}

.auth-back-button {
    padding-left: 0;
    padding-right: 0;
}

.auth-client-error {
    margin-top: 6px;
}

/* QR varianty karty: jemný okraj v obou režimech, decentní stín jen ve světlém */
.centered-window.auth-flow-window:has(.qr-flow) {
    background-color: var(--auth-panel);
    border: 1px solid var(--auth-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

[data-bs-theme=dark] .centered-window.auth-flow-window:has(.qr-flow) {
    box-shadow: none;
}

.qr-flow {
    max-width: 390px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-flow .back-link a {
    color: var(--auth-link);
    text-decoration: none;
    font-size: .92rem;
    font-weight: 500;
}

.qr-flow .back-link a:hover {
    color: var(--auth-link-hover);
}

.qr-flow > * {
    width: 100%;
}

.qr-title {
    margin: 0 0 8px;
    color: var(--auth-text);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-align: center;
}

.qr-copy {
    color: var(--auth-muted);
    text-align: center;
    font-size: .98rem;
    line-height: 1.45;
}

.qr-code-frame {
    width: 280px;
    height: 280px;
    padding: 14px;
    border-radius: 14px;
    background: #ffffff;
    margin: 4px auto 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-frame svg {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-confirm-user {
    color: var(--auth-text);
}

.qr-device-card {
    padding: 12px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: var(--auth-panel-subtle);
}

.qr-device-label {
    color: var(--auth-text);
    font-weight: 600;
}

.qr-device-useragent {
    color: var(--auth-value-text);
    font-size: .9rem;
    word-break: break-all;
}

.qr-device-ip,
.qr-security-hint {
    color: var(--auth-muted);
    font-size: .85rem;
}

.qr-security-hint {
    font-size: .9rem;
}

@keyframes auth-step-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

@media (max-width: 700px) {
    .auth-flow-window {
        padding: 24px 18px;
    }

    .auth-language {
        top: 0;
        right: 0;
    }

    .auth-corner-brand {
        display: none; /* Na mobilu logo skryte, setrime misto. */
    }

    .auth-language .btn-link {
        padding: 14px 16px;
        font-size: 1rem !important;
    }

    .auth-title,
    .qr-title {
        font-size: 1.72rem;
    }

    .auth-subtitle {
        margin-bottom: 26px;
        font-size: 1rem;
    }

    .auth-button-row {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-inline-primary {
        width: 100%;
    }
}
