/* ============================================================
   vm-auth.css — VOUCHMORPH sign in (login.php), registration
   (register.php) and the email pages drawn by _email_auth.php
   (sign up, forgot, reset, choose a username). One stylesheet so
   they stay identical.

   The same look as the customer dashboard (vm-brand.css, brand
   pack 3 "frame"): a cream ground under grain and two slow pools
   of light, ink frames, square corners, no drop shadows, Unbounded
   for display and Inter for reading. The brand's sky marks the
   main action; states use the dashboard's plain colours.
   ============================================================ */
:root {
    /* The dashboard's palette (vm-brand.css), value for value. */
    --vm-ground:      #F2EDE4;
    --vm-raised:      #FAF7F1;
    --vm-fill:        #E6E0D5;
    --vm-ink:         #121214;
    --vm-line-strong: #847E74;
    --vm-muted:       #5B5751;
    --vm-faint:       #A39D94;
    --vm-sky:         #1785D6;
    --vm-sky-deep:    #136DB0;
    --vm-grain:       url('brand/grain-cream.png');
    --vm-glow-1:      #FBF8F2;
    --vm-glow-2:      #DDE5EC;

    /* States: every text pair passes 4.5:1 on its own background. */
    --st-ok:   #2E7D4F; --st-ok-bg:   #DDEBDF;
    --st-wait: #8A5300; --st-wait-bg: #F5E6C8;
    --st-bad:  #B3261E; --st-bad-bg:  #F6DCD8;
    --st-info: #0F67AA; --st-info-bg: #DCEAF6;

    /* Old names some markup still reaches for. */
    --danger:    var(--st-bad);
    --danger-bg: var(--st-bad-bg);
    --accent:    var(--vm-sky);

    --f-display: 'Unbounded', 'Inter', system-ui, sans-serif;
    --f-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --ease:      cubic-bezier(.65, 0, .35, 1);

    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
    --sp-9: 48px; --sp-10: 64px;
    --frame-inset: 14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after { border-radius: 0; }
html, body { min-height: 100%; }
html { background-color: var(--vm-ground); -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--f-body);
    color: var(--vm-ink);
    font-size: 15px;
    line-height: 1.55;
    font-feature-settings: 'tnum' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: transparent;
}
:focus-visible { outline: 2px solid var(--vm-sky); outline-offset: 2px; }

/* The dashboard's background: grain over two soft pools of light that
   drift and swell over 24s. Still for people who ask for less motion. */
body::before {
    content: ''; position: fixed; inset: -25vmax; z-index: -2; pointer-events: none;
    background:
        radial-gradient(38vmax 32vmax at 24% 22%, var(--vm-glow-1), transparent 72%),
        radial-gradient(44vmax 38vmax at 78% 74%, var(--vm-glow-2), transparent 72%),
        var(--vm-ground);
    animation: vmBreathe 24s var(--ease) infinite alternate;
}
body::after {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: var(--vm-grain); opacity: .95;
}
@keyframes vmBreathe {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(4vmax, -3vmax, 0) scale(1.08); }
    100% { transform: translate3d(-3vmax, 2vmax, 0) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

.split { display: flex; min-height: 100vh; width: 100%; }
.col { min-width: 0; display: flex; flex-direction: column; }

/* LEFT — the form, straight on the ground */
.col-form {
    flex: 0 0 56%;
    align-items: center;
    justify-content: center;
    padding: var(--sp-8) var(--sp-6);
}
.form-wrap { width: 100%; max-width: 440px; }

/* The dashboard's wordmark, then a sky marker over the eyebrow —
   the same marker that sits over the tab you are on up there. */
.brand { margin-bottom: var(--sp-8); }
.brand .mark {
    display: flex;
    align-items: center;
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--vm-ink);
}
.brand .mark img { display: block; height: 20px; width: auto; }
.brand .mark sup { font-size: 10px; color: var(--vm-muted); }
.brand .division {
    display: block;
    margin-top: var(--sp-7);
    font-family: var(--f-body);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vm-muted);
}
.brand .division::before {
    content: '';
    display: block;
    width: 24px;
    height: 3px;
    margin-bottom: var(--sp-3);
    background: var(--vm-sky);
}

.form-wrap h2 {
    font-family: var(--f-display);
    font-size: clamp(30px, 3vw, 40px);
    line-height: 1.08;
    font-weight: 500;
    letter-spacing: -0.045em;
    color: var(--vm-ink);
}
.form-wrap .subtitle {
    color: var(--vm-muted);
    font-size: 16px;
    line-height: 24px;
    margin-top: var(--sp-3);
    margin-bottom: var(--sp-7);
}

/* Identifier type — a tab row on an ink line, the one you are on
   underlined in sky, like the dashboard's navigation. */
.id-tabs {
    display: flex;
    gap: var(--sp-6);
    border-bottom: 1px solid var(--vm-ink);
    margin-bottom: var(--sp-7);
    overflow-x: auto;
    scrollbar-width: none;
}
.id-tabs::-webkit-scrollbar { display: none; }
.id-tab {
    flex: 0 0 auto;
    background: none;
    border: none;
    padding: var(--sp-3) 0;
    font-family: var(--f-body);
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
    color: var(--vm-muted);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color .15s;
}
.id-tab:hover { color: var(--vm-ink); }
.id-tab.active { color: var(--vm-ink); font-weight: 500; }
.id-tab.active::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--vm-sky);
}

.field { margin-bottom: var(--sp-5); }
.field label {
    display: block;
    margin-bottom: var(--sp-2);
    font-family: var(--f-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 20px;
    color: var(--vm-ink);
}
.field label .hint {
    font-weight: 400;
    color: var(--vm-muted);
}
.field-input { position: relative; display: flex; }
.field-input svg {
    position: absolute;
    left: var(--sp-4);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--vm-muted);
    pointer-events: none;
}
.phone-prefix {
    display: none;
    align-items: center;
    padding: 0 14px;
    font-family: var(--f-body);
    font-size: 16px;
    font-weight: 500;
    color: var(--vm-ink);
    background: var(--vm-fill);
    border: 1px solid var(--vm-line-strong);
    border-right: none;
}
.phone-prefix.show { display: flex; }
.field input {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 14px var(--sp-4) 14px 48px;
    border: 1px solid var(--vm-line-strong);
    font-size: 16px;
    font-family: var(--f-body);
    background: var(--vm-raised);
    transition: border-color .15s, box-shadow .15s;
    color: var(--vm-ink);
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
}
.field-input.has-prefix input { padding-left: var(--sp-4); }
.field input:hover { border-color: var(--vm-ink); }
.field input:focus,
.field input:focus-visible {
    outline: none;
    border-color: var(--vm-sky);
    box-shadow: inset 0 0 0 1px var(--vm-sky);
}
.field-input.has-prefix:focus-within .phone-prefix { border-color: var(--vm-sky); }
.field input::placeholder { color: var(--vm-line-strong); opacity: 1; }

/* A box holding the wrong kind of value: a red edge, and the reason
   directly under it. Both are put there by VMFields in vm-auth.js, or
   by login.php when the server turned the value away. */
.field-input.invalid input,
.field-input.invalid .phone-prefix { border-color: var(--st-bad); }
.field-input.invalid input:focus { border-color: var(--st-bad); box-shadow: inset 0 0 0 1px var(--st-bad); }
.field-error {
    margin-top: var(--sp-2);
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    color: var(--st-bad);
}
.pin-input { letter-spacing: 0.35em; font-weight: 500; }

.field-input.has-toggle input { padding-right: 52px; }
.pin-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--vm-muted);
    transition: color .15s, background-color .15s;
}
.pin-toggle:hover { color: var(--vm-ink); background: var(--vm-fill); }
/* The eye icon sits in the button, not at the box's left edge. */
.field-input .pin-toggle svg { position: static; transform: none; width: 18px; height: 18px; color: inherit; }

.consent {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    margin: var(--sp-1) 0 var(--sp-5);
    font-size: 14px;
    line-height: 20px;
    color: var(--vm-muted);
    cursor: pointer;
}
.consent input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--vm-ink);
    cursor: pointer;
}
.consent a,
.consent-note a {
    color: var(--vm-ink);
    text-decoration: underline;
    text-decoration-color: var(--vm-line-strong);
    text-underline-offset: 3px;
    transition: text-decoration-color .15s, color .15s;
}
.consent a:hover,
.consent-note a:hover { color: var(--vm-sky-deep); text-decoration-color: var(--vm-sky); }
.consent.needs-tick { color: var(--st-bad); }

/* The credentials step no longer carries a checkbox: agreement is asked for
   once per version of the documents, on its own step, not at every sign-in.
   This is the quiet notice that stays under the button. */
.consent-note {
    margin: var(--sp-4) 0 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--vm-muted);
    text-align: center;
}

/* The main action: a deep-sky block that fills with ink from one side
   on hover — the dashboard's primary button. */
.btn {
    width: 100%;
    min-height: 52px;
    padding: 0 var(--sp-5);
    margin-top: var(--sp-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    font-family: var(--f-body);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    text-decoration: none;
    color: #FFFFFF;
    cursor: pointer;
    border: 1px solid var(--vm-sky-deep);
    border-radius: 0;
    background-color: var(--vm-sky-deep);
    background-image: linear-gradient(var(--vm-ink), var(--vm-ink));
    background-repeat: no-repeat;
    background-size: 0% 100%;
    transition: background-size 1.1s var(--ease), color .55s var(--ease), border-color .3s var(--ease);
}
.btn:hover { background-size: 100% 100%; color: #FFFFFF; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; transition: transform .3s var(--ease); }
.btn:hover svg { transform: translateX(4px); }

.error {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    background: var(--st-bad-bg);
    color: var(--st-bad);
    border: 1px solid currentColor;
    padding: 14px var(--sp-4);
    margin-bottom: var(--sp-6);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}
.error svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.dev-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    background: var(--st-wait-bg);
    color: var(--st-wait);
    border: 1px solid currentColor;
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-6);
    font-size: 13px;
    line-height: 19px;
    font-weight: 500;
}
.dev-notice.is-info { background: var(--st-info-bg); color: var(--st-info); }
.dev-notice svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.dev-notice strong { font-weight: 700; }

.trust-row {
    display: flex;
    justify-content: space-between;
    margin-top: var(--sp-7);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--vm-ink);
    font-size: 12px;
    line-height: 16px;
    color: var(--vm-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.trust-row span { display: flex; align-items: center; gap: var(--sp-2); }
.trust-row svg { width: 14px; height: 14px; color: var(--vm-ink); }

.foot-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--sp-2) var(--sp-6);
    margin-top: var(--sp-6);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}
.foot-links a {
    color: var(--vm-ink);
    text-decoration: underline;
    text-decoration-color: var(--vm-line-strong);
    text-underline-offset: 4px;
    transition: color .15s, text-decoration-color .15s;
}
.foot-links a:hover { color: var(--vm-sky-deep); text-decoration-color: var(--vm-sky); }

/* ============================================================
   RIGHT — the brand panel: a raised cream panel inside an ink
   frame (the dashboard's frame motif), with a thin inner line the
   labels cut into, and a scatter of line doodles behind the copy.
   ============================================================ */
/* Held to the screen while a long form scrolls past it. */
.col-brand {
    flex: 0 0 44%;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    height: 100dvh;
    align-items: stretch;
    justify-content: stretch;
    padding: var(--sp-6) var(--sp-6) var(--sp-6) 0;
    overflow: hidden;
}
.frame-mat {
    position: relative;
    flex: 1;
    background: var(--vm-raised);
    border: 1.5px solid var(--vm-ink);
    overflow: hidden;
}
.frame-line {
    position: absolute;
    inset: var(--frame-inset);
    border: 1px solid rgba(18, 18, 20, 0.16);
    pointer-events: none;
}
.frame-strip {
    position: absolute;
    color: var(--vm-muted);
    font-family: var(--f-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.frame-strip span { background: var(--vm-raised); padding: 0 12px; }
.frame-strip.top,
.frame-strip.bottom {
    left: calc(var(--frame-inset) + 30px);
    right: calc(var(--frame-inset) + 30px);
    height: 20px;
}
.frame-strip.top    { top: calc(var(--frame-inset) - 10px); }
.frame-strip.bottom { bottom: calc(var(--frame-inset) - 10px); }
.frame-strip.lateral {
    right: calc(var(--frame-inset) - 10px);
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    width: 20px;
    writing-mode: vertical-rl;
    color: var(--vm-ink);
    font-family: var(--f-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3em;
    z-index: 3;
}
.frame-strip.lateral span { padding: 12px 0; }

/* Doodle field — thin line icons scattered across the panel */
.doodle-field {
    position: absolute;
    inset: var(--frame-inset);
    z-index: 0;
    overflow: hidden;
}
/* Kept quiet, like the dashboard: the copy reads first, the doodles after. */
.doodle-field svg { position: absolute; stroke: rgba(18, 18, 20, 0.13); fill: none; stroke-width: 1.3; stroke-linecap: square; stroke-linejoin: miter; }
.doodle-field svg.accent,
.doodle-field svg.brass { stroke: rgba(23, 133, 214, 0.38); }
.doodle-field svg.faint { stroke: rgba(18, 18, 20, 0.07); }

.magazine {
    position: absolute;
    inset: var(--frame-inset);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-7) var(--sp-7);
    z-index: 1;
}
/* halo, not a fade: punches letterforms clear of doodles crossing
   behind them without masking the artwork itself */
.halo-text {
    text-shadow:
        0 0 6px var(--vm-raised), 0 0 6px var(--vm-raised),
        0 0 12px var(--vm-raised), 0 0 12px var(--vm-raised);
}
.magazine .script-word {
    font-family: var(--f-display);
    font-size: clamp(40px, 4.4vw, 64px);
    line-height: 1;
    font-weight: 500;
    letter-spacing: -0.045em;
    color: var(--vm-ink);
    margin-bottom: var(--sp-6);
}
.magazine .eyebrow {
    font-family: var(--f-body);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vm-sky-deep);
    margin-bottom: var(--sp-4);
}
.magazine p {
    font-family: var(--f-body);
    font-size: 15px;
    line-height: 24px;
    color: var(--vm-ink);
    max-width: 320px;
}
.magazine p.secondary {
    font-size: 14px;
    line-height: 22px;
    color: var(--vm-muted);
    max-width: 310px;
    margin-top: var(--sp-4);
}
.magazine p.secondary strong { color: var(--vm-ink); font-weight: 600; }
.magazine .rule { margin-top: var(--sp-6); width: 24px; height: 3px; background: var(--vm-sky); }

/* ============================================================
   REGISTRATION — pieces only register.php and the email pages
   use. None of these classes appear on login.php.
   ============================================================ */
.id-tab.locked { color: var(--vm-faint); cursor: not-allowed; }
.id-tab.locked:hover { color: var(--vm-faint); }

.help-text {
    margin-top: var(--sp-2);
    font-size: 13px;
    line-height: 18px;
    color: var(--vm-muted);
}
.field-input.plain input { padding-left: var(--sp-4); }

.link-toggle {
    background: none;
    border: none;
    padding: 0;
    font-family: var(--f-body);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--vm-ink);
    text-decoration: underline;
    text-decoration-color: var(--vm-line-strong);
    text-underline-offset: 4px;
    cursor: pointer;
    transition: color .15s, text-decoration-color .15s;
}
.link-toggle:hover { color: var(--vm-sky-deep); text-decoration-color: var(--vm-sky); }

.additional-phones {
    display: none;
    margin-top: var(--sp-3);
    padding: var(--sp-4);
    background: var(--vm-raised);
    border: 1px solid var(--vm-line-strong);
}
.additional-phones.show { display: block; }
.additional-phones .help-text { margin: 0 0 var(--sp-3); }
.additional-phones .field-input + .field-input,
.additional-phones .field-error + .field-input { margin-top: var(--sp-2); }

.contact-channel-group {
    display: none;
    margin-top: var(--sp-3);
    padding: var(--sp-4);
    background: var(--st-bad-bg);
    border: 1px solid var(--st-bad);
}
.contact-channel-group.show { display: block; }
.contact-channel-group .help-text { margin-top: 0; color: var(--st-bad); }
.contact-channel-choice {
    display: flex;
    gap: var(--sp-5);
    margin: var(--sp-2) 0 var(--sp-3);
    font-size: 14px;
    color: var(--vm-ink);
}
.contact-channel-choice input { accent-color: var(--vm-ink); }

.otp-section { display: none; }

.btn:disabled,
.btn:disabled:hover {
    cursor: not-allowed;
    background-color: var(--vm-fill);
    background-image: none;
    border-color: var(--vm-fill);
    color: var(--vm-muted);
}
.btn:disabled:hover svg { transform: none; }
/* Everything that is not the main action stays ink. */
.btn-secondary {
    background-color: transparent;
    background-image: linear-gradient(var(--vm-ink), var(--vm-ink));
    border-color: var(--vm-ink);
    color: var(--vm-ink);
}
.btn-secondary:hover { color: var(--vm-ground); }

.resend-timer {
    margin-top: var(--sp-4);
    text-align: center;
    font-size: 13px;
    color: var(--vm-muted);
}

/* Status line under the buttons. .message.error also matches .error
   above, so it resets that block's flex layout and spacing. */
.message {
    display: block;
    margin: var(--sp-5) 0 0;
    padding: 14px var(--sp-4);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    background: var(--vm-raised);
    color: var(--vm-ink);
    border: 1px solid var(--vm-line-strong);
}
.message:empty { display: none; }
.message.error { display: block; margin: var(--sp-5) 0 0; background: var(--st-bad-bg); color: var(--st-bad); border-color: currentColor; }
.message.success { background: var(--st-ok-bg); color: var(--st-ok); border-color: currentColor; }
.message.warning { background: var(--st-wait-bg); color: var(--st-wait); border-color: currentColor; }
.message .btn { margin-top: var(--sp-3); }

.fade-in { animation: vm-fade-up .35s var(--ease); }
@keyframes vm-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .fade-in { animation: none; }
    .btn { transition: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .split { flex-direction: column; }
    .col-form { flex: 1 1 auto; order: 2; padding: var(--sp-7) var(--sp-5); }
    .col-brand { flex: 1 1 auto; order: 1; position: relative; align-self: stretch; height: auto; min-height: 260px; padding: var(--sp-5) var(--sp-5) 0; }
    :root { --frame-inset: 10px; }
    .frame-strip.lateral { display: none; }
    .magazine p, .magazine p.secondary { max-width: 280px; }
    /* Stacked, the panel is only as tall as min-height, and an
       absolutely placed .magazine was cut off top and bottom once its
       copy ran past that. In the flow, the panel grows to fit it. */
    .magazine { position: relative; inset: auto; padding: var(--sp-8) var(--sp-5); }
}
@media (max-width: 480px) {
    .trust-row { flex-wrap: wrap; gap: var(--sp-3); justify-content: center; }
    .foot-links { gap: var(--sp-2) var(--sp-4); }
}

/* Fingerprint sign-in (partials/biometric-card.php), inside the Android
   app only. The fingerprint is the main action on this page, in ink as
   Brand Pack 3 asks; the PIN is one quiet tap away. */
.bio-card { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.bio-card[hidden] { display: none; }
.bio-go {
    margin-top: 0;
    border-color: var(--vm-ink);
    background-color: var(--vm-ink);
    background-image: none;
}
.bio-go:hover { color: #FFFFFF; }
.bio-go svg { width: 22px; height: 22px; }
.bio-go:hover svg { transform: none; }
.bio-use-pin {
    align-self: center;
    min-height: 44px;
    padding: 0 var(--sp-3);
    font: 500 15px/20px var(--f-body);
    color: var(--vm-ink);
    background: none;
    border: 0;
    text-decoration: underline;
    text-decoration-color: var(--vm-line-strong);
    text-underline-offset: 4px;
    cursor: pointer;
}
.bio-use-pin[hidden] { display: none; }
.bio-note {
    margin: 0 0 var(--sp-4);
    font-size: 14px;
    line-height: 20px;
    color: var(--vm-muted);
}
.bio-note[hidden] { display: none; }
#credentialsForm[hidden] { display: none; }
/* The phone layer spreads a button's label and arrow apart; this one's
   icon sits beside its words. */
.btn.bio-go { justify-content: center; }
