:root {
  color-scheme: light;
  --purple: #5429ce;
  --purple-dark: #4421ad;
  --deep: #241656;
  --ink: #15132c;
  --muted: #5d5d73;
  --line: #e6e5ee;
  --bg: #f8f8fc;
  --lilac: #eee8fc;
  --red: #a51b3b;
  --green: #137644;
  --orange: #984b08;
  --shadow: 0 2px 8px #23134a09;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a.button, input, select, textarea { border-radius: 11px; }
button, a.button, input, select { min-height: 44px; }
button, a.button {
  background: #fff;
  color: var(--ink);
  border: 1px solid #dcdce8;
  padding: .62rem .9rem;
  font-weight: 680;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
button:hover, a.button:hover { border-color: var(--purple); }
button:disabled { opacity: .58; cursor: default; }
button.primary, a.primary, button.yellow { color: #fff; background: var(--purple); border-color: var(--purple); }
button.primary:hover, a.primary:hover, button.yellow:hover { background: var(--purple-dark); }
input, select, textarea { padding: .62rem .79rem; border: 1px solid #d5d3e3; background: #fff; color: inherit; max-width: 100%; }
input::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
input[type=checkbox] { min-height: auto; width: 1.15rem; height: 1.15rem; accent-color: var(--purple); }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 630; }
label.check { flex-direction: row; align-items: center; gap: .6rem; }
:focus-visible { outline: 3px solid #8b69e1; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ui-icon { width: 22px; height: 22px; display: block; flex: none; }

.layout.authenticated {
  --sidebar: clamp(220px, 18.4vw, 280px);
  --header: 85px;
  display: grid;
  grid-template: 'brand top' var(--header) 'nav main' minmax(0, 1fr) / var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}
.identity {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 13px;
  color: white;
  background: linear-gradient(114deg,#42309b,#5832bd);
  padding: 0 21px;
}
.identity strong { display: block; font-size: 1.05rem; letter-spacing: -.016em; white-space: nowrap; }
.identity small { display: block; font-size: .8rem; color: #f4edff; margin-top: .15rem; }
#brandIcon .ui-icon { width: 42px; height: 42px; stroke-width: 1.45; }
#brandIcon img { width: 42px; border-radius: 10px; display: block; }
.top {
  grid-area: top;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 clamp(16px, 2.4vw, 36px);
  background: white;
  border-bottom: 1px solid var(--line);
}
.panel-title, .account, .profile, .feed-indicator { display: flex; align-items: center; gap: 11px; min-width: 0; }
.panel-title > strong { font-size: clamp(1.42rem, 2.7vw, 2.3rem); letter-spacing: -.047em; line-height: 1.1; white-space: nowrap; }
.panel-title-icon, .account-icon, .tile-icon, .stat-icon {
  display: grid;
  place-items: center;
  color: var(--purple);
  background: #f2edfd;
  border-radius: 12px;
  flex: none;
}
.panel-title-icon { width: 47px; height: 47px; }
.panel-title-icon .ui-icon { width: 27px; height: 27px; }
.account-icon { width: 36px; height: 36px; border-radius: 50%; }
.profile-name { min-width: 0; display: grid; gap: 1px; line-height: 1.15; }
.profile-name strong, .profile-name small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name strong { font-size: .82rem; }
.profile-name small { font-size: .69rem; }
.feed-indicator { white-space: nowrap; padding: 8px 9px; border: 1px solid var(--line); border-radius: 11px; gap: 7px; }
#feedIcon { color: var(--purple); }
#feedIcon svg { width: 17px; height: 17px; }
.feed-label { font-weight: 670; font-size: .78rem; }
.feed-indicator strong, #connection { padding: .27rem .5rem; border-radius: 20px; font-size: .72rem; background: #fff0dc; color: var(--orange); }
.feed-indicator[data-status=system] strong { color: var(--green); background: #e1f6e8; }
.square-button { position: relative; width: 44px; min-width: 44px; padding: 0; background: #faf9fd; }
#adminMenu { display: none; }
#nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: calc(100dvh - var(--header));
  min-width: 0;
  background: #fff;
  border-inline-end: 1px solid var(--line);
  padding: 15px 12px;
  overflow: auto;
}
.nav-main, .nav-footer { display: grid; gap: 5px; }
.nav-footer { margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
#nav button { justify-content: flex-start; text-align: left; background: transparent; border-color: transparent; gap: 12px; min-height: 46px; line-height: 1.16; }
#nav button:hover { background: #f8f5fd; }
#nav button[aria-current=page] { background: var(--lilac); color: var(--purple-dark); }
#nav button > .ui-icon { color: #57546a; width: 21px; height: 21px; }
#nav button[aria-current=page] > .ui-icon { color: var(--purple); }
#nav.staff-nav { background: #f4f4fa; }
#nav .count-pill { margin-left: auto; }
.count-pill { display: inline-grid; place-items: center; min-width: 20px; min-height: 20px; padding: 2px 5px; border-radius: 20px; color: white; background: var(--purple); font-size: .68rem; line-height: 1; font-weight: 750; }
.alert-pill { background: #bf2548; }
#alerts .alert-pill { position: absolute; top: -6px; right: -7px; border: 2px solid white; }
#nav [data-page=approvals] .count-pill { background: #bf2548; }
main { grid-area: main; min-width: 0; padding: clamp(16px,2.4vw,36px); }
.layout:not(.authenticated) { width: min(100%, 530px); margin: max(1.25rem,8vh) auto 0; padding: 0 12px; }
.layout:not(.authenticated) > .identity { min-height: 73px; border-radius: 15px 15px 0 0; }
.layout:not(.authenticated) main { padding: 25px 19px; background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 15px 15px; }
.layout:not(.authenticated) .panel { border: 0; padding: .95rem 0 0; box-shadow: none; }
.layout:not(.authenticated) #login > button { width: 100%; justify-self: stretch; }
.section-nav { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.section-nav button[aria-current=page], .section-nav button[aria-pressed=true] { color: var(--purple); background: var(--lilac); border-color: #dfd2fb; }

h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.04em; margin: 0 0 .75rem; }
h2 { font-size: 1.23rem; letter-spacing: -.022em; margin: 0 0 .7rem; }
h3 { margin: .1rem 0 .45rem; }
p { line-height: 1.53; }
.muted, small { color: var(--muted); }
.intro { margin: 0 0 1.15rem; }
.panel { background: white; border: 1px solid var(--line); border-radius: 16px; padding: clamp(13px,2.3vw,22px); margin-bottom: 1rem; box-shadow: var(--shadow); min-width: 0; }
.hero { background: #f0ebfd; border-color: #e6dbfb; }
.grid,.metrics,.toolbar,.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.grid { align-items: stretch; }
.grid > * { flex: 1 1 275px; min-width: 0; }
.grid > .panel { margin-bottom: 0; }
.stack { display: grid; gap: .85rem; min-width: 0; }
.stack > button { justify-self: start; }
.metrics { margin: 1rem 0; align-items: stretch; }
.metric { flex: 1 1 130px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem; }
.metric strong { display: block; font-size: 1.58rem; }
.metric span { font-size: .85rem; color: var(--muted); }
.toolbar { margin-bottom: 1rem; }
.toolbar > * { flex: 1 1 155px; min-width: 0; }
.table { overflow: auto; max-height: 65vh; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
td, th { padding: .59rem .8rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #f1edfb; z-index: 1; }
td.wrap { white-space: normal; min-width: 200px; }
.badge { display: inline-block; border-radius: 40px; padding: .3rem .62rem; font-size: .84rem; background: #eeedf3; font-weight: 650; }
.short { color: var(--red); background: #fce8ed; }
.over { color: var(--orange); background: #fff0dc; }
.equal { color: var(--green); background: #e3f4e9; }
#notice:empty { display: none; }
#notice { white-space: pre-line; border-radius: 12px; background: #eee7fb; padding: .75rem 1rem; margin-bottom: 1rem; }
#notice.error { background: #fce8ed; color: var(--red); }
progress { display: block; width: 100%; accent-color: var(--purple); height: .8rem; margin: .7rem 0; }
details { margin-top: .65rem; }
summary { cursor: pointer; font-weight: 650; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; min-width: 0; }
fieldset label+label { margin-top: .35rem; }
.splash { display: grid; min-height: 42vh; place-content: center; justify-items: center; gap: .4rem; color: var(--deep); }
.splash img { width: 76px; border-radius: 19px; }
.approval-evidence { display: flex; flex-wrap: wrap; gap: .7rem; }
.approval-evidence figure { margin: 0; width: min(230px,100%); }
.approval-evidence figcaption { color: var(--muted); font-size: .85rem; }
.approval-photo { width: 100%; max-height: 230px; object-fit: contain; border-radius: 10px; background: #f9f7fd; }
.approval-proposed { max-width: 36rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; }
.approval-proposed > p:first-child { margin: 0 0 .55rem; }
.approval-proposed small { display: block; margin-top: .5rem; overflow-wrap: anywhere; }
.approval-warning { color: var(--red); }

.scan-shell { width: 100%; }
.scan-hero { display: grid; gap: 18px; background: #f3eefc; border: 1px solid #ded2fa; border-radius: 17px; padding: clamp(16px,2.4vw,27px); }
.staff-scanner .scan-hero { border: 2px dashed #d9caf9; text-align: center; padding-block: clamp(18px,3vw,34px); }
.scanner-heading, .scanner-controls, .scanner-form { min-width: 0; display: flex; align-items: center; gap: 10px; }
.scanner-heading { gap: 13px; }
.staff-scanner .scanner-heading { flex-direction: column; }
.scanner-glyph { color: var(--purple); flex: none; }
.scanner-glyph .ui-icon { width: 57px; height: 57px; }
.staff-scanner .scanner-glyph .ui-icon { width: 71px; height: 71px; }
.scanner-heading h2 { margin: 0; font-size: clamp(1.18rem,2.0vw,1.72rem); }
.scanner-heading p { margin: .25rem 0 0; font-size: .9rem; color: var(--muted); }
.scanner-form { flex: 1; }
.scanner-form button { flex: none; min-height: 51px; }
.scanner-field { display: flex; flex: 1; flex-direction: row; align-items: center; min-width: 0; gap: 8px; padding: 0 .75rem; min-height: 51px; border: 1px solid #d5d2e4; border-radius: 11px; background: #fff; }
.scanner-field:focus-within { outline: 2px solid var(--purple); outline-offset: 1px; }
.scanner-field .ui-icon { color: var(--muted); }
.scanner-field input { border: 0; min-width: 0; width: 100%; outline: none; padding-inline: 0; }
.scanner-field input:focus-visible { outline: none; }
.scanner-capture { display: flex; gap: 8px; flex: none; }
.scan-camera { min-height: 51px; white-space: nowrap; }
.scan-hero video { display: block; width: min(100%,620px); height: clamp(145px,28vh,265px); justify-self: center; object-fit: contain; background: #160c2c; border-radius: 12px; }
#cameraHint { margin: 0; font-size: .88rem; }
.server-offline { background:#fff1df; color:#713a08; border:1px solid #f0d0a8; padding:10px 13px; border-radius:10px; margin-bottom:12px; }
.iphone-install { display:inline-block; color:var(--purple); font-weight:700; margin-bottom:12px; }
#cameraTorch[aria-pressed="true"] { color:#341a79; background:#fff0ab; border-color:#e6bf43; }
.camera-help { text-align: start; color: #292044; background: #fff; border: 1px solid #ded2fa; border-radius: 12px; padding: 12px 14px; }
.camera-help p { margin: 6px 0 0; }
.camera-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.camera-controls label { min-width: 0; max-width: 100%; }
.barcode-preview { margin: 0; }
.barcode-preview figcaption { color: var(--muted); font-size: .86rem; margin-bottom: .4rem; }
.barcode-preview canvas { display: block; max-width: 100%; max-height: 155px; object-fit: contain; border-radius: 8px; }
@media (min-width: 1110px) {
  .quick-control .scan-hero { grid-template-columns: minmax(235px,1fr) minmax(365px,1.45fr); align-items: center; }
  .quick-control .scan-hero video, .quick-control .scan-hero #cameraHint, .quick-control .scan-hero .camera-controls, .quick-control .scan-hero .camera-help { grid-column: 1/-1; }
}
.scan-current { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; font-size: .89rem; }
.scan-current button { min-height: 42px; font-size: .78rem; }
#matches { margin-top: 9px; max-height: 220px; overflow: auto; display: grid; gap: .35rem; }
#matches button { justify-content: flex-start; text-align: left; }
.proposal-matches:empty { display: none; }
.proposal-matches { display: grid; gap: .4rem; max-height: 16rem; overflow: auto; }
.proposal-matches button { display: block; text-align: left; overflow-wrap: anywhere; }
.proposal-matches small { display: block; margin-top: .15rem; }
#scanProduct:not(:empty), #queue:not([hidden]), #approvalCue:not(:empty) { margin-top: 15px; }
.product-card { min-height: 175px; display: grid; align-items: center; gap: 14px; }
.staff-product-card { grid-template-columns: minmax(0,1.15fr) minmax(210px,.9fr); }
.product-identity { display: grid; grid-template-columns: clamp(62px,10vw,130px) minmax(0,1fr); gap: 13px; align-items: center; min-width: 0; }
.product-art { position: relative; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; color: #806da9; border: 1px solid #eeebf3; border-radius: 13px; background: #f9f7fd; }
.product-art > .ui-icon { width: 44%; height: 44%; }
.product-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: white; }
.product-copy { min-width: 0; }
.product-copy h2 { margin: 0 0 .28rem; font-size: clamp(1.05rem,1.7vw,1.38rem); overflow-wrap: anywhere; }
.product-code { display: flex; align-items: center; gap: .4rem; font-size: .89rem; color: var(--muted); margin: .35rem 0 .55rem; overflow-wrap: anywhere; }
.product-code .ui-icon { width: 18px; height: 18px; }
.product-category { display: inline-block; color: var(--purple-dark); background: var(--lilac); border-radius: 7px; padding: .3rem .51rem; font-size: .78rem; font-weight: 675; overflow-wrap: anywhere; }
.staff-product-card .product-action { padding-inline-start: 16px; border-inline-start: 1px solid var(--line); }
.product-action > p:first-child { margin-top: 0; }
.quantity-field { display: grid; gap: 8px; min-width: 0; }
.quantity-steps { display: grid; grid-template-columns: minmax(42px,1fr) minmax(54px,2.3fr) minmax(42px,1fr); gap: 5px; align-items: center; }
.quantity-steps button { color: var(--purple); background: #f1ebfc; border-color: #e9e1fa; font-size: 1.35rem; padding: .15rem; min-height: 46px; }
.qty { width: 100%; min-width: 0; font-size: 1.57rem; min-height: 49px; font-weight: 750; padding: .32rem .25rem; text-align: center; appearance: textfield; }
.qty::-webkit-inner-spin-button, .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.save-count { min-height: 51px; }
.product-action .save-count { width: 100%; justify-self: stretch; }
.admin-product-card { grid-template-columns: 1fr; }
.admin-product-card .product-identity { grid-template-columns: clamp(60px,7vw,98px) minmax(0,1fr); }
.admin-count { display: grid; grid-template-columns: minmax(104px,.85fr) minmax(152px,1.1fr) minmax(102px,.85fr) minmax(120px,1fr); align-items: stretch; gap: 8px; min-width: 0; }
.admin-count > .quantity-field, .count-tile { background: #f5f4f9; padding: 9px; border-radius: 12px; align-content: center; }
.admin-count > .quantity-field { background: #f3effb; }
.admin-count .quantity-steps { grid-template-columns: minmax(32px,1fr) minmax(48px,2fr) minmax(32px,1fr); }
.admin-count .quantity-steps button { min-height: 39px; }
.admin-count .qty { min-height: 41px; }
.admin-count label, .count-tile > span { font-size: .76rem; font-weight: 680; }
.count-tile { display: grid; gap: 3px; text-align: center; }
.count-tile strong, .count-tile output { font-size: 1.55rem; font-weight: 785; }
.count-tile output { overflow-wrap: anywhere; }
.count-tile[data-tone=negative] { color: var(--red); background: #fce7ed; }
.count-tile[data-tone=positive], .count-tile[data-tone=equal] { color: var(--green); background: #e8f8ef; }
.count-tile[data-tone] small { color: inherit; font-weight: 690; }
.admin-count .product-action { display: grid; gap: 6px; align-content: center; }
.admin-count .product-action button { font-size: .83rem; padding-inline: .35rem; }
.product-source { margin: 0; color: var(--muted); font-size: .78rem; grid-column: 1/-1; }
.product-source p { margin-bottom: 0; }
.recount-warning { display: flex; align-items: center; gap: .55rem; color: var(--orange); background: #fff1e2; border-radius: 9px; padding: .55rem .65rem; }

.dashboard-metrics, .dashboard-links { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: clamp(9px,1.5vw,18px); margin-top: clamp(15px,2vw,27px); }
.dashboard-stat { display: flex; gap: 9px; min-width: 0; align-items: flex-start; padding: clamp(10px,1.4vw,17px); border-radius: 15px; background: #f5f4fb; border: 1px solid #ebe8f4; }
.dashboard-stat[data-stat] { width: 100%; justify-content: flex-start; text-align: start; }
.dashboard-stat[data-stat]:hover { border-color: currentColor; }
.stat-copy { min-width: 0; flex: 1; }
.stat-title { display: block; font-weight: 750; font-size: .78rem; letter-spacing: -.012em; margin: 1px 0 4px; }
.stat-arrow { width: 16px; height: 16px; align-self: center; flex: none; }
.dashboard-stat strong { display: block; font-size: clamp(1.23rem,2.35vw,1.95rem); line-height: 1.13; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: .74rem; color: var(--muted); }
#assignmentPushResult:empty { display: none; }
.recommendation-controls { align-items: flex-end; }
.recommendation-controls input { width: 7rem; }
#releaseUpdate { margin-bottom: .75rem; }
.assignment-summary { padding: .8rem 0; border-top: 1px solid var(--line); }
.assignment-summary p { margin: .45rem 0; }
.assignment-open { color: var(--purple-dark); text-align: start; font-weight: 750; }
.assignment-counts { display: flex; flex-wrap: wrap; gap: .35rem .8rem; font-size: .83rem; margin-top: .75rem; }
.assignment-counts + progress { max-width: 26rem; }
.pick-products { max-height: 370px; overflow: auto; }
.pick-row, .assign-detail-row { display: grid !important; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center;
  gap: .55rem; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
.pick-row small, .assign-detail-row small, .table td small { display: block; overflow-wrap: anywhere; }
.assign-detail-row button { max-width: 100%; }
.mini-product { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 7px; background: #f7f4fd; color: var(--muted); flex: none; }
.mini-product img { width: 100%; height: 100%; object-fit: contain; }
.record-product { display: flex; gap: .5rem; align-items: start; }
.record-product details { margin: 0; }
.staff-count-check { border-color: #d9cafa; border-width: 2px; background: #fcf9ff; }
.staff-count-check h3 { color: var(--purple-dark); margin-bottom: .3rem; }
.staff-count-check p { margin: .2rem 0; }
.staff-count-check .save-count { min-height: 48px; }
.variance-selection { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem 1.1rem; }
.variance-selection span { font-size: .86rem; }
.variance-value { font-weight: 750; }
.variance-value.short { color: var(--red); }
.variance-value.over { color: var(--green); }
#varianceMetrics { margin-top: 1rem; }
#varianceMetrics button { width: 100%; text-align: start; justify-content: flex-start; }
#varianceMetrics strong { font-size: clamp(1rem,1.7vw,1.5rem); white-space: nowrap; }
#recordResults { min-width: 0; }
#recordResults .table { max-width: 100%; }
dialog { max-width: min(780px,calc(100% - 24px)); max-height: 90dvh; overflow: auto; color: var(--text);
  border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; background: #fff; }
dialog::backdrop { background: #20163f65; }
.error-message:empty { display: none; }
.error-message { color: var(--red); }
.control-detail { color: var(--muted); }
.staff-assignment + .staff-assignment { margin-top: .8rem; }
.staff-assignment-filters { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: .75rem; }
.staff-assignment-filters label { flex: 1 1 12rem; }
#assignmentDetail { scroll-margin-top: 1rem; }
@media(max-width:430px) {
  .assign-detail-row { grid-template-columns: 38px minmax(0,1fr); }
  .assign-detail-row > :last-child { grid-column: 2; justify-self: start; }
  .mini-product { width: 36px; height: 36px; }
}
.stat-icon { width: 31px; height: 31px; border-radius: 9px; }
.stat-icon .ui-icon { width: 18px; height: 18px; }
.dashboard-stat.negative { background: #fff2f4; border-color: #fae0e7; }
.dashboard-stat.positive { background: #eff9f4; border-color: #dfede5; }
.dashboard-stat.accent { background: #f2edfc; border-color: #e9dff9; }
.dashboard-stat.negative strong, .dashboard-stat.negative .stat-icon { color: var(--red); }
.dashboard-stat.positive strong, .dashboard-stat.positive .stat-icon { color: var(--green); }
.dashboard-stat.negative .stat-icon { background: #fee6ec; }
.dashboard-stat.positive .stat-icon { background: #e0f5e9; }
.dashboard-link { position: relative; display: grid; justify-content: stretch; justify-items: start; align-content: start; gap: 7px; text-align: left; background: white; min-width: 0; min-height: 135px; padding: 13px 12px; border-color: var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.tile-icon { width: 42px; height: 42px; margin-bottom: 3px; }
.tile-icon.warm { color: var(--orange); background: #fff1e1; }
.dashboard-link strong { font-size: .91rem; line-height: 1.18; }
.tile-description { font-size: .76rem; color: var(--muted); font-weight: 500; max-width: calc(100% - 10px); }
.tile-arrow { position: absolute; width: 17px; height: 17px; bottom: 12px; right: 10px; color: var(--purple); }
.dashboard-link .count-pill { position: absolute; top: 10px; right: 10px; }
@media (min-width: 1230px) {
  .admin-product-card { grid-template-columns: minmax(215px,.83fr) minmax(0,2fr); }
}
@media (max-width: 1130px) {
  .dashboard-metrics, .dashboard-links { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .feed-label { display: none; }
}
@media (max-width: 820px) {
  body { height: 100dvh; overflow: hidden; }
  .layout.authenticated { --header: 67px; grid-template: 'top' var(--header) 'main' minmax(0,1fr) / minmax(0,1fr); height: 100dvh; min-height: 0; }
  .layout.staff-layout.authenticated { grid-template-rows: var(--header) minmax(0,1fr) auto; grid-template-areas: 'top' 'main' 'nav'; }
  .authenticated > .identity { display: none; }
  .top { padding-inline: clamp(10px,3vw,20px); }
  .panel-title { gap: 6px; }
  .panel-title-icon { width: 32px; height: 32px; }
  .panel-title-icon .ui-icon { width: 20px; height: 20px; }
  .panel-title > strong { font-size: clamp(1.08rem,3.2vw,1.55rem); }
  .account { gap: 7px; }
  .profile { gap: 5px; }
  .profile-name small { display: none; }
  .profile-name strong { max-width: 110px; }
  .account-icon { width: 30px; height: 30px; }
  .account-icon .ui-icon { width: 18px; height: 18px; }
  main { padding: 14px; overflow: auto; min-height: 0; padding-bottom: calc(17px + env(safe-area-inset-bottom)); }
  #nav { position: static; height: auto; border: 0; padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); }
  #nav.staff-nav { border-top: 1px solid var(--line); background: white; }
  #nav.staff-nav .nav-main { grid-template-columns: repeat(4,minmax(0,1fr)); }
  #nav.staff-nav button { justify-content: center; flex-direction: column; gap: 4px; text-align: center; padding-inline: 2px; font-size: .73rem; }
  #nav.staff-nav .count-pill { margin-left: 0; }
  #adminMenu { display: inline-flex; }
  .admin-layout #nav { display: none; position: absolute; z-index: 5; top: var(--header); right: 0; width: min(295px,95vw); max-height: calc(100dvh - var(--header)); box-shadow: 0 11px 33px #2520402a; border: 1px solid var(--line); border-radius: 0 0 0 14px; }
  .admin-layout.menu-open #nav { display: flex; }
  .admin-layout #nav .nav-footer { margin-top: 8px; }
  .layout:not(.authenticated) main { overflow: visible; }
  body:has(.layout:not(.authenticated)) { overflow: auto; }
}

.expiry-inline { color: var(--muted); font-size: .85rem; line-height: 1.45; grid-column: 1 / -1; }
.expiry-inline strong { color: #48289b; }
.expiry-result { text-align: center; display: grid; gap: 14px; }
.expiry-result h1 { color: #48289b; font-size: 1.2rem; margin: 0; }
.expiry-result p, .expiry-result h3 { margin: 0; }
.expiry-result .product-identity { grid-template-columns: 1fr; justify-items: center; }
.expiry-result .product-art { width: min(160px,50vw); }
.expiry-result .product-code { justify-content: center; overflow-wrap: anywhere; }
.expiry-day-card { color: white; background: #48289b; border-radius: 14px; padding: 14px; }
.expiry-day-card strong, .expiry-cutoff strong { display: block; font-size: clamp(1.5rem,5vw,2.4rem); }
.expiry-cutoff { color: #a12639; background: #fff1f3; border-radius: 14px; padding: 14px; }
.expiry-unknown { padding: 12px; border-radius: 12px; background: #f3eefc; color: #48289b; font-weight: 700; }
.expiry-result #nextExpiry { min-height: 52px; }
#expiryFilter, #expiryRows { min-width: 0; }
#expiryFilter .button { width: auto; }
#expiryRows td.wrap { overflow-wrap: anywhere; }
@media (max-width: 550px) {
  .admin-layout .profile, .staff-layout .profile-name { display: none; }
  .admin-layout #connection { display: none; }
  .square-button { width: 38px; min-width: 38px; min-height: 40px; }
  #feedIcon { display: none; }
  .feed-indicator { padding: 2px; }
  .scanner-controls { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
  .scanner-form { gap: 6px; }
  .scan-camera { min-height: 48px; width: 50%; flex: 1 1 0; padding-inline: 6px; }
  .staff-scanner .scan-hero { padding-block: 17px; gap: 12px; }
  .staff-scanner .scanner-glyph .ui-icon { width: 48px; height: 48px; }
  .scanner-heading p { font-size: .82rem; }
  .staff-product-card { grid-template-columns: 1fr; }
  .staff-product-card .product-action { padding: 13px 0 0; border-inline-start: 0; border-top: 1px solid var(--line); }
  .product-identity { grid-template-columns: 72px minmax(0,1fr); }
  .admin-count { grid-template-columns: minmax(0,1fr) minmax(0,1.25fr); }
  .dashboard-metrics,.dashboard-links { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .dashboard-stat { padding: 9px; }
}
@media (max-width: 360px) { .staff-layout .profile { display: none; } }

.assignment-layout { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 16px; align-items: start; }
.assignment-layout > *, .task-management { min-width: 0; }
.assignment-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: .55rem; }
.assignment-title button { font-size: .83rem; }
.assignment-layout:not(:has(.task-management > *)) { grid-template-columns: minmax(0, 730px); }
.scope-picker { margin: 0; border: 1px solid var(--line); border-radius: 11px; background: #fff; min-width: 0; }
.scope-picker summary { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 9px 11px; }
.scope-picker summary::before { content: ''; width: 7px; height: 7px; margin-right: 4px; border-bottom: 2px solid var(--purple); border-right: 2px solid var(--purple); transform: rotate(-45deg); }
.scope-picker[open] summary::before { transform: rotate(45deg); }
.scope-picker summary::-webkit-details-marker { display: none; }
.scope-picker summary span { margin-left: auto; color: var(--purple-dark); background: var(--lilac); border-radius: 16px; padding: 4px 8px; font-size: .73rem; white-space: nowrap; }
.scope-picker-content { padding: 0 10px 10px; }
.scope-tools,.task-dates { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-bottom: 8px; }
.scope-tools input,.task-dates input { min-width: 0; width: 100%; }
.scope-tools button { font-size: .81rem; padding-inline: 5px; }
.choice-list { display: grid; gap: 4px; max-height: 245px; overflow: auto; overscroll-behavior: contain; }
.choice-row,.member-choices .check { min-height: 44px; margin: 0; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.choice-row:hover,.member-choices .check:hover { border-color: var(--line); }
.choice-row:has(:checked),.member-choices .check:has(:checked) { background: var(--lilac); border-color: #e3d9f8; }
.choice-row input,.member-choices input { flex: none; }
.member-choices .check + .check { margin-top: 0; }
.member-choices small { margin-left: auto; }
.task-existing .stack,.task-existing .actions { margin-top: 12px; }
.task-submit { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0 1px; border-top: 1px solid var(--line); background: white; }
.task-submit output,.task-submit small { display: block; }
.task-submit output { font-size: .89rem; font-weight: 700; }
.task-submit button { min-width: max-content; }
.form-error { padding: 8px 10px; border-radius: 8px; margin: 0; background: #fce8ed; color: var(--red); }
button.danger-outline { color: var(--red); border-color: #ecc5cc; background: #fff8fa; }
button.danger-outline:hover { border-color: var(--red); }
.task-trash details { margin-top: 0; }
.removed-task { padding: 9px 0; border-top: 1px solid var(--line); display: flex; gap: 9px; align-items: center; justify-content: space-between; }
.removed-task small { display: block; margin-top: 3px; }
.task-trash .stack { margin-top: 10px; }
@media (max-width: 910px) {
  .assignment-layout { grid-template-columns: minmax(0,1fr); gap: 4px; }
}
@media (max-width: 820px) {
  .task-submit { position: sticky; z-index: 2; bottom: 0; padding: 9px 0 calc(5px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .task-dates { grid-template-columns: minmax(0,1fr); }
}

.source-panel { padding: clamp(12px,1.6vw,20px); }
.source-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.source-title h2 { margin: 0; }
#sourceStatus { font-size: .78rem; border-radius: 20px; padding: 4px 9px; }
#sourceStatus[data-condition=current],.feed-indicator[data-status=current] strong { background: #e1f6e8; color: var(--green); }
#sourceStatus[data-condition=stale],.feed-indicator[data-status=stale] strong { background: #fff0dc; color: var(--orange); }
#sourceStatus[data-condition=error],.feed-indicator[data-status=error] strong { background: #fce8ed; color: var(--red); }
#sourceStatus[data-condition=updating],.feed-indicator[data-status=updating] strong { background: var(--lilac); color: var(--purple-dark); }
.source-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(155px,100%),1fr)); gap: 10px 14px; margin: 12px 0; }
.source-facts dt { font-size: .76rem; color: var(--muted); }
.source-facts dd { font-size: .88rem; font-weight: 670; margin: 2px 0 0; overflow-wrap: anywhere; }
.source-panel p { font-size: .83rem; margin: 8px 0 0; color: var(--muted); }
.count-batch { margin: 12px 0; border: 1px solid #dfd6f5; border-radius: 12px; padding: 12px; }
.count-batch[open] > summary { margin-bottom: 12px; }
.count-batch .actions, .count-batch fieldset { margin: 9px 0; }
.count-batch output { color: var(--purple-dark); font-weight: 650; }
.reference-comparison { min-width: min(290px, 70vw); padding-top: 6px; }
.reference-compare-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(135px,1fr)); gap: 8px; }
.reference-compare-grid > div { padding: 8px; background: var(--lilac); border-radius: 8px; }
.reference-comparison p { margin: 4px 0; }
#scanAssignment { padding: 10px 14px; }
#scanAssignment small { display: block; margin-top: 5px; }

.security-metrics {display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:16px 0;}
.security-metrics .metric {padding:16px;border:1px solid #dad5e9;border-radius:16px;background:#f8f6ff;}
.security-request {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid #e9e3f2;}
.security-request p {margin:.3rem 0;}
.security-table {min-width:720px;}
.security-fields {display:flex;flex-wrap:wrap;align-items:end;gap:12px;}
.security-fields input {min-width:160px;}
.security-entry {max-width:580px;}
.security-dialog {width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;
  padding:24px;border:1px solid #d8cee9;border-radius:20px;color:#201534;background:white;box-shadow:0 24px 72px #19102d5c;}
.security-dialog::backdrop {background:#17102180;}
.security-dialog .actions {margin-top:14px;}
.security-qr {display:block;width:min(260px,100%);margin:8px auto;}
.security-code,.security-recovery {overflow-wrap:anywhere;display:block;font-family:ui-monospace,monospace;letter-spacing:.08em;}
.security-code {padding:15px 0;font-size:1.25rem;font-weight:700;}
.security-feedback {color:#9c163a;margin:0;}
.personnel-form {align-items:end;}
.personnel-form label {flex:1 1 180px;}
.personnel-actions {display:flex; flex-wrap:wrap; gap:6px;}
.personnel-actions button {min-height:40px;padding-inline:10px;}
.personnel-table {min-width:680px;}
.security-dialog input.security-code {padding:10px;font-size:1rem;}

.manager-count-note {max-width:62ch;border:1px solid #e4a43d;border-left:4px solid #db8e24;border-radius:10px;background:#fff4dc;color:#432a07;padding:10px 14px;margin:8px 0;overflow-wrap:anywhere;}
.manager-count-note p {white-space:pre-wrap;margin:6px 0 0;}
.control-tag {background:#fff0cd;color:#704009;}
.recount-dialog {width:min(760px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;}
.recount-dialog textarea,.product-note-fields textarea {width:100%;}
.product-note-fields label {display:block;margin-top:10px;}
.member-group {margin:6px 0 10px;}
#newAssignmentNotice {margin:0 0 12px;}
#assignmentItemRows .assign-detail-row {grid-template-columns:44px minmax(150px,1fr) minmax(0,3fr);align-items:start;}
#assignmentItemRows .assign-detail-row > div {min-width:0;}
@media (max-width: 650px) {
  #assignmentItemRows .assign-detail-row {grid-template-columns:38px minmax(0,1fr);}
  #assignmentItemRows .assign-detail-row > :last-child {grid-column:2;justify-self:stretch;}
}

.system-health-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap:.65rem; margin:0 0 1rem; }
.system-health-list div { background:var(--background,#f7f7fb); border:1px solid var(--line); border-radius:10px; padding:.6rem .8rem; }
.system-health-list dt { font-size:.83rem; color:var(--muted); }
.system-health-list dd { margin:.16rem 0 0; font-weight:700; overflow-wrap:anywhere; }
