/* =====================================================================
   dm-auth.css - the pre-authentication screens: sign in, forgot password,
   reset password and the forced change-password gate.

   All four previously carried their OWN copy of this stylesheet inline --
   .login-card, .login-field, .login-input, .btn-login, .login-footer,
   .toggle-password, and a .switch/.slider toggle copied from the Home
   screen. Four copies, in the leaf palette (#8EB69B, #DAF1DE, #0B2B26),
   drifting apart. This is the one copy, in tokens.

   Scoped under body.dm-themed like every other file here, and built only
   from dm-theme.css's tokens. The single exception is documented at the
   splash, which is a brand artwork rather than a themed surface.
   ===================================================================== */

body.dm-themed.dm-auth-page {
    min-height: 100vh;
    margin: 0;
    /* The signed-in app is a flowing page; this one centres a single card, so
       it opts out of the shell's layout entirely. */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-darkest);
}

/* Bottom-right rather than the top bar, which does not exist here. */
body.dm-themed .dm-auth-theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10;
}

body.dm-themed .dm-auth-wrap { width: 100%; max-width: 420px; }

body.dm-themed .dm-auth-card {
    padding: 38px 34px 30px;
    border-radius: var(--radius-card);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-overlay);
}

/* ---- Brand block ----------------------------------------------------- */
body.dm-themed .dm-auth-brand { text-align: center; margin-bottom: 26px; }
body.dm-themed .dm-auth-mark {
    width: 62px; height: 62px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px;
    /* The one place orange does its job: a mark, not text on a fill. */
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-line);
}
body.dm-themed .dm-auth-brand h2 { margin: 0; font-size: 23px; font-weight: 600; color: var(--text); }
body.dm-themed .dm-auth-brand p  { margin: 7px 0 0; font-size: 13.5px; color: var(--text-muted); }

/* ---- Fields ----------------------------------------------------------
   The icon sits inside the field, so the input carries left padding rather
   than the icon being a prefix box. ---------------------------------- */
body.dm-themed .dm-auth-field { margin-bottom: 17px; }
body.dm-themed .dm-auth-field > label {
    display: block; margin-bottom: 6px;
    font-size: 13px; color: var(--text-muted);
}
body.dm-themed .dm-auth-input { position: relative; }
body.dm-themed .dm-auth-input .dm-auth-icon {
    position: absolute; top: 50%; left: 14px;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 14px;
    pointer-events: none;
}
body.dm-themed .dm-auth-input input {
    width: 100%;
    padding: 12px 42px 12px 40px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 15px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
body.dm-themed .dm-auth-input input::placeholder { color: var(--text-dim); }
body.dm-themed .dm-auth-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Chrome and Edge paint their own pale-blue ground over an autofilled field,
   which on a dark surface is unreadable. There is no way to set the colour
   directly, so the standard workaround: an inset box-shadow the size of the
   field, plus -webkit-text-fill-color for the ink. */
body.dm-themed .dm-auth-input input:-webkit-autofill,
body.dm-themed .dm-auth-input input:-webkit-autofill:hover,
body.dm-themed .dm-auth-input input:-webkit-autofill:focus,
body.dm-themed .dm-auth-input input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
    box-shadow: 0 0 0 1000px var(--surface-2) inset;
    transition: background-color 9999s ease-in-out 0s;
}

/* Edge draws its own reveal/clear buttons inside a password field, which would
   sit alongside the custom eye and give two of them. */
body.dm-themed .dm-auth-input input::-ms-reveal,
body.dm-themed .dm-auth-input input::-ms-clear { display: none; }

body.dm-themed .dm-auth-reveal {
    position: absolute; top: 50%; right: 10px;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer; padding: 6px;
    border-radius: 6px;
}
body.dm-themed .dm-auth-reveal:hover { color: var(--accent); background: var(--hover); }
body.dm-themed .dm-auth-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Options row: remember-me toggle + forgot link ------------------- */
body.dm-themed .dm-auth-options {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin: 6px 0 22px;
    font-size: 13.5px;
}
body.dm-themed .dm-auth-remember {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); cursor: pointer; user-select: none;
}
/* dm-theme.css already ships .dm-switch / .dm-slider -- the same component the
   Home screen's toggles use -- so the login page's private copy of it is gone
   rather than re-tokenised. */

/* ---- Submit ---------------------------------------------------------- */
body.dm-themed .dm-auth-submit { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

body.dm-themed .dm-auth-footer {
    text-align: center; margin-top: 20px;
    font-size: 13.5px; color: var(--text-muted);
}

/* ---- Validation -----------------------------------------------------
   asp-validation-summary and asp-validation-for emit these two class names;
   they are MVC's, not ours, so they are styled rather than renamed. ---- */
body.dm-themed .validation-summary-errors ul {
    list-style: none; padding: 0; margin: 0 0 14px;
    color: var(--danger); font-size: 13.5px; text-align: center;
}
body.dm-themed .field-validation-error {
    display: block; margin-top: 5px;
    color: var(--danger); font-size: 12.5px;
}

/* A neutral message block: "we have sent you a link", "your password is set". */
body.dm-themed .dm-auth-message {
    margin-bottom: 16px; padding: 11px 14px;
    border-radius: 10px;
    background: var(--info-soft);
    border: 1px solid var(--info);
    color: var(--text);
    font-size: 13.5px;
}
body.dm-themed .dm-auth-message.is-invalid {
    background: var(--danger-soft);
    border-color: var(--danger);
}

/* =====================================================================
   Sign-in splash

   Covers the page between submit and the Home screen, which is a genuinely
   long wait: the server authenticates and then loads the whole customer
   document list from Intacct.

   THIS IS THE ONE PLACE IN THE dm-* STYLESHEETS THAT USES COLOUR LITERALS,
   and it is deliberate. The splash is brand artwork, not a themed surface:
   it is a fixed, full-bleed navy field with the logo and an orange halo,
   and it must look identical whichever theme the visitor is on -- a light
   -theme splash would be a white flash between two dark screens. The values
   are the Kiteview brand navy and orange.

   The logo sits on a white card (2026-11-09 redesign, option A): its navy
   wordmark disappears on the navy field, which is what the old version did.
   ===================================================================== */
body.dm-themed .dm-auth-splash {
    position: fixed; inset: 0; z-index: 9999;
    display: none;
    flex-direction: column; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
    text-align: center; overflow: hidden;
    background: radial-gradient(120% 90% at 30% 0%, #17415E 0%, #0C2A3E 48%, #071926 100%);
}
body.dm-themed .dm-auth-splash.show { display: flex; }

/* Faint technical grid, masked to a soft centre vignette. */
body.dm-themed .dm-auth-splash .splash-grid {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(rgba(120, 180, 220, 0.06) 1px, transparent 1px) 0 0 / 100% 38px,
                linear-gradient(90deg, rgba(120, 180, 220, 0.06) 1px, transparent 1px) 0 0 / 38px 100%;
    -webkit-mask: radial-gradient(70% 60% at 50% 42%, #000 0%, transparent 78%);
            mask: radial-gradient(70% 60% at 50% 42%, #000 0%, transparent 78%);
}
/* The white card: logo, an indeterminate orange bar, then the message. */
body.dm-themed .dm-auth-splash .splash-card {
    position: relative;
    width: min(520px, 100%); box-sizing: border-box;
    padding: 44px 48px 36px;
    display: flex; flex-direction: column; align-items: center; gap: 26px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.65);
    animation: dmSplashRise 0.45s ease-out both;
}
body.dm-themed .dm-auth-splash .splash-logo {
    width: min(330px, 100%); height: auto; display: block;
}
body.dm-themed .dm-auth-splash .splash-bar {
    width: 100%; height: 4px; border-radius: 2px; overflow: hidden;
    background: rgba(1, 71, 107, 0.10);
}
body.dm-themed .dm-auth-splash .splash-bar span {
    display: block; width: 40%; height: 100%; border-radius: 2px;
    background: #F47C20;
    animation: dmSplashBar 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
body.dm-themed .dm-auth-splash .splash-text { display: flex; flex-direction: column; gap: 4px; }
body.dm-themed .dm-auth-splash .splash-text p {
    margin: 0; font-size: 13.5px; line-height: 1.55;
    color: rgba(10, 30, 43, 0.68);
    text-wrap: balance;
}
body.dm-themed .dm-auth-splash .splash-text .splash-title {
    font-size: 16px; font-weight: 600; color: #0A1E2B;
}
@media (max-width: 480px) {
    body.dm-themed .dm-auth-splash .splash-card { padding: 32px 24px 28px; }
}

@keyframes dmSplashBar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}
@keyframes dmSplashRise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    body.dm-themed .dm-auth-splash .splash-card,
    body.dm-themed .dm-auth-splash .splash-bar span { animation: none; }
}
