:root {
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-focus: #2563eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #b91c1c;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 24px;
}

/* The card is centered on its own. The brand logo is absolutely positioned over the stack's
   top edge so it doesn't contribute height to the flex centering — any logo size lands the
   card at exact viewport center. */
.auth-stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
}

.brand-logo {
    /* Out of flow so .auth-stack's height equals the card's height alone; the card centers
       in viewport regardless of logo size. */
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 24px;
    text-align: center;
}

.brand-logo img {
    display: inline-block;
    max-height: 56px;
    max-width: 200px;
}

.card {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px 32px;
}

.brand-title {
    text-align: center;
    margin-bottom: 28px;
}

.brand-title h1 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-title p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field input[readonly] {
    background: #f8fafc;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.back-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

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

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.step-heading {
    text-align: center;
    margin: -6px 0 22px;
}

.step-heading h2 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.step-heading p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.code-input {
    height: 56px !important;
    letter-spacing: 0.5em;
    text-align: center;
    font-size: 24px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    padding-left: 0.5em !important;
}

.code-input::placeholder {
    letter-spacing: 0.2em;
    color: #cbd5e1;
    font-size: 18px;
}

.idp-buttons {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-idp {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    gap: 8px;
}

.btn-idp:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-idp img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 0 7px 7px 0;
    transition: color 0.15s;
}

.password-toggle:hover {
    color: var(--text);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Language switcher */
.lang-switcher {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
}
.lang-switcher a {
    color: var(--color-text-muted, #6b7280);
    text-decoration: none;
    padding: 2px 4px;
}
.lang-switcher a:hover {
    text-decoration: underline;
}
.lang-switcher a.active {
    color: var(--color-primary, #2563eb);
    font-weight: 600;
}
.lang-sep {
    color: var(--color-text-muted, #6b7280);
    margin: 0 2px;
}
