:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #17202b;
  --muted: #5f6b7a;
  --border: #dde3ea;
  --primary: #1f4e79;
  --primary-hover: #183e61;
  --primary-soft: #e6eef7;
  --good: #1e7a46;
  --good-soft: #e3f4ea;
  --warn: #9a6200;
  --warn-soft: #fff4dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --grant: #6b3fa0;
  --grant-soft: #f1eafa;
  --customer: #0d7377;
  --customer-soft: #e0f3f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --nav-w: 232px;
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171e26;
    --surface-2: #1d252f;
    --text: #e6ebf1;
    --muted: #9aa6b4;
    --border: #2b3542;
    --primary: #5b9bd5;
    --primary-hover: #77afe0;
    --primary-soft: #1b2b3c;
    --good: #4cc282;
    --good-soft: #15301f;
    --warn: #e9b44c;
    --warn-soft: #33280f;
    --bad: #f07167;
    --bad-soft: #3a1a18;
    --grant: #b896e6;
    --grant-soft: #2a2038;
    --customer: #4fc4c8;
    --customer-soft: #11302f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
h1 { font-size: 1.45rem; margin: 0 0 .2rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
p { margin: .35rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warnc { color: var(--warn); }
.prewrap { white-space: pre-wrap; }
.break { word-break: break-all; }
.center { justify-content: center; }
.mt { margin-top: 1.25rem; }
.pad { padding: 1rem 1.25rem; }
.pad-x { padding: 0 1rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
.print-only { display: none; }

/* ---------- top bar & navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
  background: var(--primary);
  color: #fff;
}
@media (prefers-color-scheme: dark) { .topbar { background: #12263b; } }
.brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 22px; width: auto; filter: brightness(0) invert(1); } /* logo file is black; show it white on the header */
.nav-toggle { display: none; color: #fff; }
.global-search { flex: 1; max-width: 520px; position: relative; margin-left: auto; }
.global-search input {
  width: 100%; height: 36px; border-radius: 8px; border: 0; padding: 0 .8rem;
  background: rgba(255, 255, 255, .16); color: #fff; font: inherit;
}
.global-search input::placeholder { color: rgba(255, 255, 255, .75); }
.global-search input:focus { outline: 2px solid #fff; background: rgba(255, 255, 255, .24); }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); max-height: 60vh; overflow: auto;
}
.search-results a { display: block; padding: .5rem .8rem; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--primary-soft); text-decoration: none; }
.scan-btn { background: #fff !important; color: var(--primary) !important; border-color: #fff !important; font-weight: 700; }
@media (prefers-color-scheme: dark) { .scan-btn { color: #12263b !important; } }
.user-chip {
  background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 999px;
  padding: .35rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}

.sidenav {
  position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w);
  overflow-y: auto; padding: .75rem .6rem 2rem;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 20;
}
.sidenav a {
  display: block; padding: .5rem .75rem; border-radius: 8px; color: var(--text); margin-bottom: 2px; font-size: .93rem;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem .75rem .3rem; }
.nav-scrim { display: none; }

main { margin-left: var(--nav-w); padding: 1.5rem 1.75rem 4rem; max-width: 1400px; outline: none; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 24px rgba(0, 0, 0, .2); }
  body.nav-open .sidenav { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(0, 0, 0, .35); z-index: 15; }
  main { margin-left: 0; padding: 1rem 1rem 4rem; }
  .brand-name { display: none; }
  .user-chip span { display: none; }
}
@media (max-width: 520px) {
  .topbar { gap: .5rem; padding: 0 .6rem; }
  .global-search input { font-size: 16px; }
}

/* ---------- sign-in & roles ---------- */
body.locked .topbar, body.locked .sidenav, body.locked main, body.locked .nav-scrim { visibility: hidden; }
#signin { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 1rem; background: var(--bg); }
.signin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 2rem 1.75rem; width: min(400px, 100%); text-align: center; }
.signin-logo { height: 52px; width: auto; margin-bottom: .5rem; }
@media (prefers-color-scheme: dark) { .signin-logo { filter: brightness(0) invert(1); } }
.signin-card h1 { margin-bottom: .25rem; }
.signin-google { display: flex; justify-content: center; min-height: 44px; margin: 1.25rem 0 .5rem; }
.signin-msg { min-height: 1.5em; font-size: .9rem; }
.signin-dev { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; display: grid; gap: .5rem; text-align: left; }
.user-chip { display: inline-flex; align-items: center; gap: .4rem; }
.user-chip img { width: 22px; height: 22px; border-radius: 50%; }
.account-menu { position: fixed; top: calc(var(--top-h) - 4px); right: .75rem; z-index: 60; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); min-width: 220px; padding-bottom: .6rem; }
.account-menu .link { margin: 0 1rem; }
.pad-sm { padding: .75rem 1rem; }
body:not([data-role="custodian"]):not([data-role="manager"]):not([data-role="admin"]) .need-custodian,
body:not([data-role="manager"]):not([data-role="admin"]) .need-manager,
body:not([data-role="admin"]) .need-admin { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 36px; padding: .4rem .9rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.small { min-height: 30px; padding: .2rem .6rem; font-size: .82rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0f141a; } }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.active { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.icon-btn { background: none; border: 0; font-size: 1.15rem; cursor: pointer; padding: .3rem .5rem; color: inherit; border-radius: 6px; }
.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: .88rem; }
.link.danger, .danger { color: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- layout pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.crumbs { margin: 0 0 .2rem; font-size: .85rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2.pad { margin: 0; padding-bottom: .5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 1.5rem; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .grid-detail { grid-template-columns: minmax(0, 1fr); } }
.grid-detail > *, .grid-2 > *, .scan-layout > * { min-width: 0; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; }
.notice { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text); border-radius: 8px; padding: .65rem .9rem; margin-bottom: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { text-decoration: none; border-color: var(--primary); }
.tile-label { font-size: .82rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile-value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; margin: .15rem 0; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: .83rem; color: var(--muted); }
.tiles-alert .tile-value { font-size: 1.5rem; }
.tile-warn { border-left: 4px solid var(--warn); }
.tile-bad { border-left: 4px solid var(--bad); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.card .tabs { margin-bottom: 0; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.table th, .table td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.compact th, .table.compact td { padding: .4rem .7rem; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: var(--primary-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .chk { width: 36px; }
.table td.actions { white-space: nowrap; text-align: right; }
.table tfoot td { background: var(--surface-2); }
.report-table td { white-space: nowrap; }
.table code { white-space: nowrap; }
.table select { width: auto; min-width: 120px; min-height: 32px; padding: .2rem .5rem; }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; vertical-align: middle; }
a.badge:hover { text-decoration: none; border-color: var(--primary); }
.reg-fixed { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.reg-grant { background: var(--grant-soft); color: var(--grant); border-color: transparent; }
.reg-customer { background: var(--customer-soft); color: var(--customer); border-color: transparent; }
.st-in_service { background: var(--good-soft); color: var(--good); border-color: transparent; }
.st-in_storage, .st-checked_out { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.st-in_repair { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-missing { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.st-disposed { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.tag-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--primary-soft); color: var(--primary); padding: .05rem .45rem; border-radius: 6px; font-weight: 700; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; background: var(--muted); }
.dot.ok { background: var(--good); } .dot.warn { background: var(--warn); } .dot.err { background: var(--bad); }

/* ---------- detail ---------- */
dl.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem 1.25rem; margin: 0 0 1.25rem; }
dl.info.one { grid-template-columns: 1fr 1fr; }
dl.info dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
.qr-card { display: flex; gap: 1rem; align-items: center; }
.qr-card img { background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: .65rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.timeline li:last-child { border: 0; }
.tl-icon { flex: none; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); border-radius: 50%; font-size: .8rem; }
.tl-dot { flex: none; width: .55rem; height: .55rem; margin-top: .45rem; background: var(--primary); border-radius: 50%; }
details.menu { position: relative; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 40px; z-index: 10; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); min-width: 260px; padding: .3rem; }
.menu-items button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .55rem .7rem; border-radius: 6px; font: inherit; cursor: pointer; color: var(--text); }
.menu-items button:hover { background: var(--surface-2); }
.menu-items button.danger { color: var(--bad); }
.stock-card .stock-qty { font-size: 1rem; color: var(--muted); }
.stock-card .stock-qty span { font-size: 2.6rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stock-card.low { border-left: 4px solid var(--bad); }
.stock-card .btn-row { margin-top: .9rem; }

/* ---------- forms ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
fieldset[hidden] { display: none; }
legend { font-weight: 700; font-size: 1rem; margin-bottom: .6rem; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: .9rem 1rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: .84rem; font-weight: 600; }
.field small { color: var(--muted); font-size: .78rem; }
.req { color: var(--bad); margin-left: 2px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .65rem; min-height: 38px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent); border-color: var(--primary); }
textarea { resize: vertical; }
@media (max-width: 520px) { input, select, textarea { font-size: 16px; } }
.check { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; cursor: pointer; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 9px; padding: 3px; background: var(--surface-2); gap: 2px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: .38rem .85rem; border-radius: 7px; font-size: .9rem; font-weight: 500; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); }
.segmented.small span { padding: .3rem .7rem; font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters > input[type=search] { flex: 1 1 260px; }
.filters .field { flex: 0 1 220px; }
.filters .field > span { font-size: .75rem; color: var(--muted); }
.qty-input { display: flex; gap: .4rem; }
.qty-input input { text-align: center; font-size: 1.3rem; font-weight: 700; }
.qty-input .btn { min-width: 48px; font-size: 1.3rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1rem; }
.report-card { color: var(--text); margin: 0; }
a.report-card:hover { border-color: var(--primary); text-decoration: none; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .5); z-index: 100; display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.modal-wide { width: min(780px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.modal header h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: .25rem 1.25rem 1rem; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; width: min(92vw, 520px); }
.toast { background: #17202b; color: #fff; padding: .65rem 1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(8px); transition: .2s; font-size: .92rem; }
.toast.show { opacity: 1; transform: none; }
.toast-err { background: var(--bad); }
.toast-warn { background: #8a5a00; }

/* ---------- scanner ---------- */
.scan-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .scan-layout { grid-template-columns: minmax(0, 1fr); } }
.scan-video-wrap { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; margin-bottom: .75rem; }
.scan-video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-reticle { position: absolute; inset: 18% 22%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.torch-btn { position: absolute; right: .5rem; top: .5rem; background: rgba(0, 0, 0, .45); color: #fff; }
.scan-controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.scan-manual { display: flex; gap: .4rem; flex: 1 1 260px; }
.scan-manual input { font-family: ui-monospace, Consolas, monospace; }
.scan-hint { margin-top: .6rem; }
.context-bar:not(:empty), .here { margin-bottom: .8rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.here select { width: auto; min-height: 32px; padding: .2rem .4rem; }
.result-card { border-left: 5px solid var(--muted); padding: .9rem 1.1rem; border-radius: 10px; background: var(--surface); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.result-card.ok { border-left-color: var(--good); background: color-mix(in srgb, var(--good-soft) 55%, var(--surface)); }
.result-card.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 70%, var(--surface)); }
.result-card.err { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad-soft) 70%, var(--surface)); }
.result-head { font-size: 1.05rem; margin-bottom: .4rem; }
.result-card .info { margin-bottom: .8rem; }
.result-card.flash { animation: flash .5s; margin-top: .8rem; }
@keyframes flash { from { transform: scale(.97); opacity: .3; } to { transform: none; opacity: 1; } }
.big-qty { font-size: 2.2rem; font-weight: 700; margin: .2rem 0; }
.big-qty span { font-size: 1rem; font-weight: 400; color: var(--muted); }
.scan-log li { padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.scan-log li.log-err { color: var(--bad); }
.progress-card { padding: .9rem 1.1rem; }
.progress { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: var(--good); transition: width .3s; }
.stats { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-top: .6rem; font-size: .9rem; }

/* ---------- labels ---------- */
.label-sheets { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; padding: 1rem 0; overflow-x: auto; }
.sheet { background: #fff; color: #000; box-shadow: 0 2px 10px rgba(0, 0, 0, .2); display: grid; align-content: start; flex: none; margin-inline: auto; }
.sheet.thermal { display: block; }
.lbl { display: flex; align-items: center; gap: .06in; padding: .06in .08in; overflow: hidden; color: #000; font-family: Arial, Helvetica, sans-serif; outline: 1px dashed #ccd; outline-offset: -1px; }
.lbl-qr { height: 100%; aspect-ratio: 1; flex: none; image-rendering: pixelated; }
.lbl-text { min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.12; }
.lbl-org { font-size: 6pt; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-tag { font-family: "Cascadia Mono", Consolas, "Courier New", monospace; font-size: 11pt; font-weight: 700; white-space: nowrap; }
.lbl-name { font-size: 6.5pt; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl-foot { font-size: 5.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.size-md .lbl-tag { font-size: 13pt; } .size-md .lbl-org { font-size: 7pt; } .size-md .lbl-name { font-size: 7.5pt; } .size-md .lbl-foot { font-size: 6.5pt; }
.size-lg .lbl { padding: .12in; gap: .12in; } .size-lg .lbl-tag { font-size: 18pt; } .size-lg .lbl-org { font-size: 9pt; } .size-lg .lbl-name { font-size: 10pt; -webkit-line-clamp: 3; } .size-lg .lbl-foot { font-size: 8pt; }
.size-lg .lbl-qr { height: 85%; }

@media print {
  .topbar, .sidenav, .nav-scrim, #toasts, .no-print, .filters, .btn-row, .tabs { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 10pt; }
  .print-only { display: block; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table th { background: none; color: #000; }
  .table th, .table td { padding: 2px 4px; border-bottom: 1px solid #ccc; }
  body.printing-labels .label-sheets { display: block; padding: 0; gap: 0; overflow: visible; }
  body.printing-labels .sheet { box-shadow: none; page-break-after: always; break-after: page; margin: 0; }
  body.printing-labels .lbl { outline: none; }
}
