/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #f5f4f0;
    --card-bg:     #ffffff;
    --border:      rgba(0,0,0,0.10);
    --border-focus:#534AB7;
    --text-primary:#1a1a18;
    --text-muted:  #6b6a64;
    --text-hint:   #9b9a94;
    --primary:     #534AB7;
    --primary-h:   #3C3489;
    --error-bg:    #FCEBEB;
    --error-text:  #A32D2D;
    --error-border:#F09595;
    --input-bg:    #fafaf8;
    --radius:      10px;
    --radius-sm:   6px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #1a1a18;
        --card-bg:     #242422;
        --border:      rgba(255,255,255,0.10);
        --text-primary:#e8e6de;
        --text-muted:  #9b9a94;
        --text-hint:   #6b6a64;
        --error-bg:    #2d1414;
        --error-text:  #F09595;
        --error-border:#791F1F;
        --input-bg:    #1e1e1c;
    }
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Brand ────────────────────────────────────────────────────────────────── */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.auth-logo {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-brand-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.auth-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ── Alert ────────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.alert svg { flex-shrink: 0; margin-top: 1px; }

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

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    appearance: none;
}

.form-input::placeholder { color: var(--text-hint); }

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(83,74,183,0.12);
}

.form-error {
    display: block;
    font-size: 12px;
    color: var(--error-text);
    margin-top: 4px;
}

.form-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.form-link:hover { text-decoration: underline; }

/* ── Password toggle ──────────────────────────────────────────────────────── */
.input-with-toggle { position: relative; }

.input-with-toggle .form-input { padding-right: 40px; }

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-hint);
    padding: 4px;
    display: flex;
    align-items: center;
}

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

/* ── Checkbox ─────────────────────────────────────────────────────────────── */
.form-check { margin-bottom: 20px; }

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.check-input { display: none; }

.check-box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    flex-shrink: 0;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.check-input:checked + .check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.check-input:checked + .check-box::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
    display: block;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

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

.btn-full { width: 100%; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

/* ── Password strength ────────────────────────────────────────────────────── */
.strength-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

.strength-label {
    font-size: 11px;
    font-weight: 500;
    display: block;
    margin-top: 4px;
    min-height: 16px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-card { padding: 24px 20px; }
    .form-row { grid-template-columns: 1fr; }
}
