/* ─────────────────────────────────────────────────────────────
   Sign-in / sign-up split layout.

   Same visual language as the marketing page (views/welcome.php):
   ink panel with topographic linework, Plus Jakarta Sans with
   JetBrains Mono for small labels, flat colour — no gradients.
   Everything is scoped under body.auth-page so none of it leaks
   into the signed-in app, which shares app.css / custom.css.
   ───────────────────────────────────────────────────────────── */
.auth-page {
    --pm-blue: #0d6efd;
    --pm-blue-dark: #0b5ed7;
    --pm-blue-soft: #e8f1ff;
    --pm-blue-bright: #4d94ff;
    --pm-ink: #07111f;
    --pm-ink-2: #0c1a2e;
    --pm-ink-line: rgba(255, 255, 255, .1);
    --pm-ink-muted: #9fb0c3;
    --pm-text: #0b1524;
    --pm-text-2: #1c2b3a;
    --pm-muted: #5b6b7c;
    --pm-line: #e3e9f0;
    --pm-field: #f5f8fb;
    --pm-green: #0f9d58;
    --pm-green-bright: #34d399;
    --pm-amber: #c2760a;
    --pm-amber-bright: #fbbf24;
    --pm-red: #d92d20;
    --pm-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --pm-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    margin: 0;
    min-height: 100vh;
    background: #fff;
    color: var(--pm-text);
    font-family: var(--pm-font);
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
}
@media (min-width: 992px) {
    .auth-shell { grid-template-columns: minmax(420px, 44%) minmax(0, 1fr); }
    .auth-shell.is-wide { grid-template-columns: minmax(400px, 40%) minmax(0, 1fr); }
}

/* ── Brand panel ─────────────────────────────────────────── */
.auth-aside {
    display: none;
    position: relative;
    overflow: hidden;
    background: var(--pm-ink);
    color: #fff;
}
@media (min-width: 992px) {
    .auth-aside { display: block; }
}
.auth-topo {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    fill: none; stroke: rgba(77, 148, 255, .16);
    transform: scale(1.5) translate(4%, 6%);
}
.auth-aside-inner {
    position: relative; z-index: 1;
    height: 100%; min-height: 100vh;
    display: flex; flex-direction: column;
    padding: 44px 56px;
}
.auth-brand {
    display: inline-flex; align-items: center; gap: 12px;
    font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; color: #fff;
}
.brand-tile {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    background: var(--pm-blue);
    display: inline-flex; align-items: center; justify-content: center;
}
.brand-tile img { height: 27px; width: auto; filter: brightness(0) invert(1); }

.auth-aside-body { margin: auto 0; padding: 48px 0; max-width: 460px; }
.auth-kicker {
    display: inline-flex; align-items: center; gap: 12px;
    font-family: var(--pm-mono); font-size: .72rem; font-weight: 500;
    letter-spacing: .14em; text-transform: uppercase; color: var(--pm-blue-bright);
    margin-bottom: 20px;
}
.auth-kicker::before { content: ''; width: 28px; height: 1px; background: currentColor; }
.auth-aside-title {
    font-family: var(--pm-font);
    font-size: clamp(1.9rem, 2.6vw, 2.5rem); font-weight: 800;
    line-height: 1.1; letter-spacing: -.035em; color: #fff;
    margin: 0 0 36px;
}

.auth-status { display: grid; gap: 12px; }
.auth-status-row {
    display: flex; align-items: center; gap: 14px;
    background: rgba(12, 26, 46, .88);
    border: 1px solid var(--pm-ink-line); border-radius: 14px;
    padding: 14px 16px;
}
.auth-status-row strong { display: block; font-size: .92rem; font-weight: 700; color: #fff; }
.auth-status-row small { display: block; font-family: var(--pm-mono); font-size: .68rem; color: var(--pm-ink-muted); margin-top: 2px; }
.auth-status-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.auth-status-icon svg { width: 17px; height: 17px; }
.auth-status-icon.is-green { background: rgba(52, 211, 153, .14); color: var(--pm-green-bright); }
.auth-status-icon.is-blue  { background: rgba(77, 148, 255, .16); color: var(--pm-blue-bright); }
.auth-status-icon.is-amber { background: rgba(251, 191, 36, .14); color: var(--pm-amber-bright); }

.auth-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.auth-steps li { display: flex; gap: 16px; align-items: flex-start; }
.auth-steps b {
    font-family: var(--pm-mono); font-weight: 600; font-size: .78rem;
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .06); border: 1px solid var(--pm-ink-line); color: var(--pm-blue-bright);
}
.auth-steps strong { display: block; font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 2px; }
.auth-steps span { color: var(--pm-ink-muted); font-size: .92rem; line-height: 1.5; }

.auth-aside-foot {
    font-family: var(--pm-mono); font-size: .7rem; letter-spacing: .04em; color: #7d8fa1;
}
.auth-aside-foot span { display: inline-flex; align-items: center; gap: 8px; }
.auth-aside-foot svg { width: 14px; height: 14px; }

/* ── Form column ─────────────────────────────────────────── */
.auth-main {
    display: flex; flex-direction: column;
    min-height: 100vh;
    padding: 28px 20px;
}
@media (min-width: 576px) { .auth-main { padding: 36px 40px; } }

.auth-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    font-size: .9rem; color: var(--pm-muted);
}
.auth-topbar a { color: var(--pm-blue); font-weight: 700; text-decoration: none; }
.auth-topbar a:hover { color: var(--pm-blue-dark); text-decoration: underline; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; color: var(--pm-muted) !important; font-weight: 600 !important; }
.auth-back:hover { color: var(--pm-text) !important; text-decoration: none !important; }
.auth-back svg { width: 16px; height: 16px; }

.auth-content {
    width: 100%; max-width: 420px;
    margin: auto; padding: 40px 0;
}
.auth-shell.is-wide .auth-content { max-width: 560px; }

/* Compact brand header — only where the brand panel is hidden. */
.auth-brand-mobile {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; color: var(--pm-text);
    margin-bottom: 28px;
}
.auth-brand-mobile .brand-tile { width: 36px; height: 36px; border-radius: 11px; }
.auth-brand-mobile .brand-tile img { height: 24px; }
@media (min-width: 992px) { .auth-brand-mobile { display: none; } }

.auth-title {
    font-family: var(--pm-font);
    font-size: clamp(1.7rem, 3vw, 2.1rem); font-weight: 800;
    letter-spacing: -.035em; line-height: 1.15; color: var(--pm-text);
    margin: 0 0 8px;
}
.auth-subtitle { color: var(--pm-muted); font-size: 1rem; margin: 0 0 32px; }

/* ── Fields ──────────────────────────────────────────────── */
.auth-form .form-label,
.auth-label {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    font-weight: 700; font-size: .85rem; color: var(--pm-text-2);
    margin-bottom: 7px;
}
.auth-label .optional { font-weight: 500; color: var(--pm-muted); font-size: .78rem; }
.auth-label a { font-weight: 600; font-size: .82rem; color: var(--pm-blue); text-decoration: none; }
.auth-label a:hover { text-decoration: underline; }

.auth-field { position: relative; margin-bottom: 18px; }
.auth-input-wrap { position: relative; }
.auth-input-wrap > .auth-input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: #8a99a8; pointer-events: none;
    transition: color .15s ease;
}
.auth-form .form-control {
    height: 50px;
    border-radius: 12px;
    border: 1px solid var(--pm-line);
    background: var(--pm-field);
    padding: 0 16px;
    font-size: .98rem;
    color: var(--pm-text);
    box-shadow: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.auth-form .has-icon .form-control { padding-left: 44px; }
.auth-form .has-toggle .form-control { padding-right: 48px; }
.auth-form .form-control::placeholder { color: #9aa7b5; }
.auth-form .form-control:hover { border-color: #cfd9e4; }
.auth-form .form-control:focus {
    background: #fff;
    border-color: var(--pm-blue);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
}
.auth-input-wrap:focus-within > .auth-input-icon { color: var(--pm-blue); }
.auth-form .form-control.is-invalid { border-color: var(--pm-red); background-image: none; }
.auth-form .form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(217, 45, 32, .12); }
.auth-form .form-control.is-valid { border-color: var(--pm-green); background-image: none; }

/* Show/hide password */
.auth-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: 0; border-radius: 9px;
    background: transparent; color: #7d8b99;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.auth-toggle:hover { background: #e9eef4; color: var(--pm-text); }
.auth-toggle:focus-visible { outline: 3px solid rgba(13, 110, 253, .35); outline-offset: 0; }
.auth-toggle svg { width: 18px; height: 18px; }

.auth-hint { display: block; font-size: .8rem; color: var(--pm-muted); margin-top: 7px; }
.auth-hint.is-error { color: var(--pm-red); }
.auth-hint.is-ok { color: var(--pm-green); }

/* Password strength */
.auth-strength { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.auth-strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; flex: 1; }
.auth-strength-bars i { height: 4px; border-radius: 4px; background: var(--pm-line); transition: background-color .2s ease; }
.auth-strength-label { font-family: var(--pm-mono); font-size: .7rem; color: var(--pm-muted); min-width: 50px; text-align: right; }
.auth-strength[data-score="1"] i:nth-child(-n+1) { background: var(--pm-red); }
.auth-strength[data-score="2"] i:nth-child(-n+2) { background: var(--pm-amber-bright); }
.auth-strength[data-score="3"] i:nth-child(-n+3) { background: #22c55e; }
.auth-strength[data-score="4"] i { background: var(--pm-green); }

/* Checkbox */
.auth-form .form-check { display: flex; align-items: flex-start; gap: 10px; padding-left: 0; min-height: 0; }
.auth-form .form-check-input {
    float: none; margin: 2px 0 0; flex-shrink: 0;
    width: 18px; height: 18px; border-radius: 5px; border-color: #c3ceda; cursor: pointer;
}
.auth-form .form-check-input:checked { background-color: var(--pm-blue); border-color: var(--pm-blue); }
.auth-form .form-check-input:focus { box-shadow: 0 0 0 4px rgba(13, 110, 253, .15); border-color: var(--pm-blue); }
.auth-form .form-check-label { font-size: .9rem; color: var(--pm-text-2); cursor: pointer; line-height: 1.45; }
.auth-form .form-check-label a { color: var(--pm-blue); font-weight: 600; text-decoration: none; }
.auth-form .form-check-label a:hover { text-decoration: underline; }

/* Primary action */
.auth-submit {
    width: 100%; height: 52px;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: 1px solid var(--pm-blue); border-radius: 12px;
    background: var(--pm-blue); color: #fff;
    font-family: var(--pm-font); font-size: 1rem; font-weight: 700;
    transition: background-color .15s ease, box-shadow .2s ease, transform .2s ease;
}
.auth-submit:hover:not(:disabled) {
    background: var(--pm-blue-dark); border-color: var(--pm-blue-dark); color: #fff;
    box-shadow: 0 10px 24px rgba(13, 110, 253, .28);
    transform: translateY(-1px);
}
.auth-submit:focus-visible { outline: 3px solid rgba(13, 110, 253, .4); outline-offset: 3px; }
.auth-submit:disabled { opacity: .75; cursor: progress; }
.auth-submit svg { width: 18px; height: 18px; }

.auth-switch { text-align: center; margin: 26px 0 0; font-size: .93rem; color: var(--pm-muted); }
.auth-switch a { color: var(--pm-blue); font-weight: 700; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.auth-divider {
    display: flex; align-items: center; gap: 14px;
    font-family: var(--pm-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
    color: #97a4b2; margin: 26px 0 0;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--pm-line); }

.auth-legal { font-size: .78rem; color: var(--pm-muted); text-align: center; }
.auth-legal a { color: var(--pm-muted); text-decoration: underline; }
.auth-legal a:hover { color: var(--pm-text); }

/* Android prompt restyled to sit comfortably in the form column. */
.auth-page #androidAppPrompt {
    border: 1px solid #cfe0fb !important; border-radius: 14px;
    background: var(--pm-blue-soft) !important; margin-bottom: 24px !important;
}

/* Registration success state (replaces the form in place). */
.auth-success { text-align: center; padding: 12px 0; }
.auth-success-icon {
    width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 22px;
    display: flex; align-items: center; justify-content: center;
    background: var(--pm-blue-soft); color: var(--pm-blue);
}
.auth-success-icon svg { width: 30px; height: 30px; }
.auth-success h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 10px; }
.auth-success p { color: var(--pm-muted); margin-bottom: 8px; }
.auth-success .auth-submit { margin-top: 22px; text-decoration: none; }

/* Status icon variants for the other account screens. */
.auth-success-icon.is-green { background: #e7f7ee; color: var(--pm-green); }
.auth-success-icon.is-red   { background: #fdecec; color: var(--pm-red); }
.auth-success-icon.is-amber { background: #fdf3e3; color: var(--pm-amber); }

/* Working state: verifying a link, processing an invitation. */
.auth-spinner {
    width: 44px; height: 44px; margin: 0 auto 24px;
    border: 3px solid rgba(13, 110, 253, .16); border-top-color: var(--pm-blue);
    border-radius: 50%;
    animation: authSpin .8s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Secondary action alongside .auth-submit */
.auth-secondary {
    width: 100%; height: 52px;
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    border: 1px solid var(--pm-line); border-radius: 12px;
    background: #fff; color: var(--pm-text);
    font-family: var(--pm-font); font-size: 1rem; font-weight: 700;
    text-decoration: none; cursor: pointer;
    transition: border-color .15s ease, color .15s ease, transform .2s ease;
}
.auth-secondary:hover { border-color: var(--pm-blue); color: var(--pm-blue); transform: translateY(-1px); }
.auth-secondary:focus-visible { outline: 3px solid rgba(13, 110, 253, .4); outline-offset: 3px; }
.auth-actions { display: grid; gap: 12px; margin-top: 28px; }
.auth-success .auth-actions .auth-submit { margin-top: 0; }

/* Inline notice (info / warning), e.g. "link expires in 2 hours". */
.auth-notice {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--pm-blue-soft); border: 1px solid #cfe0fb; border-radius: 14px;
    padding: 14px 16px; margin-bottom: 24px;
    font-size: .9rem; color: var(--pm-text-2); line-height: 1.5; text-align: left;
}
.auth-notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--pm-blue); }
.auth-notice.is-warning { background: #fdf3e3; border-color: #f6ddb2; }
.auth-notice.is-warning svg { color: var(--pm-amber); }
.auth-notice ul { margin: 6px 0 0; padding-left: 18px; }
.auth-notice strong { color: var(--pm-text); }

/* Read-only field (e.g. the invited address) */
.auth-form .form-control[readonly] { background: #eef2f6; color: var(--pm-muted); cursor: default; }
.auth-form .form-control[readonly]:focus { border-color: var(--pm-line); box-shadow: none; }

/* Multi-line input */
.auth-form textarea.form-control { height: auto; min-height: 112px; padding-top: 13px; padding-bottom: 13px; resize: vertical; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
    .auth-spinner { animation-duration: 2s; }
    .auth-page *, .auth-page *::before, .auth-page *::after {
        transition-duration: .01ms !important;
    }
}

/* Status headings receive focus programmatically (so screen readers announce
   the outcome); they are not interactive, so no focus ring is drawn. */
.auth-page h1[tabindex="-1"]:focus { outline: none; box-shadow: none; }
