/* =========================================================================
   AI Digital Vault - Authentication screens
   =========================================================================
   Shared by sign in, register, forgot, reset, change password and the
   verification notice. All six render inside app/Views/auth/layout.php, so
   this file styles one page shape rather than six.

   WHAT CHANGED IN PHASE 3
   -----------------------
   The layout, spacing and type scale are unchanged. Two things were added:

   1. Colours moved into custom properties, so the same rules serve dark and
      light. Previously every colour was a literal, which is why a second theme
      would have meant a second copy of the file - and a second copy is how the
      two drift.

   2. Components the working form needs and the mockup did not have: alerts,
      field errors, the password visibility toggle, the strength meter, the
      caps-lock hint and the theme switch.

   THEME RESOLUTION
   ----------------
   Three layers, in this order:

     :root                                  light values, the default
     @media (prefers-color-scheme: dark)    follows the operating system
     :root[data-theme="dark"|"light"]       an explicit choice, and it wins

   The third layer must come last and must cover BOTH directions. With only a
   dark override, a visitor whose OS is dark could never choose light - the
   media query would keep winning - and the toggle would appear to do nothing
   for exactly the people most likely to use it.

   assets/js/theme.js writes data-theme, and it runs in <head> before the first
   paint so the page never renders in one theme and switches to the other.
   ========================================================================= */

:root {
    color-scheme: light;

    /* Surfaces */
    --page-bg: #f5f3f0;          /* warm, so the white card reads as raised */
    --card-bg: #ffffff;
    --field-bg: #fafafa;
    --field-bg-focus: #ffffff;
    --divider: #e0e0e0;
    --divider-soft: #ececec;

    /* Text */
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-soft: #8a8a8a;
    --label: #2c2c2c;
    --placeholder: #b0b0b0;

    /* Brand */
    --accent: #2a7de1;
    --accent-ink: #ffffff;
    --accent-soft: rgba(42, 125, 225, .08);
    --accent-ring: rgba(42, 125, 225, .16);

    /* The primary button is near-black in light and inverts in dark */
    --btn-bg: #1a1a1a;
    --btn-bg-hover: #2c2c2c;
    --btn-ink: #ffffff;

    /* Secondary button */
    --btn2-bg: #f5f5f5;
    --btn2-bg-hover: #ececec;
    --btn2-border: #e0e0e0;

    /* Status. Each has a text colour, a tint and a border so an alert reads
       without relying on colour alone - see the icon dot in .alert. */
    --ok: #1a7f4b;
    --ok-bg: #eaf7ef;
    --ok-border: #bfe5cd;

    --err: #b4232a;
    --err-bg: #fdeeee;
    --err-border: #f3c9ca;

    --warn: #8a5a12;
    --warn-bg: #fdf5e6;
    --warn-border: #f0dcb4;

    --info: #1d5fa8;
    --info-bg: #eaf2fd;
    --info-border: #c5dbf6;

    /* The right-hand brand panel keeps its dark treatment in both themes -
       it is a photographic panel, not a surface. */
    --brand-overlay-top: rgba(0, 10, 35, .25);
    --brand-overlay-bottom: rgba(0, 10, 35, .60);
    --brand-ink: #ffffff;
    --brand-ink-soft: #dce9ff;
    --brand-ink-dim: #c8d7ef;

    --shadow-card: 0 30px 60px -20px rgba(0, 0, 0, .15), 0 10px 30px -10px rgba(0, 0, 0, .05);
    --shadow-btn: 0 8px 24px rgba(0, 0, 0, .10);

    --radius-card: 48px;
    --radius-field: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --page-bg: #f5f3f0;
        --card-bg: #F5F3F0;
        --field-bg: #151d2e;
        --field-bg-focus: #1a2438;
        --divider: #26304a;
        --divider-soft: #1e2739;

        --text: #eaeef7;
        --text-muted: #9aa7bf;
        --text-soft: #78849c;
        --label: #d3dbea;
        --placeholder: #5d6980;

        --accent: #5aa2f0;
        --accent-soft: rgba(90, 162, 240, .12);
        --accent-ring: rgba(90, 162, 240, .22);

        /* Inverted: a near-black button on a near-black card would disappear */
        --btn-bg: #eaeef7;
        --btn-bg-hover: #ffffff;
        --btn-ink: #0f1523;

        --btn2-bg: #172032;
        --btn2-bg-hover: #1e293e;
        --btn2-border: #26304a;

        --ok: #6fd79b;
        --ok-bg: rgba(31, 122, 74, .16);
        --ok-border: rgba(111, 215, 155, .28);

        --err: #ff9ba0;
        --err-bg: rgba(180, 35, 42, .18);
        --err-border: rgba(255, 155, 160, .30);

        --warn: #f0c674;
        --warn-bg: rgba(138, 90, 18, .20);
        --warn-border: rgba(240, 198, 116, .28);

        --info: #8dc0f7;
        --info-bg: rgba(29, 95, 168, .20);
        --info-border: rgba(141, 192, 247, .28);

        --shadow-card: 0 30px 60px -24px rgba(0, 0, 0, .70), 0 10px 30px -12px rgba(0, 0, 0, .55);
        --shadow-btn: 0 8px 24px rgba(0, 0, 0, .45);
    }
}

/* An explicit choice overrides the operating system, in both directions. */
:root[data-theme="light"] {
    color-scheme: light;

    --page-bg: #f5f3f0;
    --card-bg: #ffffff;
    --field-bg: #fafafa;
    --field-bg-focus: #ffffff;
    --divider: #e0e0e0;
    --divider-soft: #ececec;

    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-soft: #8a8a8a;
    --label: #2c2c2c;
    --placeholder: #b0b0b0;

    --accent: #2a7de1;
    --accent-soft: rgba(42, 125, 225, .08);
    --accent-ring: rgba(42, 125, 225, .16);

    --btn-bg: #1a1a1a;
    --btn-bg-hover: #2c2c2c;
    --btn-ink: #ffffff;

    --btn2-bg: #f5f5f5;
    --btn2-bg-hover: #ececec;
    --btn2-border: #e0e0e0;

    --ok: #1a7f4b;
    --ok-bg: #eaf7ef;
    --ok-border: #bfe5cd;

    --err: #b4232a;
    --err-bg: #fdeeee;
    --err-border: #f3c9ca;

    --warn: #8a5a12;
    --warn-bg: #fdf5e6;
    --warn-border: #f0dcb4;

    --info: #1d5fa8;
    --info-bg: #eaf2fd;
    --info-border: #c5dbf6;

    --shadow-card: 0 30px 60px -20px rgba(0, 0, 0, .15), 0 10px 30px -10px rgba(0, 0, 0, .05);
    --shadow-btn: 0 8px 24px rgba(0, 0, 0, .10);
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --page-bg: #f5f3f0;
    --card-bg: #0f1523;
    --field-bg: #151d2e;
    --field-bg-focus: #1a2438;
    --divider: #26304a;
    --divider-soft: #1e2739;

    --text: #eaeef7;
    --text-muted: #9aa7bf;
    --text-soft: #78849c;
    --label: #d3dbea;
    --placeholder: #5d6980;

    --accent: #5aa2f0;
    --accent-soft: rgba(90, 162, 240, .12);
    --accent-ring: rgba(90, 162, 240, .22);

    --btn-bg: #eaeef7;
    --btn-bg-hover: #ffffff;
    --btn-ink: #0f1523;

    --btn2-bg: #172032;
    --btn2-bg-hover: #1e293e;
    --btn2-border: #26304a;

    --ok: #6fd79b;
    --ok-bg: rgba(31, 122, 74, .16);
    --ok-border: rgba(111, 215, 155, .28);

    --err: #ff9ba0;
    --err-bg: rgba(180, 35, 42, .18);
    --err-border: rgba(255, 155, 160, .30);

    --warn: #f0c674;
    --warn-bg: rgba(138, 90, 18, .20);
    --warn-border: rgba(240, 198, 116, .28);

    --info: #8dc0f7;
    --info-bg: rgba(29, 95, 168, .20);
    --info-border: rgba(141, 192, 247, .28);

    --shadow-card: 0 30px 60px -24px rgba(0, 0, 0, .70), 0 10px 30px -12px rgba(0, 0, 0, .55);
    --shadow-btn: 0 8px 24px rgba(0, 0, 0, .45);
}

/* -------------------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* No web font is loaded: Config\ContentSecurityPolicy allows font-src
       'self' only, and a Google Fonts request would be blocked - as well as
       telling a third party who is using this application. The stack below
       resolves to the platform UI font, which is already on the machine. */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Helvetica, Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--page-bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* A visible focus ring on every interactive element, in the accent colour.
   Never removed: keyboard users navigate by it, and "outline: none" with no
   replacement makes a form unusable without a mouse. */
:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   MAIN CONTAINER - horizontal split
   ------------------------------------------------------------------------- */
.vault-wrapper {
    max-width: 1200px;
    width: 100%;
    height: min(760px, calc(100dvh - 48px));
    background: var(--card-bg);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    animation: card-in .5s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px) scale(.99); }
    to   { opacity: 1; transform: none; }
}

/* --- LEFT: the form ---------------------------------------------------- */
.login-side {
    padding: 56px 48px 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
    position: relative;

    /* The panel scrolls on its own rather than the page, so the brand panel
       stays put on a short viewport and the register form - the tallest of
       the six - never pushes the card out of the window. */
    overflow-y: auto;
}

.login-side .brand-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 12px;
}
.login-side .brand-mini img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.login-side h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.8px;
    margin-bottom: 8px;
    text-align: center;
}
.login-side .sub {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 28px;
    text-align: center;
    max-width: 380px;
}

/* --- Theme toggle ------------------------------------------------------ */
.theme-toggle {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--divider);
    border-radius: 50%;
    background: var(--field-bg);
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover {
    background: var(--btn2-bg-hover);
    transform: rotate(-18deg);
}

/* The icon is drawn in CSS rather than loaded: two shapes, one masked by a
   pseudo-element to make the crescent. No request, no icon font, and it
   inherits the theme colour. */
.theme-toggle__icon {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text);
    transition: background .2s;
}
.theme-toggle__icon::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--field-bg);
    transition: background .2s, transform .2s, opacity .2s;
}
/* Sun in dark mode (a filled disc), crescent moon in light mode. */
:root[data-theme="dark"] .theme-toggle__icon::after,
.theme-toggle[aria-pressed="true"] .theme-toggle__icon::after {
    opacity: 0;
    transform: scale(.4);
}

/* --- Form ------------------------------------------------------------- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 380px;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--label);
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-group label .optional {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-field);
    font-size: 15px;
    font-family: inherit;
    background: var(--field-bg);
    color: var(--text);
    transition: border-color .2s, background .2s, box-shadow .2s;
    outline: none;
}
.input-group input:focus {
    border-color: var(--accent);
    background: var(--field-bg-focus);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-group input::placeholder {
    color: var(--placeholder);
}
.input-group input:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* Two fields on one row - first and last name on the register form. */
.input-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* A field with a button inside it (the password toggle). Padding on the
   right of the input reserves the space so long text never slides under the
   button. */
.input-with-action {
    position: relative;
    display: flex;
}
.input-with-action input {
    width: 100%;
    padding: 14px 46px 14px 16px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-field);
    font-size: 15px;
    font-family: inherit;
    background: var(--field-bg);
    color: var(--text);
    transition: border-color .2s, background .2s, box-shadow .2s;
    outline: none;
}
.input-with-action input:focus {
    border-color: var(--accent);
    background: var(--field-bg-focus);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-with-action input::placeholder {
    color: var(--placeholder);
}

.pw-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: background .2s, color .2s;
}
.pw-toggle:hover {
    background: var(--btn2-bg-hover);
    color: var(--text);
}

/* An eye drawn from two ellipses; the pressed state adds a slash across it.
   Same reasoning as the theme icon - no request, follows the theme. */
.pw-toggle__icon {
    position: relative;
    width: 18px;
    height: 12px;
    border: 1.6px solid currentColor;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.pw-toggle__icon::before {
    content: '';
    position: absolute;
    inset: 50% auto auto 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    transform: translate(-50%, -50%);
}
.pw-toggle[aria-pressed="true"] .pw-toggle__icon::after {
    content: '';
    position: absolute;
    inset: 50% -2px auto -2px;
    height: 1.6px;
    background: currentColor;
    transform: rotate(-24deg);
}

/* --- Field messages ---------------------------------------------------- */
.input-group.has-error input,
.input-group.has-error .input-with-action input,
.form-row.has-error input {
    border-color: var(--err);
    background: var(--err-bg);
}
.input-group.has-error input:focus,
.input-group.has-error .input-with-action input:focus {
    box-shadow: 0 0 0 4px var(--err-border);
}

.field-error {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--err);
    display: flex;
    gap: 6px;
}
.field-error::before {
    content: '!';
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--card-bg);
    background: var(--err);
    border-radius: 50%;
}

.field-hint {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-soft);
}
.field-hint--warn {
    color: var(--warn);
    font-weight: 500;
}

/* --- Password strength ------------------------------------------------- */
.pw-strength {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}
.pw-strength__track {
    height: 5px;
    border-radius: 99px;
    background: var(--divider);
    overflow: hidden;
}
.pw-strength__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: var(--err);
    transition: width .25s ease, background .25s ease;
}
.pw-strength__label {
    font-size: 12px;
    color: var(--text-soft);
}

/* Score is written to the container by auth.js. Driving the colours from a
   data attribute keeps the score-to-colour mapping in CSS, so the script
   only has to know the number. */
.pw-strength[data-score="0"] .pw-strength__fill { width: 8%;   background: var(--err); }
.pw-strength[data-score="1"] .pw-strength__fill { width: 25%;  background: var(--err); }
.pw-strength[data-score="2"] .pw-strength__fill { width: 50%;  background: var(--warn); }
.pw-strength[data-score="3"] .pw-strength__fill { width: 75%;  background: var(--accent); }
.pw-strength[data-score="4"] .pw-strength__fill { width: 100%; background: var(--ok); }

.pw-strength[data-score="3"] .pw-strength__label,
.pw-strength[data-score="4"] .pw-strength__label { color: var(--ok); }
.pw-strength[data-score="2"] .pw-strength__label { color: var(--warn); }
.pw-strength[data-score="0"] .pw-strength__label,
.pw-strength[data-score="1"] .pw-strength__label { color: var(--err); }

/* --- Row: remember + forgot ------------------------------------------- */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
}
.form-row--stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.form-row .remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.45;
}
.form-row .remember input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.form-row .forgot {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.form-row .forgot:hover { text-decoration: underline; }

/* --- Buttons ---------------------------------------------------------- */
.btn-login {
    background: var(--btn-bg);
    border: none;
    border-radius: var(--radius-field);
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--btn-ink);
    cursor: pointer;
    font-family: inherit;
    transition: background .2s, transform .2s, box-shadow .2s, opacity .2s;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}
.btn-login:hover:not(:disabled) {
    background: var(--btn-bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn);
}
/* The disabled state is set by auth.js on submit, to stop a double post
   arriving after the CSRF token has already rotated. */
.btn-login:disabled {
    opacity: 1;
    cursor: progress;
    transform: none;
}

/* Submit feedback: the spinner and sheen remain visible while authentication
   is being processed, without adding an artificial delay to the request. */
.btn-login[aria-busy="true"] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    background: linear-gradient(110deg, #111827, #27213f, #111827);
    background-size: 220% 100%;
    animation: auth-button-sheen 1.35s ease-in-out infinite;
}

.btn-login[aria-busy="true"]::before {
    content: "";
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-button-spin .7s linear infinite;
}

@keyframes auth-button-spin {
    to { transform: rotate(360deg); }
}

@keyframes auth-button-sheen {
    0%, 100% { background-position: 100% 50%; }
    50% { background-position: 0 50%; }
}

.link-button {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
}
.link-button:hover { border-color: var(--text); }

.divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin: 4px 0;
}
.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--divider);
}

.btn-google {
    background: var(--btn2-bg);
    border: 1px solid var(--btn2-border);
    border-radius: var(--radius-field);
    padding: 14px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background .2s, border-color .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.btn-google__mark {
    font-size: 18px;
    font-weight: 700;
    color: #db4437;
}
.btn-google:hover {
    background: var(--btn2-bg-hover);
    border-color: var(--divider);
}

.signup-cta {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}
.signup-cta a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--divider);
}
.signup-cta a:hover { border-color: var(--text); }

/* --- Alerts ----------------------------------------------------------- */
.alert-stack {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-field);
    border: 1px solid var(--divider);
    background: var(--field-bg);
    font-size: 13.5px;
    line-height: 1.55;
    animation: alert-in .28s ease both;
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* The dot carries the status colour. Colour alone is never the only signal -
   the message text always says what happened, and the dot is decorative
   (aria-hidden) so a screen reader is not told about a shape. */
.alert__dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: currentColor;
}
.alert__text { flex: 1; }

.alert--success { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-border); }
.alert--error   { color: var(--err);  background: var(--err-bg);  border-color: var(--err-border); }
.alert--warning { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.alert--info    { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }

/* --- Development-only link ------------------------------------------- */
/* Rendered only in development and only when mail is unconfigured - the guard
   is in MailService::devLink(). Styled to look like a tool, not a feature. */
.dev-link {
    width: 100%;
    max-width: 380px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #e2bd62;
    border-radius: var(--radius-field);
    background: linear-gradient(135deg, #fffaf0 0%, #ffefc8 100%);
    color: #5f4108;
    font-size: 13px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 22px -18px rgba(95, 65, 8, .65);
}
.dev-link strong {
    color: #7a4d00;
    text-transform: uppercase;
    letter-spacing: .7px;
    font-size: 11px;
    font-weight: 800;
}
.dev-link span {
    color: #674b18;
    font-weight: 500;
}
.dev-link a {
    color: #075fc9;
    font-weight: 650;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.dev-link a:hover { color: #034a9f; }

:root[data-theme="dark"] .dev-link {
    background: linear-gradient(135deg, #302817 0%, #211c13 100%);
    border-color: #765d28;
    color: #f4d68e;
}
:root[data-theme="dark"] .dev-link strong { color: #ffd77d; }
:root[data-theme="dark"] .dev-link span { color: #e8cf99; }
:root[data-theme="dark"] .dev-link a { color: #82bdff; }

/* --- Notice panel (verification screen) ------------------------------ */
.notice-panel {
    width: 100%;
    max-width: 380px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}
.notice-panel__icon {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
}
.notice-panel__lead { font-size: 15px; color: var(--text); }
.notice-panel__body { font-size: 13.5px; line-height: 1.6; color: var(--text-muted); }

/* --- Captcha slot ---------------------------------------------------- */
/* The provider renders an iframe of its own size; this only reserves the
   space and keeps it from overflowing a narrow panel. */
.captcha-slot {
    display: flex;
    justify-content: center;
    min-height: 78px;
    overflow: hidden;
}

/* --- RIGHT: brand showcase ------------------------------------------- */
.brand-side {
    background-color: #00102f;
    background-image: linear-gradient(var(--brand-overlay-top), var(--brand-overlay-bottom)),
                      url('../images/login-vault.png');
    background-size: cover;
    background-position: center;
    padding: 56px 48px 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    border-left: 1px solid var(--divider-soft);
    position: relative;
    color: var(--brand-ink);
}

.brand-header {
    position: absolute;
    top: 36px;
    left: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-header img { width: 58px; height: 58px; object-fit: contain; }
.brand-header strong {
    display: block;
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -.5px;
}
.brand-header small {
    display: block;
    margin-top: 5px;
    color: var(--brand-ink-dim);
    font-size: 11px;
    letter-spacing: .2px;
}

.brand-side .big-icon {
    color: var(--accent);
    margin-bottom: 20px;
    opacity: .9;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.brand-side h2 {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
}
.brand-side h2 span { color: var(--accent); }
.brand-side p {
    font-size: 17px;
    color: var(--brand-ink-soft);
    line-height: 1.6;
    margin-top: 16px;
    max-width: 90%;
}

.brand-side .trust-badge {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px 36px;
}
.brand-side .trust-badge .item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}
/* A tick drawn with two borders rather than a character, so it renders
   identically everywhere - an emoji tick does not. */
.brand-side .trust-badge .item__tick {
    flex: 0 0 auto;
    width: 16px;
    height: 9px;
    border-left: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(-45deg) translateY(-2px);
}

.brand-foot {
    position: absolute;
    bottom: 28px;
    left: 56px;
    right: 48px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 11.5px;
    color: var(--brand-ink-dim);
}

/* -------------------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .login-side { padding: 40px 32px 40px 40px; }
    .brand-side { padding: 40px 32px 40px 40px; }
    .brand-side h2 { font-size: 34px; }
    .brand-foot { left: 40px; right: 32px; }
}

@media (max-width: 820px) {
    body {
        height: auto;
        min-height: 100dvh;
        overflow-y: auto;
        align-items: flex-start;
    }
    .vault-wrapper {
        grid-template-columns: 1fr;
        border-radius: 32px;
        height: auto;
    }
    .login-side {
        padding: 40px 32px 32px 32px;
        overflow: visible;
    }
    .login-side h1 { font-size: 30px; }

    /* The brand panel moves below the form on a narrow screen: the form is
       what the visitor came for, and pushing it below a full-height
       marketing panel would mean scrolling past the product to sign in. */
    .brand-side {
        order: 2;
        border-left: none;
        border-top: 1px solid var(--divider-soft);
        padding: 88px 32px 78px 32px;
        align-items: center;
        text-align: center;
    }
    .brand-header { top: 24px; left: 24px; text-align: left; }
    .brand-side .trust-badge { justify-content: center; }
    .brand-side h2 { font-size: 30px; }
    .brand-foot {
        left: 24px;
        right: 24px;
        bottom: 22px;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    body { padding: 12px; }
    .vault-wrapper { border-radius: 24px; }
    .login-side { padding: 28px 20px 24px 20px; }
    .login-side h1 { font-size: 26px; }
    .theme-toggle { top: 14px; right: 14px; }
    .brand-side { padding: 80px 20px 72px 20px; }
    .brand-side h2 { font-size: 24px; }
    .login-form, .alert-stack, .dev-link, .notice-panel { max-width: 100%; }
    .input-pair { grid-template-columns: 1fr; }
}

/* A short, wide window - a laptop with the browser not maximised. Tightens
   the vertical rhythm rather than letting the card scroll. */
@media (min-width: 821px) and (max-height: 780px) {
    .login-side,
    .brand-side { padding-top: 28px; padding-bottom: 28px; }
    .login-side .brand-mini { margin-bottom: 6px; }
    .login-side .brand-mini img { width: 56px; height: 56px; }
    .login-side h1 { font-size: 30px; }
    .login-side .sub { margin-bottom: 18px; }
    .login-form { gap: 13px; }
    .input-group input,
    .input-with-action input { padding-top: 11px; padding-bottom: 11px; }
    .btn-login { padding: 13px; }
    .btn-google { padding: 11px; }
    .signup-cta { margin-top: 8px; }
    .alert-stack { margin-bottom: 12px; }
}

/* -------------------------------------------------------------------------
   REDUCED MOTION
   -------------------------------------------------------------------------
   Honoured rather than treated as optional. The floating icon and the card
   entrance are decorative, and for a visitor with vestibular sensitivity
   movement of that kind can cause genuine nausea - so everything animated
   here is switched off, not merely shortened.
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .theme-toggle:hover { transform: none; }
    .btn-login:hover:not(:disabled) { transform: none; }
}

/* -------------------------------------------------------------------------
   ORIGINAL SIGN-IN PRESENTATION
   Scoped to the login route so the richer controls on registration, password
   recovery and password-change screens keep their existing layout.
   ------------------------------------------------------------------------- */
.login-reference-page {
    color-scheme: light;
    --card-bg: #ffffff;
    --field-bg: #fafafa;
    --field-bg-focus: #ffffff;
    --divider: #e0e0e0;
    --divider-soft: #e8e4de;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-soft: #8a8a8a;
    --label: #2c2c2c;
    --placeholder: #b0b0b0;
    --accent: #2a7de1;
    --accent-soft: rgba(42, 125, 225, .06);
    --btn-bg: #1a1a1a;
    --btn-bg-hover: #2c2c2c;
    --btn-ink: #ffffff;
    --btn2-bg: #f5f5f5;
    --btn2-bg-hover: #eeeeee;
    --btn2-border: #e0e0e0;
}

.login-reference-page .theme-toggle,
.login-reference-page .pw-toggle,
.login-reference-page .brand-foot {
    display: none;
}

.login-reference-page .login-side .sub {
    margin-bottom: 36px;
}

.login-reference-page .login-form {
    max-width: 360px;
    gap: 20px;
}

.login-reference-page .input-with-action input {
    padding-right: 16px;
}

.login-reference-page .signup-cta {
    margin-top: 16px;
    text-align: left;
}

.login-reference-page .brand-side .big-icon {
    margin-bottom: 24px;
    animation: none;
}

.login-reference-page .big-icon__legacy {
    display: block;
    font-size: 72px;
    line-height: 1;
}

/* Password reset uses the same clean light presentation as sign-in/forgot,
   while keeping its slightly denser two-password form balanced in the card. */
.reset-reference-page .login-side .sub {
    margin-bottom: 26px;
}

.reset-reference-page .login-form {
    gap: 15px;
}

.reset-reference-page .signup-cta {
    margin-top: 10px;
    text-align: center;
}

.reset-reference-page .field-hint {
    color: #667085;
    line-height: 1.5;
}

.reset-reference-page .pw-strength__track {
    background: #e3e7ee;
}

@media (max-width: 820px) {
    .login-reference-page .brand-side {
        padding: 32px 32px 36px;
    }
}

@media (max-width: 480px) {
    .login-reference-page .brand-side {
        padding: 24px 20px 28px;
    }
    .login-reference-page .big-icon__legacy {
        font-size: 52px;
    }
}

@media (min-width: 821px) and (max-height: 760px) {
    .login-reference-page .login-side .sub {
        margin-bottom: 20px;
    }
    .login-reference-page .login-form {
        gap: 14px;
    }
}

/* Registration has more controls than sign-in. On a normal desktop viewport
   its vertical rhythm is tightened just enough to keep the complete form in
   view, without introducing an inner panel scrollbar. */
@media (min-width: 821px) and (min-height: 761px) {
    .register-reference-page .login-side {
        padding-top: 22px;
        padding-bottom: 22px;
        overflow-y: hidden;
    }

    .register-reference-page .login-side .brand-mini {
        margin-bottom: 4px;
    }

    .register-reference-page .login-side .brand-mini img {
        width: 52px;
        height: 52px;
    }

    .register-reference-page .login-side h1 {
        font-size: 30px;
        margin-bottom: 4px;
    }

    .register-reference-page .login-side .sub {
        margin-bottom: 18px;
    }

    .register-reference-page .login-form {
        gap: 11px;
    }

    .register-reference-page .input-group,
    .register-reference-page .pw-strength {
        gap: 4px;
    }

    .register-reference-page .input-group input,
    .register-reference-page .input-with-action input {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .register-reference-page .field-hint,
    .register-reference-page .field-error {
        line-height: 1.35;
    }

    .register-reference-page .btn-login {
        padding: 12px;
        margin-top: 2px;
    }

    .register-reference-page .signup-cta {
        margin-top: 5px;
    }
}

@media (max-width: 820px) {
    .register-reference-page .login-side {
        overflow: visible;
    }
}

/* Sign-in includes the optional Google action and can also show a flash alert.
   Fit that complete state inside the desktop card without an inner scrollbar. */
@media (min-width: 821px) {
    .sign-in-page .login-side {
        padding-top: 26px;
        padding-bottom: 26px;
        overflow-y: hidden;
    }

    .sign-in-page .login-side .brand-mini {
        margin-bottom: 5px;
    }

    .sign-in-page .login-side .brand-mini img {
        width: 56px;
        height: 56px;
    }

    .sign-in-page .login-side h1 {
        font-size: 30px;
        margin-bottom: 4px;
    }

    .sign-in-page .login-side .sub {
        margin-bottom: 18px;
    }

    .sign-in-page .alert-stack {
        margin-bottom: 12px;
    }

    .sign-in-page .alert {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .sign-in-page .login-form {
        gap: 13px;
    }

    .sign-in-page .input-group input,
    .sign-in-page .input-with-action input {
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .sign-in-page .btn-login {
        padding: 13px;
        margin-top: 3px;
    }

    .sign-in-page .btn-google {
        padding: 11px;
    }

    .sign-in-page .signup-cta {
        margin-top: 8px;
    }
}

@media (max-width: 820px) {
    .sign-in-page .login-side {
        overflow: visible;
    }
}
