/* Anything Inventory — inventory layer on top of app.css.
 * Uses the shared tokens only; labels are intentionally black on white.
 */

/* Scan FAB ----------------------------------------------------------- */
.scan-fab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 42;
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent);
  color: var(--accent-contrast); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
  transition: transform .13s ease, background .13s ease; }
.scan-fab:hover { background: var(--accent-strong); transform: translateY(-1px); }
.scan-fab:active { transform: translateY(0); }
.scan-fab:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.scan-fab .icon { width: 22px; height: 22px; }

/* Dialogs + row menus ------------------------------------------------ */
.dialog-head { display: flex; align-items: center; gap: 10px; }
.dialog-head h2 { flex: 1; min-width: 0; }
.dialog-head .icon-button { flex: none; }
.tbl .kebab { width: 28px; height: 28px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
/* Page-header action menus wrap under the title on narrow screens; anchor
   the panel to the trigger's left edge so it stays inside the viewport. */
@media (max-width: 640px) {
  .action-menu .menu { left: 0; right: auto; }
}
.menu .menu-item.is-danger { color: var(--danger); }
.menu .menu-item.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
/* Chrome can propagate a wide table's scroll width to the page even when the
   table sits in an overflow container; paint containment keeps it inside. */
.table-wrap { contain: paint; }

/* Stock chips -------------------------------------------------------- */
.stock-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 21px; padding: 1px 8px; border: 1px solid transparent;
  border-radius: 999px; background: var(--surface-2); color: var(--text-dim); font-size: 11px; font-weight: 550; line-height: 1.4;
  white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-chip::before { content: ""; width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; opacity: .8; }
.stock-chip.is-success, .stock-chip-success, .stock-chip.is-in, .stock-chip-in { background: var(--success-soft); color: var(--success); }
.stock-chip.is-warn, .stock-chip-warn, .stock-chip.is-low, .stock-chip-low { background: var(--warn-soft); color: var(--warn); }
.stock-chip.is-danger, .stock-chip-danger, .stock-chip.is-out, .stock-chip-out, .stock-chip.is-negative, .stock-chip-negative {
  background: var(--danger-soft); color: var(--danger); }
.stock-chip.is-info, .stock-chip-info { background: var(--info-soft); color: var(--info); }
.stock-chip.is-muted, .stock-chip-muted, .stock-chip.is-untracked, .stock-chip-untracked { background: var(--surface-2);
  color: var(--text-faint); }
.stock-chip.is-plain::before { display: none; }
.stock-chip-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Quantity input + steppers ----------------------------------------- */
.qty-input { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; vertical-align: middle; }
.qty-input:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.qty-input input, .qty-input input[type="number"] { width: 68px; height: 100%; padding: 0 6px; border: 0;
  border-radius: 0; background: transparent; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield; box-shadow: none; }
input.qty-input { width: 88px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.qty-input input:focus { border: 0; box-shadow: none; }
input.qty-input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.qty-input input::-webkit-outer-spin-button, .qty-input input::-webkit-inner-spin-button, input.qty-input::-webkit-outer-spin-button,
input.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input .qty-step, .qty-input button { display: grid; place-items: center; width: 32px; height: 100%; padding: 0; border: 0;
  background: var(--surface-2); color: var(--text-dim); cursor: pointer; }
.qty-input .qty-step:hover, .qty-input button:hover { background: var(--surface-3); color: var(--text); }
.qty-input .qty-step:active, .qty-input button:active { color: var(--accent); }
.qty-step { touch-action: manipulation; }

/* Count screen ------------------------------------------------------- */
.count-row { display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(64px, .55fr)) auto; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 12.5px; }
.count-row:last-child { border-bottom: 0; }
.count-row:hover { background: var(--surface-2); }
.count-row .count-item { min-width: 0; }
.count-row .count-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-row .count-meta { color: var(--text-faint); font-size: 11px; margin-top: 1px; }
.count-row .count-expected, .count-row .count-counted, .count-row .count-variance { text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.count-row .count-label { display: block; font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.count-row .count-variance.is-bad { color: var(--danger); font-weight: 600; }
.count-row .count-variance.is-good { color: var(--success); }
.count-row.is-unexpected { background: var(--info-soft); }
.count-row.is-variance { background: var(--warn-soft); }
.count-row.is-counted { background: color-mix(in srgb, var(--success-soft) 55%, var(--surface)); }
.count-row .count-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.count-progress { display: grid; gap: 6px; min-width: 0; }
.count-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--text-dim); }
.count-progress-head strong { color: var(--text); font-variant-numeric: tabular-nums; }
.count-progress-bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.count-progress-bar > span, .count-progress-fill { display: block; height: 100%; min-width: 0; border-radius: inherit;
  background: var(--accent); transition: width .2s ease; }
.count-progress.is-complete .count-progress-bar > span, .count-progress.is-complete .count-progress-fill { background: var(--success); }
.count-progress.is-warn .count-progress-bar > span, .count-progress.is-warn .count-progress-fill { background: var(--warn); }

/* Labels ------------------------------------------------------------- */
.label-toolbar { position: sticky; top: calc(var(--header) + 10px); z-index: 8; display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; padding: 9px 12px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); }
.label-toolbar .spacer { flex: 1; }
.label-toolbar .label-size { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* A `.label-preview` can be either a true-size label surface (labels pages)
   or a wrapper containing `.label` previews. Only style the wrapper here so
   the label surface keeps its physical dimensions. */
.label-preview { box-sizing: border-box; }
.label-preview:has(.label) { display: grid; place-items: center; min-height: 220px; padding: 28px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%) 0 0 / 16px 16px, var(--surface); }
.label-sheet { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4mm; padding: 8mm; border: 1px solid var(--paper-border);
  border-radius: var(--radius); background: var(--paper); color: var(--paper-text); overflow: auto; }
.label-sheet.is-sheet { display: grid; grid-template-columns: repeat(var(--label-columns, 3), var(--label-w, 66.675mm));
  gap: var(--label-gap-y, 0) var(--label-gap-x, 0); }
.label-preview .label, .label-sheet .label { width: var(--label-w, 57mm); height: var(--label-h, 32mm); padding: 2mm; display: grid;
  grid-template-columns: 18mm minmax(0, 1fr); gap: 2mm; overflow: hidden; background: #fff; color: #000; border: 1px dashed #d7dbe3;
  border-radius: 0; break-inside: avoid; page-break-inside: avoid; }
.label-preview .label { border-style: solid; border-color: var(--paper-border); }
.label-qr { display: grid; place-items: center; min-width: 0; }
.label-qr svg, .label-qr img { width: 18mm; height: 18mm; display: block; }
.label-copy { min-width: 0; display: flex; flex-direction: column; gap: .6mm; }
.label-name { font-size: 8pt; font-weight: 700; line-height: 1.05; overflow: hidden; }
.label-sku { font-size: 7pt; font-weight: 600; letter-spacing: .04em; }
.label-barcode { margin-top: auto; }
.label-barcode svg, .label-barcode img { width: 100%; height: 8mm; display: block; }
.label-meta { font-size: 6pt; color: #333; }
.label-sheet .label:hover { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Scan --------------------------------------------------------------- */
.scan-status { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }
.scan-stage { position: relative; aspect-ratio: 4 / 3; max-width: 560px; border-radius: var(--radius-lg); overflow: hidden;
  background: #000; border: 1px solid var(--border); }
.scan-video { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.scan-idle { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--surface-2); }
.scan-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .18s; }
.scan-flash.is-flash { background: var(--accent-soft); opacity: 1; }
.scan-controls { margin-top: 12px; }
.scan-controls .btn { min-width: 0; }
.scan-pair-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr); gap: 24px; align-items: start; }
.scan-pair-copy p { font-size: 13px; line-height: 1.55; }
.scan-pair-steps { margin: 14px 0 0; padding-left: 18px; display: grid; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.scan-pair-meta { display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.scan-pair-meta div { display: flex; flex-direction: column; gap: 2px; }
.scan-pair-meta span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.scan-pair-meta strong { font-size: 13px; }
.scan-pair-code { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.scan-pair-qr { width: min(260px, 100%); padding: 10px; background: var(--paper); color: var(--paper-text); border-radius: 12px; border: 1px solid var(--border); }
.scan-pair-qr svg { display: block; width: 100%; height: auto; }
.scan-pair-url { font-size: 10.5px; color: var(--text-faint); overflow-wrap: anywhere; }
.scan-pair-code .muted { font-size: 11.5px; max-width: 240px; }
@media (max-width: 760px) {
  .scan-pair-grid { grid-template-columns: minmax(0, 1fr); }
  .scan-pair-code { order: -1; }
  .scan-pair-qr { width: min(220px, 70%); }
}
.scan-recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.scan-recent-list:empty { display: none; }
.scan-recent-item { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.scan-recent-item:last-child { border-bottom: 0; }
.scan-recent-button { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 8px 0;
  border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.scan-recent-button:hover .scan-recent-name { color: var(--accent); }
.scan-recent-name { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scan-recent-code { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.scan-recent-item .icon-button { width: 28px; height: 28px; }
.scan-dialog { width: min(440px, calc(100vw - 32px)); }
.scan-dialog-head { display: flex; align-items: flex-start; gap: 10px; }
.scan-dialog-head > div { flex: 1 1 auto; min-width: 0; }
.scan-dialog-head h2 { overflow-wrap: anywhere; }
.scan-kicker { display: block; margin-bottom: 2px; font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint); }
.scan-kicker:empty { display: none; }
.scan-result-item { display: flex; align-items: center; gap: 12px; }
.scan-result-image, .scan-result-placeholder { width: 52px; height: 52px; flex: none; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); object-fit: cover; }
.scan-result-placeholder { display: grid; place-items: center; color: var(--text-faint); font-weight: 600; }
.scan-result-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 11.5px; color: var(--text-faint); }
.scan-result-meta strong { color: var(--text); font-weight: 550; }
.scan-result-stats { display: flex; gap: 22px; margin-top: 14px; }
.scan-result-stat { display: flex; flex-direction: column; gap: 1px; }
.scan-result-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.scan-result-stat strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.scan-dialog-foot { margin-top: 14px; font-family: var(--mono); font-size: 11px; color: var(--text-faint); overflow-wrap: anywhere; }
.quick-scan-dialog { width: min(440px, calc(100vw - 28px)); }
.quick-scan-dialog .form-error { margin: 8px 0 0; color: var(--danger); font-size: 12px; }

/* Seats -------------------------------------------------------------- */
.seat-meter { display: grid; gap: 6px; min-width: 0; }
.seat-meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--text-dim); }
.seat-meter-head strong { color: var(--text); font-variant-numeric: tabular-nums; }
.seat-meter-bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.seat-meter-bar > span, .seat-meter-fill { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent);
  transition: width .2s ease; }
.seat-meter.is-warn .seat-meter-bar > span, .seat-meter.is-warn .seat-meter-fill { background: var(--warn); }
.seat-meter.is-danger .seat-meter-bar > span, .seat-meter.is-danger .seat-meter-fill { background: var(--danger); }
.seat-meter-meta { font-size: 10.5px; color: var(--text-faint); }

/* Returns, ledger, timeline ----------------------------------------- */
.return-line { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(64px, .5fr)) auto; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.return-line:last-child { border-bottom: 0; }
.return-line .return-item { min-width: 0; font-weight: 550; }
.return-line .return-meta { color: var(--text-faint); font-size: 11px; margin-top: 1px; }
.return-line .return-qty, .return-line .return-expected { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.return-line .return-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.return-line.is-received { background: color-mix(in srgb, var(--success-soft) 45%, var(--surface)); }
/* Returns and counts also use these classes on real table rows. */
tr.return-line, tr.count-row { display: table-row; padding: 0; border: 0; background: transparent; }
tr.return-line:hover, tr.count-row:hover { background: var(--surface-2); }
tr.return-line > td, tr.count-row > td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr.return-line:last-child > td, tr.count-row:last-child > td { border-bottom: 0; }
tr.return-line .return-line-item, tr.return-line select, tr.return-line input { min-width: 0; }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 7px; bottom: 8px; width: 1px; background: var(--border); }
.timeline > li, .timeline-item { position: relative; padding: 0 0 14px 28px; min-width: 0; }
.timeline > li:last-child, .timeline-item:last-child { padding-bottom: 0; }
.timeline > li::before, .timeline-item::before { content: ""; position: absolute; left: 3px; top: 4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline > li.is-accent::before, .timeline-item.is-accent::before { border-color: var(--accent); background: var(--accent-soft); }
.timeline > li.is-danger::before, .timeline-item.is-danger::before { border-color: var(--danger); }
.timeline-time, .timeline-meta { color: var(--text-faint); font-size: 10.5px; }
.timeline-title { font-size: 12.5px; font-weight: 550; margin: 1px 0 2px; }
.timeline-body { font-size: 12px; color: var(--text-dim); }

.movement-qty { display: inline-block; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.movement-qty.is-in, .movement-qty.is-positive, .movement-qty-in { color: var(--success); }
.movement-qty.is-out, .movement-qty.is-negative, .movement-qty-out { color: var(--danger); }
.movement-qty.is-neutral, .movement-qty-neutral { color: var(--text-dim); }

.stock-by-location { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stock-by-location th { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-faint);
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.stock-by-location td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.stock-by-location tr:last-child td { border-bottom: 0; }
.stock-by-location tbody tr:hover { background: var(--surface-2); }
.stock-by-location .location-name { font-weight: 550; }
.stock-by-location .location-code { color: var(--text-faint); font-size: 10.5px; font-family: var(--mono); }
.stock-by-location .location-qty { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stock-by-location .location-total { font-weight: 600; }

/* Item detail -------------------------------------------------------- */
.item-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 18px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 18px; }
.item-thumb { width: 72px; height: 72px; flex: none; border: 1px solid var(--border); border-radius: 9px; background: var(--accent-soft);
  color: var(--accent); object-fit: cover; display: grid; place-items: center; overflow: hidden; }
.item-thumb.is-empty::before { content: ""; width: 26px; height: 26px; border: 2px solid currentColor; border-radius: 4px;
  transform: rotate(12deg); opacity: .75; }
.item-thumb .icon { width: 28px; height: 28px; }
.item-hero-copy { min-width: 0; }
.item-hero-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.item-hero-sub { color: var(--text-dim); font-size: 12px; margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-hero-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; }
.item-hero-stats .hero-stat { display: grid; gap: 1px; }
.item-hero-stats .hero-stat span { color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.item-hero-stats .hero-stat strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.item-hero-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 280px; }

.item-label-preview { max-width: 340px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); color: var(--paper-text); }
.item-label-name { font-size: 16px; font-weight: 650; line-height: 1.2; }
.item-label-meta { margin-top: 3px; font-size: 11px; }
.item-label-code { margin-top: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.item-label-url { margin-top: 12px; font-size: 9.5px; color: var(--paper-muted); word-break: break-all; }

/* Public scanned item card ------------------------------------------ */
.public-item-card { max-width: 720px; }
.public-item-head { display: flex; gap: 18px; align-items: flex-start; }
.public-item-image { width: 120px; height: 120px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); flex: none; }
.public-item-image-fallback { display: grid; place-items: center; font-size: 38px; font-weight: 650; color: var(--text-faint); }
.public-item-copy { min-width: 0; flex: 1 1 auto; }
.public-item-kicker { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 650; }
.public-item-copy h2 { font-size: 24px; line-height: 1.18; margin: 4px 0 12px; overflow-wrap: anywhere; }
.public-item-facts { display: flex; gap: 18px; flex-wrap: wrap; }
.public-item-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 84px; }
.public-item-facts span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.public-item-facts strong { font-size: 12.5px; }
.public-item-stock { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0 0; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.public-item-stat { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.public-item-stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.public-item-stat strong { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.public-item-stat small { font-size: 11px; color: var(--text-faint); }
.public-item-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.public-item-note { margin-top: 16px; font-size: 11.5px; color: var(--text-faint); }
@media (max-width: 560px) {
  .public-item-head { flex-direction: column; }
  .public-item-image { width: 84px; height: 84px; }
  .public-item-copy h2 { font-size: 20px; }
  .public-item-links .btn { flex: 1 1 auto; min-height: 44px; }
}

.stat-danger { box-shadow: inset 0 2px 0 var(--danger); }
.stat-danger .stat-label, .stat-danger .stat-meta { color: var(--danger); }
.sync-health { display: flex; align-items: flex-start; gap: 8px; min-width: 0; font-size: 12px; color: var(--text-dim); }
.sync-health-dot { width: 8px; height: 8px; margin-top: 4px; flex: none; border-radius: 50%; background: var(--text-faint); }
.sync-health.is-ok .sync-health-dot, .sync-health-success .sync-health-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.sync-health.is-warn .sync-health-dot, .sync-health-warn .sync-health-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.sync-health.is-error .sync-health-dot, .sync-health-danger .sync-health-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.sync-health.is-syncing .sync-health-dot { background: var(--accent); animation: sync-pulse 1.4s ease-in-out infinite; }
.sync-health strong { color: var(--text); font-weight: 550; }
.sync-health .sync-health-meta { display: block; color: var(--text-faint); font-size: 10.5px; margin-top: 1px; }
@keyframes sync-pulse { 50% { opacity: .35; } }

.onboarding-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: onboarding; }
.onboarding-list > li { counter-increment: onboarding; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 12.5px; min-width: 0; }
.onboarding-list > li::before { content: counter(onboarding); display: grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 650; }
.onboarding-list > li.is-done { color: var(--text-dim); }
.onboarding-list > li.is-done::before { content: "✓"; background: var(--success-soft); color: var(--success); }
.onboarding-list .onboarding-copy { min-width: 0; flex: 1; }
.onboarding-list .onboarding-copy small { display: block; color: var(--text-faint); font-size: 10.5px; margin-top: 1px; }

.mobile-card-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mobile-card-list > * { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  min-width: 0; }

/* Picker + small app JS surfaces ------------------------------------ */
.item-picker { position: relative; }
.item-picker-menu { top: calc(100% + 4px); left: 0; right: 0; width: auto; min-width: 0; max-height: 320px; overflow-y: auto;
  overscroll-behavior: contain; }
.item-picker-option { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; }
.item-picker-name { font-weight: 550; color: var(--text); }
.item-picker-meta { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.menu-empty { padding: 10px 9px; color: var(--text-faint); font-size: 12px; }
.toast.is-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.list-load-error { color: var(--danger); font-size: 12px; padding: 12px 14px; }
.list-loading { color: var(--text-faint); font-size: 12px; padding: 12px 14px; }
.image-preview { max-width: 100%; max-height: 220px; margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); object-fit: cover; }

/* 360px / tablet refinements ---------------------------------------- */
@media (max-width: 900px) {
  .label-toolbar { top: calc(var(--header) + 4px); }
  .item-hero { grid-template-columns: auto minmax(0, 1fr); }
  .item-hero-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; } }
@media (max-width: 760px) {
  .scan-fab { width: 56px; height: 56px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .count-row { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(62px, .5fr)); gap: 6px 10px; }
  .count-row .count-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .return-line { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(60px, .5fr)); }
  .return-line .return-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .item-hero { padding: 14px; gap: 12px; }
  .item-thumb { width: 60px; height: 60px; }
  .item-hero-stats { gap: 14px; }
  .label-sheet { padding: 12px; gap: 10px; }
  .quick-scan-dialog { width: calc(100vw - 20px); } }
@media (max-width: 560px) { .label-toolbar { position: static; }
  .label-preview:has(.label) { padding: 14px; min-height: 180px; }
  .label-preview .label { transform: scale(.92); transform-origin: center; }
  .item-hero { grid-template-columns: minmax(0, 1fr); }
  .item-thumb { width: 52px; height: 52px; }
  .item-hero-title { font-size: 17px; }
  .item-hero-actions { grid-column: auto; }
  .item-hero-actions .btn { flex: 1 1 auto; }
  .count-row { grid-template-columns: minmax(0, 1fr) repeat(2, minmax(58px, .5fr)); padding: 10px; }
  .count-row .count-name { white-space: normal; }
  .onboarding-list > li { align-items: flex-start; }
  .stock-by-location { font-size: 12px; }
  .stock-by-location th, .stock-by-location td { padding-left: 8px; padding-right: 8px; } }
@media (max-width: 380px) {
  .scan-fab { width: 48px; height: 48px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .count-actions .btn { flex: 1 1 auto; } }
@media (max-width: 760px), (hover: none) { .scan-controls .btn, .scan-recent-button,
  .count-row .btn, .count-row input, .count-row .qty-input, .qty-input .qty-step, .qty-input button { min-height: 44px; }
  .qty-input { height: 44px; }
  .qty-input .qty-step, .qty-input button { width: 42px; } }

/* Print: labels + movement ledger ----------------------------------- */
@page label { size: 57mm 32mm; margin: 0; }
@media print { .sidebar, .app-header, .scan-fab,
  .page-actions, .filters, .flash-stack, .toast-host, .list-footer, .list-sentinel,
  .label-toolbar, .context-menu, dialog { display: none !important; }
  .shell { margin: 0; }
  .content { padding: 0; max-width: none; }
  body { background: #fff !important; color: #000 !important; }
  .label-sheet, .label-preview:has(.label) { background: #fff !important; border: 0 !important; border-radius: 0 !important;
    padding: 0 !important; overflow: visible !important; box-shadow: none !important; }
  .label-preview { box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; }
  .label-sheet { gap: 0; }
  .label-preview .label, .label-sheet .label { border: 0 !important; box-shadow: none !important; transform: none !important;
    break-inside: avoid; page-break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .label-sheet.is-thermal .label, .label-sheet[data-print-size="thermal"] .label, body.print-labels .label-sheet .label { page: label; }
  body.print-labels, body.print-labels .shell, body.print-labels .content { width: 57mm; margin: 0; padding: 0; }
  body.print-labels .label-sheet { display: block; }
  .label * { color: #000 !important; }
  .movement-ledger { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .movement-ledger thead { display: table-header-group; }
  .movement-ledger tr { break-inside: avoid; page-break-inside: avoid; }
  .movement-ledger th, .movement-ledger td { padding: 5pt 6pt; border-bottom: 1px solid #d9dde5; color: #000 !important;
    text-align: left; }
  .movement-ledger th { font-size: 8pt; text-transform: uppercase; letter-spacing: .04em; }
  .movement-ledger a { color: #000 !important; text-decoration: none; }
  .movement-ledger .stock-chip, .movement-ledger .badge { background: transparent !important; border: 1px solid #bbb !important;
    color: #000 !important; }
  .movement-ledger .movement-qty.is-in { color: #067647 !important; }
  .movement-ledger .movement-qty.is-out { color: #b42318 !important; } }

/* Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) { .scan-fab, .count-progress-bar > span, .count-progress-fill, .seat-meter-bar > span,
  .seat-meter-fill, .sync-health.is-syncing .sync-health-dot { transition: none !important;
    animation: none !important; } }

/* Count/list containers ---------------------------------------------- */
.count-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.return-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.onboarding-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.onboarding-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.onboarding-list li.is-done { color: var(--text-faint); text-decoration: line-through; }
@media (max-width: 700px) {
  .count-row, .return-line { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .count-row .count-expected, .count-row .count-counted, .count-row .count-variance,
  .return-line .return-expected, .return-line .return-qty { text-align: left; }
  .count-row .count-actions, .return-line .return-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Workspace dialogs and menus --------------------------------------- */
dialog > form > .dialog-head, dialog > .dialog-head { display: flex; align-items: center; gap: 10px; }
.dialog-head h2 { flex: 1; }
.menu-item-danger { color: var(--danger); }
.menu-item-danger:hover { background: var(--danger-soft); }

/* Status is plain text with a dot — no chips. */
.stock-chip {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  gap: 6px;
  font-weight: 500;
}
