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

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    background: #586977;
    color: #1a1a1a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Main content ── */

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

#login-providers {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.load-error {
    color: #b00020;
}

/* ── Username/password form ── */

.userpass-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
}

.form-logo {
    display: block;
    max-height: 56px;
    width: auto;
    margin: 0 auto 1.25rem;
}

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

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
}

.form-group input {
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

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

.toggle-password {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    line-height: 1;
    border-radius: 2px;
}

.toggle-password:hover {
    color: #1a1a1a;
}

.toggle-password:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.form-group input:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.25);
}

.form-group input[aria-invalid="true"] {
    border-color: #b00020;
    box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.15);
}

.form-group input[aria-invalid="true"]:focus {
    outline-color: #b00020;
    border-color: #b00020;
    box-shadow: 0 0 0 3px rgba(176, 0, 32, 0.25);
}

.error-msg {
    font-size: 0.875rem;
    color: #b00020;
    min-height: 1.25em;
}

.btn-primary {
    padding: 0.65rem 1rem;
    background: #0066cc;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) {
    background: #0052a3;
}

.btn-primary:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.btn-primary:disabled {
    background: #99c2e8;
    cursor: not-allowed;
}

/* ── OIDC providers ── */

.oidc-grid {
    display: grid;
    grid-template-columns: max-content auto;
    justify-content: center;
    column-gap: 0.75rem;
    padding: 1.25rem 0;
}

#login-providers > * + .oidc-grid {
    border-top: 1px solid #e5e5e5;
}

.oidc-provider {
    display: contents;
}

.oidc-row {
    display: contents;
}

.oidc-separator {
    grid-column: 1 / -1;
    border: none;
    border-top: 1px solid #e5e5e5;
    margin-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.oidc-prefix {
    min-height: 100px;
    font-size: 1rem;
    color: #333;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.oidc-logo {
    max-height: 100px;
    max-width: 300px;
    width: auto;
    height: auto;
}

.oidc-link {
    min-height: 100px;
    color: #0066cc;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.oidc-link:hover {
    text-decoration: underline;
}

.oidc-link:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Footer ── */

.login-footer {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #ffffff;
    border-top: 1px solid #ddd;
    gap: 1rem;
}

.footer-text {
    flex: 1;
    font-size: 0.8rem;
    color: #555;
    text-align: center;
}

.footer-text a {
    color: #0066cc;
    text-decoration: underline;
    text-decoration-skip-ink: auto;
}

.footer-text a:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Visually hidden (screen-reader only) ── */

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

/* ── Responsive ── */

@media (max-width: 480px) {
    #login-providers {
        padding: 2rem 1.25rem;
    }

    .login-footer {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .form-group input,
    .btn-primary {
        transition: none;
    }
}
