:root {
    --navy-deep: #0B2F5E;
    --navy-mid: #083057;
    --navy-bright: #F58220;
    --navy-glow: #FFD84D;
    --orange: #F58220;
    --orange-bright: #FF9F4D;
    --cream: #FFFBF0;
    --white: #ffffff;
    --ink: #0f1923;
    --ink-soft: #374151;
    /* Darkened from #9ca3af. The engraved surfaces below are a light grey rather
       than white, which costs ~1 point of contrast on every muted label; on
       #eaedf3 the old value measured about 2.2:1 for the placeholder, the
       subheading and the lane sub-label. This is 4.6:1 on the same surface. */
    --ink-muted: #6b7280;
    --border: #e5e7eb;
    --border-focus: #F58220;
    --error: #E4032E;
    --success: #16a34a;
    --font-display: 'Roboto', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

    /* --- engraved surface language -----------------------------------------
       The login page's cards, fields and buttons are CUT from one soft surface
       rather than outlined with borders: the light sits at the top-left, so
       anything raised carries a white highlight there and a navy-tinted shade at
       the bottom-right, and anything pressed into the surface reverses the two.
       Four shadow recipes and three tones carry every object on the page, so the
       grammar cannot drift object by object the way per-component shadows do.

       The canvas is deliberately not white: a white highlight is invisible on a
       white page, which is the failure mode that makes this style look like
       nothing happened. */
    --engrave-canvas: #eaedf3;
    --engrave-face: #f5f7fb;
    --engrave-deep: #e2e6ee;
    --engrave-hi: rgba(255, 255, 255, 0.95);
    --engrave-lo: rgba(11, 47, 94, 0.16);
    --engrave-lo-soft: rgba(11, 47, 94, 0.10);
    --engrave-hairline: rgba(11, 47, 94, 0.08);

    --raised: 6px 6px 16px var(--engrave-lo-soft), -5px -5px 12px var(--engrave-hi);
    --raised-sm: 3px 3px 8px var(--engrave-lo-soft), -3px -3px 7px var(--engrave-hi);
    --pressed: inset 3px 3px 7px var(--engrave-lo), inset -3px -3px 7px var(--engrave-hi);
    --pressed-sm: inset 2px 2px 5px var(--engrave-lo), inset -2px -2px 5px var(--engrave-hi);
    /* Dark faces need their own press: a white inset highlight on navy reads as a
       smudge, so the shade and the light swap roles instead. */
    --pressed-dark: inset 3px 3px 9px rgba(0, 0, 0, 0.45), inset -2px -2px 7px rgba(255, 255, 255, 0.12);

    /* aliases so legacy login pages still compile */
    --teal-deep: var(--navy-deep);
    --teal-mid: var(--navy-mid);
    --teal-bright: var(--orange-bright);
    --teal-glow: var(--navy-glow);
}

/* Loader */
#loader {
    position: fixed;
    inset: 0;
    background: var(--teal-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.7s var(--ease-out), visibility 0.7s;
}

    #loader.hidden {
        opacity: 0;
        visibility: hidden;
    }

.loader-ring {
    width: 52px;
    height: 52px;
    border: 3px solid rgba(245,130,32,0.2);
    border-top-color: var(--teal-glow);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.loader-logo {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Keyframes */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes checkPop {
    0% { opacity: 0; transform: scale(0); }
    70% { transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

/* Form fields */
.field {
    margin-bottom: 20px;
}

.field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.field-wrap {
    position: relative;
}

.field-input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--ink);
    /* Engraved well: the field is the canvas colour, pressed into itself, so the
       boundary is the shadow rather than a box drawn around it. The face does not
       change on focus — only the ring appears — or the well appears to pop back
       out the moment someone starts typing. */
    background: var(--engrave-canvas);
    border: 1px solid var(--engrave-hairline);
    border-radius: 14px;
    outline: none;
    box-shadow: var(--pressed);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
}

    .field-input::placeholder {
        color: var(--ink-muted);
    }

    .field-input:focus {
        border-color: var(--border-focus);
        box-shadow: var(--pressed), 0 0 0 3px rgba(245,130,32,0.22);
    }

    /* The state rings are appended to the press rather than replacing it: a bare
       box-shadow here would silently un-engrave the field on error. */
    .field-input.error {
        border-color: var(--error);
        box-shadow: var(--pressed), 0 0 0 3px rgba(228,3,46,0.16);
    }

    .field-input.success {
        border-color: var(--success);
        box-shadow: var(--pressed), 0 0 0 3px rgba(22,163,74,0.14);
    }

    .field-input:disabled {
        background: var(--engrave-deep);
        color: var(--ink-muted);
        cursor: not-allowed;
        border-color: var(--engrave-hairline);
        box-shadow: inset 2px 2px 5px rgba(11,47,94,0.10);
        opacity: 0.7;
    }

    .field-input:disabled::placeholder {
        color: rgba(107,114,128,0.7);
    }

/* A <select> with -webkit-appearance:none loses the native dropdown arrow, and
   nothing was ever drawn in its place — so the Admin/Quality lane's Store and
   Position dropdowns have always read as text fields you cannot type in. The
   engraving makes that worse rather than better: the well now has no other cue
   that it is a select at all. Drawn as a data URI so it needs no extra request,
   and padded right so the text cannot run under it. */
select.field-input {
    padding-right: 42px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230B2F5E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 14px;
    cursor: pointer;
}

.field-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color 0.2s;
}

.field-input:focus ~ .field-icon {
    color: var(--orange);
}

.field-input.success ~ .field-icon {
    display: none;
}

.field-check {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    font-size: 0.9rem;
    display: none;
    animation: checkPop 0.4s var(--ease-out);
}

.field-input.success ~ .field-check {
    display: block;
}

.field-hint {
    margin-top: 6px;
    font-size: 0.775rem;
    font-weight: 500;
    display: none;
}

    .field-hint.show {
        display: block;
    }

    .field-hint.error {
        color: var(--error);
    }

    .field-hint.success {
        color: var(--success);
    }

.toggle-pw {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
}

    .toggle-pw:hover {
        color: var(--orange);
    }

/* Buttons */
.btn-submit {
    width: 100%;
    padding: 15px 24px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    /* The raised half of the grammar, on navy: the face is lit from the top-left
       so the slab reads as standing proud of the form, and :active presses it
       back into the surface. Kept as a gradient rather than a flat fill because a
       single dark tone under an outer highlight looks like a flat sticker. */
    background: linear-gradient(145deg, #14417a, var(--navy-deep) 60%, #082444);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    letter-spacing: 0.3px;
    box-shadow: 5px 5px 14px rgba(11,47,94,0.26), -4px -4px 11px var(--engrave-hi);
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

    .btn-submit::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, var(--orange), var(--orange-bright));
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .btn-submit:hover {
        transform: translateY(-1px);
        box-shadow: 7px 7px 18px rgba(11,47,94,0.30), -4px -4px 12px var(--engrave-hi);
    }

        .btn-submit:hover::after {
            opacity: 1;
        }

    /* Pressed: the outer shadow collapses into the surface and the lift is given
       back, so a click is felt rather than only seen. The highlight flips to the
       dark variant because the face is navy — see --pressed-dark. */
    .btn-submit:active {
        transform: translateY(0);
        box-shadow: var(--pressed-dark);
    }

    .btn-submit:focus-visible {
        outline: 2px solid var(--navy-deep);
        outline-offset: 3px;
    }

    .btn-submit span, .btn-submit i {
        position: relative;
        z-index: 1;
    }

    .btn-submit.loading .btn-text {
        opacity: 0;
    }

    .btn-submit.loading .btn-spinner {
        display: block;
    }

    .btn-submit:disabled {
        opacity: 0.72;
        cursor: not-allowed;
        transform: none;
        box-shadow: var(--pressed-dark);
    }

        .btn-submit:disabled::after {
            opacity: 0;
        }

.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: relative;
    z-index: 1;
}

/* Error banner */
.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(228,3,46,0.05);
    border: 1px solid rgba(228,3,46,0.18);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    /* Engraved like the fields, not raised: a message about the form is part of
       the form, and a card floating above it competes with the button that fixes
       it. The tint carries the meaning; the press carries the material. */
    box-shadow: var(--pressed-sm);
    animation: fadeIn 0.3s ease;
}

    .error-banner i {
        color: var(--error);
        font-size: 0.9rem;
        margin-top: 1px;
        flex-shrink: 0;
    }

    .error-banner p {
        font-size: 0.875rem;
        color: var(--error);
        line-height: 1.5;
        margin: 0;
    }

/* Info notice — the idle-logout explanation on the return leg of a timeout.
   Deliberately NOT the error treatment: nothing went wrong, and a red banner
   after a timeout reads as a fault. Same geometry as .error-banner so the two
   never shift the form when one replaces the other. */
.notice-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(11,47,94,0.05);
    border: 1px solid rgba(11,47,94,0.16);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    box-shadow: var(--pressed-sm);
    animation: fadeIn 0.3s ease;
}

    .notice-banner i {
        color: var(--navy-deep);
        font-size: 0.9rem;
        margin-top: 1px;
        flex-shrink: 0;
    }

    .notice-banner p {
        font-size: 0.875rem;
        color: var(--ink-soft);
        line-height: 1.5;
        margin: 0;
    }

    .notice-banner strong {
        color: var(--navy-deep);
    }

/* Access guide (reusable across login pages) */
.access-guide {
    background: rgba(245,130,32,0.08);
    border: 1.5px solid rgba(245,130,32,0.22);
    border-radius: 14px;
    padding: 14px 16px;
    animation: fadeIn 0.4s var(--ease-out);
}

.access-guide-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--orange);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.access-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.access-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy-deep);
    background: white;
    border: 1.5px solid rgba(245,130,32,0.35);
    border-radius: 100px;
    padding: 6px 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

    .access-chip:hover {
        background: var(--navy-deep);
        color: white;
        border-color: var(--navy-deep);
    }

@media (max-width: 900px) {
    .access-guide {
        padding: 12px 14px;
    }

    .access-options {
        flex-direction: column;
        gap: 8px;
    }

    .access-chip {
        width: 100%;
        justify-content: center;
        font-size: 0.82rem;
        padding: 8px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #loader {
        transition: none;
    }
}

/* ---------------------------------------------------------------------------
   Unified login lane selector (LoginPage). Began as a repurposing of
   .access-options/.access-chip, and is now a grid of lane CARDS instead: the
   six doors are peer options, and pills of six different widths read as a
   navigation strip rather than a choice. Appended here rather than in a Razor
   <style> block, where an @media would break the build.
   .access-options/.access-chip/.access-guide remain above for reuse.
   --------------------------------------------------------------------------- */

.lane-section {
    margin-bottom: 16px;
}

.lane-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    /* Named, not inherited: this sat on var(--text-muted, #7c8794), a 3.4:1 grey
       on the engraved canvas for text this small. */
    color: var(--ink-muted);
    margin-bottom: 8px;
}

/* Buttons, not links: a card toggles a hidden field rather than navigating.
   Three columns so the six doors resolve to exactly two rows at every width
   above the breakpoint below — an auto-fit grid would give a 4+2 orphan row
   once the panel is wide enough. */
.lane-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.lane-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    min-height: 86px;
    padding: 15px 10px;
    /* Raised: a card at rest stands proud of the form's canvas. The face is still
       near-white so the six doors read as one quiet set, but the lift is carried
       by the shadow rather than by a 1.5px outline on every card. */
    background: linear-gradient(145deg, #fdfefe, var(--engrave-face));
    border: 1px solid var(--engrave-hairline);
    border-radius: 16px;
    color: var(--navy-deep);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-shadow: var(--raised-sm);
    transition: box-shadow 0.22s var(--ease-out), transform 0.22s var(--ease-out),
                background 0.22s ease, color 0.2s ease;
}

    /* The lane's icon on its own small raised chip, the way the reference sets an
       icon beside a label rather than floating it on the card face. It also gives
       the six cards a shared left-anchored rhythm at a glance. */
    .lane-card i {
        display: grid;
        place-items: center;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        background: linear-gradient(145deg, #ffffff, var(--engrave-deep));
        box-shadow: var(--raised-sm);
        font-size: 0.92rem;
        color: var(--orange);
        transition: color 0.2s ease, box-shadow 0.22s var(--ease-out);
    }

    .lane-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--raised);
        background: linear-gradient(145deg, #ffffff, #eef3fb);
    }

    .lane-card:focus-visible {
        outline: 2px solid var(--orange);
        outline-offset: 2px;
    }

    /* Selected: pressed into the canvas instead of tinted on top of it, which is
       the same grammar the fields use and so reads as "this one is set" rather
       than "this one is highlighted". The navy ring stays — #laneSub beneath
       names the door in words, but depth alone is a subtle cue and the chosen
       credential store is the one thing on this form that must be unmistakable. */
    .lane-card.active {
        background: var(--engrave-canvas);
        border-color: transparent;
        box-shadow: var(--pressed), inset 0 0 0 1.5px rgba(11, 47, 94, 0.38);
        font-weight: 700;
    }

        /* The chip inverts with the card: raised on a pressed face would read as a
           mistake, so the selected lane's icon sits flat in the well. */
        .lane-card.active i {
            color: var(--navy-deep);
            background: rgba(11, 47, 94, 0.07);
            box-shadow: none;
        }

.lane-sub {
    font-size: 0.78rem;
    color: var(--ink-muted);
    margin: 8px 0 0;
    line-height: 1.45;
}

/* The sub-label's row, shared with the "More" control. Kept as a flex row so
   the pill does not push the sentence around when the lane changes. */
.lane-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

    .lane-foot .lane-sub {
        margin: 0;
        flex: 1 1 auto;
    }

/* "More" — the way to the Super User door (/AdminAccess). Deliberately NOT a
   lane card: a lane selects which credential store to authenticate against,
   and this navigates away to a different one (super_users, not logind_u), so
   it must not look like a seventh choice in that set. Outlined pill, on the
   sub-label's row, so someone whose door is not among the six can still find
   it without the privileged door carrying the weight of the everyday ones. */
.lane-more {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--navy-deep);
    /* Raised like the lane cards, one step smaller: the "More" pill belongs to the
       same family of objects, but not to the same set of choices — so it gets the
       material without the size. */
    background: linear-gradient(145deg, #fdfefe, var(--engrave-face));
    border: 1px solid var(--engrave-hairline);
    border-radius: 100px;
    box-shadow: var(--raised-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: box-shadow 0.2s var(--ease-out), color 0.2s ease, transform 0.2s var(--ease-out);
}

    .lane-more:hover {
        color: var(--navy-deep);
        transform: translateY(-1px);
        box-shadow: var(--raised);
    }

    .lane-more:active {
        transform: translateY(0);
        box-shadow: var(--pressed-sm);
    }

    .lane-more:focus-visible {
        outline: 2px solid var(--orange);
        outline-offset: 2px;
    }

    .lane-more i {
        font-size: 0.7rem;
        color: var(--orange);
        transition: color 0.2s ease;
    }

    .lane-more:hover i {
        color: var(--navy-deep);
    }

.lane-extra {
    border-left: 3px solid rgba(245, 130, 32, 0.45);
    padding-left: 12px;
    margin-bottom: 4px;
}

.lane-extra .field {
    margin-bottom: 12px;
}

/* Two columns on a phone: three would leave each card narrower than the longest
   single word in a lane name ("Planning", "Marketplace"). */
@media (max-width: 480px) {
    .lane-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .lane-card {
        min-height: 78px;
        /* 6px, not 8px: the labels now end in "Login", and at 390px — a common
           phone width — the longest one ("Production Siavonga Login") cleared the
           card edge by only 7px. Two more pixels a side takes that to 11px, which
           is the difference between "fits" and "looks like it only just fits".
           The rename from "Production Planning" is length-neutral — same 25
           characters, and "Siavonga" is 8 like "Planning" — so this still holds. */
        padding: 12px 6px;
        font-size: 0.74rem;
    }

    /* Stack: a multi-line sub-label beside the pill squeezes both. */
    .lane-foot {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .lane-foot .lane-sub {
        flex: 0 1 auto;
    }

    /* The mini tabs must never overflow. They are `flex: 1 1 0`, which cannot
       shrink a nowrap label below its min-content width, so on a narrow phone the
       row stops shrinking and grows wider than its container instead. Measured:
       below ~390px the two stop sharing equal widths, and the row sat at exactly
       scrollWidth == clientWidth — no slack at all. Wrapping turns a would-be
       overflow into a stack, and the tighter metrics below keep them side by side
       at normal phone widths. */
    .mini-tabs {
        flex-wrap: wrap;
    }

    .mini-tab {
        font-size: 0.72rem;
        padding: 7px 6px;
    }
}

/* -------------------------------------------------------- admin mini tabs
   The Admin/Quality lane is two credential doors behind ONE card — store admins
   (admin_reg, needs a Store) and quality controllers (logind_u, matched on
   Title) — so it gets two mini tabs and each panel shows only its own field.
   Appended here rather than in a Razor <style> block, where an @media would
   break the build.

   Selection follows .lane-card.active above: border and tint rather than a fill,
   so the pair reads as one quiet segmented control instead of two buttons. */
.mini-tabs {
    display: flex;
    gap: 4px;
    padding: 5px;
    /* A groove cut into the form, with the live tab standing back out of it — the
       clearest read of "one of these two is selected" the grammar offers, and it
       matches the lane cards without repeating their size. */
    background: var(--engrave-canvas);
    border: 1px solid var(--engrave-hairline);
    box-shadow: var(--pressed-sm);
    border-radius: 100px;
    margin-bottom: 14px;
}

.mini-tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border: 0;
    border-radius: 100px;
    background: transparent;
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.2s ease;
}

    .mini-tab i {
        font-size: 0.72rem;
    }

    .mini-tab:hover {
        color: var(--navy-deep);
    }

    .mini-tab.active {
        background: linear-gradient(145deg, #ffffff, var(--engrave-face));
        color: var(--navy-deep);
        box-shadow: var(--raised-sm);
    }

        .mini-tab.active i {
            color: var(--orange);
        }

        .mini-tab.active i {
            color: var(--orange);
        }

    .mini-tab:focus-visible {
        outline: 2px solid var(--orange);
        outline-offset: 2px;
    }

/* The server-rendered closed state for the whole Admin/Quality block, so
   #adminExtra no longer needs an inline style="display:none" that only the
   page's JS could correct before the first paint. The JS toggles this same
   class, so there is one mechanism rather than a class plus an inline style. */
.lane-extra.is-hidden {
    display: none;
}

/* The panel the inactive tab owns. Its control is also disabled, because a
   display:none input still POSTS — which is how the old block sent a stale
   Store and Position with every lane. Disabled controls are not submitted. */
.mini-panel[hidden] {
    display: none;
}
