/* ==========================================================================
   DN WMS — Authentication screen (v4)
   One full-bleed washed ground, the same one the institution websites use, and
   a single centred sign-in card on it.
   Loaded AFTER bootstrap.min.css + mdb.min.css, so it wins on purpose.
   ========================================================================== */

:root {
    /* Ink ---------------------------------------------------------------- */
    --a-ink: #131B2E; /* headings, input text            */
    --a-ink-2: #46506A; /* body, labels            8.0:1  */
    --a-muted: #676F8C; /* placeholder, footnotes  4.6:1  */

    /* Structure ---------------------------------------------------------- */
    --a-surface: #FFFFFF;
    --a-line: #E4E7EE; /* hairlines                       */
    --a-line-strong: #CFD5E1; /* hover hairlines                 */

    /* Brand -------------------------------------------------------------- */
    /* The action colour is the console's primary (--al-brand elsewhere in the
       admin UI); hardcoded here because the login page loads none of the
       stylesheets that define it, and dark-mode.css would lighten it below
       the contrast this button needs. */
    --a-navy: #16234A; /* display ink, focus ring         */
    --a-brand: #0E76BD; /* the single action colour 4.8:1  */
    --a-brand-600: #0A5C96;
    --a-brand-700: #084A79;

    /* Semantic ----------------------------------------------------------- */
    --a-danger: #B42318;
    --a-danger-bg: #FEF3F2;
    --a-danger-line: #FDA29B;
    --a-warn: #B54708;
    --a-warn-bg: #FFFAEB;
    --a-warn-line: #FEC84B;
    --a-success: #067647;
    --a-success-bg: #ECFDF3;
    --a-success-line: #75E0A7;
    --a-info: #175CD3;
    --a-info-bg: #EFF8FF;
    --a-info-line: #84CAFF;

    /* Space (4 / 8) ------------------------------------------------------ */
    --a-1: 4px;
    --a-2: 8px;
    --a-3: 12px;
    --a-4: 16px;
    --a-5: 24px;
    --a-6: 32px;
    --a-7: 48px;

    --a-r: 8px;
    --a-r-lg: 16px;

    --a-ease: cubic-bezier(.4, 0, .2, 1);
    --a-ease-out: cubic-bezier(.16, 1, .3, 1); /* exponential settle */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

html,
body {
    height: 100%;
}

body.auth-body {
    margin: 0;
    background-color: #FCFCFD;
    color: var(--a-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Browser surfaces — the parts we did not draw still belong to the design. */
.auth ::selection {
    background: rgba(14, 118, 189, .16);
    color: var(--a-ink);
}

.auth {
    caret-color: var(--a-brand);
    accent-color: var(--a-brand);
}

.auth :focus-visible {
    outline: 2px solid var(--a-navy);
    outline-offset: 2px;
    border-radius: 4px;
}

.auth * {
    scrollbar-width: thin;
    scrollbar-color: var(--a-line-strong) transparent;
}

.auth ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.auth ::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 99px;
    background: var(--a-line-strong);
    background-clip: content-box;
}

.auth ::-webkit-scrollbar-thumb:hover {
    background: var(--a-muted);
    background-clip: content-box;
}

/* Skip link -------------------------------------------------------------- */
.auth-skip {
    position: absolute;
    left: var(--a-4);
    top: -100px;
    z-index: 200;
    padding: 10px var(--a-4);
    border-radius: var(--a-r);
    background: var(--a-navy);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: top .18s var(--a-ease);
}

.auth-skip:focus {
    top: var(--a-4);
    color: #fff;
    text-decoration: none;
}

/* ==========================================================================
   Stage — the washed ground fills the viewport; one centred stack sits on it
   ========================================================================== */
.auth {
    display: grid;
    /* "safe" so a tall render — server alert plus both field errors on a short
       window — overflows downward only, instead of pushing the wordmark above
       the scroll origin where it cannot be reached. */
    align-content: safe center;
    justify-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--a-7) var(--a-5);
    background-color: #FCFCFD;
    background-image:
            radial-gradient(42% 46% at 82% 14%, rgba(168, 138, 209, .58), rgba(168, 138, 209, 0) 68%),
            radial-gradient(20% 26% at 99% 0%, rgba(146, 116, 199, .58), rgba(146, 116, 199, 0) 72%),
            radial-gradient(46% 50% at 16% 10%, rgba(141, 161, 206, .44), rgba(141, 161, 206, 0) 70%),
            radial-gradient(56% 40% at 50% 99%, rgba(192, 158, 174, .24), rgba(192, 158, 174, 0) 72%);
    background-repeat: no-repeat;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    /* The one authored moment: the whole stack settles once, exponentially. */
    animation: auth-settle .5s var(--a-ease-out) both;
}

@keyframes auth-settle {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Brandmark above the card ----------------------------------------------- */
.auth-mark {
    text-align: center;
    margin-bottom: var(--a-5);
}

.auth-mark img {
    display: inline-block;
    width: 152px;
    height: auto;
    aspect-ratio: 300 / 87;
}

.auth-tagline {
    margin: var(--a-3) 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--a-ink-2);
    text-wrap: balance;
}

/* Card ------------------------------------------------------------------- */
.auth-card {
    padding: var(--a-6);
    border: 1px solid var(--a-line);
    border-radius: var(--a-r-lg);
    background: var(--a-surface);
    box-shadow:
            0 1px 2px rgba(16, 24, 40, .05),
            0 16px 40px -16px rgba(19, 27, 46, .20);
}

.auth-title {
    margin: 0 0 var(--a-2);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.022em;
    text-align: center;
    color: var(--a-ink);
    text-wrap: balance;
}

.auth-sub {
    margin: 0 0 var(--a-6);
    font-size: 15px;
    text-align: center;
    color: var(--a-ink-2);
}

/* Alerts ----------------------------------------------------------------- */
.auth-card .alert {
    position: relative;
    margin: 0 0 var(--a-5);
    padding: 11px var(--a-3) 11px 38px;
    border: 1px solid transparent;
    border-radius: var(--a-r);
    font-size: 14px !important;
    line-height: 1.5;
    text-align: left;
    box-shadow: none;
}

.auth-card .alert::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 13px;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask: var(--a-alert-icon) center / contain no-repeat;
    mask: var(--a-alert-icon) center / contain no-repeat;
}

.auth-card .alert-danger,
.auth-card .alert-warning,
.auth-card .alert-info {
    --a-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
}

.auth-card .alert-success {
    --a-alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12.3 2.4 2.4 4.6-4.9'/%3E%3C/svg%3E");
}

.auth-card .alert-danger {
    color: var(--a-danger);
    background: var(--a-danger-bg);
    border-color: var(--a-danger-line);
}

.auth-card .alert-success {
    color: var(--a-success);
    background: var(--a-success-bg);
    border-color: var(--a-success-line);
}

.auth-card .alert-info {
    color: var(--a-info);
    background: var(--a-info-bg);
    border-color: var(--a-info-line);
}

.auth-card .alert-warning {
    color: var(--a-warn);
    background: var(--a-warn-bg);
    border-color: var(--a-warn-line);
}

/* Fields ----------------------------------------------------------------- */
.field {
    margin-bottom: var(--a-5);
}

.field > label {
    display: block;
    margin: 0 0 6px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--a-ink-2);
}

.field__shell {
    position: relative;
    display: flex;
    align-items: center;
}

.field input {
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0 var(--a-3);
    border: 1px solid var(--a-line);
    border-radius: var(--a-r);
    background: var(--a-surface);
    color: var(--a-ink);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: border-color .15s var(--a-ease), box-shadow .15s var(--a-ease);
}

#password {
    padding-right: 44px;
}

.field input::placeholder {
    color: var(--a-muted);
}

.field input:hover:not(:focus) {
    border-color: var(--a-line-strong);
}

.field input:focus {
    outline: none;
    border-color: var(--a-navy);
    box-shadow: 0 0 0 3px rgba(22, 35, 74, .11);
}

/* Chrome paints autofill with its own sheet; keep the field white. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--a-ink);
    caret-color: var(--a-brand);
    -webkit-box-shadow: 0 0 0 40px var(--a-surface) inset, 0 1px 2px rgba(16, 24, 40, .04);
    box-shadow: 0 0 0 40px var(--a-surface) inset, 0 1px 2px rgba(16, 24, 40, .04);
}

.field input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 40px var(--a-surface) inset, 0 0 0 3px rgba(22, 35, 74, .11);
    box-shadow: 0 0 0 40px var(--a-surface) inset, 0 0 0 3px rgba(22, 35, 74, .11);
}

/* Password visibility ---------------------------------------------------- */
.field__toggle {
    position: absolute;
    right: 5px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--a-muted);
    cursor: pointer;
    transition: color .15s var(--a-ease), background-color .15s var(--a-ease);
}

.field__toggle:hover {
    color: var(--a-ink);
    background: #F2F4F7;
}

.field__toggle svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
}

.field__toggle .icon-eye-off {
    display: none;
}

.field__toggle[aria-pressed="true"] .icon-eye {
    display: none;
}

.field__toggle[aria-pressed="true"] .icon-eye-off {
    display: block;
}

/* Inline validation ------------------------------------------------------ */
/* jQuery Validate appends <div class="error"> into .field__error and toggles
   it with .hide()/.show(), so every piece of error chrome lives on .error
   itself — otherwise the icon lingers after the message is cleared. */
.field__error .error {
    position: relative;
    margin: 6px 0 0;
    padding-left: 20px;
    font-size: 13px !important;
    font-weight: 500;
    line-height: 1.45;
    color: var(--a-danger) !important;
}

.field__error .error::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 14px;
    height: 14px;
    background-color: var(--a-danger);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.field input.error,
.field input.error:hover {
    border-color: var(--a-danger-line);
}

.field input.error:focus {
    border-color: var(--a-danger);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}

/* Caps Lock — warns before the attempt fails, not after. */
.field__hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--a-warn);
}

.field__hint.is-on {
    display: flex;
}

.field__hint svg {
    flex: none;
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

/* Submit ----------------------------------------------------------------- */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--a-2);
    width: 100%;
    height: 42px;
    margin: var(--a-6) 0 0;
    padding: 0 var(--a-5);
    border: 0;
    border-radius: var(--a-r);
    background: var(--a-brand);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.004em;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .10);
    transition: background-color .15s var(--a-ease), box-shadow .15s var(--a-ease), transform .1s var(--a-ease);
}

.btn-login:hover:not(:disabled) {
    background: var(--a-brand-600);
    box-shadow: 0 2px 6px rgba(10, 92, 150, .26);
}

.btn-login:active:not(:disabled) {
    background: var(--a-brand-700);
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .10);
}

.btn-login:disabled {
    opacity: .65;
    cursor: not-allowed;
    box-shadow: none;
}

/* Bootstrap's spinner, which showButtonLoader() injects on submit. */
.btn-login .spinner-border {
    width: 15px;
    height: 15px;
    border-width: 2px;
}

/* Foot ------------------------------------------------------------------- */
.auth-foot {
    margin: var(--a-5) 0 0;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    color: var(--a-muted);
}

.auth-foot .company-name {
    font-weight: 500;
    color: var(--a-ink-2);
    text-decoration: none;
}

.auth-foot a.company-name:hover,
.auth-foot a.company-name:focus-visible {
    color: var(--a-brand);
    text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 575.98px) {
    .auth {
        padding: var(--a-6) var(--a-4) var(--a-7);
    }

    .auth-card {
        padding: var(--a-5);
    }

    .auth-title {
        font-size: 23px;
    }

    /* 16px keeps iOS from zooming the viewport on focus. */
    .field input {
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .auth-mark img {
        width: 136px;
    }

    .auth-title {
        font-size: 22px;
    }
}

/* Short viewports: scroll rather than crush the card. */
@media (max-height: 700px) {
    .auth {
        align-content: start;
        padding-block: var(--a-6);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell {
        animation: none;
    }

    .auth-skip,
    .field input,
    .field__toggle,
    .btn-login {
        transition-duration: .01ms;
    }

    .btn-login:active:not(:disabled) {
        transform: none;
    }
}

@media (forced-colors: active) {
    .field input {
        border: 1px solid CanvasText;
    }

    .btn-login {
        border: 1px solid ButtonText;
    }
}
