/* Pagine di accesso SYS-01 ... SYS-04 */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(440px, 1fr) minmax(0, 1fr);
    background: var(--surface);
    color: var(--tx);
}

.auth-main { display: flex; flex-direction: column; padding: 28px 40px; min-width: 0; }

.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-logo {
    width: 30px; height: 30px; border-radius: 7px;
    background: var(--primary); color: var(--logo-fg);
    display: grid; place-items: center;
    font-weight: 600; font-size: 16px;
}
.auth-name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }

.auth-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 0; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.auth-card.wide { max-width: 420px; }

.auth-title h1 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.auth-title p { font-size: 13.5px; color: var(--tx2); margin: 6px 0 0; line-height: 1.5; }
.auth-title strong { color: var(--tx); font-weight: 500; }
.auth-step { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--tx2); }
.auth-step + h1 { margin-top: 6px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.label-row label { margin: 0; font-size: 12.5px; font-weight: 500; }
.label-row a { font-size: 12.5px; font-weight: 500; }

.capslock { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--warning); margin-top: 5px; }
.capslock .material-symbols-outlined { font-size: 15px; }
.capslock[hidden] { display: none; }

.auth-divider { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--tx2); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.back-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; font-weight: 500; color: var(--tx2); width: fit-content;
}
.back-link .material-symbols-outlined { font-size: 18px; }

.auth-links { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.auth-links a { font-weight: 500; width: fit-content; }
.auth-links span { color: var(--tx2); }
.auth-note { font-size: 12px; color: var(--tx2); line-height: 1.5; }

.status-icon {
    width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center;
    background: color-mix(in oklch, var(--success) 12%, transparent);
}
.status-icon .material-symbols-outlined { font-size: 24px; color: var(--success); }
.status-icon.danger { background: color-mix(in oklch, var(--danger) 12%, transparent); }
.status-icon.danger .material-symbols-outlined { color: var(--danger); }

/* Codice a 6 cifre */
.otp { display: flex; gap: 8px; align-items: center; }
.otp input {
    width: 48px; height: 54px; box-sizing: border-box;
    text-align: center;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--tx);
    font-family: var(--mono); font-size: 22px; font-weight: 500;
    outline: none;
}
.otp input:nth-child(3) { margin-right: 10px; }
.otp input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 18%, transparent); }
.otp.invalid input { border-color: var(--danger); }
.input-code { font-family: var(--mono); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.input-totp { width: 160px; font-family: var(--mono); font-size: 18px; letter-spacing: .2em; }

/* Barra dei passi del primo accesso */
.stepper { display: flex; gap: 6px; }
.stepper span { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.stepper span.done { background: var(--primary); }

/* Nuova password: robustezza e requisiti */
.meter { display: flex; gap: 4px; margin-top: 8px; }
.meter span { flex: 1; height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.meter[data-tone="danger"] span.on { background: var(--danger); }
.meter[data-tone="warning"] span.on { background: var(--warning); }
.meter[data-tone="success"] span.on { background: var(--success); }

.rules { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); margin: 0; list-style: none; }
.rules li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--tx2); }
.rules li .material-symbols-outlined { font-size: 16px; color: var(--bar2); }
.rules li.ok { color: var(--tx); }
.rules li.ok .material-symbols-outlined { color: var(--success); }
.rules li.ko .material-symbols-outlined { color: var(--danger); }

/* Configurazione 2FA */
.qr-row { display: flex; gap: 16px; align-items: flex-start; }
.qr {
    width: 132px; height: 132px; flex: none;
    border: 1px solid var(--border); border-radius: 8px;
    background: #FFFFFF; display: grid; place-items: center; overflow: hidden;
}
.qr img { width: 124px; height: 124px; image-rendering: pixelated; }
.qr-steps { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; min-width: 0; }
.secret { font-family: var(--mono); font-size: 12px; padding: 6px 8px; border-radius: 4px; background: var(--bg); word-break: break-all; }

.codes-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.codes-box h2 { margin: 0; font-size: 13px; font-weight: 600; }
.codes-box p { margin: 0; font-size: 12.5px; color: var(--tx2); line-height: 1.45; }
.codes {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px;
    font-family: var(--mono); font-size: 13px;
    padding: 8px 10px; border-radius: 4px; background: var(--bg);
    margin: 0; list-style: none;
}
.codes-actions { display: flex; gap: 8px; }

/* Preferenze */
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-option { position: relative; }
.theme-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.theme-option label {
    padding: 10px; border: 1.5px solid var(--border); border-radius: 8px;
    cursor: pointer; display: flex; flex-direction: column; gap: 8px;
    font-size: 13px; font-weight: 500;
}
.theme-option input:checked + label { border-color: var(--primary); background: var(--accent-soft); }
.theme-option input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
.swatch { height: 44px; border-radius: 5px; border: 1px solid var(--border); display: flex; gap: 4px; padding: 6px; box-sizing: border-box; }
.swatch span { border-radius: 2px; }
.swatch span:first-child { width: 14px; }
.swatch span:last-child { flex: 1; opacity: .6; }
.swatch.light { background: #FFFFFF; }
.swatch.light span { background: #D9D7D0; }
.swatch.dark { background: #171D23; }
.swatch.dark span { background: #2B323A; }
.swatch.system { background: linear-gradient(90deg, #FFFFFF 50%, #171D23 50%); }
.swatch.system span { background: #A4A9AF; }

.segmented { display: flex; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.segmented div { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label {
    height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; font-size: 13px; font-weight: 500; color: var(--tx2); cursor: pointer;
}
.segmented input:checked + label { background: var(--surface); color: var(--tx); box-shadow: 0 1px 2px rgba(15, 17, 21, .12); }
.segmented input:focus-visible + label { outline: 2px solid var(--primary); }

.auth-nav { display: flex; gap: 8px; }
.auth-nav .btn-primary { flex: 1; }

/* Piè di pagina e pannello di brand */
.auth-footer { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--tx2); }
.auth-footer a { color: var(--tx2); }
.auth-footer .spacer { flex: 1; }

.auth-aside {
    background: var(--hover);
    border-left: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    padding: 40px; min-width: 0;
}
.auth-aside svg { width: 100%; max-width: 560px; height: auto; }

@media (max-width: 960px) {
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

@media (max-width: 480px) {
    .auth-main { padding: 20px 16px; }
    .otp input { width: 40px; height: 48px; font-size: 20px; }
    .qr-row { flex-direction: column; }
}
