/* ==========================================================================
   Pulse Operations · staff sign-in

   Scoped entirely to `body.staff-login-page`, so nothing here reaches the rest
   of Pulse Operations or Pulse Portal. The page is a sibling of the Pulse
   Portal login — same two-column skeleton, same eyebrow/rule motif, same field
   and submit anatomy — but it leads with charcoal instead of paper: the left
   rail restates the authenticated staff shell (charcoal surface, canonical
   logo on an off-white plate, gold/green rule) so signing in reads as stepping
   into the operations app rather than into a customer portal.

   Every selector is prefixed with the page scope on purpose. The staff theme
   in pulse.css styles bare `h1`-`h6`, `input`, and `:focus-visible` through
   `.pulse-operations :is(...)` groups that resolve to (0,2,x) specificity, so
   a page-scoped prefix is what keeps these component rules authoritative
   without editing the shared stylesheet.
   ========================================================================== */

body.staff-login-page {
    /* Working Ideal Freight palette. */
    --brand-charcoal: #252525;
    --brand-gold: #c18a2b;
    --brand-green: #1f5a3b;
    --brand-off-white: #f5f1e8;
    --brand-sand: #d8c9b2;

    --staff-ink: var(--brand-charcoal);
    --staff-ink-muted: #514c45;
    --staff-ink-light: #655f56;
    --staff-accent: var(--brand-gold);
    --staff-heritage: var(--brand-green);
    --staff-line: var(--brand-sand);
    --staff-warm: var(--brand-off-white);
    --staff-paper: #fffdf9;

    /* Reversed-out tones for the charcoal rail. */
    --staff-rail: var(--brand-charcoal);
    --staff-rail-text: var(--brand-off-white);
    --staff-rail-muted: rgba(245, 241, 232, 0.74);
    --staff-rail-line: rgba(216, 201, 178, 0.22);

    display: block;
    min-height: 100vh;
    padding: 0;
    background: var(--staff-warm);
    color: var(--staff-ink);
}

body.staff-login-page .staff-login-shell {
    display: grid;
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 46px) clamp(16px, 4vw, 52px);
    place-items: center;
}

/* One card, two halves ----------------------------------------------------- */

body.staff-login-page .staff-login-card {
    position: relative;
    display: grid;
    overflow: hidden;
    width: min(100%, 1180px);
    border: 1px solid var(--staff-line);
    border-radius: 12px;
    background: var(--staff-paper);
    box-shadow: 0 28px 68px rgba(37, 37, 37, 0.17);
}

/* The gold/green rule carried by the authenticated staff sidebar, spanning
   both halves so the card reads as one surface. */
body.staff-login-page .staff-login-card::before {
    position: absolute;
    z-index: 1;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--staff-accent) 0 72%,
        var(--staff-heritage) 72% 100%
    );
    content: "";
}

/* Charcoal half ------------------------------------------------------------ */

body.staff-login-page .staff-login-rail {
    display: grid;
    padding: clamp(26px, 3vw, 42px);
    align-content: start;
    gap: clamp(20px, 2.2vw, 30px);
    background: var(--staff-rail);
    color: var(--staff-rail-text);
}

body.staff-login-page .staff-login-rail__head {
    padding-top: 4px;
}

/* The canonical logo is charcoal artwork, so it keeps the same off-white
   plate it sits on inside the app sidebar. Width-only sizing preserves its
   native aspect ratio; it is never recolored or reproportioned. */
body.staff-login-page .staff-login-logo {
    display: block;
    width: clamp(186px, 17.5vw, 232px);
    height: auto;
    padding: 11px 14px;
    border: 1px solid rgba(216, 201, 178, 0.5);
    border-radius: 8px;
    background: var(--staff-warm);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

body.staff-login-page .staff-login-eyebrow,
body.staff-login-page .staff-login-panel__eyebrow {
    display: flex;
    margin: 0;
    align-items: center;
    gap: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    line-height: 1.4;
    text-transform: uppercase;
}

body.staff-login-page .staff-login-eyebrow::after,
body.staff-login-page .staff-login-panel__eyebrow::after {
    width: 42px;
    height: 2px;
    background: var(--staff-accent);
    content: "";
}

body.staff-login-page .staff-login-eyebrow {
    color: var(--staff-accent);
}

body.staff-login-page .staff-login-rail__intro h2 {
    max-width: 16ch;
    margin: 14px 0 12px;
    color: var(--staff-rail-text);
    font-size: clamp(28px, 2.9vw, 40px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.07;
}

body.staff-login-page .staff-login-lede {
    max-width: 48ch;
    margin: 0;
    color: var(--staff-rail-muted);
    font-size: 15px;
    line-height: 1.6;
}

body.staff-login-page .staff-login-capabilities {
    display: grid;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--staff-rail-line);
    list-style: none;
}

body.staff-login-page .staff-login-capability {
    display: grid;
    padding: 12px 0;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 15px;
    align-items: start;
    border-bottom: 1px solid var(--staff-rail-line);
}

body.staff-login-page .staff-login-capability__mark {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    color: var(--staff-accent);
}

body.staff-login-page .staff-login-capability__mark svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

body.staff-login-page .staff-login-capability h3 {
    margin: 0;
    color: var(--staff-rail-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
}

body.staff-login-page .staff-login-capability p {
    max-width: 46ch;
    margin: 3px 0 0;
    color: var(--staff-rail-muted);
    font-size: 13.5px;
    line-height: 1.5;
}

body.staff-login-page .staff-login-rail__note {
    max-width: 52ch;
    margin: 0;
    padding-left: 15px;
    border-left: 2px solid var(--staff-heritage);
    color: var(--staff-rail-muted);
    font-size: 12.5px;
    line-height: 1.55;
}

/* Paper half --------------------------------------------------------------- */

body.staff-login-page .staff-login-panel {
    display: flex;
    padding: clamp(26px, 3vw, 42px);
    flex-direction: column;
    background: var(--staff-paper);
}

body.staff-login-page .staff-login-panel__eyebrow {
    color: var(--staff-heritage);
}

body.staff-login-page .staff-login-panel h1 {
    margin: 13px 0 10px;
    color: var(--staff-ink);
    font-size: clamp(26px, 2.4vw, 33px);
    font-weight: 700;
    letter-spacing: -0.032em;
    line-height: 1.1;
}

body.staff-login-page .staff-login-panel__support {
    max-width: 44ch;
    margin: 0;
    color: var(--staff-ink-muted);
    font-size: 15px;
    line-height: 1.6;
}

body.staff-login-page .staff-login-error {
    display: grid;
    margin: 20px 0 0;
    padding: 13px 14px;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    border: 1px solid rgba(193, 138, 43, 0.5);
    border-radius: 5px;
    background: rgba(216, 201, 178, 0.34);
    color: var(--staff-ink);
}

body.staff-login-page .staff-login-error__mark {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
}

body.staff-login-page .staff-login-error p {
    margin: 1px 0 0;
    font-size: 14.5px;
    line-height: 1.5;
}

body.staff-login-page .staff-login-form {
    display: grid;
    margin-top: 22px;
    gap: 17px;
}

body.staff-login-page .staff-login-field {
    display: grid;
    gap: 7px;
}

body.staff-login-page .staff-login-form label {
    color: var(--staff-ink);
    font-size: 13px;
    font-weight: 700;
}

body.staff-login-page .staff-login-form input {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    border: 1px solid var(--staff-line);
    border-radius: 5px;
    background-color: #fff;
    color: var(--staff-ink);
    font: inherit;
    font-size: 16px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

body.staff-login-page .staff-login-form input::placeholder {
    color: var(--staff-ink-light);
}

body.staff-login-page .staff-login-form input:hover {
    border-color: var(--staff-ink-light);
}

body.staff-login-page .staff-login-form input:focus-visible {
    border-color: var(--staff-heritage);
    box-shadow: 0 0 0 3px rgba(31, 90, 59, 0.16);
    outline: 0;
}

body.staff-login-page .staff-login-form input[aria-invalid="true"] {
    border-color: rgba(193, 138, 43, 0.8);
}

body.staff-login-page .staff-login-password {
    position: relative;
}

body.staff-login-page .staff-login-password input {
    padding-right: 74px;
}

body.staff-login-page .staff-login-password__toggle {
    position: absolute;
    top: 50%;
    right: 5px;
    min-width: 56px;
    min-height: 42px;
    padding: 8px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--staff-ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

body.staff-login-page .staff-login-password__toggle:hover {
    background: var(--staff-warm);
}

body.staff-login-page .staff-login-password__toggle:focus-visible {
    outline: 3px solid rgba(193, 138, 43, 0.6);
    outline-color: rgba(193, 138, 43, 0.6);
    outline-offset: 0;
}

body.staff-login-page .staff-login-submit {
    display: flex;
    width: 100%;
    min-height: 54px;
    margin-top: 5px;
    padding: 14px 18px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--staff-ink);
    border-radius: 5px;
    background: var(--staff-ink);
    color: var(--staff-warm);
    cursor: pointer;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    transition: background-color 140ms ease, border-color 140ms ease,
        color 140ms ease, transform 140ms ease;
}

body.staff-login-page .staff-login-submit:hover {
    border-color: var(--staff-accent);
    background: var(--staff-accent);
    color: var(--staff-ink);
}

body.staff-login-page .staff-login-submit:active {
    transform: translateY(1px);
}

body.staff-login-page .staff-login-submit:focus-visible {
    outline: 3px solid rgba(193, 138, 43, 0.6);
    outline-color: rgba(193, 138, 43, 0.6);
    outline-offset: 3px;
}

body.staff-login-page .staff-login-submit[disabled],
body.staff-login-page .staff-login-submit[aria-disabled="true"] {
    border-color: var(--staff-line);
    background: var(--staff-line);
    color: var(--staff-ink-muted);
    cursor: progress;
    transform: none;
}

body.staff-login-page .staff-login-submit[disabled] .staff-login-submit__arrow,
body.staff-login-page .staff-login-submit[aria-disabled="true"] .staff-login-submit__arrow {
    opacity: 0.5;
}

body.staff-login-page .staff-login-workos {
    max-width: 44ch;
    margin: 0;
    color: var(--staff-ink-muted);
    font-size: 14.5px;
    line-height: 1.6;
}

/* Local-development credential guidance ------------------------------------ */

body.staff-login-page .staff-login-demo {
    margin-top: 20px;
    padding: 13px 15px;
    border: 1px dashed var(--staff-line);
    border-radius: 6px;
    background: rgba(216, 201, 178, 0.22);
}

body.staff-login-page .staff-login-demo__label {
    margin: 0;
    color: var(--staff-heritage);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

body.staff-login-page .staff-login-demo__list {
    display: grid;
    margin: 9px 0 0;
    gap: 3px;
}

body.staff-login-page .staff-login-demo__list > div {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
}

body.staff-login-page .staff-login-demo__list dt {
    color: var(--staff-ink-muted);
    font-size: 12.5px;
    font-weight: 700;
}

body.staff-login-page .staff-login-demo__list dd {
    margin: 0;
    color: var(--staff-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

body.staff-login-page .staff-login-demo__note {
    margin: 9px 0 0;
    color: var(--staff-ink-light);
    font-size: 12px;
    line-height: 1.5;
}

body.staff-login-page .staff-login-panel__footer {
    padding-top: 17px;
    border-top: 1px solid var(--staff-line);
}

/* Whatever closes the panel body — the form, the demo block, or the WorkOS
   action — holds a fixed gap above the closing rule. The footer's `auto`
   margin then only absorbs leftover slack, so the rule can never end up
   cramped against the content when an error banner grows the column. */
body.staff-login-page .staff-login-panel > :nth-last-child(2) {
    margin-bottom: clamp(22px, 2.6vw, 32px);
}

body.staff-login-page .staff-login-panel__footer > p:first-child {
    margin: 0;
    color: var(--staff-ink);
    font-size: 13px;
    font-weight: 700;
}

body.staff-login-page .staff-login-panel__footer-help {
    max-width: 46ch;
    margin: 4px 0 0;
    color: var(--staff-ink-muted);
    font-size: 13px;
    line-height: 1.55;
}

/* Responsive --------------------------------------------------------------- */

@media (min-width: 1000px) {
    /* The two halves stretch to a shared height, so the charcoal/paper edge
       runs the full depth of the card. */
    body.staff-login-page .staff-login-card {
        grid-template-columns: minmax(0, 1.04fr) minmax(408px, 0.96fr);
    }

    body.staff-login-page .staff-login-rail {
        align-content: space-between;
    }

    /* Both halves anchor their closing note to the same baseline. */
    body.staff-login-page .staff-login-panel__footer {
        margin-top: auto;
    }
}

/* Short desktop viewports keep the full rail, just tighter. */
@media (min-width: 1000px) and (max-height: 960px) {
    body.staff-login-page .staff-login-shell {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    body.staff-login-page .staff-login-rail {
        padding: 26px 30px 28px;
        gap: 18px;
    }

    body.staff-login-page .staff-login-logo {
        width: clamp(176px, 15vw, 206px);
    }

    body.staff-login-page .staff-login-rail__intro h2 {
        margin: 11px 0 9px;
        font-size: clamp(26px, 2.5vw, 34px);
    }

    body.staff-login-page .staff-login-lede {
        font-size: 14.5px;
    }

    body.staff-login-page .staff-login-capability {
        padding: 10px 0;
    }

    body.staff-login-page .staff-login-panel {
        padding-top: 30px;
        padding-bottom: 30px;
    }
}

/* Tablet and below: the halves stack, but stay one continuous card. */
@media (max-width: 999px) {
    body.staff-login-page .staff-login-shell {
        min-height: auto;
        align-items: start;
        padding-top: clamp(24px, 5vw, 40px);
        padding-bottom: clamp(36px, 6vw, 56px);
    }

    body.staff-login-page .staff-login-card {
        max-width: 640px;
    }

    /* One column has the room the two-column measure does not. */
    body.staff-login-page .staff-login-rail__intro h2 {
        max-width: 24ch;
    }
}

@media (max-width: 600px) {
    body.staff-login-page .staff-login-shell {
        padding: 18px 14px 34px;
    }

    body.staff-login-page .staff-login-card {
        border-radius: 10px;
    }

    body.staff-login-page .staff-login-rail {
        padding: 22px 20px 24px;
        gap: 20px;
    }

    body.staff-login-page .staff-login-logo {
        width: min(212px, 66vw);
        padding: 9px 12px;
    }

    body.staff-login-page .staff-login-rail__intro h2 {
        max-width: none;
        font-size: clamp(25px, 7vw, 32px);
    }

    body.staff-login-page .staff-login-panel {
        padding: 24px 19px 26px;
    }

    body.staff-login-page .staff-login-panel h1 {
        font-size: clamp(23px, 6.4vw, 29px);
    }

    body.staff-login-page .staff-login-demo__list > div {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.staff-login-page .staff-login-form input,
    body.staff-login-page .staff-login-submit {
        transition: none;
    }

    body.staff-login-page .staff-login-submit:active {
        transform: none;
    }
}
