:root {
    --navy-900:#081427; --navy-800:#0d1f3c; --navy-700:#14305c; --navy-600:#1d4279;
    --accent:#1ec8de; --accent-2:#13a3c4; --amber:#ffb547;
    --ink:#0f1b2d; --slate:#4b5a6e; --muted:#76859a; --line:#e3e8ef;
    --bg:#fff; --bg-soft:#f5f8fc; --bg-tint:#eef4fb; --radius:14px; --radius-lg:22px;
    --font:"Inter",-apple-system,"Segoe UI",Roboto,sans-serif;
}
html, body { font-family: var(--font); color: var(--ink); background: var(--bg-soft); }
a, .btn-link { color: var(--navy-600); }
.btn-primary { color: var(--navy-900); background-color: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover, .btn-primary:focus { color: var(--navy-900); background-color: var(--accent-2); border-color: var(--accent-2); }
.btn:focus, .form-control:focus, .form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(30,200,222,.25); border-color: var(--accent); }
.nav-tabs .nav-link { color: var(--slate); border-radius: var(--radius) var(--radius) 0 0; cursor: pointer; }
.nav-tabs .nav-link.active { color: var(--navy-700); font-weight: 700; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #b42318; }
h1:focus { outline: none; }

.ex-shell { min-height: 100vh; }
.ex-topbar { background: var(--navy-900); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.5rem; }
.ex-brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.ex-brand span { color: var(--accent); }
.ex-brand small { color: var(--muted); font-weight: 400; font-size: .8rem; margin-left: .6rem; letter-spacing: 0; }
.ex-nav { display: flex; gap: 1.25rem; margin-right: auto; margin-left: 2rem; }
.ex-nav a { color: #fff; text-decoration: none; font-weight: 600; }
.ex-nav a:hover { color: var(--accent); }
.ex-user { display: flex; align-items: center; gap: 1rem; font-size: .875rem; }
.ex-user a { color: var(--accent); text-decoration: none; }
.ex-user form { margin: 0; }
.ex-main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.ex-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-top: 1rem; }
.ex-key { font-family: Consolas, monospace; background: var(--bg-tint); border: 1px dashed var(--accent-2); border-radius: 10px; padding: .6rem .8rem; word-break: break-all; user-select: all; }
.ex-chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.ex-chip.ok { background: #dcfce7; color: #15803d; }
.ex-chip.bad { background: #fef2f2; color: #991b1b; }
#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ---- Sign-in (BlankLayout) — VAST corporate tokens ------------------------------- */

.ex-auth-page {
    /* Tokens come from :root now - this block used to redeclare them, which meant a brand change
       had to be made twice and the sign-in page silently kept the old palette. */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, var(--navy-700) 0%, var(--navy-900) 100%);
}

.ex-auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(8, 20, 39, .45);
}

.ex-auth-brand {
    background: var(--navy-900);
    color: #fff;
    padding: 1.4rem 1.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.ex-auth-brand span { color: var(--accent); }

.ex-auth-brand-sub {
    font-size: .8rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    margin-top: .15rem;
}

.ex-auth-body { padding: 1.75rem; }

.ex-auth-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 1.25rem;
}

.ex-auth-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: .3rem;
}

.ex-auth-input {
    width: 100%;
    padding: .6rem .8rem;
    margin-bottom: .35rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-soft);
    color: var(--ink);
}

.ex-auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(30, 200, 222, .25);
    background: #fff;
}

/* ---- Password reveal (<PasswordReveal />), shared by the sign-in card and the Identity forms ----
   The button is absolutely positioned inside whatever wrapper holds the input, so that wrapper must
   be position:relative. Bootstrap's .form-floating already is; .ex-auth-password is set below. */
.ex-reveal {
    position: absolute;
    top: 0;
    right: .45rem;
    display: flex;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 0 .35rem;
    border-radius: 8px;
    color: var(--slate);
    cursor: pointer;
    /* Above .form-floating's label, which otherwise sits over the button and eats the click. */
    z-index: 3;
}

.ex-reveal:hover { color: var(--ink); }

.ex-reveal:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* One icon at a time, chosen by the button's own aria-pressed - so the accessible state and the
   visual state cannot drift apart. eye = currently masked, eye-slash = currently revealed. */
.ex-reveal .ex-eye-off { display: none; }
.ex-reveal[aria-pressed="true"] .ex-eye { display: none; }
.ex-reveal[aria-pressed="true"] .ex-eye-off { display: block; }

/* Sign-in card: bottom is the input's own margin-bottom, so the button centres on the INPUT rather
   than on the wrapper plus that margin. */
.ex-auth-password { position: relative; }
.ex-auth-password .ex-auth-input { padding-right: 2.6rem; }
.ex-auth-password .ex-reveal { bottom: .35rem; }

/* Bootstrap form-floating: the wrapper is exactly the input's height, and mb-3 is a margin outside
   it. Scoped to .ex-has-reveal so no other floating field loses padding it needs. */
.ex-has-reveal .form-control { padding-right: 2.6rem; }
.ex-has-reveal .ex-reveal { bottom: 0; }

.ex-auth-validation { display: block; font-size: .8rem; color: #b42318; margin-bottom: .6rem; }

.ex-auth-remember {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    color: var(--slate);
    margin: .75rem 0 1.1rem;
}

.ex-auth-button {
    width: 100%;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--navy-900);
    font-weight: 700;
    cursor: pointer;
}

.ex-auth-button:hover { background: #13a3c4; }

.ex-auth-error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
    border-radius: 14px;
    padding: .6rem .8rem;
    font-size: .875rem;
    margin-bottom: 1rem;
}

.ex-auth-help {
    margin: 1.25rem 0 0;
    font-size: .8rem;
    color: var(--muted);
    text-align: center;
}


/* ---- Scanner (/scan) - Newland handhelds, 360px wide, big touch targets ----------------------- */
.sc { max-width: 560px; margin: 0 auto; }
.sc-field { font-size: 1.25rem; min-height: 3.25rem; }
.sc-scan { font-size: 1.5rem; font-family: Consolas, monospace; border-width: 2px; }
.sc-btn { min-height: 3.25rem; font-size: 1.05rem; font-weight: 600; }
.sc-msg { padding: .6rem .8rem; }
.sc-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.sc-loc { background: var(--navy-800); color: #fff; font-weight: 700; padding: .25rem .7rem; border-radius: 999px; }
.sc-banner { margin-top: .75rem; padding: 1rem; border-radius: var(--radius); color: #fff; font-size: 1.05rem; word-break: break-word; }
.sc-banner-result { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.sc-banner-code { font-family: Consolas, monospace; font-size: 1.15rem; font-weight: 700; }
.sc-banner-sage { margin-top: .35rem; font-weight: 700; font-size: 1.2rem; }
.sc-counts { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.sc-count { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; color: #fff; }
.sc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .75rem; }
.sc-actions .btn-outline-danger { grid-column: 1 / -1; }
.sc-recent { list-style: none; padding: 0; margin: 0; }
.sc-recent li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .6rem; margin-bottom: .35rem; }
.sc-recent-code { font-family: Consolas, monospace; font-weight: 700; margin: 0 .4rem; word-break: break-all; }
/* Result colours: Correct green, WrongLocation amber, NotFound red, Ambiguous purple, Disposed grey, Duplicate blue. */
.sc-correct { background: #15803d; }
.sc-wronglocation { background: #b45309; }
.sc-notfound { background: #b91c1c; }
.sc-ambiguous { background: #7e22ce; }
.sc-disposed { background: #4b5563; }
.sc-duplicate { background: #1d4ed8; }

@media (max-width: 640px) {
    .ex-topbar { flex-wrap: wrap; gap: .4rem .75rem; padding: .5rem .75rem; }
    .ex-nav { margin-left: 0; gap: 1rem; }
    .ex-user { flex-wrap: wrap; gap: .5rem; font-size: .8rem; }
    .ex-main { padding: .75rem; }
}

/* Handheld shell (ScannerLayout) and the printable scanner label. */
.sc-topbar { flex-wrap: wrap; gap: .4rem .75rem; padding: .5rem .75rem; }
.sc-topbar-scanner { font-weight: 700; color: var(--accent); margin-right: auto; }
.sc-main { max-width: 640px; padding: .75rem; }
.sc-label { display: inline-block; text-align: center; padding: 1rem; border: 1px dashed #999; background: #fff; }
.sc-label-name { font-size: 1.1rem; font-weight: 700; margin-top: .4rem; }
.sc-label-code { font-family: Consolas, monospace; font-size: 1.3rem; letter-spacing: .1em; }
@media print { .no-print, .ex-topbar { display: none !important; } .sc-label { border: 0; } }

/* ---- Dashboard (/) ---------------------------------------------------------------- */
.db-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.db-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.db-tile span { display: block; color: var(--slate); font-size: .85rem; }
.db-tile strong { font-size: 2rem; color: var(--navy-700); }
.db-shortcuts { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Printable session report (/sessions/{id}/print), A4 portrait ------------------ */
.pr-page { max-width: 210mm; margin: 0 auto; padding: 1rem; background: #fff; font-size: 10pt; }
.pr-toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.pr-title { font-size: 14pt; font-weight: 700; margin: 0 0 .5rem; }
.pr-header { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0 0 .5rem; }
.pr-header dt { display: inline; font-weight: 600; margin-right: .3rem; }
.pr-header dd { display: inline; margin: 0; }
.pr-counts { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem 0; }
.pr-group { font-size: 11pt; font-weight: 700; margin: 1rem 0 .3rem; break-after: avoid; }
.pr-table { width: 100%; border-collapse: collapse; font-size: 8.5pt; }
.pr-table th { background: var(--navy-900); color: #fff; text-align: left; padding: 3px 5px; }
.pr-table td { border-bottom: 1px solid var(--line); padding: 3px 5px; vertical-align: top; }
.pr-table thead { display: table-header-group; }     /* repeat the header row on every printed page */
.pr-table tr { break-inside: avoid; page-break-inside: avoid; }
@media print {
    @page { size: A4 portrait; margin: 12mm; }
    html, body { background: #fff; }
    .pr-toolbar, #blazor-error-ui, #components-reconnect-modal { display: none !important; }
    .pr-page { max-width: none; padding: 0; }
    .pr-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
