:root {
    --primary: #4f46e5;
    --primary-2: #2563eb;
    --secondary: #7c3aed;
    --text: #0f172a;
    --muted: #475569;
    --danger: #dc2626;
    --ok: #059669;
    --glass: rgba(255, 255, 255, 0.58);
    --glass-border: rgba(255, 255, 255, 0.62);
    --input: rgba(255, 255, 255, 0.72);
    --shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { overflow-x: hidden; }
body.auth-body {
    min-height: 100vh;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: #0b1220;
}

.skip-link {
    position: absolute; left: -999px; top: 8px; z-index: 20;
    padding: 8px 12px; border-radius: 8px; background: var(--primary); color: #fff;
}
.skip-link:focus { left: 12px; }

.auth-photo {
    position: fixed; inset: 0; z-index: 0;
    background: var(--auth-photo) center / cover no-repeat;
    filter: saturate(1.05) brightness(1.08);
    transform: scale(1.04);
}
.auth-veil {
    position: fixed; inset: 0; z-index: 0;
    background:
        linear-gradient(120deg, rgba(15, 23, 42, .55) 0%, rgba(79, 70, 229, .28) 48%, rgba(15, 23, 42, .5) 100%),
        radial-gradient(circle at 80% 10%, rgba(124, 58, 237, .28), transparent 36%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 8px;
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
}
.auth-top-actions { display: flex; align-items: center; gap: 10px; }
.auth-home {
    color: #fff;
    text-decoration: none;
    font-weight: 750;
    font-size: .86rem;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.28);
    backdrop-filter: blur(10px);
}
.auth-home:hover { background: rgba(255,255,255,.2); }
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}
.logo-mark {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 14px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2) 55%, var(--secondary));
    box-shadow: 0 10px 24px rgba(79, 70, 229, .35);
}
.auth-brand strong { display: block; font-size: 1.05rem; letter-spacing: -.03em; }

.lp-theme {
    width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.35);
    border-radius: 50%; background: rgba(255,255,255,.14); color: #fff;
    cursor: pointer; display: grid; place-items: center;
    backdrop-filter: blur(10px);
}
.lp-theme [data-when] { display: none; }
html[data-theme="light"] .lp-theme [data-when="light"] { display: block; }
html[data-theme="dark"] .lp-theme [data-when="dark"] { display: block; }

.auth-stage {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 460px);
    gap: 28px;
    align-items: center;
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 12px 0 24px;
}
.auth-card-wrap.is-wide { min-width: 0; }
.auth-stage:has(.is-wide) {
    grid-template-columns: minmax(0, .9fr) minmax(340px, 540px);
}

.auth-showcase {
    color: #fff;
    padding: 36px 32px;
    border-radius: 28px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 24px 50px rgba(2, 6, 23, .18);
    backdrop-filter: blur(22px) saturate(1.35);
    -webkit-backdrop-filter: blur(22px) saturate(1.35);
    animation: rise .5s ease both;
}
.auth-showcase .eyebrow {
    margin: 0 0 10px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #c7d2fe;
}
.auth-showcase h2 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    letter-spacing: -.04em;
    line-height: 1.15;
    text-shadow: 0 10px 30px rgba(2, 6, 23, .35);
}
.auth-showcase p { margin: 0 0 18px; color: #e2e8f0; line-height: 1.65; max-width: 36ch; }
.auth-showcase ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.auth-showcase li {
    display: flex; align-items: center; gap: 10px;
    font-weight: 650; font-size: .92rem;
}
.auth-showcase li i { color: #a5b4fc; }

.auth-card-wrap {
    width: 100%;
}
.auth-card {
    width: 100%;
    padding: 30px 26px 22px;
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    background: var(--glass);
    backdrop-filter: blur(28px) saturate(1.45);
    -webkit-backdrop-filter: blur(28px) saturate(1.45);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.8);
    animation: rise .45s ease both;
}
.auth-card h1 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -.04em; }
.lede { margin: 0 0 20px; color: var(--muted); font-size: .92rem; line-height: 1.55; }

.alert {
    margin-bottom: 14px; padding: 11px 13px; border-radius: 14px;
    border: 1px solid #fecaca; background: rgba(254, 242, 242, .9); color: #991b1b;
    font-size: .86rem; font-weight: 600;
}
.alert.ok { border-color: #a7f3d0; background: rgba(236, 253, 245, .9); color: #065f46; }
.auth-card.is-invalid { animation: shake .45s ease; }

.field { margin-bottom: 14px; }
.field label {
    display: block; margin-bottom: 6px; color: #334155;
    font-size: .78rem; font-weight: 700;
}
.req { color: var(--danger); }
.control { position: relative; display: flex; align-items: center; }
.control i.lead {
    position: absolute; left: 14px; color: var(--muted); pointer-events: none;
}
.control input {
    width: 100%; min-height: 48px; padding: 0 44px 0 42px;
    border: 1px solid rgba(148, 163, 184, .35); border-radius: 16px;
    background: var(--input); color: var(--text); outline: 0;
    backdrop-filter: blur(10px);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.control input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .18);
    background: rgba(255,255,255,.88);
}
.control input.is-bad { border-color: var(--danger); }
.field-error { margin: 6px 0 0; color: var(--danger); font-size: .75rem; min-height: 1em; }
.toggle-pass {
    position: absolute; right: 6px; width: 40px; height: 40px;
    border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer;
}
.toggle-pass:hover, .toggle-pass:focus-visible { color: var(--primary); background: rgba(238, 242, 255, .7); }

.strength {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
    margin-top: 8px;
}
.strength-bar {
    height: 6px; border-radius: 99px; background: rgba(226, 232, 240, .8); overflow: hidden;
}
.strength-bar::after {
    content: ""; display: block; height: 100%; width: 0;
    background: #f59e0b; transition: width .2s ease, background .2s ease;
}
.strength-bar[data-score="1"]::after { width: 25%; background: #dc2626; }
.strength-bar[data-score="2"]::after { width: 50%; background: #f59e0b; }
.strength-bar[data-score="3"]::after,
.strength-bar[data-score="4"]::after { width: 100%; background: #059669; }
.strength-label { font-size: .72rem; font-weight: 700; color: var(--muted); min-width: 3.5rem; text-align: right; }

.row-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 4px 0 16px; font-size: .82rem;
}
.remember {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: #334155;
}
.remember input { width: 18px; height: 18px; accent-color: var(--primary); }
.forgot { color: var(--primary); font-weight: 700; text-decoration: none; }
.forgot:hover { text-decoration: underline; }

.field-grid { display: grid; gap: 0 12px; }
@media (min-width: 640px) {
    .field-grid { grid-template-columns: 1fr 1fr; }
}
.plan-picker { margin: 4px 0 16px; padding: 0; border: 0; }
.plan-picker legend { display: block; margin-bottom: 8px; font-size: .78rem; font-weight: 800; color: #334155; }
.plan-picker-grid { display: grid; gap: 8px; }
@media (min-width: 640px) {
    .plan-picker-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.plan-option {
    position: relative; display: grid; gap: 2px; padding: 12px; cursor: pointer;
    border: 2px solid rgba(148, 163, 184, .45); border-radius: 14px; background: rgba(255,255,255,.7);
}
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.plan-option-pop { font-size: .62rem; font-weight: 800; text-transform: uppercase; color: var(--primary); }
.plan-option strong { font-size: .82rem; }
.plan-option-price { font-size: .78rem; font-weight: 800; }
.plan-option-annual { font-size: .68rem; color: var(--muted); }
.optional { font-weight: 500; color: var(--muted); }
.inline-link {
    border: 0; background: none; padding: 0; color: var(--primary);
    font: inherit; font-weight: 700; cursor: pointer;
}
.inline-link:hover { text-decoration: underline; }

.btn-login {
    width: 100%; min-height: 50px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 999px; cursor: pointer;
    color: #fff; font-weight: 800; font-size: .95rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-2) 55%, var(--secondary));
    box-shadow: 0 14px 28px rgba(79, 70, 229, .32);
    transition: transform .18s ease, filter .18s ease;
}
.btn-login:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-login:active { transform: scale(.99); }
.btn-login:disabled { opacity: .75; cursor: wait; transform: none; }
.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
    animation: spin .7s linear infinite;
}

.support { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .84rem; }
.support a { color: var(--primary); font-weight: 700; text-decoration: none; }
.support a:hover { text-decoration: underline; }
.secure {
    margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
    color: var(--ok); font-size: .78rem; font-weight: 600;
}
.legal {
    margin-top: 12px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
    font-size: .75rem;
}
.legal button {
    border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit;
}
.legal button:hover { color: var(--primary); }

.auth-body .primo-app-footer {
    border-top-color: transparent;
    padding-bottom: 20px;
    color: rgba(226, 232, 240, .85);
}
.auth-body .primo-app-footer strong { color: #fff; }

.dialog {
    border: 0; padding: 0; background: transparent; max-width: 440px; width: calc(100% - 32px);
}
.dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(8px); }
.dialog-card {
    padding: 22px; border-radius: 20px;
    background: rgba(255,255,255,.86);
    border: 1px solid rgba(255,255,255,.6);
    backdrop-filter: blur(18px);
    color: var(--text);
    box-shadow: var(--shadow);
}
.dialog-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.dialog-card p { margin: 0 0 16px; color: var(--muted); font-size: .88rem; line-height: 1.6; }

html[data-theme="dark"] {
    color-scheme: dark;
    --text: #f1f5f9;
    --muted: #cbd5e1;
    --glass: rgba(15, 23, 42, 0.62);
    --glass-border: rgba(255, 255, 255, 0.16);
    --input: rgba(15, 23, 42, 0.55);
}
html[data-theme="dark"] .auth-card h1,
html[data-theme="dark"] .field label,
html[data-theme="dark"] .remember { color: #e2e8f0; }
html[data-theme="dark"] .control input {
    color: #f8fafc;
    border-color: rgba(148, 163, 184, .35);
}
html[data-theme="dark"] .control input:focus { background: rgba(15, 23, 42, .75); }
html[data-theme="dark"] .dialog-card { background: rgba(15, 23, 42, .82); color: #e2e8f0; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
    .auth-showcase { display: none; }
    .auth-stage, .auth-stage:has(.is-wide) { grid-template-columns: 1fr; width: min(540px, calc(100% - 24px)); }
    .auth-top { width: min(540px, calc(100% - 24px)); padding-top: max(14px, env(safe-area-inset-top)); }
    .control input { font-size: 16px; }
}
@media (max-width: 425px) {
    .auth-card { padding: 22px 16px 18px; }
    .row-meta { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .auth-card, .auth-showcase { opacity: 1; transform: none; }
    .auth-photo { transform: none; }
}
@media (prefers-contrast: more) {
    .control input, .btn-login { border: 2px solid currentColor; }
}
