/* ═══════════════════════════════════════════
   SpazaBoek — Slate & Copper (Vinyl Vault kin)
   Mobile-first. No backdrop-filter: older
   Android WebViews render it inconsistently.
   ═══════════════════════════════════════════ */

:root {
  --bg-deep:   #101218;
  --bg-mid:    #14161d;

  --glass-1:   #191c24;
  --glass-2:   #1e222b;
  --glass-hi:  #262a35;
  --hairline:  rgba(255,255,255,.10);
  --hairline-2:rgba(255,255,255,.17);

  --copper:      #d98a5e;
  --copper-lite: #f0b98c;
  --copper-deep: #a85f39;
  --copper-glow: rgba(217,138,94,.30);

  --ink:      #eef0f4;
  --muted:    #9195a1;
  --muted-2:  #5c6070;

  --danger: #e2685f;
  --ok:     #5fc48b;
  --warn:   #e0a63f;
  --warn-bg: rgba(224,166,63,.12);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --f-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --f-head: 'Inter Tight', 'Inter', -apple-system, sans-serif;

  --tab-h: 78px;
  --tap-min: 48px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html { background: var(--bg-deep); }

body {
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: calc(var(--tab-h) + 60px);
}

button, input, select {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

/* ── Topbar ───────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--copper);
  color: var(--copper);
  display: grid;
  place-items: center;
  font-size: .7rem;
  flex-shrink: 0;
}

.topbar h1 {
  font-family: var(--f-head);
  font-size: 1.42rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  color: var(--muted);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:active { background: var(--glass-2); color: var(--ink); }

/* ── Layout ───────────────────────────────── */
#app { padding: 0 20px 28px; }
.view { display: block; }
.view[hidden] { display: none; }

.empty-msg {
  text-align: center;
  color: var(--muted);
  margin-top: 60px;
  font-size: .95rem;
}

/* ── Stat tiles ───────────────────────────── */
.stat-pills {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-pill {
  border-radius: var(--r-lg);
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  padding: 17px 8px;
  text-align: center;
}

.stat-pills-sm {
  grid-auto-columns: 1fr;
  margin-top: -4px;
}
.stat-pills-sm .stat-pill-num {
  font-size: 1.15rem;
}
.stat-pills-sm .stat-pill {
  padding: 11px 8px;
}

.stat-pill.low {
  border-color: rgba(224,166,63,.42);
  background: var(--warn-bg);
}

.stat-pill-num {
  display: block;
  font-family: var(--f-head);
  font-size: 1.68rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink);
}

.stat-pill.low .stat-pill-num { color: var(--warn); }

.stat-pill-label {
  display: block;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Global search bar ────────────────────── */
.global-search-wrap {
  position: sticky;
  top: 66px;
  z-index: 25;
  background: var(--bg-deep);
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--hairline);
}

/* ── Search + filters ─────────────────────── */
.search-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  color: var(--ink);
  margin-bottom: 12px;
  font-size: .95rem;
}
.search-input::placeholder { color: var(--muted-2); }
.search-input:focus {
  outline: none;
  border-color: var(--copper-deep);
}

.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-row select {
  flex: 1;
  min-width: 0;
  min-height: var(--tap-min);
  padding: 12px 36px 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239195a1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px 6px;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.filter-row select:focus { outline: none; border-color: var(--copper-deep); }

/* ── Product cards ────────────────────────── */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  border-radius: var(--r-lg);
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  overflow: hidden;
}

.product-card.low-stock {
  border-color: var(--danger);
  border-width: 2px;
}

.product-row {
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.product-info-text { min-width: 0; flex: 1; }

.product-thumb,
.product-thumb-placeholder {
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

/* contain, not cover: packshots are tall and cover crops the label off */
.product-thumb {
  object-fit: contain;
  background: #fff;
  padding: 3px;
}

.product-thumb-placeholder {
  background: var(--glass-hi);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}

.product-category {
  display: block;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--copper-lite);
  opacity: .9;
  margin-bottom: 3px;
}

.product-name {
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 3px;
}

/* Stock +/- controls */
.stock-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.stock-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--glass-2);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.stock-btn.minus { color: var(--danger); }
.stock-btn.plus  { color: var(--copper-lite); }
.stock-btn:active { background: var(--glass-hi); }

.stock-count {
  min-width: 32px;
  text-align: center;
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
}

.stock-count-edit {
  width: 52px;
  background: var(--glass-hi);
  border: 1.5px solid var(--copper);
  border-radius: 6px;
  padding: 2px 4px;
  outline: none;
}

.expand-chevron {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* Expanded detail panel */
.product-details {
  border-top: 1px solid var(--hairline);
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.product-details[hidden] { display: none; }

.detail-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.detail-label {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-value {
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink);
}

.ce-val {
  display: inline-block;
  min-width: 20px;
  outline: none;
  cursor: text;
  border-bottom: 1.5px solid transparent;
  transition: border-color .15s;
  padding-bottom: 1px;
}
.ce-val:hover     { border-bottom-color: var(--glass-hi); }
.ce-val.ce-active { border-bottom-color: var(--copper); }

.ce-select {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--glass-hi);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.ce-select:focus { border-bottom-color: var(--copper); }

/* Inline edit inputs inside grid value cells — underline only, no layout shift */
.iep-inp {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--copper);
  border-radius: 0;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
  padding: 1px 0;
}
.iep-inp:focus { outline: none; }



.detail-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.icon-action {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--glass-2);
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
}
.icon-action.danger { color: var(--danger); border-color: rgba(226,104,95,.4); }
.icon-action:active { background: var(--glass-hi); }

/* ── Profile ──────────────────────────────── */
.profile-store-name-row {
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 18px;
}
.profile-store-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.profile-store-field {
  display: flex;
  gap: 10px;
}
.profile-store-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--bg-deep);
  color: var(--ink);
  font-size: .95rem;
}
.profile-store-input:focus { outline: none; border-color: var(--copper-deep); }
.profile-store-save { flex-shrink: 0; }
.profile-store-hint {
  margin: 8px 0 0;
  font-size: .76rem;
  color: var(--muted-2);
}

.profile-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-box {
  border-radius: var(--r-lg);
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  padding: 17px 8px;
  text-align: center;
}

.stat-num {
  display: block;
  font-family: var(--f-head);
  font-size: 1.68rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink);
}

.stat-label {
  display: block;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Buttons ──────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger {
  min-height: var(--tap-min);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .9rem;
  padding: 0 18px;
  cursor: pointer;
}

.btn-primary {
  background: var(--copper);
  color: #1a1206;
  border-color: var(--copper);
}
.btn-primary:active { background: var(--copper-deep); }

.btn-secondary {
  background: var(--glass-1);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn-secondary:active { background: var(--glass-2); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(226,104,95,.45);
}
.btn-danger:active { background: rgba(226,104,95,.12); }

.full { width: 100%; margin-bottom: 10px; }

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Floating action button ───────────────── */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tab-h) + 16px);
  z-index: 40;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--copper);
  color: #1a1206;
  font-size: 1.9rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 26px var(--copper-glow);
}
.fab:active { background: var(--copper-deep); }
.fab[hidden] { display: none; }

/* ── Tab bar ──────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tab-h);
  z-index: 30;
  display: flex;
  align-items: flex-start;
  padding-top: 12px;
  background: var(--bg-mid);
  border-top: 1px solid var(--hairline);
}

.tab-btn {
  flex: 1;
  border: 1px solid transparent;
  background: none;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  min-height: var(--tap-min);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--muted-2);
  cursor: pointer;
  position: relative;
}

.tab-btn.pending-alert,
.tab-btn.active.pending-alert { color: var(--danger); }
.tab-btn.stock-alert,
.tab-btn.active.stock-alert   { color: var(--danger); }

.tab-btn.active {
  color: var(--copper-lite);
  background: rgba(217,138,94,.10);
  border-color: rgba(217,138,94,.28);
}

.tab-btn.shop-tab-link {
  text-decoration: none;
}

.tab-spacer { display: none; }

/* ── Modals ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,13,.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.modal-overlay[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-mid);
  border-top: 1px solid var(--hairline-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 26px 20px calc(20px + env(safe-area-inset-bottom));
}

.modal h2 {
  font-family: var(--f-head);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  margin-bottom: 20px;
}

.modal h3 {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
}

.modal label {
  display: block;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.modal label input,
.modal label select {
  display: block;
  width: 100%;
  margin-top: 7px;
  min-height: var(--tap-min);
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.modal label select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239195a1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px 6px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.modal label input:focus,
.modal label select:focus {
  outline: none;
  border-color: var(--copper-deep);
}

.modal label input::placeholder { color: var(--muted-2); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.modal-actions button { flex: 1; }

/* Scan / AI capture */
.scan-block {
  margin-bottom: 10px;
}

.photo-thumb-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--glass-1);
}
.photo-thumb-preview img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
#photoPreviewLabel {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ok);
}

.scan-status {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}
.scan-status.done { color: var(--ok); }

/* Label scan preview panel */
.label-text-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  background: var(--glass-hi);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: .9rem;
  padding: 10px 12px;
  resize: vertical;
  margin-bottom: 8px;
  font-family: inherit;
}
.label-text-input:focus {
  outline: none;
  border-color: var(--copper);
}

.label-preview {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--copper-deep);
  background: var(--glass-1);
}
.label-preview-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 10px;
}
.label-preview-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.lp-row {
  display: flex;
  gap: 8px;
  font-size: .88rem;
}
.lp-key {
  font-weight: 600;
  color: var(--muted);
  min-width: 80px;
  flex-shrink: 0;
}
.lp-val {
  font-weight: 600;
  color: var(--ink);
}
.label-preview-actions {
  display: flex;
  gap: 8px;
}
.label-preview-actions .btn-primary { flex: 1; }

/* ── Print card ───────────────────────────── */
.print-card-landscape {
  background: #fff;
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

#pcQr canvas, #pcQr img {
  display: block;
  width:  104px !important;
  height: 104px !important;
}

.pc-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pc-sku {
  font-family: var(--f-head);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: #111;
}

.pc-name {
  font-size: .88rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  margin-top: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pc-price {
  font-family: var(--f-head);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #111;
  margin-top: 6px;
}

.pc-unit {
  font-size: .72rem;
  font-weight: 600;
  color: #888;
  margin-top: 2px;
}

/* ── Mini shelf card (expanded product panel) */
.mini-shelf-card {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid #ccc;
  background: #fff;
  margin-bottom: 4px;
  width: fit-content;
}

.ms-qr canvas,
.ms-qr img {
  display: block;
  width: 52px !important;
  height: 52px !important;
  border-radius: 4px;
}

.ms-qr-fallback {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: #eee;
  display: grid;
  place-items: center;
  font-size: .6rem;
  color: #888;
}

/* ── Inline edit toggle ───────────────────── */
.product-details .fe  { display: none; }
.product-details .eo  { display: none; }
.product-details.editing .fv { display: none; }
.product-details.editing .fe { display: block; }
.product-details.editing .vo { display: none !important; }
.product-details.editing .eo { display: inline-flex; }

/* Copper underline on editable value cells in edit mode — nothing else changes */
.product-details.editing .dv-edit {
  border-bottom: 1.5px solid var(--copper);
  padding-bottom: 2px;
}

/* Inline inputs — match the text they replace, no box */
.iep-inp {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
  padding: 0;
  margin: 0;
  line-height: 1.4;
}
.iep-inp:focus { outline: none; }
select.iep-inp { cursor: pointer; }

/* Full-width children in the detail-fields grid */
.df-full { grid-column: 1 / -1; }

/* Photo edit row */
.photo-edit-row {
  align-items: center;
  gap: 12px;
}
.photo-edit-preview img,
.pep-placeholder {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.pep-placeholder {
  display: grid;
  place-items: center;
  background: var(--glass-hi);
  font-size: 1.6rem;
}
.photo-change-btn {
  background: var(--glass-hi);
  border: 1px solid var(--hairline);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.photo-change-btn:hover { background: var(--glass-2); }

/* Mini-card inline inputs (unused — mini card is now static) */
.ms-inp {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #bbb;
  border-radius: 0;
  color: #111;
  padding: 1px 0;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}
.ms-inp:focus {
  outline: none;
  border-bottom-color: #e07000;
}

/* ── Inline edit fields ───────────────────── */

.detail-input:focus {
  outline: none;
}

.detail-actions .btn-secondary,
.detail-actions .btn-primary {
  flex: 1;
}

.ms-info {
  flex: 1;
  min-width: 0;
}

.ms-sku {
  font-family: var(--f-head);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: #111;
}

.ms-name {
  font-size: .75rem;
  font-weight: 700;
  color: #111;
  margin-top: 2px;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ms-price {
  font-family: var(--f-head);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: #111;
  margin-top: 2px;
}

.ms-unit {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .5px;
  color: #888;
  margin-top: 2px;
  text-transform: uppercase;
}

/* ── Sales History ────────────────────────── */
.period-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.period-chip {
  flex: 1;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
}

.period-chip.active {
  background: var(--copper);
  color: #1a1206;
  border-color: var(--copper);
}

/* ── Stats panel (expandable) ────────────── */
.stats-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.stats-panel.expanded {
  max-height: 600px;
  border: 1px solid var(--copper-deep);
  border-radius: var(--r-lg);
  padding: 14px;
  margin-bottom: 12px;
}
.stats-toggle-btn {
  display: block;
  width: 100%;
  padding: 8px 14px;
  margin-bottom: 0;
  border-radius: var(--r-md);
  border: 1px solid var(--copper-deep);
  background: transparent;
  color: var(--copper);
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  letter-spacing: .02em;
  transition: background .12s, color .12s;
}
.stats-toggle-btn:hover { background: rgba(217,138,94,.1); }
.stats-toggle-btn.open  { background: rgba(217,138,94,.12); }

/* ── Hourly heatmap ──────────────────────── */
.heatmap-block {
  margin-bottom: 10px;
}
.heatmap-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.heatmap-bars {
  display: flex;
  gap: 2px;
}
.heatmap-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.heatmap-bar-wrap {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: flex-end;
}
.heatmap-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--copper-deep);
  opacity: .45;
}
.heatmap-bar.peak    { background: var(--copper); opacity: 1; }
.heatmap-bar.empty   { background: var(--glass-2); opacity: 1; }
.heatmap-lbl {
  font-size: .46rem;
  font-weight: 600;
  color: var(--muted-2);
  height: 10px;
  line-height: 10px;
  white-space: nowrap;
}

/* ── Cash flow block ─────────────────────── */
.cash-flow-block {
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--copper-deep);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.cash-flow-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 8px;
}
.cash-flow-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--hairline);
}
.cash-flow-row:last-child { border-bottom: none; }
.cash-flow-row-change { opacity: .7; }
.cash-flow-label {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
}
.cash-flow-value {
  font-family: var(--f-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Favourites panel ─────────────────────── */
.fav-panel {
  margin-bottom: 16px;
}
.fav-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--copper-deep);
  background: transparent;
  color: var(--copper);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .02em;
  margin-bottom: 10px;
  transition: background .12s;
}
.fav-toggle-btn:hover { background: rgba(217,138,94,.08); }
.fav-toggle-btn.open  { background: rgba(217,138,94,.14); }
.fav-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.fav-chips::-webkit-scrollbar { display: none; }
.fav-chips[hidden] { display: none; }
.fav-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 5px 12px 5px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fav-rank {
  font-size: .65rem;
  font-weight: 700;
  color: var(--muted-2);
}
.fav-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
}
.fav-qty {
  font-size: .72rem;
  font-weight: 700;
  color: var(--copper);
}

.sales-search-row {
  margin-bottom: 14px;
}
.sales-search-row .search-input {
  margin-bottom: 0;
}

.sales-sort-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.sales-sort-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted-2);
  flex-shrink: 0;
  margin-right: 2px;
}
.sales-sort-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--glass-1);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.sales-sort-btn:hover { background: var(--glass-2); color: var(--ink); }
.sales-sort-btn.active { background: var(--copper-deep); border-color: var(--copper-deep); color: #fff; }

.sale-gap-marker {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--danger);
  padding: 4px 0;
  opacity: .75;
}

.sales-list {
  display: flex;
  flex-direction: column;
}

.sales-date-group {
  margin-bottom: 4px;
}

.sales-date-label {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0 2px;
}

.sale-card {
  border-radius: var(--r-lg);
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  margin-bottom: 10px;
  overflow: hidden;
}

.sale-card-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  cursor: pointer;
}

.sale-card-summary:active { background: var(--glass-2); }

.sale-card-detail {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--hairline);
}

.sale-card-left { flex: 1; min-width: 0; }

.sale-order-tag {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--copper-lite);
  margin-bottom: 3px;
  text-transform: uppercase;
}

.sale-item-count {
  font-family: var(--f-head);
  font-weight: 700;
  font-size: .92rem;
  color: var(--ink);
}

.sale-items-preview {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sale-time-tag {
  font-size: .72rem;
  color: var(--muted-2);
  margin-top: 4px;
}

/* ── Cancelled sale cards ─────────────────── */
.sale-card-cancelled {
  border-color: rgba(226,104,95,.35);
  background: rgba(226,104,95,.04);
  border-left: 3px solid var(--danger);
}

.sale-cancelled-tag {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--danger);
  margin-bottom: 3px;
}

.sale-cancelled-note {
  font-size: .72rem;
  font-weight: 600;
  color: var(--danger);
  opacity: .6;
  flex-shrink: 0;
}

.sale-print-icon-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s;
}
.sale-print-icon-btn:hover { opacity: 1; }

.sale-total-pill {
  font-family: var(--f-head);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--copper-lite);
  flex-shrink: 0;
}

.sale-chevron {
  color: var(--muted-2);
  font-size: .85rem;
  flex-shrink: 0;
}

/* Sale detail modal content */
.sale-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sale-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--glass-1);
  border: 1px solid var(--hairline);
  gap: 10px;
}

.sale-line-name {
  flex: 1;
  font-weight: 600;
  font-size: .9rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sale-line-qty {
  font-size: .8rem;
  color: var(--muted);
  flex-shrink: 0;
}

.sale-line-price {
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink);
  flex-shrink: 0;
}

.sale-detail-totals {
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
}

.sale-total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-weight: 700;
  font-size: .95rem;
}

.sale-total-row.muted {
  font-weight: 500;
  font-size: .85rem;
  color: var(--muted);
}

/* Receipt mode toggle */
#printOverlay .print-receipt-view { display: none; }
#printOverlay.receipt-mode .print-shelf-view { display: none; }
#printOverlay.receipt-mode .print-receipt-view { display: block; }

/* Receipt preview card */
.receipt {
  background: #fff;
  color: #111;
  border-radius: 8px;
  padding: 18px 16px 14px;
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  line-height: 1.4;
}
.rct-header { text-align: center; margin-bottom: 10px; }
.rct-store { font-weight: 700; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; }
.rct-date { font-size: .75rem; color: #666; margin-top: 3px; }
.rct-sep { border: none; border-top: 1px dashed #bbb; margin: 10px 0; }
.rct-lines { display: flex; flex-direction: column; gap: 4px; }
.rct-line { display: flex; align-items: baseline; gap: 6px; }
.rct-name { flex: 1; }
.rct-qty { color: #666; flex-shrink: 0; font-size: .75rem; }
.rct-price { font-weight: 600; flex-shrink: 0; min-width: 50px; text-align: right; }
.rct-totals { display: flex; flex-direction: column; gap: 3px; }
.rct-total-row { display: flex; justify-content: space-between; }
.rct-total-row.total { font-weight: 700; font-size: .9rem; }
.rct-total-row.muted { color: #666; }
.rct-footer { text-align: center; margin-top: 12px; font-size: .75rem; color: #999; letter-spacing: .04em; }


@media print {
  body > *:not(#printOverlay) { display: none !important; }
  #printOverlay {
    display: block !important;
    position: static !important;
    background: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  #printOverlay .modal {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 20px !important;
    max-height: none !important;
    overflow: visible !important;
  }
  #printOverlay .modal h2,
  #printOverlay .modal-actions { display: none !important; }
  /* Shelf card print */
  .print-card-landscape {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid #ccc;
    border-radius: 8px;
  }
  /* Receipt print */
  #printOverlay.receipt-mode .print-shelf-view { display: none !important; }
  #printOverlay:not(.receipt-mode) .print-receipt-view { display: none !important; }

  .receipt {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #fff !important;
    color: #111 !important;
    border-radius: 0;
    padding: 0;
  }
}

/* ── Restock list ──────────────────────────── */
.restock-list-btn {
  display: block;
  width: 100%;
  margin: 10px 0 4px;
  padding: 11px 16px;
  background: none;
  border: 1.5px solid var(--copper);
  border-radius: 10px;
  color: var(--copper);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  letter-spacing: .02em;
}
.restock-list-btn:active { background: var(--copper-glow); }
.restock-subtitle {
  font-size: .8rem;
  color: var(--muted);
  margin: -6px 0 14px;
}
.restock-items { display: flex; flex-direction: column; gap: 10px; }
.restock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 10px;
  border-left: 3px solid var(--copper);
}
.restock-item-name { font-size: .9rem; font-weight: 600; color: var(--text); }
.restock-item-stock { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.restock-item-badge {
  font-size: .75rem;
  font-weight: 700;
  color: var(--copper);
  background: var(--copper-glow);
  padding: 4px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
