/* Bundle Portal Inventory theme. Tokens first, then mapped onto Bootstrap's --bs-* variables. */
:root {
  --brand: #1463d8;
  --brand-d: #0d4bab;
  --brand-s: #e8f0fd;
  --navy: #0b1f45;
  --navy-2: #13306a;
  --navy-ink: #c9d6ee;
  --navy-muted: #7f93bd;
  --ink: #14213d;
  --muted: #5d6b85;
  --line: #dfe5ef;
  --bg: #f3f6fb;
  --soft: #f7f9fa;
  --ok: #25855a;
  --ok-s: #e3f3ea;
  --warn: #9a5d00;
  --warn-s: #fdf1dc;
  --bad: #c0392b;
  --bad-s: #fbe5e2;
  --blue: #1d5fa8;
  --blue-s: #e5eef9;
  --plum: #6a3fb5;
  --plum-s: #efe7fb;
  --topbar-h: 60px;

  --bs-primary: #1463d8;
  --bs-primary-rgb: 20, 99, 216;
  --bs-primary-text-emphasis: #0d4bab;
  --bs-primary-bg-subtle: #e8f0fd;
  --bs-primary-border-subtle: #b9d0f6;
  --bs-body-bg: #f3f6fb;
  --bs-body-bg-rgb: 243, 246, 251;
  --bs-body-color: #14213d;
  --bs-body-color-rgb: 20, 33, 61;
  --bs-body-font-family: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-font-sans-serif: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-heading-color: #0b1f45;
  --bs-border-color: #dfe5ef;
  --bs-secondary-color: #5d6b85;
  --bs-secondary-color-rgb: 93, 107, 133;
  --bs-border-radius-lg: 14px;
  --bs-link-color: #1463d8;
  --bs-link-color-rgb: 20, 99, 216;
  --bs-link-hover-color: #0d4bab;
  --bs-link-hover-color-rgb: 13, 75, 171;
  --bs-focus-ring-color: rgba(20, 99, 216, .3);
  --bs-success: #25855a;
  --bs-success-rgb: 37, 133, 90;
  --bs-danger: #c0392b;
  --bs-danger-rgb: 192, 57, 43;
  --bs-success-bg-subtle: #e3f3ea;
  --bs-success-border-subtle: #b9dcc8;
  --bs-success-text-emphasis: #25855a;
  --bs-danger-bg-subtle: #fbe5e2;
  --bs-danger-border-subtle: #f0bdb7;
  --bs-danger-text-emphasis: #c0392b;
  --bs-warning-bg-subtle: #fdf1dc;
  --bs-warning-border-subtle: #f0d29c;
  --bs-warning-text-emphasis: #9a5d00;
}

html, body { margin: 0; }
body { -webkit-text-size-adjust: 100%; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: "Poppins", "Lato", system-ui, sans-serif; font-weight: 600; }
h1, .h1 { font-weight: 700; font-size: 1.5rem; margin-bottom: .25rem; }
[hidden] { display: none !important; }

/* buttons: pills */
.btn {
  --bs-btn-border-radius: 999px;
  --bs-btn-font-weight: 700;
  --bs-btn-padding-x: 1rem;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn-sm { min-height: 38px; }
@media (pointer: coarse) { .btn-sm, .btn.small { min-height: 44px; } }
.btn-primary {
  --bs-btn-bg: #1463d8; --bs-btn-border-color: #1463d8;
  --bs-btn-hover-bg: #0d4bab; --bs-btn-hover-border-color: #0d4bab;
  --bs-btn-active-bg: #0d4bab; --bs-btn-active-border-color: #0d4bab;
  --bs-btn-disabled-bg: #1463d8; --bs-btn-disabled-border-color: #1463d8;
  --bs-btn-focus-shadow-rgb: 20, 99, 216;
}
.btn-outline-primary {
  --bs-btn-color: #1463d8; --bs-btn-border-color: #1463d8;
  --bs-btn-hover-bg: #1463d8; --bs-btn-hover-border-color: #1463d8;
  --bs-btn-active-bg: #0d4bab; --bs-btn-active-border-color: #0d4bab;
}
.btn-dark { --bs-btn-bg: #14213d; --bs-btn-border-color: #14213d; --bs-btn-hover-bg: #0b1f45; --bs-btn-hover-border-color: #0b1f45; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--soft); }
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* cards: 14px radius, navy header */
.card { --bs-card-border-radius: 14px; --bs-card-inner-border-radius: 13px; --bs-card-border-color: #dfe5ef; box-shadow: 0 1px 2px rgba(11, 31, 69, .05); }
.card-header { background: var(--navy); color: #fff; font-family: "Poppins", "Lato", sans-serif; font-weight: 600; }
.card-header .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }

/* forms: 16px keeps iOS from zooming, 44px touch targets */
.form-control, .form-select { font-size: 16px; min-height: 44px; }
.form-label { font-size: .8125rem; color: var(--muted); margin-bottom: .25rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(20, 99, 216, .25); }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; min-height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(11, 31, 69, .06);
}
.menu-btn { display: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); background: #fff; border-radius: 10px; place-items: center; flex: none; font-size: 1.4rem; color: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; white-space: nowrap; color: inherit; text-decoration: none; }
.brand img { height: 32px; width: auto; max-width: 140px; object-fit: contain; display: block; }
.brand .sep { color: var(--line); font-weight: 300; font-size: 24px; line-height: 1; }
.brand .app { color: var(--navy); font-family: "Poppins", "Lato", sans-serif; font-weight: 600; font-size: 18px; letter-spacing: .2px; }
.owner { display: flex; align-items: center; gap: 6px; background: var(--brand-s); border-radius: 999px; padding: 4px 14px; min-width: 0; }
.owner .owner-l { font-size: 12px; color: var(--brand-d); font-weight: 700; white-space: nowrap; }
.owner b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; color: var(--navy); }
.gq { flex: 1; min-width: 0; max-width: 440px; margin-left: auto; display: flex; gap: 6px; position: relative; }
.gq .btn { flex: none; min-width: 44px; }
.gq input { background: var(--soft); }
.user-btn { display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: 0; padding: 0; min-height: 44px; min-width: 44px; color: var(--ink); }
.me { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.user-name { font-weight: 700; font-size: .875rem; line-height: 1.1; text-align: left; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .75rem; color: var(--muted); font-weight: 400; display: block; }
.gq-note { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--navy); color: #fff; font-size: .8125rem; padding: 6px 12px; border-radius: 8px; z-index: 30; }
.gq-note.err { background: var(--bad); }

/* shell */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.nav-side { background: var(--navy); padding: 12px 10px 20px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow: auto; }
/* .nav-item below belongs to the sidebar only (Pages/Shared/_Nav.cshtml, inside <nav class="nav-side">). It is scoped on purpose: Bootstrap tabs use .nav-item too
   (the help panel), and an unscoped rule made them full-width dark rows. */
.nav-side .grp { font-size: 11px; color: var(--navy-muted); padding: 16px 12px 6px; text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.nav-side .nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; min-height: 44px; border-radius: 10px; color: var(--navy-ink); margin-bottom: 2px; text-decoration: none; }
.nav-side a.nav-item:hover { background: var(--navy-2); color: #fff; }
.nav-side .nav-item .bi { font-size: 1.1rem; flex: none; }
.nav-side .nav-item[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(20, 99, 216, .35); }
.nav-side .nav-item[aria-disabled="true"] { opacity: .6; cursor: default; }
.soon { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; background: rgba(255, 255, 255, .16); color: var(--navy-ink); border-radius: 9px; padding: 1px 7px; }
.btn .soon, .card .soon { background: var(--warn-s); color: var(--warn); margin-left: .25rem; }
.nav-scrim { display: none; }
.bnav { display: none; }
.shell-bare { display: block; }
.shell-bare main.content { max-width: 640px; margin: 0 auto; padding-top: 40px; }
main.content { padding: 22px 26px 80px; min-width: 0; }
.sub { color: var(--muted); margin: 0 0 18px; max-width: 76ch; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; border-top: 3px solid var(--brand); padding: 12px 16px; height: 100%; }
.kpi span { font-size: 13px; color: var(--muted); display: block; }
.kpi b { display: block; font-size: 28px; color: var(--brand-d); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi.alert b { color: var(--bad); }
.kpi small { color: var(--muted); font-size: 12.5px; }

/* reusable prototype classes */
.req { color: var(--bad); }
.hint { color: var(--muted); font-size: 13px; }
.msg { min-height: 22px; margin-top: 8px; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--bad); font-weight: 700; }
.msg.warn { color: var(--warn); font-weight: 700; }
.tag { display: inline-block; font-size: 12.5px; padding: 1px 9px; border-radius: 10px; background: #eceff3; white-space: nowrap; font-weight: 700; }
.tag.ok { background: var(--ok-s); color: var(--ok); }
.tag.warn { background: var(--warn-s); color: var(--warn); }
.tag.bad { background: var(--bad-s); color: var(--bad); }
.tag.blue { background: var(--blue-s); color: var(--blue); }
.tag.plum { background: var(--plum-s); color: var(--plum); }
.tag.act { background: var(--brand); color: #fff; }
.seg { display: inline-flex; background: #e6eaee; border-radius: 8px; padding: 3px; margin: 12px 0 4px; flex-wrap: wrap; max-width: 100%; }
.seg button { font: inherit; border: 0; background: none; padding: 7px 16px; min-height: 44px; border-radius: 6px; color: var(--muted); font-weight: 700; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--brand-d); box-shadow: 0 1px 2px rgba(31, 41, 51, .15); }
.scanbox { border: 2px solid var(--brand); border-radius: 10px; padding: 14px 16px; margin-top: 12px; background: #fbfefe; }
.scanrow { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.scanrow input { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 22px; min-height: 44px; padding: 12px 14px; flex: 1 1 260px; min-width: 0; }
.counter { min-width: 110px; text-align: center; background: var(--brand-s); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; }
.counter b { font-size: 28px; font-weight: 900; color: var(--brand-d); line-height: 1; }
.counter span { font-size: 12px; color: var(--brand-d); }
.notice { background: var(--ok-s); border: 1px solid #b9dcc8; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.notice span { flex: 1; min-width: 220px; }
.notice.warn { background: var(--warn-s); border-color: #f0d29c; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 180px 1fr; }
  .brand .app { font-size: 16px; }
  .brand img { height: 28px; }
}

/* phone and small tablet */
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 8px 12px; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); }
  .menu-btn { display: grid; }
  .brand { gap: 6px; }
  .brand img { height: 24px; max-width: 110px; }
  .brand .app { font-size: 15px; }
  .brand .sep { font-size: 20px; }
  .owner { flex: 1; }
  .owner b { max-width: none; }
  .gq { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .user-text { display: none; }
  .shell { display: block; }
  .nav-side {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(280px, 84vw); z-index: 45;
    transform: translateX(-100%); visibility: hidden; transition: transform .18s ease-out, visibility 0s .18s;
    box-shadow: 8px 0 24px rgba(31, 41, 51, .14);
    padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .nav-side.open { transform: none; visibility: visible; transition: transform .18s ease-out, visibility 0s; }
  body.nav-open { overflow: hidden; }
  .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(31, 41, 51, .35); z-index: 44; opacity: 0; pointer-events: none; transition: opacity .15s; }
  .nav-scrim.on { opacity: 1; pointer-events: auto; }
  main.content { padding: 14px max(12px, env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .bnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 25; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .bnav a, .bnav button, .bnav .tab { font: inherit; font-size: 11px; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; min-width: 44px; text-decoration: none; }
  .bnav .bi { font-size: 1.4rem; line-height: 1; }
  .bnav [aria-current="page"] { color: var(--brand-d); font-weight: 900; }
  .bnav [aria-disabled="true"] { opacity: .5; }
  .bnav .soon { margin: 0; font-size: 9px; background: var(--warn-s); color: var(--warn); padding: 0 5px; }
  h1, .h1 { font-size: 1.3rem; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 9px 8px; }
  .counter { flex: 1; flex-direction: row; gap: 8px; align-items: baseline; justify-content: center; padding: 8px; }
  .counter b { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 22px; }
}
/* setup screens: filter row, tables, card stacking on phones, full-screen dialogs */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters input[type="search"], .filters input[type="text"] { flex: 1 1 260px; min-width: 0; }
.filters select { flex: 0 1 190px; width: auto; }
.filters .dt { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; flex: 0 1 220px; }
.filters .dt input { flex: 1 1 auto; min-width: 0; width: auto; }
.filters .check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; cursor: pointer; }
.filters .check input { width: 22px; height: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 16px; background: var(--navy); color: #fff; font-family: "Poppins", "Lato", sans-serif; font-weight: 600; border-radius: 14px 14px 0 0; }
.panel-head small { color: var(--navy-ink); font-family: "Lato", sans-serif; font-weight: 400; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(11, 31, 69, .05); overflow: hidden; }
.tablewrap { overflow-x: auto; }
.tablewrap table { width: 100%; border-collapse: collapse; margin: 0; }
.tablewrap th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.tablewrap td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tablewrap tbody tr:last-child td { border-bottom: 0; }
.tablewrap .num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap .zero { color: var(--muted); }
.tablewrap td.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.tablewrap table.is-empty thead { display: none; }

@media (max-width: 640px) {
  .tablewrap table.stack thead { display: none; }
  .tablewrap table.stack, .tablewrap table.stack tbody { display: block; }
  .tablewrap table.stack tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tablewrap table.stack tr[hidden] { display: none !important; }
  .tablewrap table.stack td { display: block; padding: 0; border: 0; text-align: left; }
  .tablewrap table.stack td.num { text-align: left; }
  .tablewrap table.stack td[data-label] { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; font-size: 14px; }
  .tablewrap table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); flex: none; }
  .tablewrap table.stack td { overflow-wrap: anywhere; }
  .tablewrap table.stack td.card-title { font-weight: 700; font-size: 1rem; }
  .tablewrap table.stack td.card-title > a { display: inline-flex; align-items: center; min-height: 44px; }
  .filters .dt { flex: 1 1 100%; }
  .filters .dt input { flex: 1; }
  .tablewrap table.stack td.card-tags { padding-top: 4px; }
  .filters select { flex: 1 1 100%; }
}

/* 44px touch targets inside dialogs */
.modal .btn-close { width: 44px; height: 44px; padding: 0; background-size: 1em; background-position: center; background-repeat: no-repeat; box-sizing: border-box; }
.modal .form-check { min-height: 44px; display: flex; align-items: center; gap: .5rem; padding-left: 0; }
.modal .form-check .form-check-input { float: none; margin: 0; flex: none; }
.modal .form-check .form-check-label { flex: 1 1 auto; align-self: stretch; padding: .5rem 0; cursor: pointer; }
.modal .form-check.ps-5 { padding-left: .75rem !important; }

/* dialogs go full screen on phones */
@media (max-width: 575.98px) {
  .modal-fullscreen-xs .modal-dialog { width: 100%; max-width: none; height: 100%; margin: 0; }
  .modal-fullscreen-xs .modal-content { height: 100%; border: 0; border-radius: 0; }
  .modal-fullscreen-xs .modal-body { overflow-y: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .scan-err { animation: none !important; } }
@media print { .top, .nav-side, .nav-scrim, .bnav { display: none !important; } .shell { display: block; } }

/* scan boxes: green or red flash after each scan */
.scan-ok { border-color: var(--ok) !important; box-shadow: 0 0 0 .25rem rgba(37, 133, 90, .25) !important; }
.scan-err { border-color: var(--bad) !important; background: var(--bad-s) !important; box-shadow: 0 0 0 .25rem rgba(192, 57, 43, .25) !important; animation: scan-shake .3s; }
@keyframes scan-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.min-h-44 { min-height: 44px; }
.scanrow .btn { flex: none; min-width: 52px; }

/* camera dialog */
#camView { width: 100%; min-height: 240px; background: #000; border-radius: 8px; overflow: hidden; }
#camView video { width: 100% !important; display: block; }
#camLast { font-size: 14px; margin: 10px 0 0; min-height: 20px; }
.cam-tools { display: flex; gap: 8px; margin-top: 10px; }
.cam-tools .btn { min-height: 44px; flex: 1 1 0; }
.cam-tools .btn.active, .cam-tools .btn[aria-pressed="true"] { background: var(--brand-soft, #e8f0fd); border-color: var(--brand, #1463d8); }
.cam-zoom { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-height: 44px; }
.cam-zoom .form-range { flex: 1; min-height: 44px; }
.cam-hint { font-size: 13px; margin: 8px 0 0; }

/* labels: preview on screen, one label per page when printed */
.lgrid { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
/* A label's size, padding, gap and text size are set inline from labelcore.js (inches and points), so any size scales to fit. */
.lbl { background: #fff; border: 1px solid #c9d0d6; border-radius: 3px; overflow: hidden; display: flex; color: #000; box-sizing: border-box; break-inside: avoid; page-break-inside: avoid; }
.lbl.o-row { flex-direction: row; align-items: center; }
.lbl.o-col { flex-direction: column; align-items: center; }
.lbl .qr { flex: none; }
/* centring: .cx holds the QR code, .bx the barcode; each takes the room the text leaves and centres its content both ways (screen and print) */
.lbl .cx { display: flex; align-items: center; justify-content: center; align-self: stretch; flex: none; min-height: 0; }
.lbl .cx-col { flex: 1; flex-direction: column; align-self: stretch; width: 100%; }
.lbl .bx { display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; width: 100%; }
.lbl.o-col .tx { flex: none; }
.lbl .qr img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.lbl .tx { min-width: 0; min-height: 0; flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: center; line-height: 1.25; overflow: hidden; }
.lbl .tx .id { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-weight: 500; word-break: break-all; }
.lbl .tx .nm { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl .tx .one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl svg.bar { display: block; width: 100%; flex: none; }
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea .lgrid { display: block; }
  #printArea .lbl { border: 0; border-radius: 0; break-after: page; page-break-after: always; }
  #printArea .lbl:last-child { break-after: auto; page-break-after: auto; }
  #printArea.sheet .lgrid { display: flex; flex-wrap: wrap; gap: 0.08in; align-content: flex-start; }
  #printArea.sheet .lbl { border: 1px dashed #999; break-after: auto; page-break-after: auto; break-inside: avoid; }
  body { background: #fff; }
}

/* pick lists (Stock out From and To) */
/* A panel that holds a picker list must not clip it (.panel hides overflow). The head keeps its own rounded corners. */
.panel.panel-visible { overflow: visible; }
.pick { position: relative; }
.pick-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(11, 31, 69, .16); max-height: 320px; overflow: auto; -webkit-overflow-scrolling: touch; }
.pick-opt { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); }
.pick-opt span { font-size: 13px; color: var(--muted); }
.pick-opt.hl, .pick-opt:hover:not(:disabled) { background: var(--brand-s); }
.pick-opt:disabled { opacity: .55; cursor: not-allowed; }

/* packing slip (printed from #printArea) */
.slip { color: #000; font-size: 12px; }
.slip h2 { font-size: 18px; margin: 0 0 4px; }
.slip-h { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.slip-h img { width: 96px; height: 96px; image-rendering: pixelated; }
.slip table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.slip th, .slip td { border: 1px solid #999; padding: 5px 8px; text-align: left; vertical-align: top; }
.slip .ids { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 10px; word-break: break-all; }
.slip .sign { display: flex; gap: 24px; margin-top: 36px; }
.slip .sign div { flex: 1; border-top: 1px solid #000; padding-top: 4px; }

/* 44px hit area around a table checkbox (Returns) */
.hit44 { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -10px -8px; cursor: pointer; }
.hit44 .form-check-input { width: 22px; height: 22px; margin: 0; }

/* Dashboard */
a.kpi { display: block; color: inherit; text-decoration: none; }
a.kpi:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(20, 99, 216, .15); }
.kpi small { overflow-wrap: anywhere; }
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel-head .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.panel-head .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 900px) { .dash-cols { grid-template-columns: minmax(0, 1fr); } }

/* Trace card: details on the left, the ID as a QR code on the right (above the details on a phone) */
.trace-top { display: flex; gap: 16px; align-items: flex-start; }
.trace-top dl { flex: 1 1 auto; min-width: 0; }
.trace-qr { flex: none; width: 112px; height: 112px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.trace-qr svg { width: 100%; height: 100%; display: block; }
@media (max-width: 575.98px) { .trace-top { flex-direction: column-reverse; } }
@media print { .trace-qr { border: 0; } }

/* A document opened by a link (Returns ?doc=) */
tr.row-open > td { background: var(--brand-s); }
tr.row-open { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Bulk scanning: steps, progress bar, chips, rejected list, help panel, (i) tips (scanlist.js) */
:root { --sl-top: var(--topbar-h); }
@media (max-width: 860px) { :root { --sl-top: 112px; } }

.page-top { display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px; margin-bottom: 8px; }
.page-top h1 { margin: 0; min-width: 0; }
.page-top .page-back { flex: none; }
.sl-help-panel { --bs-offcanvas-width: min(420px, 85vw); }
.sl-help-panel .offcanvas-title { font-size: 1.1rem; color: var(--navy); }
.sl-help-panel h3 { font-size: .95rem; margin: 1rem 0 .2rem; color: var(--navy); }
.sl-help-panel p { margin: 0 0 .4rem; color: var(--ink); }
@media (max-width: 575.98px) { .sl-help-panel { --bs-offcanvas-width: 85vw; } }

/* Page help (info icon + panel) and the /Help page: the user guide rendered from docs/user-guide.md */
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0 .35rem; margin-bottom: .25rem; }
.title-line h1 { margin: 0; min-width: 0; }
.guide-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none; display: inline-grid; place-items: center; border-radius: 999px; font-size: 1.2rem; color: var(--brand-d); }
.guide-panel .offcanvas-body { padding-bottom: 1rem; }
.guide-panel .offcanvas-footer { padding: .75rem 1rem; border-top: 1px solid var(--line); background: #fff; }
.guide-panel h4 { font-size: .9rem; margin: .9rem 0 .2rem; color: var(--navy); }
.guide-panel .guide-intro { padding-bottom: .5rem; margin-bottom: .75rem; border-bottom: 1px dashed var(--line); }
.guide-panel .guide-intro h3 { margin-top: 0; }
.guide-body h3:first-child { margin-top: 0; }
.guide-body ul, .guide-article ul { padding-left: 1.2rem; margin: 0 0 .6rem; }
.guide-body li, .guide-article li { margin-bottom: .2rem; }
.guide-body img, .guide-article img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.guide-tablewrap { overflow-x: auto; margin: .4rem 0 .9rem; -webkit-overflow-scrolling: touch; }
.guide-table { font-size: .875rem; margin: 0; min-width: 28rem; }
.guide-table th { background: var(--brand-s); color: var(--navy); font-weight: 700; white-space: nowrap; }
.guide-table td, .guide-table th { vertical-align: top; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (min-width: 992px) { .guide-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; } }
.guide-side { position: static; }
@media (min-width: 992px) { .guide-side { position: sticky; top: calc(var(--sl-top) + 12px); max-height: calc(100vh - var(--sl-top) - 24px); overflow: auto; } }
.guide-toc ul { list-style: none; margin: .5rem 0 0; padding: 0; }
.guide-toc li a { display: block; padding: .5rem .75rem; min-height: 44px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.guide-toc li.sub-entry a { padding-left: 1.6rem; font-weight: 400; color: var(--muted); }
.guide-toc li a:hover { background: var(--brand-s); color: var(--brand-d); }
.guide-article { min-width: 0; max-width: 78ch; }
.guide-article h2 { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 1.3rem; color: var(--navy); scroll-margin-top: calc(var(--sl-top) + 12px); }
.guide-article h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.guide-article h3 { margin-top: 1.4rem; font-size: 1.05rem; color: var(--navy); scroll-margin-top: calc(var(--sl-top) + 12px); }
.guide-article p { margin: 0 0 .7rem; }

.infotip { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -6px 0 -6px 2px; padding: 0; border: 0; background: none; color: var(--muted); vertical-align: middle; border-radius: 50%; flex: none; }
.infotip span { display: grid; place-items: center; width: 16px; height: 16px; border: 1.25px solid currentColor; border-radius: 50%; font: italic 700 10px/1 "Lato", serif; }
.infotip:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; }
.panel-head .infotip { color: var(--navy-ink); }
.infotip-pop { --bs-popover-max-width: min(300px, 90vw); --bs-popover-body-color: var(--ink); --bs-popover-body-padding-x: .85rem; --bs-popover-body-padding-y: .7rem; font-size: .9rem; }

.sl-steps { display: flex; flex-wrap: nowrap; gap: 0; align-items: center; list-style: none; margin: 0; padding: 0; flex: none; }
.sl-steps li { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; font-size: .85rem; min-height: 44px; white-space: nowrap; }
.sl-steps li + li::before { content: "\f285"; font-family: "bootstrap-icons"; margin: 0 8px; color: var(--muted); font-weight: 400; font-size: .9rem; line-height: 1; }
.sl-step-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 11px; color: var(--muted); flex: none; }
.sl-steps li.is-done { color: var(--ok); }
.sl-steps li.is-done .sl-step-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.sl-steps .sl-step-n .bi { display: none; }
.sl-steps li.is-done .sl-step-n .bi { display: inline; }
.sl-steps li.is-done .sl-step-n b { display: none; }

.sl-bar { position: sticky; top: var(--sl-top); z-index: 15; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 8px rgba(11, 31, 69, .08); padding: 0 10px; margin: 0 0 12px; max-width: 100%; }
.sl-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 44px; overflow-x: auto; overflow-y: hidden; }
.sl-progress { display: flex; align-items: center; flex-wrap: nowrap; gap: 0 12px; margin-left: auto; font-size: .85rem; color: var(--muted); white-space: nowrap; flex: none; }
.sl-progress[hidden] { display: none; }
.sl-progress b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 1rem; }
.sl-progress .sl-added b { color: var(--ok); }
.sl-progress .sl-rej-n b { color: var(--bad); }
.sl-by-btn { margin-left: 0; min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--brand-d); font-weight: 700; }
.sl-by { list-style: none; margin: 0; padding: 4px 0 8px; border-top: 1px solid var(--line); max-height: 40vh; overflow: auto; }
.sl-by li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 2px; min-height: 28px; }

.sl-chips-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.sl-chips { list-style: none; margin: 0; padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; max-height: 340px; overflow: auto; }
.sl-chip { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border: 1px solid #b9dcc8; background: var(--ok-s); border-radius: 10px; padding-left: 10px; min-width: 0; }
.sl-chip.is-checking { background: #eceff3; border-color: var(--line); color: var(--muted); }
.sl-chip-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.sl-chip-id { font-size: 14px; overflow-wrap: anywhere; }
.sl-chip-note { font-size: 11.5px; }
.sl-chip-note:empty { display: none; }
.sl-x { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; border-radius: 10px; }
.sl-x:hover { color: var(--bad); }
.sl-flash { animation: sl-flash .7s ease-out; }
@keyframes sl-flash { 0% { box-shadow: 0 0 0 4px rgba(20, 99, 216, .45); } 100% { box-shadow: 0 0 0 0 rgba(20, 99, 216, 0); } }
.sl-empty, .sl-more { margin: 0; padding: 14px 16px; color: var(--muted); }
.sl-more { padding-top: 0; }
.sl-table-box { max-height: 420px; overflow: auto; }
.sl-table { width: 100%; }

.sl-rejected { border: 1px solid #f0bdb7; border-radius: 14px; background: #fff; overflow: hidden; margin-bottom: 12px; }
.sl-rejected-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 6px 16px; background: var(--bad-s); color: var(--bad); min-height: 44px; }
.sl-rejected-head h2 { font-size: 1rem; margin: 0; color: var(--bad); }
.sl-rejected-head .btn { background: #fff; }
.sl-rej-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.sl-rej { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 8px; align-items: center; padding: 8px 12px 8px 16px; border-top: 1px solid var(--bad-s); }
.sl-rej-id { font-weight: 700; overflow-wrap: anywhere; grid-column: 1; }
.sl-rej-why { grid-column: 1 / 2; grid-row: 2; color: var(--bad); font-size: .875rem; }
.sl-rej-x2 { grid-column: 2; grid-row: 1; font-weight: 700; color: var(--bad); }
.sl-rej .sl-copy { grid-column: 3; grid-row: 1 / span 2; }
.sl-rej-empty { margin: 0; padding: 12px 16px; color: var(--muted); }

/* Back button above a page title (Pages/Shared/_PageBack.cshtml) */
.page-back { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .25rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.page-back:hover, .page-back:focus-visible { color: var(--brand); text-decoration: underline; }

/* Footer on every page (inside main, so it clears the sidebar and the phone bottom bar) */
.site-foot { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; text-align: center; }

/* Linked counts in a clickable table row (Vendors: Items and Stock-ins) */
.tablewrap td.num a { display: inline-block; min-width: 44px; padding: 10px 0; color: var(--brand); font-weight: 700; text-decoration: none; }
.tablewrap td.num a:hover, .tablewrap td.num a:focus-visible { text-decoration: underline; }

/* Dedicated edit / view button at the end of a setup list row (Vendors, Items) */
.tablewrap th.act, .tablewrap td.act { width: 1%; white-space: nowrap; text-align: right; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--brand); font-size: 1.1rem; }
.btn-icon:hover, .btn-icon:focus-visible { background: var(--brand-soft); color: var(--brand-dark); }
@media (max-width: 640px) { .tablewrap table.stack td.act { display: flex; justify-content: flex-end; padding-top: 4px; } }

/* Stock in: unit value boxes inside "Add items", next to the scan box (stockin.js renderCosts) */
.si-costs { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.si-costs-head { margin-bottom: 6px; }
.si-cost-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.si-cost-label { flex: 1 1 auto; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.si-cost-row .form-control { flex: 0 0 150px; width: 150px; }
@media (max-width: 640px) { .si-cost-row .form-control { flex-basis: 140px; width: 140px; } }

/* The Ask tab: a chat-style search over the user guide (ask.js) */
.guide-panel textarea { font-size: 16px; }
.guide-tabs { margin-bottom: .5rem; }
.guide-tabs .nav-link { min-height: 44px; color: var(--muted); }

/* Tabs of the item Edit dialog (Details | Label and QR): Bootstrap's nav-underline, themed through its own variables. One row at every width,
   active tab bold blue with a 3px underline, inactive muted with no box, a light line under the row, 44px high. */
.item-tabs { --bs-nav-link-color: var(--muted); --bs-nav-link-hover-color: var(--brand-d); --bs-nav-link-font-size: 1rem;
  --bs-nav-underline-gap: 1.5rem; --bs-nav-underline-border-width: 3px; --bs-nav-underline-link-active-color: var(--brand);
  flex-wrap: nowrap; border-bottom: 1px solid var(--line); }
.item-tabs .nav-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; margin-bottom: -1px; white-space: nowrap; background: none; border-top: 0; border-inline: 0; }
.item-tabs .nav-link:hover:not(.active), .item-tabs .nav-link:focus:not(.active) { border-bottom-color: transparent; }
.item-tabs .nav-link:focus { outline: 0; box-shadow: none; }
.item-tabs .nav-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.item-tabs .nav-link .bi { font-size: 1.1rem; }
.item-tabs .tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.guide-tabs .nav-link.active { color: var(--navy); font-weight: 700; }
.ask-log { display: flex; flex-direction: column; gap: .6rem; padding: .75rem 0; max-height: 52vh; overflow-y: auto; }
.msg { max-width: 94%; padding: .55rem .75rem; border-radius: 14px; overflow-wrap: anywhere; }
.msg p { margin: 0; }
.msg-user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-bot { align-self: flex-start; background: var(--brand-s); color: var(--ink); border-bottom-left-radius: 4px; }
.msg .ask-error { color: #a11a2a; font-weight: 700; }
.hit { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .65rem; margin-top: .5rem; }
.hit-path { display: block; color: var(--muted); font-size: .75rem; }
.hit-text { margin: .15rem 0 .3rem; font-size: .9rem; }
.ask-link { display: inline-block; min-height: 32px; font-weight: 700; }
.ask-source { margin-top: .4rem; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 .5rem; }
.ask-chip { min-height: 44px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: .35rem .85rem; font-size: .875rem; text-align: left; }
.ask-chip:hover { background: var(--brand-s); border-color: var(--brand); }
.ask-form { display: flex; gap: .5rem; align-items: flex-end; margin-top: .5rem; }
.ask-form textarea { resize: none; }
.ask-form .btn { min-width: 44px; min-height: 44px; flex: none; }
