/* =====================================================================
   Atelier Noir — Portal Design Foundation
   Scoped to the Fine Thread customer/admin portal only.
   Public marketing pages must NOT load this stylesheet.
   ===================================================================== */

:root.portal,
.portal-shell {
    /* Surfaces (vellum-paper hierarchy) */
    --surface:               #f9f9f9;
    --surface-low:           #f3f3f4;
    --surface-lowest:        #ffffff;
    --surface-high:          #e8e8e8;
    --surface-highest:       #e2e2e2;

    /* Ink */
    --on-surface:            #1a1c1c;
    --on-surface-variant:    #474747;
    --on-primary:            #e5e2e1;

    /* Primary (the ink) + secondaries */
    --primary:               #000000;
    --primary-container:     #3c3b3b;
    --secondary:             #5f5e5e;

    /* Lines & ghosting */
    --outline:               #777777;
    --outline-variant:       #c6c6c6;
    --outline-ghost:         rgba(198, 198, 198, 0.20);

    /* Status palette (driven by real status values) */
    --status-pending:            #5f5e5e;
    --status-stock-received:     #6b5d3a;
    --status-artwork-approved:   #1a1c1c;
    --status-scheduled:          #2f3a4a;
    --status-in-production:      #3c3b3b;
    --status-ready:              #1a1c1c;
    --status-completed:          #000000;
    /* Task #144 — post-completion billing/handoff statuses. Both sit in
       the warm neutral family so they read as "settled / archival" next
       to the active workflow tones above. */
    --status-invoiced:           #4a3a2a;
    --status-exported:           #2a3a4a;
    /* Task #180 — terminal billing state once Louise reconciles the
       Xero payment. Sits in the same warm/muted family as invoiced /
       exported above, but tinted green to signal "settled". */
    --status-paid:               #0a4a22;
    /* Task #174 — cancelled needs to read as "void / inactive" at a glance,
       not blend in with the neutral grey scale used by pending / in-production
       / ready_for_collection. A desaturated brick-red sits inside the muted
       Atelier Noir palette while still signalling "stopped" without screaming
       like the saturated --feedback-error tone. */
    --status-cancelled:          #8a3a3a;

    /* Feedback */
    --feedback-success:      #1f6f3a;
    --feedback-error:        #ba1a1a;
    --feedback-warning:      #8a5a00;
    --feedback-info:         #1a1c1c;

    /* Spacing scale (4-pt) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Radii — "tailored, sharp" */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;

    /* Elevation — soft glow, never muddy drop-shadow */
    --elev-1: 0 2px 8px rgba(26, 28, 28, 0.04);
    --elev-2: 0 8px 24px rgba(26, 28, 28, 0.06);
    --elev-3: 0 24px 60px rgba(26, 28, 28, 0.10);

    /* Glass */
    --glass-bg: rgba(249, 249, 249, 0.78);
    --glass-blur: 20px;

    /* Layout constants */
    --side-rail-w: 248px;
    --top-bar-h: 80px;
}

/* =====================================================================
   Shell layout
   ===================================================================== */

body.portal-shell {
    font-family: 'Manrope', 'Open Sans', sans-serif;
    background: var(--surface);
    color: var(--on-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    min-height: 100vh;
}

body.portal-shell h1,
body.portal-shell h2,
body.portal-shell h3,
body.portal-shell h4,
body.portal-shell h5,
body.portal-shell h6,
body.portal-shell .font-headline {
    font-family: 'Noto Serif', 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.01em;
}

body.portal-shell .portal-main {
    margin-left: var(--side-rail-w);
    min-height: 100vh;
    padding-top: 0;
    background: var(--surface);
}

/* The legacy .main-content container from base.html is NOT used by
   the portal base; existing per-page sections (`.header`, `.filters-section`,
   `.calendar-container`, etc.) live directly inside .portal-main. */

/* =====================================================================
   Side-rail navigation
   ===================================================================== */

.atelier-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--side-rail-w);
    height: 100vh;
    box-sizing: border-box;
    background: var(--primary);
    border-right: 0;
    display: flex;
    flex-direction: column;
    padding: 40px 24px 32px;
    gap: 32px;
    z-index: 900;
    box-shadow: 1px 0 0 0 rgba(229, 226, 225, 0.08);
    overflow: hidden;
    overscroll-behavior: contain;
}

.atelier-rail__brand {
    display: block;
    text-decoration: none;
    color: var(--on-primary);
}

.atelier-rail__brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.atelier-rail__brand-mark {
    font-family: 'Noto Serif', serif;
    font-size: 1.05rem;
    line-height: 1.15;
    color: var(--on-primary);
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex: 1;
    min-width: 0;
}

.atelier-rail__logo {
    display: block;
    width: auto;
    height: 2.4em;
    flex: 0 0 auto;
    filter: brightness(0) invert(1);
}

.atelier-rail__brand-eyebrow {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(229, 226, 225, 0.7);
    margin-top: 8px;
    display: block;
}

.atelier-rail__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Primary CTA — "New Order" lives above the grouped destinations because it
   is an action, not a place. Inverts the rail palette so it reads as the
   one bright affordance in the navigation. */
.atelier-rail__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--on-primary);
    color: var(--primary);
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.atelier-rail__cta:hover {
    opacity: 0.9;
}

.atelier-rail__cta.is-active {
    box-shadow: inset 0 0 0 1px rgba(26, 28, 28, 0.15);
}

.atelier-rail__cta-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
    stroke: none;
}

/* Grouped destination list: each group is a labelled cluster of links with
   a thin divider between them. The groups region is the rail's only
   scrolling area so the Logout footer stays pinned at the bottom. */
.atelier-rail__groups {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -8px;
    padding: 0 8px;
}

.atelier-rail__group + .atelier-rail__group {
    border-top: 1px solid rgba(229, 226, 225, 0.08);
    padding-top: 18px;
}

.atelier-rail__group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(229, 226, 225, 0.45);
    padding: 4px 14px;
    margin-bottom: 8px;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-sm);
    transition: color 0.18s ease, background-color 0.18s ease;
}

.atelier-rail__group-label:hover,
.atelier-rail__group-label:focus-visible {
    color: rgba(229, 226, 225, 0.85);
    background: rgba(229, 226, 225, 0.04);
    outline: none;
}

.atelier-rail__group-chevron {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    fill: currentColor;
    stroke: none;
    transition: transform 0.18s ease;
}

.atelier-rail__group-label[aria-expanded="false"] .atelier-rail__group-chevron {
    transform: rotate(-90deg);
}

.atelier-rail__group-label[aria-expanded="false"] + .atelier-rail__group-list {
    display: none;
}

.atelier-rail__group-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Logout footer — pinned to the bottom of the rail, never scrolls with
   the groups region above it. */
.atelier-rail__footer {
    flex: 0 0 auto;
    border-top: 1px solid rgba(229, 226, 225, 0.08);
    padding-top: 12px;
    margin-top: 4px;
}

.atelier-rail__item {
    list-style: none;
}

.atelier-rail__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    text-decoration: none;
    color: rgba(229, 226, 225, 0.7);
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    border-radius: var(--radius-sm);
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 100%;
    min-width: 0;
    text-align: left;
}

.atelier-rail__link:hover {
    background: rgba(229, 226, 225, 0.06);
    color: var(--on-primary);
}

.atelier-rail__link.is-active {
    background: rgba(229, 226, 225, 0.1);
    color: var(--on-primary);
    box-shadow: none;
}

.atelier-rail__link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--on-primary);
}

.atelier-rail__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: currentColor;
    stroke: none;
}

/* Inbox unread-count chip — sits at the right edge of the side-rail
   link. Hidden by default (nav-base.html sets `hidden` until a count
   arrives) so the link stays clean when there is nothing new.
   Task #263 — keep the badge at its natural size (no flex-shrink) and
   let the uppercase, letter-spaced label flex-shrink instead, so
   two-digit counts and the "99+" fallback always render fully. */
.atelier-rail__link > span:not([class]) {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.atelier-rail__badge {
    margin-left: auto;
    flex: 0 0 auto;
    box-sizing: content-box;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--on-primary);
    color: var(--primary);
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Mobile top bar (shown when side rail collapses) */
.atelier-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-h);
    background: var(--primary);
    border-bottom: 1px solid rgba(229, 226, 225, 0.08);
    z-index: 901;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.atelier-topbar__brand {
    font-family: 'Noto Serif', serif;
    font-size: 1.15rem;
    line-height: 1.15;
    color: var(--on-primary);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.atelier-topbar__logo {
    display: block;
    width: auto;
    height: 40px;
    flex: 0 0 auto;
    filter: brightness(0) invert(1);
}

.atelier-topbar__menu {
    background: transparent;
    border: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--on-primary);
}

.atelier-topbar__menu svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: none;
}

.atelier-rail__backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 28, 28, 0.4);
    z-index: 899;
}

@media (max-width: 900px) {
    .atelier-topbar { display: flex; }
    body.portal-shell .portal-main {
        margin-left: 0;
        padding-top: var(--top-bar-h);
    }
    .atelier-rail {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        padding-top: calc(var(--top-bar-h) + 16px);
        height: 100dvh;
        max-height: 100dvh;
    }
    /* Brand is already shown in the mobile top bar — hide the rail's
       duplicate brand block so the nav starts cleanly. */
    .atelier-rail__brand { display: none; }
    body.portal-shell.rail-open .atelier-rail {
        transform: translateX(0);
        box-shadow: var(--elev-3);
    }
    body.portal-shell.rail-open .atelier-rail__backdrop {
        display: block;
    }
}

/* =====================================================================
   Slide-out drawer (the global "no popups" pattern)
   ===================================================================== */

/* The drawer renders as a full-height side sheet that sits to the right of
   the Atelier rail — never on top of it. Both the scrim and the panel are
   confined to the content area so the navigation rail stays reachable. */
.atelier-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--side-rail-w);
    right: 0;
    z-index: 1100;
    pointer-events: none;
    visibility: hidden;
}

.atelier-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

.atelier-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 28, 28, 0.32);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.atelier-drawer.is-open .atelier-drawer__backdrop {
    opacity: 1;
}

.atelier-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 720px;
    background: var(--surface-lowest);
    box-shadow: var(--elev-3);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    outline: none;
}

.atelier-drawer.is-open .atelier-drawer__panel {
    transform: translateX(0);
}

.atelier-drawer[data-size="sm"] .atelier-drawer__panel { max-width: 480px; }
.atelier-drawer[data-size="md"] .atelier-drawer__panel { max-width: 720px; }
.atelier-drawer[data-size="lg"] .atelier-drawer__panel { max-width: 960px; }

/* When the rail collapses on narrow viewports, the drawer should fill the
   whole viewport instead of leaving a phantom rail-width gutter on the left. */
@media (max-width: 900px) {
    .atelier-drawer { left: 0; }
}

.atelier-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 20px;
    background: var(--surface-low);
}

.atelier-drawer__eyebrow {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--on-surface-variant);
    display: block;
    margin-bottom: 6px;
}

.atelier-drawer__title {
    font-family: 'Noto Serif', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.atelier-drawer__close {
    background: transparent;
    border: 0;
    color: var(--on-surface-variant);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.atelier-drawer__close:hover {
    background: var(--surface-high);
    color: var(--primary);
}

.atelier-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--surface-lowest);
}

.atelier-drawer__footer {
    padding: 18px 32px;
    background: var(--surface-low);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    box-shadow: 0 -1px 0 0 var(--outline-ghost);
}

.atelier-drawer__footer:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
    .atelier-drawer__panel,
    .atelier-drawer__backdrop,
    .atelier-rail { transition: none; }
}

@media (max-width: 600px) {
    .atelier-drawer__header { padding: 18px 18px 14px; }
    .atelier-drawer__body   { padding: 18px; }
    .atelier-drawer__footer { padding: 14px 18px; }
}

/* Capacity warning (admin calendar — drag-over-capacity confirm) */
.capacity-warning {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.capacity-warning__lede {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
}

.capacity-warning__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin: 0;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(229, 226, 225, 0.12);
}

.capacity-warning__grid > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: rgba(20, 18, 18, 0.55);
}

.capacity-warning__grid dt {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(229, 226, 225, 0.55);
}

.capacity-warning__grid dd {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--on-primary);
}

.capacity-warning__hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    color: rgba(229, 226, 225, 0.6);
}

.atelier-drawer .capacity-warning__grid {
    background: rgba(20, 18, 18, 0.08);
}

.atelier-drawer .capacity-warning__grid > div {
    background: #fff;
}

.atelier-drawer .capacity-warning__grid dt {
    color: rgba(20, 18, 18, 0.55);
}

.atelier-drawer .capacity-warning__grid dd {
    color: var(--primary);
}

.atelier-drawer .capacity-warning__hint {
    color: rgba(20, 18, 18, 0.6);
}

/* =====================================================================
   Reusable primitives
   ===================================================================== */

/* Buttons */
.btn-atelier {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    border-radius: var(--radius-sm);
    border: 0;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-atelier--primary {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-container) 100%);
    color: var(--on-primary);
}

.btn-atelier--primary:hover {
    box-shadow: var(--elev-2);
    transform: translateY(-1px);
}

.btn-atelier--secondary {
    background: var(--surface-lowest);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--outline-ghost);
}

.btn-atelier--secondary:hover {
    background: var(--surface-low);
}

.btn-atelier--tertiary {
    font-family: 'Noto Serif', serif;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.95rem;
    background: transparent;
    color: var(--primary);
    padding: 6px 0;
    border-radius: 0;
    box-shadow: inset 0 -1px 0 0 var(--primary);
    transition: box-shadow 0.18s ease;
}

.btn-atelier--tertiary:hover {
    box-shadow: inset 0 -2px 0 0 var(--primary);
}

.btn-atelier:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Inputs (minimalist bottom-border) */
.input-atelier {
    display: block;
    width: 100%;
    padding: 10px 2px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--outline-variant);
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    color: var(--on-surface);
    transition: border-color 0.18s ease, background-color 0.18s ease;
    border-radius: 0;
}

.input-atelier:focus {
    outline: 0;
    border-bottom-color: var(--primary);
    background: var(--surface-lowest);
}

.label-atelier {
    display: block;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--on-surface-variant);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Cards */
.card-atelier {
    background: var(--surface-lowest);
    border-radius: var(--radius-sm);
    padding: 32px;
    box-shadow: var(--elev-1);
}

.card-atelier--low { background: var(--surface-low); box-shadow: none; }

/* List rows — alternating tones, no dividers */
.list-atelier {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-atelier > li {
    padding: 14px 18px;
    background: var(--surface-lowest);
}

.list-atelier > li:nth-child(even) {
    background: var(--surface-low);
}

/* Status badge — shared values */
.badge-atelier {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-low);
    color: var(--primary);
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.badge-atelier::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-atelier[data-status="pending"]            { color: var(--status-pending); }
.badge-atelier[data-status="stock_received"]     { color: var(--status-stock-received); }
.badge-atelier[data-status="artwork_approved"]   { color: var(--status-artwork-approved); }
.badge-atelier[data-status="scheduled"]          { color: var(--status-scheduled); }
.badge-atelier[data-status="in_production"]      { color: var(--status-in-production); }
.badge-atelier[data-status="ready_for_collection"]{ color: var(--status-ready); }
.badge-atelier[data-status="completed"]          { color: var(--status-completed); background: var(--surface-high); }
.badge-atelier[data-status="invoiced"]           { color: var(--status-invoiced); background: var(--surface-high); }
.badge-atelier[data-status="exported"]           { color: var(--status-exported); background: var(--surface-high); }
.badge-atelier[data-status="paid"]               { color: var(--status-paid); background: var(--surface-high); }
.badge-atelier[data-status="cancelled"]          { color: var(--on-surface-variant); }

/* "Stitch" progress indicator */
.stitch-progress {
    position: relative;
    height: 1px;
    background: var(--outline-variant);
    width: 100%;
    margin: 16px 0 28px;
}

.stitch-progress__needle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
    transition: left 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.stitch-progress__steps {
    position: absolute;
    top: 100%;
    margin-top: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--on-surface-variant);
}

.stitch-progress__steps .is-active {
    color: var(--primary);
    font-weight: 700;
}

/* =====================================================================
   Toast notifications (Atelier Noir)
   ===================================================================== */

.atelier-toast-stack {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.atelier-toast {
    pointer-events: auto;
    background: var(--surface-lowest);
    color: var(--on-surface);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--elev-2);
    box-shadow:
        var(--elev-2),
        inset 3px 0 0 0 var(--primary);
    min-width: 280px;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    animation: atelier-toast-in 0.22s ease-out;
}

.atelier-toast.is-leaving {
    animation: atelier-toast-out 0.22s ease-in forwards;
}

.atelier-toast[data-type="success"] { box-shadow: var(--elev-2), inset 3px 0 0 0 var(--feedback-success); }
.atelier-toast[data-type="error"]   { box-shadow: var(--elev-2), inset 3px 0 0 0 var(--feedback-error); }
.atelier-toast[data-type="warning"] { box-shadow: var(--elev-2), inset 3px 0 0 0 var(--feedback-warning); }
.atelier-toast[data-type="info"]    { box-shadow: var(--elev-2), inset 3px 0 0 0 var(--feedback-info); }

.atelier-toast__close {
    background: transparent;
    border: 0;
    color: var(--on-surface-variant);
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    margin-left: auto;
}

@keyframes atelier-toast-in {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes atelier-toast-out {
    to { transform: translateX(40px); opacity: 0; }
}

@media (max-width: 600px) {
    .atelier-toast-stack {
        top: calc(var(--top-bar-h) + 12px);
        right: 12px;
        left: 12px;
    }
    .atelier-toast { max-width: none; min-width: 0; }
}

/* ---- Dark variant (matches the side rail / mobile top bar) ---- */
.atelier-toast.is-dark {
    background: var(--on-surface);
    color: var(--on-primary);
    box-shadow:
        var(--elev-2),
        inset 3px 0 0 0 rgba(229, 226, 225, 0.85);
}

.atelier-toast.is-dark[data-type="success"] { box-shadow: var(--elev-2), inset 3px 0 0 0 #4ade80; }
.atelier-toast.is-dark[data-type="error"]   { box-shadow: var(--elev-2), inset 3px 0 0 0 #f87171; }
.atelier-toast.is-dark[data-type="warning"] { box-shadow: var(--elev-2), inset 3px 0 0 0 #fbbf24; }
.atelier-toast.is-dark[data-type="info"]    { box-shadow: var(--elev-2), inset 3px 0 0 0 rgba(229, 226, 225, 0.85); }

.atelier-toast.is-dark .atelier-toast__close {
    color: rgba(229, 226, 225, 0.7);
}

.atelier-toast.is-dark .atelier-toast__close:hover {
    color: var(--on-primary);
}

/* ---- One-time rail collapse hint ----
   Reuses .atelier-toast.is-dark styling but is anchored inline inside a
   rail group rather than the floating toast stack, so it can point at
   the group's chevron. Removed permanently after first interaction. */
.atelier-rail-hint {
    position: relative;
    margin: -2px 8px 10px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 0.78rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    text-transform: none;
    animation: atelier-rail-hint-in 0.22s ease-out;
}

.atelier-rail-hint::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 18px;
    width: 12px;
    height: 12px;
    background: var(--on-surface);
    transform: rotate(45deg);
    box-shadow: -1px -1px 0 0 rgba(0, 0, 0, 0.05);
}

.atelier-rail-hint .atelier-toast__content {
    flex: 1 1 auto;
}

@keyframes atelier-rail-hint-in {
    from { transform: translateY(-4px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}


/* =====================================================================
   Phase 3F — Collection proof (portal "My Orders" drawer + admin drawer)
   ===================================================================== */

.collection-proof {
    margin: 0 0 28px;
    padding: 18px 20px 20px;
    background: var(--surface-low);
    border-radius: var(--radius-sm);
}

.collection-proof__title {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--on-surface-variant);
    font-weight: 700;
    margin: 0 0 14px;
}

.collection-proof__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin-bottom: 16px;
}

.collection-proof__field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.collection-proof__label {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--on-surface-variant);
    margin-bottom: 4px;
    font-weight: 600;
}

.collection-proof__value {
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    color: var(--on-surface);
}

/* Task #92 — driver handover note can be a sentence or two, so it
   gets the full row instead of sitting next to the driver/timestamp
   chips, with whitespace preserved for natural line breaks. */
.collection-proof__field--notes {
    flex-basis: 100%;
}

.collection-proof__field--notes .collection-proof__value {
    white-space: pre-wrap;
}

.collection-proof__media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.collection-proof__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.collection-proof__image {
    display: block;
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: var(--radius-sm);
    background: var(--surface-lowest);
    box-shadow: var(--elev-1);
}

.collection-proof__image--signature {
    background: #ffffff;
    padding: 8px;
    box-sizing: border-box;
}

.collection-proof__empty {
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    color: var(--on-surface-variant);
    margin: 0;
}

@media (max-width: 600px) {
    .collection-proof__media { grid-template-columns: 1fr; }
    .collection-proof__image { max-width: 100%; }
}
