/* ─────────────────────────────────────────────────────────────────────────────
   PlatinumWCA — shell, pages, and boot surfaces.

   The shell follows PlatinumPOS: a white app bar with NO bottom border
   (POS `.mud-appbar { border-bottom: none }`), a borderless drawer
   (`.mud-drawer { border-right: none }`) whose links are MD3 pills, and a
   working surface on the light cool-grey ground.
   ──────────────────────────────────────────────────────────────────────────── */

/* ═══ SHELL ═════════════════════════════════════════════════════════════════ */

.shell { min-height: 100dvh; display: flex; flex-direction: column; }

/* POS's app bar is 64px and carries no bottom border. */
.head {
    position: sticky; top: 0; z-index: var(--z-sticky);
    display: flex; align-items: center; gap: var(--s-2);
    height: 64px; padding: 0 var(--s-3) 0 var(--s-2);
    background: var(--stock);
    border-bottom: none;
}
.head__brand {
    display: flex; align-items: center; gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    background: none; border: none; cursor: pointer;
    color: var(--ink); text-decoration: none;
    border-radius: var(--r-pill);
    transition: background-color var(--dur-1) var(--ease);
}
.head__brand:hover { background: var(--bench-deep); }
.head__mark { width: 28px; height: 28px; flex: 0 0 auto; }
.head__name {
    font-size: var(--t-body); font-weight: 700;
    letter-spacing: var(--track-h); line-height: 1.15;
    text-align: left; white-space: nowrap;
}
.head__name small {
    display: block;
    font-size: var(--t-fine); font-weight: 500;
    letter-spacing: 0; text-transform: none; color: var(--ink-3);
}
.head__who {
    font-size: var(--t-small); color: var(--ink-2);
    padding-right: var(--s-2); white-space: nowrap;
    max-width: 14rem; overflow: hidden; text-overflow: ellipsis;
}

/* The head is a width budget, not a layout: below the drawer's breakpoint the
   wordmark goes so every control still fits a 390px phone. */
@media (max-width: 700px) {
    .head { gap: 0; padding-right: 0; height: 56px; }
    .head__name { display: none; }
    .head__brand { padding-left: var(--s-2); padding-right: var(--s-2); }
    .head .ibtn { width: 40px; flex: 0 0 auto; }
}

.body { flex: 1 1 auto; display: flex; align-items: stretch; min-height: 0; }

/* ── The drawer ───────────────────────────────────────────────────────────
   POS: no right border, and every link is a 100px pill inset from the edge. */
.index {
    flex: 0 0 auto;
    width: 260px;                      /* POS DrawerWidthLeft */
    background: var(--bench);          /* POS DrawerBackground */
    border-right: none;
    display: flex; flex-direction: column;
}
.index__nav { padding: var(--s-2) 0; flex: 1 1 auto; position: sticky; top: 64px; }
.index__group { padding: var(--s-5) var(--s-6) var(--s-2); }
.index__foot {
    padding: var(--s-4) var(--s-5);
    font-size: var(--t-fine);
    line-height: 1.5;
    color: var(--ink-3);
    text-align: center;
}

/* POS .mud-drawer .mud-nav-link, ported value for value. */
.nlink {
    display: flex; align-items: center; gap: var(--s-4);
    min-height: var(--hit);
    border-radius: var(--r-pill);
    margin: 4px 12px;
    padding: 10px 16px;
    color: var(--ink-2);              /* POS DrawerText */
    text-decoration: none;
    font-size: var(--t-body);
    font-weight: 500;
    transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.nlink:hover { background: var(--bench-deep); color: var(--ink); }
.nlink.is-here {
    background: var(--spot-wash);
    color: var(--spot);
    font-weight: 600;
}
.nlink.is-here .nlink__icon { color: var(--spot); }
.nlink__icon { flex: 0 0 auto; color: var(--ink-3); }

@media (max-width: 1000px) {
    .index {
        position: fixed; top: 56px; left: 0; bottom: 0;
        z-index: var(--z-modal);
        transform: translateX(-100%);
        transition: transform var(--dur-3) var(--ease);
        box-shadow: var(--lift-3);
        background: var(--stock);
    }
    .index.is-open { transform: none; }
    .index__nav { position: static; }
    .index__scrim {
        display: block; position: fixed; inset: 56px 0 0 0;
        z-index: var(--z-scrim);
        background: rgba(15, 23, 42, .40);
        animation: fade var(--dur-2) var(--ease);
    }
}
.index__scrim { display: none; }
@media (prefers-reduced-motion: reduce) { .index { transition: none; } }

/* ── The working surface ──────────────────────────────────────────────────── */
.work { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--bench); }
/* overflow-x: hidden, not visible's default: a wide table inside .tbl-wrap
   scrolls itself (that wrapper has its own overflow-x: auto), but nothing
   upstream of it constrains width, so on a phone the overflow was escaping
   tbl-wrap's own box and widening this — and everything above it, up to the
   page - past the viewport. Clipped here rather than on .tape, which every
   card in the app uses and some may legitimately want to overflow. */
.work__in { flex: 1 1 auto; padding: var(--s-6) var(--s-6) var(--s-8); overflow-x: hidden; }
@media (max-width: 700px) { .work__in { padding: var(--s-4) var(--s-4) var(--s-8); } }

.tape-col { max-width: var(--measure-tape); margin: 0 auto; }
.bench-col { max-width: var(--measure-bench); margin: 0 auto; }
.bench-col--wide { max-width: none; }

/* ── The page head ────────────────────────────────────────────────────────
   POS .rw-section-header: heading and description on the left, actions on the
   right, wrapping onto their own row rather than overflowing on a phone. */
.phead {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: var(--s-3) var(--s-5);
    margin-bottom: var(--s-6);
}
.phead > *:first-child { flex: 1 1 220px; min-width: 0; }
.phead__title { font-size: var(--t-h4); font-weight: 700; letter-spacing: var(--track-h); line-height: 1.2; }
.phead__note { font-size: var(--t-small); color: var(--ink-2); margin-top: 4px; }
.phead__acts { flex: 0 1 auto; display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.phead__acts .switch { padding-bottom: 0; }

/* ── Grid helpers ─────────────────────────────────────────────────────────── */
.cols { display: grid; gap: var(--s-5); }
.cols--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols--7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s-6); }
.cols--donut { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
@media (max-width: 1100px) { .cols--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .cols--7-5, .cols--3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px)  { .cols--donut { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px)  { .cols--4 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px)  { .cols--2 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: var(--s-6); }

/* ── The tally strip ──────────────────────────────────────────────────────
   POS's dashboard tiles: one card per figure, 24px radius, lifting on hover. */
.tally {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--s-4);
}
.tally__cell {
    padding: var(--s-5);
    background: var(--stock);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    container-type: inline-size;
}
.tally__num {
    font-family: var(--face-value);
    font-variant-numeric: tabular-nums lining-nums;
    font-size: clamp(1.25rem, 14cqw, 1.9rem);
    line-height: 1.2; letter-spacing: -0.02em; font-weight: 700;
    display: block; white-space: nowrap; max-width: 100%;
    color: var(--ink);
}
.tally__num--flag { color: var(--warn-strong); }
.tally__leg { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--t-small); font-weight: 500; }
@media (max-width: 700px) { .tally { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── The bench ────────────────────────────────────────────────────────────── */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.bench__queue { min-width: 0; }
.bench__open { min-width: 0; order: -1; }
@media (min-width: 1600px) {
    .bench--split { grid-template-columns: minmax(0, 1fr) 19rem; }
    .bench--split:has(.bench__open > div) { grid-template-columns: minmax(0, 1fr) 23rem; }
    .bench__open { order: 0; position: sticky; top: calc(64px + var(--s-5)); }
    .bench--split .bench__open > div { margin-top: 0; }
}

/* ── Sign-in ──────────────────────────────────────────────────────────────────
   Ported from PlatinumWeigh's login screen (rw-login-*): logo and everything
   else inside one card, not a wordmark row sitting above it. */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-5); background: var(--bench); }
.signin__col { width: min(26rem, 100%); }
.signin__tape { padding: 0; }
.signin__body { padding: var(--s-10) var(--s-10) var(--s-8); }
.signin__mark { display: flex; justify-content: center; margin-bottom: var(--s-3); }
.signin__mark img { width: 96px; height: 96px; }
/* The mark above and the footer below are both centred, so a left-aligned
   title was the only thing off the centre line on the whole screen. */
.signin__title { text-align: center; font-size: var(--t-h5); font-weight: 700; letter-spacing: -0.01em; margin: 0 0 var(--s-2); }
.signin__sub { text-align: center; color: var(--ink-2); margin: 0 0 var(--s-6); }
.signin__foot { margin-top: var(--s-6); text-align: center; font-size: var(--t-fine); color: var(--ink-3); }

@media (max-width: 480px) {
    .signin__body { padding: var(--s-6) var(--s-5) var(--s-5); }
    .signin__mark img { width: 76px; height: 76px; }
}

/* ── The brand lockup ─────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: var(--s-3); user-select: none; }
.brand__mark { flex: 0 0 auto; display: block; }
.brand__words { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: var(--t-body); font-weight: 700; letter-spacing: var(--track-h); color: var(--ink); }
.brand__sub { font-size: var(--t-fine); font-weight: 500; color: var(--ink-2); }

/* ── Spacing utilities ────────────────────────────────────────────────────── */
.u-center { margin-left: auto; margin-right: auto; }
.u-mt-2 { margin-top: var(--s-2); }
.u-mt-3 { margin-top: var(--s-3); }
.u-mt-4 { margin-top: var(--s-4); }
.u-mt-5 { margin-top: var(--s-5); }
.u-mt-8 { margin-top: var(--s-8); }
.u-mb-3 { margin-bottom: var(--s-3); }
.u-mb-4 { margin-bottom: var(--s-4); }

/* ── Boot surfaces ────────────────────────────────────────────────────────
   These render before any stylesheet variable exists, so they carry their own
   colours. Kept in sync with tokens.css by hand, deliberately. */
.loading-progress {
    position: relative; display: block;
    width: 5rem; height: 5rem;
    margin: 32vh auto 1rem auto;
}
.loading-progress circle {
    fill: none; stroke: #E2E8F0; stroke-width: 3px;
    transform-origin: 50% 50%; transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #2563EB;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute; text-align: center;
    inset: calc(32vh + 2.1rem) 0 auto 0;
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.875rem; font-weight: 500; color: #475569;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

#blazor-error-ui {
    position: fixed; left: 0; bottom: 0; width: 100%;
    z-index: 2000; display: none; box-sizing: border-box;
    padding: 12px 16px;
    /* Red 600, not POS's Error #EF4444: white on that is 3.76:1, and this
       bar exists to be read at the worst possible moment. */
    background: #DC2626; color: #FFFFFF;
    font-family: Inter, system-ui, sans-serif; font-size: 0.875rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,.2);
}
#blazor-error-ui a { color: #FFFFFF; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: 0.6rem; }

.blazor-error-boundary {
    background: #DC2626; color: #FFFFFF;
    padding: 16px; border-radius: 12px;
    font-family: Inter, system-ui, sans-serif;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ── Brand splash ─────────────────────────────────────────────────────────
   Unchanged: the Platinum Brink mark and its particle animation are a brand
   commitment. Geometry is duplicated in an inline <style> in index.html so it
   applies before this stylesheet lands - keep the two in sync. */
/* The splash never takes a pointer.

   It is a brand moment on a fixed 3-second timer, not a modal, but it is
   position:fixed at z-index 9999 over the whole viewport - so for the 3.6
   seconds before it removes itself it was swallowing every tap and click on the
   page behind it. The sign-in form is up and interactive well before then, so a
   quick operator's first tap simply did nothing. Decorative overlays do not
   take input. */
#splash-screen {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
#splashCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.splash-overlay {
    position: relative; z-index: 10; text-align: center;
    display: flex; flex-direction: column; align-items: center;
}
.splash-logo-wrap { position: relative; width: 120px; height: 120px; margin-bottom: 2rem; }
.splash-logo { width: 100%; height: 100%; position: relative; z-index: 2; }
.splash-glow {
    position: absolute; top: 50%; left: 50%;
    width: 140%; height: 140%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, rgba(37,99,235,0) 70%);
    z-index: 1;
}
.splash-tagline {
    font-family: Inter, system-ui, sans-serif;
    color: #64748B;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
}
