:root {
  --bg: #edf1f5;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-solid: #ffffff;
  --panel-muted: #f5f7fb;
  --sidebar: #1b1d22;
  --sidebar-soft: #2b2f37;
  --border: rgba(16, 24, 40, 0.08);
  --text: #1d2430;
  --muted: #667085;
  --brand: #1a73e8;
  --brand-soft: #eaf2ff;
  --green: #1f9d61;
  --green-soft: #eafaf1;
  --amber: #e1901d;
  --amber-soft: #fff2db;
  --red: #d94b54;
  --red-soft: #fdebea;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", "SF Pro Display", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f5f7fb 0%, #eef3f7 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
  padding: 20px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1500px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 18px;
  min-height: calc(100vh - 40px);
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, #171b22 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: 0 18px 40px rgba(13, 18, 25, 0.2);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15);
  background: #f2e6d1;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-name {
  color: #f3f7ff;
  font-weight: 700;
  font-size: 14px;
}

.brand-subtitle {
  color: rgba(255,255,255,0.6);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.8);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.06);
}

.sidebar-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px 14px;
}

.mini-label {
  color: rgba(255,255,255,0.58);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  margin-bottom: 10px;
}

.store-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  font-weight: 700;
}

.status-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}

.status-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dot.green { background: #40d494; }
.dot.gold { background: #f0b64d; }
.dot.blue { background: #68a8ff; }

.main-panel {
  background: rgba(255,255,255,0.18);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 22px 24px 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 2vw, 38px);
  letter-spacing: -0.05em;
}

h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toolbar-select select {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  min-width: 130px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
}
.primary-btn:disabled,
.secondary-btn:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }   /* a disabled button must not look tappable */

.primary-btn {
  background: linear-gradient(135deg, #1a73e8, #5ba1ff);
  color: white;
  box-shadow: 0 10px 22px rgba(26, 115, 232, 0.2);
}

.secondary-btn {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  color: var(--text);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.03);
}

.kpi-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.kpi-badge {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.kpi-value {
  font-size: clamp(26px, 2vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.06em;
  margin-bottom: 8px;
}

.kpi-change {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }

.panel-grid {
  display: grid;
  gap: 18px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px 18px 16px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

.rank-list,
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-row {
  display: grid;
  grid-template-columns: 28px 1fr 92px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-index {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  font-size: 12px;
}

.product-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.product-topline strong {
  font-size: 14px;
}

.bar-track {
  width: 100%;
  height: 10px;
  background: var(--panel-muted);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b9cff, #1a73e8);
}

.val-badge {
  text-align: right;
  font-weight: 800;
  color: var(--text);
}

.upload-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.upload-box {
  min-height: 200px;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 1.5px dashed rgba(26, 115, 232, 0.25);
  background: linear-gradient(180deg, rgba(26,115,232,0.04), rgba(255,255,255,0.4));
  border-radius: 18px;
  min-height: 130px;
  color: var(--muted);
  text-align: center;
  padding: 18px;
  transition: all 0.2s ease;
}

.dropzone:hover {
  border-color: rgba(26,115,232,0.5);
  background: linear-gradient(180deg, rgba(26,115,232,0.06), rgba(255,255,255,0.6));
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone strong {
  color: var(--brand);
  font-size: 14px;
}

.file-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.table-panel {
  margin-top: 10px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.4);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  background: rgba(245,247,251,0.8);
}

tbody tr:hover {
  background: rgba(26,115,232,0.02);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill.good { background: var(--green-soft); color: var(--green); }
.status-pill.watch { background: var(--amber-soft); color: var(--amber); }
.status-pill.low { background: var(--red-soft); color: var(--red); }

.stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stack-row:last-child {
  border-bottom: none;
}

.stack-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.stack-name {
  font-weight: 700;
}

.stack-value {
  font-weight: 800;
  color: var(--text);
}




/* smart import */
.upload-box { display: flex; flex-direction: column; gap: 12px; height: auto; }
.upload-box .dropzone { flex: 0 0 auto; width: 100%; box-sizing: border-box; min-height: 130px; }
.camera-btn { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 auto; width: 100%; box-sizing: border-box; margin: 0; cursor: pointer; text-align: center; }
.upload-box .file-meta { margin-top: 0; }
.import-review { margin-bottom: 18px; }
.import-note { background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 6px 0 12px; }
.import-controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: end; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.import-controls select { display: block; margin-top: 4px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-solid); }
.import-check { display: flex; gap: 6px; align-items: center; }
.import-scroll { max-height: 420px; overflow: auto; }
.import-code { width: 140px; }
.import-qty { width: 70px; }
.import-code, .import-qty { padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; }
.import-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* spacing fix: keep the camera button clear of the drop area */
.upload-box .dropzone { margin-bottom: 18px; }
.upload-box .camera-btn { margin-top: 18px; margin-bottom: 6px; clear: both; }
.upload-box .file-meta { margin-top: 10px; }


/* search */
#inventory > .panel, #inventory > .panel-grid { margin-bottom: 18px; }
.search-row { display: flex; gap: 10px; margin-bottom: 10px; }
.search-row input { flex: 1; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 15px; background: var(--panel-solid); }
.search-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.search-tools .camera-btn { width: auto; margin: 0; }
.result-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--panel-solid); }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 16px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.result-grid span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.result-grid b { font-size: 14px; font-weight: 600; word-break: break-word; }
.result-grid .hl b { color: var(--brand); }
.scan-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 50; }
.scan-overlay[hidden] { display: none; }
.scan-box { background: #111; border-radius: 18px; padding: 14px; width: min(92vw, 560px); text-align: center; color: #fff; }
.scan-box video { width: 100%; border-radius: 12px; background: #000; }
.scan-hint { margin: 10px 0; font-size: 14px; }

/* editing */
.link-btn { background: none; border: none; color: var(--brand); font-weight: 700; cursor: pointer; padding: 4px 6px; }
.result-actions { display: flex; align-items: center; gap: 10px; }
.result-actions .secondary-btn { padding: 6px 12px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-box { background: #fff; border-radius: 18px; padding: 22px; width: min(94vw, 640px); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-box h3 { margin: 0 0 4px; }
.modal-sub { color: var(--muted); margin: 0 0 14px; font-size: 13px; }
.modal-box > input { width: 100%; box-sizing: border-box; padding: 11px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; }
.modal-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0; }
.modal-note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.edit-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.edit-grid input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); }

.danger-btn { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }

/* layout stability: sidebar keeps its size, only the main panel flexes */
.app-shell { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.sidebar { position: sticky; top: 20px; align-self: start; height: calc(100vh - 40px); overflow-y: auto; box-sizing: border-box; }
.main-panel { min-width: 0; box-sizing: border-box; }
.main-panel .panel, .main-panel .panel-grid, .main-panel .table-scroll { min-width: 0; max-width: 100%; }
.table-scroll { overflow-x: auto; }
.topbar { flex-wrap: wrap; gap: 12px; }
.toolbar { flex-wrap: wrap; }
/* fixed layout: sidebar always on the left, same arrangement at every window size.
   Below the minimum width the page scrolls sideways instead of re-arranging. */
body { min-width: 1080px; }
.app-shell { min-width: 1040px; }
.kpi-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.topbar { flex-wrap: nowrap; }
.toolbar { flex-wrap: nowrap; flex-shrink: 0; }

/* inventory list: rank + pager */
.rank-pill { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.rank-A { background: var(--green-soft); color: var(--green); }
.rank-B { background: var(--brand-soft); color: var(--brand); }
.rank-C { background: var(--amber-soft); color: var(--amber); }
.rank-D { background: var(--red-soft); color: var(--red); }
.inv-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.inv-filter { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.inv-filter select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; }

.cat-row td { background: var(--brand-soft); color: var(--brand); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; font-size: 12px; padding: 8px 14px; }
.cat-row td span { color: var(--muted); font-weight: 600; margin-left: 8px; text-transform: none; }

.days-pill { display: inline-block; min-width: 34px; text-align: center; padding: 3px 9px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.days-low { background: var(--red-soft); color: var(--red); }
.days-watch { background: var(--amber-soft); color: var(--amber); }
.days-good { background: var(--green-soft); color: var(--green); }
.days-none { background: var(--panel-muted); color: var(--muted); font-weight: 600; font-size: 12px; }

/* team chat */
.chat-widget { position: fixed; left: 20px; bottom: 20px; z-index: 40; }   /* bottom-left: the right corner is covered by Netlify's badge */
.chat-fab { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 24px; box-shadow: var(--shadow); position: relative; }
.chat-badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.chat-badge[hidden], .chat-panel[hidden], .chat-name[hidden], .chat-form[hidden] { display: none; }
.chat-panel { position: absolute; left: 0; bottom: 68px; width: 340px; height: 460px; max-height: 70vh; background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(15,23,42,.25); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--sidebar); color: #fff; }
.chat-head strong { flex: 1; }
.chat-head button { background: none; border: none; color: #fff; font-size: 16px; }
.chat-state { font-size: 11px; }
.chat-state.on { color: #5fd49a; } .chat-state.off { color: #ff8a8f; }
.chat-name { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.chat-name input, .chat-form input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; min-width: 0; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-muted); }
.chat-msg { max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.chat-bubble { display: inline-block; text-align: left; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; font-size: 14px; word-break: break-word; white-space: pre-wrap; }
.chat-msg.mine .chat-bubble { background: var(--brand); color: #fff; border-color: var(--brand); }
.chat-empty { color: var(--muted); text-align: center; margin-top: 30px; font-size: 13px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-form .primary-btn { padding: 9px 14px; }

/* cloud / PWA additions */
.nav-badge { background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; margin-left: 6px; }
.nav-badge[hidden] { display: none; }
.settings-btn { white-space: nowrap; }
#toastHost { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; pointer-events: none; }
.toast { background: #1b1d22; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.error { background: var(--red); }
#offlineBanner { background: var(--amber-soft); color: var(--amber); text-align: center; padding: 8px; font-size: 13px; font-weight: 600; position: sticky; top: 0; z-index: 70; }
.change-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel-solid); }
.change-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 6px; }
.change-head span { color: var(--muted); }
.change-head time { margin-left: auto; font-size: 12px; color: var(--muted); }
.change-card ul { margin: 0; padding-left: 18px; font-size: 13px; }
.set-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.set-label input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.modal-actions.left { justify-content: flex-start; flex-wrap: wrap; }
.modal-box hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
/* Google Drive is the single source of truth: local-only reset/undo controls are hidden */
body.cloud-mode #resetChangesBtn, body.cloud-mode #efReset { display: none; }

/* iPhone / phone layout (desktop keeps the fixed layout above) */
@media (pointer: coarse) and (max-width: 1000px) {
  body { min-width: 0; padding: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .app-shell { min-width: 0; grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 100vh; }
  .main-panel { border-radius: 0; border: none; padding: 14px 12px; padding-top: calc(14px + env(safe-area-inset-top)); }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 55; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; gap: 0; overflow: visible; }
  .brand-row, .sidebar-card { display: none; }
  .nav-list { display: flex; width: 100%; gap: 2px; }
  .nav-item { flex: 1; font-size: 10px; line-height: 1.15; padding: 9px 2px; text-align: center; white-space: normal; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar h1 { font-size: 24px; }
  .toolbar { flex-wrap: wrap; width: 100%; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .upload-grid { grid-template-columns: minmax(0, 1fr); }
  .search-row { flex-wrap: wrap; }
  .chat-widget { bottom: calc(86px + env(safe-area-inset-bottom)); left: 12px; }
  .chat-panel { width: calc(100vw - 24px); left: -4px; }
  .modal-box { padding: 16px; }
  /* long forms (Edit item): the buttons stay on screen while the boxes scroll */
  .modal-box > .modal-actions { position: sticky; bottom: -16px; margin: 12px -16px -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; background: #fff; border-top: 1px solid var(--border); z-index: 3; }
  .modal-box > .modal-actions > button { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
  .edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll { -webkit-overflow-scrolling: touch; }
  /* nothing may be wider than the screen, otherwise iOS zooms the whole page out */
  html, body { overflow-x: hidden; max-width: 100vw; }
  .main-panel, .main-panel > section, .panel, .panel-grid { max-width: 100%; min-width: 0; box-sizing: border-box; }
  .panel-header { flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; }
  .panel-header > div:first-child { flex: 1 1 100%; min-width: 0; }
  .panel-header h2 { font-size: 18px; }
  .inv-filter { flex: 0 0 auto; }
  .panel-header .secondary-btn, .panel-header .primary-btn { padding: 8px 12px; font-size: 13px; }
        .import-code { width: 110px; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card, .rank-row { min-width: 0; }
  table { font-size: 13px; }
}

/* iOS: keep text size identical when the phone is rotated */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ---------------------------------------------------------------- login gate + admin dashboard */
.nav-item[hidden] { display: none !important; }
body.gated .app-shell { visibility: hidden; }
#loginGate { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: #f4f1ea; padding: 20px; overflow-y: auto; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card input { font-size: 16px; padding: 12px 14px; border: 1px solid #d8d3c8; border-radius: 12px; width: 100%; box-sizing: border-box; }
.login-card h1 { margin: 0; font-size: 26px; }
.login-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; margin: 0 auto; }
.login-sub, .login-note { margin: 0; color: #6b6b6b; font-size: 14px; }
.login-note { text-align: left; line-height: 1.45; }
.login-error { min-height: 18px; color: #c0392b; font-size: 13px; }
.link-btn { background: none; border: 0; color: #6b6b6b; font-size: 13px; text-decoration: underline; cursor: pointer; }
.user-chip { font-size: 13px; padding: 8px 12px; border-radius: 999px; background: #efe9dc; white-space: nowrap; }
.admin-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-kpis .kpi-card span { display: block; font-size: 13px; color: #6b6b6b; }
.admin-kpis .kpi-card strong { font-size: 28px; }
#admin .panel { margin-bottom: 16px; }
#admin .table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee8da; vertical-align: top; }
.admin-table tr.bad td { background: #fdecea; }
.role-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #e8e3d6; text-transform: capitalize; }
.role-pill.admin { background: #1b1d22; color: #fff; }
.role-pill.transport { background: var(--t-amber, #ffd08a); color: #17151f; }
.kick-btn { padding: 4px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- phone: slide-in menu (replaces the bottom bar) */
.menu-btn, .menu-backdrop { display: none; }
.scan-overlay { z-index: 9000; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.scan-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.scan-actions button { flex: 1 1 auto; }
@media (pointer: coarse) and (max-width: 1000px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  .main-panel { padding-top: calc(60px + env(safe-area-inset-top)); }
  .menu-btn { display: flex; flex-direction: column; justify-content: center; gap: 5px; position: fixed; z-index: 70; top: calc(10px + env(safe-area-inset-top)); left: 10px; width: 44px; height: 44px; padding: 0 11px; box-sizing: border-box; border: 0; border-radius: 12px; background: var(--sidebar); cursor: pointer; }
  .menu-btn span { display: block; height: 3px; border-radius: 2px; background: #fff; }
  .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; right: auto; width: min(280px, 82vw); height: 100%; z-index: 90; flex-direction: column; align-items: stretch; gap: 16px; padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)); border-radius: 0 20px 20px 0; overflow-y: auto; transform: translateX(-105%); transition: transform .28s ease; box-shadow: none; }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.35); }
  body.menu-open { overflow: hidden; }
  .brand-row, .sidebar-card { display: flex; }
  .sidebar-card { display: block; }
  .nav-list { flex-direction: column; gap: 4px; }
  .nav-item { flex: none; font-size: 16px; padding: 13px 14px; text-align: left; white-space: nowrap; }
  .chat-widget { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- AI assistant tab inside the chat panel */
.chat-tabs { display: flex; gap: 4px; padding: 6px 8px 0; background: var(--sidebar); }
.chat-tabs button { flex: 1; padding: 8px; border: 0; border-radius: 10px 10px 0 0; background: rgba(255,255,255,.08); color: #cfd3da; font-size: 13px; cursor: pointer; }
.chat-tabs button.on { background: #fff; color: #1b1d22; font-weight: 600; }
.ai-view { display: none; flex-direction: column; flex: 1; min-height: 0; }
.chat-panel.ai-mode .ai-view { display: flex; }
.chat-panel.ai-mode .chat-list, .chat-panel.ai-mode .chat-form, .chat-panel.ai-mode .chat-name { display: none !important; }
.ai-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.ai-msg.bot { background: #f0ede4; align-self: flex-start; }
.ai-msg.me { background: #1b6ef3; color: #fff; align-self: flex-end; }
.ai-card { background: #fff; border: 2px solid #1b6ef3; max-width: 100%; width: 100%; box-sizing: border-box; }
.ai-card.done { opacity: .55; border-color: #ccc; }
.ai-card-title { font-weight: 700; margin-bottom: 8px; }
.ai-act { padding: 6px 0; border-bottom: 1px solid #eee8da; }
.ai-act select { width: 100%; padding: 8px; font-size: 14px; border-radius: 8px; }
.ai-bad { color: #c0392b; }
.ai-change { background: none; border: 0; color: #1b6ef3; text-decoration: underline; cursor: pointer; font-size: 12px; }
.ai-buttons { display: flex; gap: 8px; margin-top: 10px; }
.ai-buttons button { flex: 1; }
.ai-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #eee8da; }
.ai-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #d8d3c8; border-radius: 12px; font-size: 16px; }
.ai-mic { width: 44px; border: 0; border-radius: 12px; background: #efe9dc; font-size: 18px; cursor: pointer; }
.ai-mic.on { background: #e74c3c; animation: aipulse 1s infinite; }
@keyframes aipulse { 50% { opacity: .55; } }

#productPerformance > .panel-grid { margin-bottom: 18px; }
.dash-top .panel { min-height: 140px; }

.store-sales { display: grid; gap: 2px; }
.store-sales-row { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px solid var(--border); font-size: 14px; }
.store-sales-row:last-child { border-bottom: 0; }
.store-sales-row.total { margin-top: 4px; font-size: 15px; }
.sample-tag { font-size: 11px; font-style: normal; color: var(--amber); background: var(--amber-soft); border-radius: 8px; padding: 1px 6px; margin-left: 4px; }
.store-open { display: flex; gap: 10px; align-items: center; color: var(--muted, #64748b); font-size: 13px; }
.store-open { white-space: nowrap; }

.transfer-route { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin: 10px 0; background: rgba(255,255,255,0.6); }
.transfer-route > summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; cursor: pointer; font-size: 15px; }
.transfer-route > summary .status-pill { margin-left: auto; }
.transfer-actions { display: flex; gap: 12px; align-items: center; margin-top: 10px; }

.move-qty { display: inline-block; min-width: 38px; padding: 4px 10px; border-radius: 8px; background: #e6f4ee; color: #0b5b3d; font-size: 18px; font-weight: 700; text-align: center; }

/* Fixing Inventory */
.audit-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.audit-tabs button { border: 1px solid var(--line, #d9dee3); background: #fff; border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.audit-tabs button.active { background: #1a1d21; color: #fff; border-color: #1a1d21; }
.audit-tabs .audit-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; background: #c9ced3; }
.audit-tabs .audit-dot.pending { background: #f2a93b; } .audit-tabs .audit-dot.approved { background: #2f9e6b; } .audit-tabs .audit-dot.rejected { background: #d6453d; }
.audit-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: #f3f5f7; margin: 6px 0 14px; }
.audit-banner.pending { background: #fdf3df; } .audit-banner.approved { background: #e6f4ee; } .audit-banner.rejected { background: #fbe9e7; }
.audit-summary { max-width: 560px; margin-bottom: 14px; }
.audit-summary td:nth-child(2), .audit-summary td:nth-child(3), .audit-summary th:nth-child(2), .audit-summary th:nth-child(3) { text-align: right; }
.audit-code { display: inline-block; margin: 0 4px 2px 0; padding: 2px 8px; border-radius: 999px; background: #eceff2; font-size: 12px; font-weight: 600; white-space: nowrap; }
.audit-code.NEG, .audit-code.LOSS, .audit-code.NOPRICE, .audit-code.NOCOST { background: #fbe9e7; color: #a3302a; }
.audit-code.DEAD, .audit-code.OVER { background: #fdf3df; color: #8a5a00; }
.audit-table input[type="number"] { width: 80px; padding: 6px 8px; font: inherit; border: 1px solid #d9dee3; border-radius: 8px; }
.audit-table input[type="text"] { width: 170px; padding: 6px 8px; font: inherit; border: 1px solid #d9dee3; border-radius: 8px; }
.audit-table select { max-width: 190px; padding: 6px 8px; font: inherit; border: 1px solid #d9dee3; border-radius: 8px; background: #fff; }
.audit-table select:disabled, .audit-table input:disabled { background: #f3f5f7; color: #6b7480; }
.audit-neg { color: #a3302a; font-weight: 700; }
.audit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.audit-table th, .audit-table td { padding: 8px 8px; vertical-align: middle; }
.audit-table td:nth-child(2) { min-width: 150px; }
.audit-table input[type="text"] { width: 140px; }

.audit-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 12px 0; }
.audit-type { text-align: left; border: 1px solid #d9dee3; background: #fff; border-radius: 12px; padding: 10px 12px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.audit-type span { font-size: 12px; color: #6b7480; }
.audit-type.active { border-color: #1a1d21; box-shadow: 0 0 0 2px #1a1d21 inset; }
.audit-help { background: #eef4ff; border-radius: 10px; padding: 10px 14px; margin: 6px 0 12px; }
.audit-parts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.audit-part { min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid #d9dee3; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.audit-part.active { outline: 2px solid #1a1d21; }
.audit-part.pending { background: #fdf3df; } .audit-part.approved { background: #e6f4ee; } .audit-part.rejected { background: #fbe9e7; }

.audit-now { display: block; color: #8a5a00; font-size: 11px; }
.audit-track { color: #5a6570; font-size: 11px; max-width: 230px; line-height: 1.3; margin-top: 3px; }
.audit-track:empty { display: none; }

.audit-part.saved { box-shadow: inset 0 -3px 0 #e0a100; }

.store-chart svg { width: 100%; height: auto; display: block; }
.sc-grid { stroke: #e6e9ed; stroke-width: 1; }
.sc-tick, .sc-axis, .sc-na { fill: #6b7480; font-size: 11px; }
.sc-name { fill: #1a1d21; font-size: 12px; font-weight: 600; }
.sc-val { fill: #1a1d21; font-size: 12px; font-weight: 700; }
.sc-fill { fill: var(--brand); }
.sc-bar:hover .sc-fill { filter: brightness(0.9); }

.sc-fill.sc-part { opacity: 0.45; }
.sc-prev { fill: none; stroke: #e8710a; stroke-width: 2; stroke-dasharray: 2 5; stroke-linecap: round; stroke-linejoin: round; }
.sc-prev-dot { fill: #fff; stroke: #e8710a; stroke-width: 2; }
.sc-trend { stroke: #1a1d21; stroke-width: 1.5; }
.trend-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 8px; }
.trend-stat span { display: block; color: #6b7480; font-size: 11px; }
.trend-stat strong { font-size: 17px; }
.trend-stat strong.up { color: #1a7f4b; } .trend-stat strong.down { color: #c5362b; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; margin: 4px 0; }
.trend-legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-bar { width: 12px; height: 12px; background: var(--brand); border-radius: 3px; }
.lg-prev { width: 22px; height: 0; border-top: 2px dotted #e8710a; }
.lg-trend { width: 22px; height: 0; border-top: 2px solid #1a1d21; }
#trendStore { padding: 6px 10px; font: inherit; border: 1px solid #d9dee3; border-radius: 8px; background: #fff; }

.nav-logout { margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }

/* before first paint: staff see Fixing Inventory only; visitors without a session see nothing until the login page or silent sign-in is ready */
html[data-role="staff"] .nav-item:not([data-tab="fixingInventory"]):not([data-tab="staff"]):not([data-tab="transfers"]):not([data-tab="requests"]):not(.nav-logout) { display: none !important; }
html[data-role="staff"] .tab-panel:not(#fixingInventory):not(#staff):not(#transfers):not(#restock):not(#requests) { display: none !important; }
html[data-role="staff"] #requests:not(.active) { display: none !important; }
html[data-role="staff"] #transfers:not(.active) { display: none !important; }
html[data-role="staff"] #staff:not(.active) { display: none !important; }
html[data-role="staff"] #fixingInventory:not(.active) { display: none !important; }
html[data-role="staff"] #fixingInventory.active { display: block !important; }
html.pre-gate .app-shell { visibility: hidden; }

html[data-role="staff"] .chat-widget { display: none !important; }

.audit-table tr.audit-group td { background: #eef1f5; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #3b4654; padding: 6px 10px; }
/* employees: no store/period pickers or Export above the list, so the list starts higher up the screen */
html[data-role="staff"] .topbar .toolbar-select, html[data-role="staff"] .topbar .primary-btn { display: none !important; }
/* phone: keep #, Product, Counted and OK all on screen together */
@media (max-width: 600px) {
  .audit-table td:nth-child(2) { min-width: 0; width: 38%; word-break: break-word; }
  .audit-table input[type="number"] { width: 58px; }
  .audit-table th, .audit-table td { padding: 8px 5px; }
}

/* admin-only tools (hidden for everyone else) */
.admin-only { display: none; }
body.role-admin .admin-only { display: block; }
#allocPanel { margin-bottom: 16px; }
#allocPanel .search-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
#allocPanel .search-row input { flex: 1 1 220px; }
.alloc-card { border: 1px solid #d9dee3; border-radius: 12px; padding: 12px; margin: 8px 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alloc-card small { color: #6b7480; display: block; }
.alloc-tag { background: #fdf3df; color: #8a5a00; border-radius: 8px; padding: 2px 8px; font-weight: 700; font-size: 12px; }
.alloc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.alloc-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: #6b7480; }
.alloc-form input, .alloc-form select { padding: 8px 10px; font: inherit; border: 1px solid #d9dee3; border-radius: 10px; }
.alloc-list summary { cursor: pointer; font-weight: 700; margin: 8px 0; }
.alloc-list .alloc-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #eef1f5; font-size: 14px; }

/* price review (admin) */
#pricePanel { margin-bottom: 16px; }
#pricePanel .search-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
#pricePanel .search-row input, #pricePanel .search-row select { flex: 1 1 200px; padding: 8px 10px; font: inherit; border: 1px solid #d9dee3; border-radius: 10px; }
.pr-card { border: 1px solid #d9dee3; border-radius: 12px; padding: 12px; margin: 8px 0; }
.pr-card-down { border-color: #e0a3a3; background: #fff6f6; box-shadow: inset 4px 0 0 #d64545; }
.pr-head small { color: #6b7480; display: block; }
.pr-why { margin-top: 6px; background: #fff3d6; color: #7a4d00; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0; align-items: end; }
.pr-grid label, .pr-grid > div { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: #6b7480; }
.pr-grid input { padding: 8px 10px; font: inherit; border: 1px solid #d9dee3; border-radius: 10px; width: 100%; box-sizing: border-box; }
.pr-grid b { font-size: 18px; color: #1d2430; }
.pr-lbl { font-size: 12px; }
.pr-diff { font-size: 18px; font-weight: 800; }
.pr-down { color: #c62828; } .pr-up { color: #1b7f3b; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#pricePanel, #pricePanel * { min-width: 0; box-sizing: border-box; }
#pricePanel { max-width: 100%; overflow: hidden; }
.pr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#pricePanel .search-row select, #pricePanel .search-row input { flex: 1 1 100%; width: 100%; }
@media (min-width: 700px) { .pr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } #pricePanel .search-row select, #pricePanel .search-row input { flex: 1 1 220px; width: auto; } }

/* sign-up codes + User Admin */
.otp-code { font-size: 40px; font-weight: 800; letter-spacing: 6px; text-align: center; background: #eef4ff; color: #1b4fbf; border-radius: 14px; padding: 14px 8px; margin: 12px 0; }
.otp-inline { font-size: 20px; font-weight: 800; letter-spacing: 3px; color: #1b4fbf; }
.dot.gray { background: #b5bcc6; }
.activity-list { max-height: 55vh; overflow-y: auto; margin: 8px 0; }
.activity-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f5; font-size: 14px; }
.activity-when { color: #6b7480; font-size: 12px; }
.activity-line { color: #4a5563; font-size: 13px; margin-left: 24px; }
@media (max-width: 600px) { .activity-row { grid-template-columns: 1fr; gap: 2px; } .otp-code { font-size: 32px; } }
.loc-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: 15px; border-bottom: 1px solid #eef1f5; }
.loc-all { background: #f5f7fb; border-radius: 8px; margin-bottom: 4px; }
.ua-none { color: #b45309; font-weight: 700; }
tr.ua-paused td { background: #fff8e8; color: #7a5a1a; }
.ua-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 10px 0; }
.ua-add label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: #6b7480; }
.ua-add input { padding: 8px 10px; font: inherit; border: 1px solid #d9dee3; border-radius: 10px; width: 100%; box-sizing: border-box; }
.ua-pw { display: flex; gap: 8px; }
.ua-locs { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 6px 0 12px; }
.ua-locs .loc-row { border: 0; padding: 4px 0; }
.cred-box { background: #f5f7fb; border-radius: 12px; padding: 14px; font-size: 17px; line-height: 1.8; margin: 10px 0; word-break: break-all; }
/* login history: fixed-height scroll area, header stays visible */
#admin .hist-scroll { max-height: 420px; overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid #eee8da; border-radius: 10px; }
#admin .hist-scroll thead th { position: sticky; top: 0; background: #f6f1e4; z-index: 1; }
@media (max-width: 600px) { #admin .hist-scroll { max-height: 55vh; } }

/* User Admin: people as cards */
.ua-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 10px; }
.ua-card { border: 1px solid #e3e7ee; border-radius: 16px; padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(20,30,50,.04); }
.ua-card.is-paused { background: #fffaf0; border-color: #f0d9a8; }
.ua-top { display: flex; align-items: center; gap: 12px; }
.ua-avatar { position: relative; width: 44px; height: 44px; border-radius: 50%; background: #e8edf7; color: #2b4a8b; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; flex: none; }
.ua-avatar .ua-dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; background: #b5bcc6; }
.ua-avatar.online .ua-dot { background: #2fbf7d; } .ua-avatar.paused .ua-dot { background: #f0b64d; }
.ua-who { min-width: 0; }
.ua-name { font-weight: 800; font-size: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ua-name em { font-weight: 500; color: #6b7480; font-size: 13px; }
.ua-status { font-size: 13px; color: #6b7480; margin-top: 2px; }
.ua-status.online { color: #1b8a57; font-weight: 700; } .ua-status.paused { color: #a8741a; font-weight: 700; }
.ua-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; background: #f6f8fb; border-radius: 12px; padding: 12px; }
.ua-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ua-facts span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a93a0; }
.ua-facts b { font-size: 14px; font-weight: 600; color: #1d2430; word-break: break-word; }
.ua-none { color: #b45309; font-weight: 700; font-style: normal; }
.ua-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; }
.ua-btn { padding: 9px 10px; font: inherit; font-size: 14px; font-weight: 600; border: 1px solid #d9dee3; background: #fff; color: #1d2430; border-radius: 10px; cursor: pointer; text-align: center; white-space: nowrap; }
.ua-btn:hover { background: #f3f6fb; border-color: #c3cbd6; }
.ua-btn.ua-danger { color: #c62828; border-color: #f0c6c6; background: #fff6f6; }
.ua-btn.ua-danger:hover { background: #fdeaea; }
@media (max-width: 600px) { .ua-list { grid-template-columns: 1fr; } .ua-facts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .ua-btn { font-size: 13px; padding: 10px 6px; } }

/* ---- Staff & Shifts tab */
.stf-subs, .stf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.stf-sp { flex: 1; }
.stf-sub { border: 1px solid var(--line, #d9dde3); background: transparent; color: inherit; padding: 8px 14px; border-radius: 999px; font: inherit; cursor: pointer; }
.stf-sub.on { background: #2f6f3e; color: #fff; border-color: #2f6f3e; }
.stf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stf-card { padding: 16px; } .stf-card h3 { margin: 0 0 8px; font-size: 14px; opacity: .75; }
.stf-big { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.stf-day { margin-bottom: 10px; border: 1px solid var(--line, #d9dde3); border-radius: 10px; overflow: hidden; }
.stf-dayhead { display: flex; justify-content: space-between; padding: 8px 12px; background: rgba(128,128,128,.14); font-weight: 600; }
.stf-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line, #d9dde3); }
.stf-row.off { opacity: .75; justify-content: flex-start; } .stf-none { padding: 10px 12px; text-align: center; }
.stf-act { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.stf-total { display: flex; justify-content: space-between; padding: 12px 14px; margin-top: 10px; background: rgba(128,128,128,.2); border-radius: 10px; }
.stf-user td { background: rgba(128,128,128,.12); }
.stf-chip { display: inline-block; margin: 2px 6px 2px 0; padding: 3px 8px; border-radius: 999px; background: rgba(128,128,128,.2); }
.stf-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; }
.stf-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.stf-box { background: var(--panel, #fff); color: inherit; border-radius: 12px; padding: 18px; width: min(420px, 100%); max-height: 90vh; overflow: auto; }
.stf-box h3 { margin: 0 0 12px; }
.stf-f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.stf-f input, .stf-f select { padding: 8px; border-radius: 8px; border: 1px solid var(--line, #c8ccd2); font: inherit; background: transparent; color: inherit; }
.stf-f input[type=checkbox] { width: 20px; height: 20px; }

/* Inventory list: the title row stays visible while the rows scroll (the box scrolls both ways, so sticky works inside it) */
.table-scroll.freeze-head { max-height: 72vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.table-scroll.freeze-head thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-solid, #fff); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }

/* Transfers: big touch targets, no tap delay, cards for pickup / received */
.t-table, .t-row, .t-row td, .transfer-route summary, #transfers button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.t-row { cursor: pointer; user-select: none; -webkit-user-select: none; }
.t-row td { padding-top: 14px; padding-bottom: 14px; }
.t-row:active { background: rgba(47, 111, 62, .18); }
.t-row.on { background: rgba(47, 111, 62, .10); }
.t-tick { width: 64px; text-align: center; }
.t-tick input { width: 28px; height: 28px; margin: 0; pointer-events: none; accent-color: #2f6f3e; }   /* the whole row takes the tap, not just the box */
.t-rrow .t-state { font-weight: 700; color: #2f6f3e; white-space: nowrap; }
.t-rrow.miss { background: rgba(190, 50, 50, .12); } .t-rrow.miss .t-state { color: #b3261e; }
.t-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.t-h { margin: 18px 0 6px; font-size: 15px; }
.t-missing { color: #b3261e; font-weight: 600; }
#transfers .primary-btn, #transfers .secondary-btn { min-height: 44px; }
.transfer-route > summary { min-height: 44px; }

/* Explanations on the shrinkage cards: hover with a mouse, tap on a phone */
.has-tip { position: relative; cursor: help; }
.has-tip::after { content: attr(data-tip); white-space: pre-line; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; max-width: 320px;
  padding: 10px 12px; border-radius: 10px; background: #1f2937; color: #fff; font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s; pointer-events: none; }
.has-tip:hover::after, .has-tip:focus::after, .has-tip.tip-open::after { opacity: 1; visibility: visible; transform: none; }

/* loading skeletons: grey bars that pulse while a tab's data is on its way */
.skel { height: 64px; margin: 10px 0; border-radius: 10px; background: linear-gradient(90deg, rgba(128,128,128,.12) 25%, rgba(128,128,128,.22) 50%, rgba(128,128,128,.12) 75%); background-size: 200% 100%; animation: skel-pulse 1.3s ease-in-out infinite; }
@keyframes skel-pulse { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* developer-only Undo button, on every page */
#devUndo { position: fixed; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: #2b2f3a; color: #fff; font: 600 13px/1 inherit; box-shadow: 0 4px 14px rgba(0,0,0,.35); touch-action: manipulation; }
#devUndo[hidden] { display: none; }
#devUndo:disabled { opacity: .55; }

/* admin "Recent changes" button and list */
#adminUndo { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: #2b2f3a; color: #fff; font: 600 13px/1 inherit; box-shadow: 0 4px 14px rgba(0,0,0,.35); touch-action: manipulation; }
#adminUndo[hidden] { display: none; }
.undo-list { max-height: 55vh; overflow: auto; margin: 8px 0; }
.undo-row { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid rgba(128,128,128,.25); }
.undo-main { min-width: 0; }
.undo-line { font-size: 12px; opacity: .85; overflow-wrap: anywhere; }

.log-why { opacity: .55; }

/* Transfers: select-all header, pickup checklist, who picked up */
.t-allcell { cursor: pointer; white-space: nowrap; user-select: none; }
.t-allx { display: block; font-size: 11px; font-weight: 600; opacity: .8; }
.t-by { font-size: 12px; opacity: .85; margin-left: 4px; }

/* Transfer status colours: Not ready red, Ready blue, Picked up purple, Complete green, Complete with items missing amber */
.status-pill.ready { background: #e6effe; color: #1d4ed8; }
.status-pill.moving { background: #f0e8fd; color: #6d28d9; }

/* Purchases tab */
.pc-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pc-file { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.pc-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.pc-chip { border: 1px solid rgba(128,128,128,.4); border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.pc-chip button { border: 0; background: none; font-size: 16px; cursor: pointer; }
.pc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.pc-meta label { display: flex; flex-direction: column; font-size: 12px; gap: 3px; }
.pc-mode { margin: 8px 0; font-size: 14px; }
.pc-table input:not([type=checkbox]) { width: 100%; min-width: 70px; }
.pc-table td:nth-child(3) input { min-width: 180px; }
.pc-off { opacity: .45; }
.pc-raw { white-space: pre-wrap; font-size: 12px; max-height: 240px; overflow: auto; }

/* Phone search: one big pill, two rounded action chips (web layout unchanged) */
@media (pointer: coarse) and (max-width: 1000px) {
  .search-panel { padding: 14px; border-radius: 22px; }
  .search-panel .panel-header { margin-bottom: 10px; }
  .search-panel .panel-kicker, .search-panel h2 { display: none; }
  .search-panel .panel-header { justify-content: flex-end; min-height: 0; }
  .search-panel #searchClear { display: none; }       /* the field has its own clear x; Lookup stays: after a scan or typing it shows the result */
  .search-panel .search-row { margin-bottom: 12px; }
  .search-panel .search-row input { width: 100%; height: 54px; padding: 0 20px 0 52px; border: 0; border-radius: 999px; font-size: 16px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%231d2430' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E") no-repeat 18px center; box-shadow: 0 2px 10px rgba(16, 24, 40, 0.14), inset 0 0 0 1.5px rgba(16, 24, 40, 0.1); }
  .search-panel .search-row input:focus { outline: none; box-shadow: 0 2px 12px rgba(26, 115, 232, 0.28), inset 0 0 0 2px var(--brand); }
  .search-panel .search-tools { flex-wrap: nowrap; gap: 10px; }
  .search-panel .search-tools .secondary-btn { flex: 1 1 0; width: auto; height: 48px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; justify-content: center; border: 0; background: #fff; color: var(--brand); box-shadow: inset 0 0 0 1.5px rgba(26, 115, 232, 0.35); }
  .search-panel #scanLiveBtn { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35); }
  .search-panel .search-tools .secondary-btn:active { transform: scale(0.97); }
}

/* Phone: the side menu becomes a bottom bar of centred icons with short labels (scrolls sideways when there are many tabs) */
@media (pointer: coarse) and (max-width: 1000px) {
  .menu-btn, .menu-backdrop { display: none !important; }
  .main-panel { padding-top: calc(14px + env(safe-area-inset-top)); }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sidebar { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; transform: none !important; flex-direction: row; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; border-radius: 22px 22px 0 0; background: rgba(255,255,255,0.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 -4px 24px rgba(16,24,40,0.14); border: 0; overflow: hidden; }
  body.menu-open .sidebar { box-shadow: 0 -4px 24px rgba(16,24,40,0.14); }
  body.menu-open { overflow: auto; }
  .brand-row, .sidebar-card { display: none; }
  .nav-list { flex-direction: row; width: 100%; gap: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { position: relative; flex: 1 0 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 2px 6px; border: 0; border-radius: 14px; background: transparent; color: #6b7280; font-size: 10.5px; font-weight: 600; line-height: 1.15; text-align: center; white-space: normal; overflow: hidden; }
  .nav-item::before { content: ""; width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
  .nav-item.active, .nav-item:hover { background: transparent; color: var(--brand); }
  .nav-item.active::before { transform: translateY(-1px) scale(1.1); }
  .nav-item.active::after { content: ""; position: absolute; top: 0; width: 22px; height: 3px; border-radius: 3px; background: var(--brand); }
  .nav-item .nav-badge { position: absolute; top: 3px; left: 50%; margin: 0 0 0 6px; padding: 0 5px; font-size: 10px; line-height: 15px; }
  .nav-logout { color: #b42318; }
  .chat-widget { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .nav-item[data-tab="productPerformance"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h6v6H4z M14 4h6v6h-6z M4 14h6v6H4z M14 14h6v6h-6z'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="inventory"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5v8l9 5 9-5z M3 8l9 5 9-5 M12 13v8'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="shrinkage"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7l6 6 4-4 8 8 M21 11v6h-6'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="orderList"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4h6v3H9z M7 5H5v16h14V5h-2 M9 12h6 M9 16h6'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="transfers"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 8h14l-4-4 M20 16H6l4 4'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="fixingInventory"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16v16H4z M8 12l3 3 5-6'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="staff"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2 M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7 M21 20v-2a4 4 0 0 0-3-3.9'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="purchases"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-3-2-3 2-3-2-3 2z M9 8h6 M9 12h6'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="changes"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18 M12 7v5l3 2'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="admin"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="userAdmin"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8 M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
  .nav-item[data-tab="developer"] { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 8l-5 4 5 4 M16 8l5 4-5 4'/%3E%3C/svg%3E"); }
  #logoutBtn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4H5v16h4 M16 8l4 4-4 4 M20 12H9'/%3E%3C/svg%3E"); }
}

@media (pointer: coarse) and (max-width: 1000px) { .search-panel .chip:empty { display: none; } }
#loginGate [hidden] { display: none !important; }
#loginGate #lgFace { width: 100%; margin-top: 8px; }

/* ================================================================ 2026-11 theme: real liquor-store photos behind every page, frosted-glass panels,
   vibrant gradients and colourful liquor icons. Everything for this look is in this block (it overrides the rules above), so it can be tuned or removed in one place.
   Photos: assets/bg (Unsplash licence, see assets/bg/CREDITS.md). Icons: assets/nav. */
:root {
  --panel: rgba(255, 255, 255, 0.80);
  --panel-solid: #ffffff;
  --panel-muted: rgba(246, 242, 255, 0.85);
  --sidebar: #160f22;
  --sidebar-soft: #2a1f3a;
  --border: rgba(255, 255, 255, 0.55);
  --text: #191424;
  --muted: #5f5874;
  --brand: #c2185b;
  --brand-soft: #fde7f1;
  --shadow: 0 18px 40px rgba(20, 6, 40, 0.28);
  --g-hero: linear-gradient(120deg, rgba(123, 31, 162, .88) 0%, rgba(214, 51, 132, .78) 50%, rgba(255, 140, 50, .72) 100%);
  --g-whisky: linear-gradient(135deg, #ffcf5c, #ff8a00);
  --g-wine: linear-gradient(135deg, #ff5fa2, #b0125b);
  --g-mojito: linear-gradient(135deg, #5ef0b0, #0fa968);
  --g-gin: linear-gradient(135deg, #6fc3ff, #3b5bff);
  --g-rose: linear-gradient(135deg, #ffa7c4, #ff5c7a);
  --photo: url("assets/bg/default.jpg");
}
/* the photo of the open page, under a colourful dark wash so text stays readable */
html, body { background: #1a0f24; }
body { background: transparent; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: linear-gradient(165deg, rgba(26, 8, 48, .86) 0%, rgba(86, 18, 92, .62) 45%, rgba(170, 60, 40, .55) 100%), var(--photo) center / cover no-repeat; }
body:has(#productPerformance.active) { --photo: url("assets/bg/dashboard.jpg"); }
body:has(#inventory.active), body:has(#shrinkage.active) { --photo: url("assets/bg/inventory.jpg"); }
body:has(#orderList.active), body:has(#purchases.active) { --photo: url("assets/bg/orders.jpg"); }
body:has(#transfers.active) { --photo: url("assets/bg/transfers.jpg"); }
body:has(#fixingInventory.active) { --photo: url("assets/bg/fixing.jpg"); }
body:has(#restock.active) { --photo: url("assets/bg/inventory.jpg"); }

/* page header sits on the photo: light text */
.main-panel { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; }
.topbar h1 { color: #fff; letter-spacing: -0.02em; text-shadow: 0 2px 18px rgba(0, 0, 0, .45); }
.topbar .eyebrow, .toolbar-select > span { color: rgba(255, 255, 255, .78); }

/* frosted-glass panels: the photo glows through */
.panel, .kpi-card, .modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); }
.panel-kicker { background: linear-gradient(90deg, #c2185b, #ff7a18); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .08em; font-weight: 800; }
.panel-header h2 { letter-spacing: -0.02em; }
.chip { background: rgba(255, 255, 255, .7); border: 1px solid rgba(25, 20, 36, .08); }
table th { background: rgba(255, 255, 255, .55); }

/* buttons and fields */
.primary-btn, .secondary-btn { border-radius: 999px; }
.primary-btn { background: linear-gradient(120deg, #d6336c, #ff7a18); color: #fff; border: 0; box-shadow: 0 10px 22px rgba(214, 51, 108, .35); }
.primary-btn:hover { filter: brightness(1.06); }
.secondary-btn { background: rgba(255, 255, 255, .85); border: 1px solid rgba(25, 20, 36, .1); }
.toolbar-select select, select, input[type="text"], input[type="search"], input[type="number"], input[type="password"] { border-radius: 14px; }
.toolbar-select select { background: rgba(255, 255, 255, .92); border: 0; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.user-chip { background: linear-gradient(120deg, #ffcf5c, #ff8a00); color: #2a1600; font-weight: 700; }

/* number tiles: drink-coloured gradients */
.kpi-row .kpi-card { color: #fff; border: 0; }
.kpi-row .kpi-card:nth-child(5n+1) { background: var(--g-whisky); }
.kpi-row .kpi-card:nth-child(5n+2) { background: var(--g-wine); }
.kpi-row .kpi-card:nth-child(5n+3) { background: var(--g-mojito); }
.kpi-row .kpi-card:nth-child(5n+4) { background: var(--g-gin); }
.kpi-row .kpi-card:nth-child(5n+5) { background: var(--g-rose); }
.kpi-row .kpi-label, .kpi-row .kpi-change.up, .kpi-row .kpi-change.down { color: rgba(255, 255, 255, .92); }
.kpi-row .kpi-badge { background: rgba(255, 255, 255, .28); color: #fff; border-radius: 50%; }
.kpi-row .kpi-value { color: #fff; font-size: 30px; letter-spacing: -0.03em; text-shadow: 0 2px 10px rgba(0, 0, 0, .15); }

/* dashboard hero: a real photo with a vibrant wash */
.hero-card { position: relative; display: flex; align-items: flex-end; min-height: 170px; margin-bottom: 18px; padding: 24px 26px; border-radius: 28px; overflow: hidden; color: #fff;
  background: var(--g-hero), url("assets/bg/dashboard.jpg") center 40% / cover; box-shadow: 0 20px 44px rgba(123, 31, 162, .45); border: 1px solid rgba(255, 255, 255, .35); }
.hero-copy { position: relative; min-width: 0; }
.hero-hello { font-size: 15px; opacity: .92; }
.hero-card h2 { margin: 4px 0 2px; font-size: 42px; letter-spacing: -0.03em; text-shadow: 0 3px 18px rgba(0, 0, 0, .35); }
.hero-card p { margin: 0; opacity: .9; font-size: 14px; }

/* desktop sidebar: dark glass with colourful icons */
.sidebar { background: rgba(22, 12, 34, .72); -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .12); border-radius: 30px; }
.nav-item { display: flex; align-items: center; gap: 12px; border-radius: 14px; }
.nav-item::before { content: ""; flex: 0 0 26px; width: 26px; height: 26px; background: var(--icon) center / contain no-repeat; -webkit-mask: none; mask: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3)); }
.nav-item.active { background: linear-gradient(120deg, rgba(214, 51, 108, .9), rgba(255, 122, 24, .85)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(214, 51, 108, .35); }
.nav-item:hover:not(.active) { background: rgba(255, 255, 255, .08); }
.nav-item[data-tab="productPerformance"] { --icon: url("assets/nav/dashboard.svg"); }
.nav-item[data-tab="inventory"] { --icon: url("assets/nav/inventory.svg"); }
.nav-item[data-tab="shrinkage"] { --icon: url("assets/nav/shrinkage.svg"); }
.nav-item[data-tab="orderList"] { --icon: url("assets/nav/orders.svg"); }
.nav-item[data-tab="transfers"] { --icon: url("assets/nav/transfers.svg"); }
.nav-item[data-tab="fixingInventory"] { --icon: url("assets/nav/fixing.svg"); }
.nav-item[data-tab="restock"] { --icon: url("assets/nav/restock.svg"); }
.nav-item[data-tab="staff"] { --icon: url("assets/nav/staff.svg"); }
.nav-item[data-tab="purchases"] { --icon: url("assets/nav/purchases.svg"); }
.nav-item[data-tab="changes"] { --icon: url("assets/nav/changes.svg"); }
.nav-item[data-tab="admin"] { --icon: url("assets/nav/admin.svg"); }
.nav-item[data-tab="userAdmin"] { --icon: url("assets/nav/useradmin.svg"); }
.nav-item[data-tab="developer"] { --icon: url("assets/nav/developer.svg"); }
#logoutBtn { --icon: url("assets/nav/logout.svg"); }
.chat-fab { background: linear-gradient(135deg, #d6336c, #ff7a18); box-shadow: 0 10px 24px rgba(214, 51, 108, .45); }

/* login: bar photo behind a glass card */
#loginGate { background: linear-gradient(165deg, rgba(26, 8, 48, .78), rgba(120, 25, 90, .55) 55%, rgba(200, 80, 30, .5)), url("assets/bg/login.jpg") center / cover no-repeat; }
.login-card { background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); border: 1px solid rgba(255, 255, 255, .6); border-radius: 30px; box-shadow: 0 30px 70px rgba(10, 0, 30, .5); }
.login-card h1 { background: linear-gradient(90deg, #7b1fa2, #d6336c, #ff7a18); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-logo { border: 4px solid #fff; border-radius: 22px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.login-card input { border-radius: 14px; border-color: rgba(25, 20, 36, .12); background: rgba(255, 255, 255, .9); }

/* phone */
@media (pointer: coarse) and (max-width: 1000px) {
  .topbar .eyebrow, .toolbar-select > span { display: none; }
  .topbar h1 { font-size: 28px; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 4px 2px 8px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: 0 0 auto; }
  .toolbar-select select { padding: 9px 12px; font-size: 14px; }
  .toolbar .secondary-btn, .toolbar .primary-btn, .user-chip { padding: 9px 14px; font-size: 14px; }
  .hero-card { min-height: 150px; padding: 18px; border-radius: 26px; }
  .hero-card h2 { font-size: 30px; }
  .kpi-row .kpi-value { font-size: 24px; }
  .panel { border-radius: 24px; }

  /* floating dark-glass pill with colourful icons; the open tab sits in a glowing gradient circle */
  body { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .sidebar { left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 8px; border-radius: 999px; background: rgba(22, 12, 34, .82); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
  body.menu-open .sidebar { box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
  .nav-list { justify-content: space-between; gap: 2px; }
  .nav-item { flex: 1 0 48px; height: 52px; padding: 0; justify-content: center; border-radius: 999px; font-size: 0; }
  .nav-item::before { flex: 0 0 28px; width: 28px; height: 28px; background: var(--icon) center / contain no-repeat; -webkit-mask: none; mask: none; }
  .nav-item.active { background: linear-gradient(135deg, #d6336c, #ff7a18); box-shadow: 0 6px 16px rgba(214, 51, 108, .5); }
  .nav-item:hover:not(.active) { background: transparent; }
  .nav-item.active::after { display: none; }
  .nav-item.active::before { transform: scale(1.08); }
  .nav-item .nav-badge { font-size: 10px; top: 4px; }
  .chat-widget { left: auto; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .chat-panel { left: auto; right: -4px; }
  .chat-fab { width: 50px; height: 50px; font-size: 21px; }
  #adminUndo, #devUndo { bottom: calc(96px + env(safe-area-inset-bottom)); padding: 8px 12px; font-size: 13px; }
  #adminUndo { right: 76px; }                   /* left of the chat button */
  #devUndo { left: 16px; }
  .search-panel #scanLiveBtn { background: linear-gradient(120deg, #d6336c, #ff7a18); box-shadow: 0 6px 14px rgba(214, 51, 108, .35); }
  .search-panel .search-tools .secondary-btn { color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(25, 20, 36, .15); }
}

/* Transfer Pending rows: route + status on one line, details on a second line (never wider than the panel) */
.t-dash-row { display: block; }
.t-dash-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.t-route { min-width: 0; font-weight: 600; }
.t-dash-main .status-pill { flex: 0 0 auto; white-space: nowrap; }
.t-dash-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (pointer: coarse) and (max-width: 380px) {           /* small phones (iPhone SE): the Scan / Photo search pair must fit side by side */
  .search-panel .search-tools .secondary-btn { min-width: 0; padding: 0 8px; font-size: 13px; }
}

/* ---------------------------------------------------------------- phone home screen (menu tiles); never shown on desktop */
.home-screen, .home-btn, .home-hello { display: none; }
@media (pointer: coarse) and (max-width: 1000px) {
  :root { --g-violet: linear-gradient(135deg, #a98bff, #6a3df0); --g-slate: linear-gradient(135deg, #8fa4c8, #4a5878); }
  /* the tiles replace the bottom icon bar */
  .sidebar { display: none !important; }
  body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .chat-widget { bottom: calc(18px + env(safe-area-inset-bottom)); }
  #adminUndo, #devUndo { bottom: calc(22px + env(safe-area-inset-bottom)); }

  /* home: greeting, store/period controls, tiles */
  body.home .main-panel > .tab-panel { display: none !important; }
  body.home .topbar h1, body.home .topbar .eyebrow { display: none; }
  body.home .home-hello { display: block; margin: 6px 0 4px; color: #fff; font-size: 31px; line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; text-shadow: 0 2px 18px rgba(0, 0, 0, .45); }
  body.home .home-screen { display: block; margin-top: 4px; }
  .home-tiles { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 124px; grid-auto-flow: dense; gap: 12px; }
  .home-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; min-width: 0; padding: 14px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 26px; overflow: hidden; color: #fff; text-align: left; cursor: pointer;
    background: linear-gradient(180deg, rgba(10, 4, 20, .05) 25%, rgba(15, 5, 28, .82) 100%), var(--tile-photo) center / cover no-repeat; box-shadow: 0 14px 30px rgba(10, 0, 30, .35); transition: transform .12s ease; }
  .home-tile:active { transform: scale(.97); }
  .home-tile.wide { grid-column: span 2; }
  .home-tile.tall { grid-row: span 2; }
  .home-tile.grad { background: linear-gradient(0deg, rgba(0, 0, 0, .12), rgba(0, 0, 0, 0)), var(--g), var(--tile-photo) center / cover; background-blend-mode: normal, multiply, normal; }
  .home-tile.g-mojito { --g: var(--g-mojito); } .home-tile.g-wine { --g: var(--g-wine); } .home-tile.g-rose { --g: var(--g-rose); } .home-tile.g-whisky { --g: var(--g-whisky); }
  .home-tile.g-gin { --g: var(--g-gin); } .home-tile.g-violet { --g: var(--g-violet); } .home-tile.g-slate { --g: var(--g-slate); }
  .ht-icon { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; background: rgba(255, 255, 255, .9) var(--icon) center / 28px no-repeat; box-shadow: 0 6px 14px rgba(0, 0, 0, .25); }
  .home-tile.tall .ht-icon, .home-tile.wide .ht-icon { width: 54px; height: 54px; background-size: 32px; }
  .ht-text { display: block; min-width: 0; max-width: 100%; }
  .ht-text b { display: block; font-size: 18px; line-height: 1.15; letter-spacing: -0.01em; text-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
  .home-tile.wide .ht-text b, .home-tile.tall .ht-text b { font-size: 22px; }
  .ht-text small { display: block; margin-top: 2px; font-size: 12px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ht-badge { position: absolute; top: 12px; right: 12px; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: #ff3b5c; color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
  .home-logout { display: block; margin: 18px auto 8px; padding: 10px 22px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
  .home-logout[hidden] { display: none; }

  /* inside a menu: a Home button above the page title */
  body:not(.home) .home-btn { display: inline-flex; align-items: center; margin-bottom: 6px; padding: 7px 14px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 14px; font-weight: 700; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}

/* Net $ by Product: ranked horizontal bars, full names (one series: one colour, values in text ink) */
.pb-list { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 4px; }
.pb-row { padding: 8px 6px; border-radius: 12px; outline: none; }
.pb-row:hover, .pb-row:focus-visible { background: rgba(194, 24, 91, .07); }
.pb-head { display: flex; align-items: baseline; gap: 8px; }
.pb-rank { flex: 0 0 22px; height: 22px; border-radius: 50%; background: rgba(25, 20, 36, .08); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; }
.pb-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.pb-val { flex: 0 0 auto; font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pb-track { display: flex; align-items: center; gap: 8px; margin: 6px 0 0 30px; }
.pb-bar { height: 10px; min-width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.pb-row:hover .pb-bar { filter: brightness(.9); }
.pb-qty { flex: 0 0 auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Home tiles: "liquid glass" (no photo inside the tile; the page photo shows through, blurred, with a faint tint per menu) */
@media (pointer: coarse) and (max-width: 1000px) {
  .home-tile {
    background: linear-gradient(145deg, rgba(var(--tint), .30) 0%, rgba(255, 255, 255, .10) 45%, rgba(var(--tint), .16) 100%);
    -webkit-backdrop-filter: blur(24px) saturate(1.9) brightness(1.05); backdrop-filter: blur(24px) saturate(1.9) brightness(1.05);
    border: 1px solid rgba(255, 255, 255, .38);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .65), inset 0 -1px 0 rgba(255, 255, 255, .14), inset 0 0 22px rgba(255, 255, 255, .08), 0 16px 34px rgba(8, 0, 24, .32);
  }
  .home-tile::before {                                  /* the soft shine across the top of the glass */
    content: ""; position: absolute; inset: 0 0 auto 0; height: 55%; border-radius: inherit; pointer-events: none;
    background: radial-gradient(120% 90% at 18% 0%, rgba(255, 255, 255, .42), rgba(255, 255, 255, .08) 45%, transparent 70%);
  }
  .home-tile::after {                                   /* a thin bright rim, stronger at the top-left like light on glass */
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(140deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .05) 40%, rgba(255, 255, 255, .25));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  }
  .home-tile > * { position: relative; z-index: 1; }
  .ht-icon { background-color: rgba(255, 255, 255, .78); box-shadow: inset 0 1px 0 #fff, 0 6px 14px rgba(0, 0, 0, .22); }
  .ht-text b { text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
}
@media (pointer: coarse) and (max-width: 1000px) {           /* home screen wins over the staff rule that forces Fixing Inventory open */
  html[data-role] body.home .main-panel > #fixingInventory.active { display: none !important; }
}

/* ---------------------------------------------------------------- Restocking assist */
.rs-scan { display: flex; gap: 8px; margin: 12px 0; }
.rs-scan input { flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 16px; border: 1px solid rgba(25, 20, 36, .14); border-radius: 999px; font-size: 16px; background: rgba(255, 255, 255, .92); }
.rs-scan button { flex: 0 0 auto; height: 48px; }
.rs-card { padding: 14px; border-radius: 20px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(25, 20, 36, .08); display: grid; gap: 10px; }
.rs-name { font-size: 18px; font-weight: 700; }
.rs-name span { font-size: 13px; font-weight: 600; color: var(--muted); }
.rs-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.rs-facts > div { flex: 1 1 90px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 190, 160, .1); }
.rs-facts > div.rs-on { background: rgba(255, 160, 40, .16); }
.rs-facts b { display: block; font-size: 24px; letter-spacing: -.02em; }
.rs-facts span { font-size: 12px; color: var(--muted); }
.rs-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rs-inputs label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rs-inputs input { height: 46px; padding: 0 12px; font-size: 18px; border: 1px solid rgba(25, 20, 36, .16); border-radius: 14px; background: #fff; }
.rs-pick { display: grid; gap: 6px; }
.rs-pickrow { display: grid; text-align: left; gap: 2px; padding: 10px 12px; border: 1px solid rgba(25, 20, 36, .1); border-radius: 14px; background: rgba(255, 255, 255, .8); }
.rs-pickrow span { font-size: 12px; color: var(--muted); }
.rs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rs-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .65); border: 1px solid rgba(25, 20, 36, .06); }
.rs-row.done { opacity: .55; }
.rs-row.done .rs-line b { text-decoration: line-through; }
.rs-tick input { width: 24px; height: 24px; accent-color: #0d9e86; }
.rs-main { min-width: 0; cursor: pointer; }
.rs-line { overflow-wrap: anywhere; }
.rs-size { font-size: 12px; color: var(--muted); font-weight: 600; }
.rs-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.rs-want { min-width: 40px; padding: 6px 10px; border-radius: 999px; background: linear-gradient(135deg, #3fe0c0, #0d9e86); color: #fff; font-weight: 800; text-align: center; }
.rs-want::before { content: "×"; opacity: .8; margin-right: 1px; }
.rs-del { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(25, 20, 36, .06); color: var(--muted); }
.rs-card { grid-template-columns: minmax(0, 1fr); }                 /* nothing in the scan card may be wider than the card */
.rs-inputs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.rs-inputs label { min-width: 0; }
.rs-inputs input { width: 100%; box-sizing: border-box; }
.rs-card .primary-btn { width: 100%; }

/* ---------------------------------------------------------------- Price comparison (admin dashboard) */
.pc-panel { margin-bottom: 16px; }
.pc-search { display: flex; gap: 8px; margin: 6px 0 10px; }
.pc-search input { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 16px; border: 1px solid rgba(25, 20, 36, .14); border-radius: 999px; font-size: 15px; background: rgba(255, 255, 255, .92); }
.pc-h { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; padding: 10px 4px; border-bottom: 1px solid rgba(25, 20, 36, .07); }
.pc-row:last-child { border-bottom: 0; }
.pc-item { min-width: 0; overflow-wrap: anywhere; }
.pc-item span { font-size: 12px; color: var(--muted); }
.pc-ours { margin-top: 2px; font-size: 13px; color: var(--muted); }
.pc-ours b { color: var(--text); font-variant-numeric: tabular-nums; }
.pc-comp { display: grid; gap: 4px; min-width: 0; }
.pc-c { display: grid; grid-template-columns: minmax(0, 1fr) auto 78px; align-items: center; gap: 8px; }
.pc-store { min-width: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.pc-store small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.pc-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-arrow { font-size: 12px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-up { color: #13803f; } .pc-down { color: #c62828; } .pc-eq { color: var(--muted); }
.pc-legend { margin-top: 8px; font-size: 12px; color: var(--muted); }
.pc-pick { display: grid; gap: 6px; }
.pc-pick button { text-align: left; padding: 9px 12px; border: 1px solid rgba(25, 20, 36, .1); border-radius: 14px; background: rgba(255, 255, 255, .8); }
.pc-pick span { font-size: 12px; color: var(--muted); }
.pc-found { padding: 6px 10px; margin-bottom: 6px; border-radius: 18px; background: rgba(255, 255, 255, .6); border: 1px solid rgba(25, 20, 36, .07); }
.pc-add, .pc-addstore { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.pc-add select, .pc-add input, .pc-addstore input { flex: 1 1 140px; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid rgba(25, 20, 36, .14); border-radius: 12px; }
.pc-more { margin-top: 10px; }
.pc-more summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.list10 { overflow: auto !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }   /* product lists: 10 items, the rest scroll inside (fitTen in app.js) */
.pc-match { padding: 8px 0; border-bottom: 1px solid rgba(25, 20, 36, .07); }
.pc-match span { font-size: 12px; color: var(--muted); }
.pc-opt { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; }
.pc-opt a { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { .pc-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* ---------------------------------------------------------------- motion: quick, soft transitions (off when the phone asks for reduced motion) */
button, a, input, select, .home-tile, .nav-item { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }   /* no tap delay, no grey flash */
@media (prefers-reduced-motion: no-preference) {
  .tab-panel.active { animation: mlIn .26s cubic-bezier(.2, .7, .2, 1) both; }
  body.home .home-screen { animation: mlIn .26s cubic-bezier(.2, .7, .2, 1) both; }
  .home-tile { animation: mlTile .38s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
  .rs-card, .pc-found, .modal-box, .toast, .rs-pick, .pc-pick { animation: mlPop .2s ease-out both; }
  details[open] > :not(summary) { animation: mlIn .2s ease-out both; }
  button, .nav-item, .home-tile { transition: transform .14s ease, filter .14s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease; }
  button:active:not(:disabled), .nav-item:active, .home-tile:active { transform: scale(.96); }
}
@keyframes mlIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes mlTile { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes mlPop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Fixing Inventory: simple counting */
.au-in { display: flex; gap: 6px; align-items: center; }
.au-in input { min-width: 0; }
.au-mic { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(25, 20, 36, .07); font-size: 18px; }
.au-mic.on { background: #ff3b5c; color: #fff; animation: auPulse 1s ease-in-out infinite; }
@keyframes auPulse { 50% { box-shadow: 0 0 0 8px rgba(255, 59, 92, .2); } }
.au-h { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.au-fab { position: fixed; z-index: 60; left: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border: 0; border-radius: 50%; font-size: 22px; color: #fff;
  background: linear-gradient(135deg, #6a4cf5, #d6336c); box-shadow: 0 10px 24px rgba(106, 76, 245, .45); }
.au-find { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; justify-content: center; padding: 12px; background: rgba(10, 4, 20, .45); }
.au-find[hidden] { display: none; }
.au-find-box { width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto; padding: 16px; border-radius: 26px; background: rgba(255, 255, 255, .96); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.au-find-top { display: flex; justify-content: space-between; align-items: center; }
.au-hit { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid rgba(25, 20, 36, .07); }
.au-hit small { display: block; font-size: 12px; color: var(--muted); }
.au-hitq { min-width: 52px; padding: 6px 10px; border-radius: 999px; background: rgba(0, 190, 160, .14); font-size: 18px; font-weight: 800; text-align: center; }
@media (prefers-reduced-motion: no-preference) { .au-find-box { animation: mlPop .2s ease-out both; } }

/* phones: each item is a card (no sideways scrolling) */
@media (pointer: coarse) and (max-width: 1000px) {
  #fixingInventory .table-scroll { overflow: visible; }
  .audit-table, .audit-table tbody { display: block; width: 100%; }
  .audit-table thead { display: none; }
  .audit-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin: 0 0 10px; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .72); border: 1px solid rgba(25, 20, 36, .07); }
  .audit-table tr.audit-group { display: block; padding: 6px 4px; background: none; border: 0; font-weight: 800; }
  .audit-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .audit-table td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
  .audit-table .au-n { display: none; }
  .audit-table .au-name { grid-column: 1 / -1; font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
  .audit-table .au-count input { width: 100%; height: 48px; font-size: 20px; text-align: center; border-radius: 14px; }
  .audit-table .au-ok input { width: 28px; height: 28px; margin-top: 10px; }
  .audit-table .au-cat, .audit-table .au-fix, .audit-table .au-note { grid-column: 1 / -1; }
  .audit-table .au-cat select, .audit-table .au-fix select, .audit-table .au-note input { width: 100%; height: 40px; }
  .audit-table .au-size, .audit-table .au-qty { font-size: 14px; }
  #fixingInventory .audit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  /* admin waiting box: one card per bottle, Counted / Modisoft / Difference side by side */
  .au-batch-t, .au-batch-t tbody { display: block; width: 100%; min-width: 0; }
  .au-batch-t thead, .au-batch-t .au-bz { display: none; }
  .au-batch-t tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid rgba(25, 20, 36, .08); }
  .au-batch-t td { display: block; padding: 0; border: 0; min-width: 0; font-size: 16px; font-weight: 700; }
  .au-batch-t td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
  .au-batch-t .au-bn, .au-batch-t .au-bf { grid-column: 1 / -1; font-size: 14px; overflow-wrap: anywhere; }
  .au-batch-t .au-bf { font-weight: 400; color: var(--muted); }
  .au-batch-t .au-bf:empty { display: none; }
  #fixingInventory .au-batch-t .au-bn small { display: inline; font-weight: 400; color: var(--muted); }
  .au-wait .audit-actions input { grid-column: 1 / -1; height: 40px; }
  #fixingInventory .audit-actions > * { width: 100%; }
  #fixingInventory .audit-actions .primary-btn, #auditDoneCount { grid-column: 1 / -1; }
}
@media (pointer: coarse) and (max-width: 1000px) { .audit-table { min-width: 0 !important; width: 100% !important; } }
@media (pointer: coarse) and (max-width: 1000px) { .audit-table td { max-width: none !important; width: auto !important; white-space: normal !important; } }
.au-fab { left: auto; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
.au-hit[data-go-sku] { cursor: pointer; flex-wrap: wrap; }
.au-not { flex-basis: 100%; color: #c62828; font-size: 12px; }
.audit-table tr.au-hl { outline: 3px solid #6a4cf5; outline-offset: 2px; background: rgba(106, 76, 245, .12) !important; transition: background .3s; }
.au-onlist { color: #6a4cf5; font-weight: 700; }
.au-cats { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding-bottom: 6px; scrollbar-width: none; }
.au-cats::-webkit-scrollbar { display: none; }
.au-cat-chip { flex: 0 0 auto; display: grid; gap: 1px; padding: 8px 14px; white-space: nowrap; border-radius: 14px; }
.au-cat-chip small { font-size: 11px; opacity: .75; }
.au-pending { position: sticky; top: 0; z-index: 5; margin: 6px 0 10px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .92); font-size: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.au-pending b { font-size: 20px; color: #c2185b; }
.audit-table tr.au-done { opacity: .6; }
/* category chips: name + "25 left" stacked, sized to fit, compact */
#auditBody .au-cat-chip { width: auto; min-width: 0; height: auto; min-height: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 6px 12px; line-height: 1.15; font-size: 13px; font-weight: 700; white-space: nowrap; border-radius: 12px; }
#auditBody .au-cat-chip small { font-size: 10.5px; font-weight: 600; opacity: .7; }
#auditBody .au-cat-chip.active small { opacity: .9; }
/* Fixing Inventory, admin: batches waiting for approval */
.au-wait { margin: 10px 0 16px; padding: 12px; border-radius: 16px; background: rgba(255, 190, 60, .12); }
.au-wait h3 { margin: 0 0 6px; font-size: 16px; }
.au-batch { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(25, 20, 36, .1); }
.au-batch-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.au-batch-t .au-bn small { display: none; }
.au-batch-t th, .au-batch-t td { padding: 5px 6px; text-align: left; border-bottom: 1px solid rgba(25, 20, 36, .06); }

/* Price changes & offers (priceplans.js) */
.pp-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; align-items: end; }
.pp-row > label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; font-size: 13px; color: var(--muted); }
.pp-row > label[hidden] { display: none; }
.pp-row input, .pp-row select { height: 42px; font-size: 16px; }
.pp-row > label.pp-check { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; height: 42px; color: inherit; font-size: 15px; }
.pp-check input { width: 22px; height: 22px; }
.pp-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(25, 20, 36, .07); }
.pp-item input { width: 22px; height: 22px; flex: none; }
.pp-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pp-item small, .pp-pi small { display: block; font-size: 12px; color: var(--muted); }
.pp-item b { white-space: nowrap; }
.pp-plan { padding: 10px 0; border-top: 1px solid rgba(25, 20, 36, .1); }
.pp-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(25, 20, 36, .08); }
.pp-running { background: rgba(0, 170, 120, .16); color: #0a6b4d; }
.pp-upcoming { background: rgba(60, 120, 255, .14); color: #2347a8; }
.pp-cancelled { background: rgba(220, 50, 50, .12); color: #a32020; }
.pp-pop { padding: 10px 0; border-top: 1px solid rgba(25, 20, 36, .1); }
.pp-pi { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14px; }
.pp-pi s { color: var(--muted); font-weight: 400; }
.pp-tag { margin: 6px 0; padding: 6px 10px; border-radius: 10px; background: rgba(255, 190, 60, .2); font-size: 14px; }

/* Customer requests and rebates (requests.js) */
.rq-card { padding: 10px 2px; border-bottom: 1px solid rgba(25, 20, 36, .08); overflow-wrap: anywhere; }
.rq-card small { color: var(--muted); }
.rq-x { display: inline-block; margin-left: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 140, 60, .16); font-size: 12px; font-weight: 700; }
.rq-note { margin: 4px 0; font-size: 14px; }
.rq-ans { margin: 6px 0; padding: 6px 10px; border-radius: 10px; background: rgba(25, 20, 36, .06); font-size: 14px; }
.rq-procure, .rq-ordered { background: rgba(0, 170, 120, .14); }
.rq-slow, .rq-disc, .rq-cant { background: rgba(220, 50, 50, .1); }
.rq-pick { margin: 8px 0; font-size: 16px; }
.rb-reported { background: rgba(255, 170, 40, .2); } .rb-claimed { background: rgba(60, 120, 255, .14); } .rb-received { background: rgba(0, 170, 120, .16); } .rb-denied { background: rgba(220, 50, 50, .12); }
.rb-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rb-kpis .kpi-card { padding: 14px; } .rb-kpis span, .rb-kpis small { display: block; color: var(--muted); font-size: 13px; } .rb-kpis b { display: block; font-size: 24px; margin: 4px 0; }
.rb-photo { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto 8px; border-radius: 12px; }
#reqBody > .panel, #rebBody > .panel { margin-bottom: 16px; }

/* Sign-in notice (consent.js): above everything, including the login screen */
.cs-overlay { z-index: 10000; background: rgba(10, 4, 20, .82); }
.cs-box { max-width: 640px; background: #fff !important; -webkit-backdrop-filter: none; backdrop-filter: none; }
.cs-body { font-size: 15px; line-height: 1.45; }
.cs-body h4 { margin: 14px 0 4px; font-size: 15px; }
.cs-body ul { margin: 0; padding-left: 20px; } .cs-body li { margin: 4px 0; }
.cs-agree { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px; border-radius: 12px; background: rgba(255, 190, 60, .18); font-weight: 600; }
.cs-agree input { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.cs-declined { padding: 10px; border-radius: 10px; background: rgba(220, 50, 50, .12); font-weight: 700; }

/* Price review: long list scrolls inside the panel */
.pr-scroll { max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.au-dup { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; font-size: .85em; white-space: nowrap; }

/* No zooming (pinch or double-tap); scrolling still works */
html, body { touch-action: pan-x pan-y; }
.dev-who { display: inline-flex; gap: 4px; align-items: center; margin-left: 12px; }

/* Invoice scanner: full-screen live camera with a bar at the bottom */
.pc-scan { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; flex-direction: column; }
.pc-scan video { flex: 1; width: 100%; min-height: 0; object-fit: contain; }
.pc-scan-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: #111; color: #fff; }
.pc-scan-bar span { flex: 1 1 100%; font-size: 15px; }
