:root {
  --bg: #efefea;
  --surface: #ffffff;
  --ink: #15171c;
  --muted: #5d626b;
  --line: #d9dad3;
  --accent: #f2b705;
  --on-accent: #15171c;
  --bar: #15171c;
  --on-bar: #f4f4ef;
  --bar-muted: #b4b8bf;
  --bar-track: #3a3d45;
  --cust-a: #1f3a8a;
  --on-a: #ffffff;
  --cust-b: #f2b705;
  --on-b: #15171c;
  --cust-c: #ffffff;
  --on-c: #15171c;
  --cust-d: #5d626b;
  --on-d: #ffffff;
  --check: #15171c;
  --on-check: #ffffff;
  --warn-bg: #fff3c9;
  --warn-ink: #574100;
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", "Segoe UI", sans-serif;
  --font-name: "Arial Narrow", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  --bar-h: 84px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --surface: #191c21;
    --ink: #ecede8;
    --muted: #a3a8b1;
    --line: #2b2f36;
    --bar: #191c21;
    --on-bar: #ecede8;
    --bar-muted: #a3a8b1;
    --bar-track: #33363d;
    --cust-a: #a9bcff;
    --on-a: #15171c;
    --cust-b: #f2b705;
    --on-b: #15171c;
    --cust-c: #ecede8;
    --on-c: #15171c;
    --cust-d: #a3a8b1;
    --on-d: #15171c;
    --check: #f2b705;
    --on-check: #15171c;
    --warn-bg: #3a2f0a;
    --warn-ink: #f6dc8a;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* count bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar);
  color: var(--on-bar);
}
.bar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
}
.count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.count-label {
  font-size: 13px;
  color: var(--bar-muted);
}
.count-num {
  font-family: var(--font-name);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.count-total {
  font-family: var(--font-name);
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  color: var(--bar-muted);
  font-variant-numeric: tabular-nums;
}
.bar-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  min-width: 0;
}
.status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-bar);
  white-space: nowrap;
}
.status svg {
  flex: none;
}
.status[data-icon="offline"] {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
}
.cust {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cust-t {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-name);
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.track {
  height: 5px;
  background: var(--bar-track);
}
.fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* customer badge, the same letters as the delivery app */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex: none;
  background: var(--cust-d);
  color: var(--on-d);
}
.badge[data-c="A"] {
  background: var(--cust-a);
  color: var(--on-a);
}
.badge[data-c="B"] {
  background: var(--cust-b);
  color: var(--on-b);
}
.badge[data-c="C"] {
  background: var(--cust-c);
  color: var(--on-c);
  box-shadow: inset 0 0 0 1.5px var(--on-c);
}

/* strip under the bar */
.strip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 4px;
}
.src {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.pill {
  align-self: flex-start;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pill[aria-pressed="true"] {
  background: var(--check);
  border-color: var(--check);
  color: var(--on-check);
}
.notice {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
}
.notice p {
  margin: 0;
}
.notice .ghost-btn {
  margin-top: 8px;
}
.conflict {
  position: sticky;
  top: var(--bar-h);
  z-index: 15;
  margin: 10px 16px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.conflict strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.conflict-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* store areas */
.sec-head {
  position: sticky;
  top: var(--bar-h);
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 7px;
  background: var(--bg);
}
.sec-name {
  margin: 0;
  font-family: var(--font-name);
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.sec-left {
  flex: none;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sec-left.done {
  color: var(--ink);
  font-weight: 600;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rows li + li {
  border-top: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 13px 16px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.row:disabled {
  cursor: default;
}
.box {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border-radius: 9px;
  border: 2px solid var(--muted);
  color: transparent;
}
.body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.name {
  font-family: var(--font-name);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.spec {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip-note {
  font-weight: 500;
  color: var(--muted);
}
.note {
  font-size: 13px;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-radius: 6px;
  padding: 4px 8px;
  align-self: flex-start;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.who {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.who.pending {
  font-weight: 700;
  color: var(--ink);
}
.qty {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 34px;
  font-family: var(--font-name);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.qty small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.item.done .box {
  background: var(--check);
  border-color: var(--check);
  color: var(--on-check);
}
.item.done .name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.item.done .qty {
  color: var(--muted);
}
.item.done .chip,
.item.done .note {
  opacity: 0.65;
}

/* loading, finished */
.ghost {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.ghost i {
  display: block;
  border-radius: 6px;
  background: var(--line);
}
.ghost i:first-child {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.ghost i:last-child {
  height: 14px;
  flex: 1;
  max-width: 220px;
}
.alldone {
  margin: 12px 16px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
}
.alldone strong {
  display: block;
  font-size: 17px;
}
.alldone span {
  font-size: 13px;
  color: var(--muted);
}
.foot {
  padding: 22px 16px 96px;
  font-size: 12px;
  color: var(--muted);
}
.foot p {
  margin: 0;
}

/* full pages: name, expired, no network */
.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
  padding: 30px 20px;
}
.brand {
  font-family: var(--font-name);
  font-size: 24px;
  font-weight: 700;
}
.page h1,
.page h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}
.page p {
  margin: 0;
  color: var(--muted);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.field input {
  min-height: 48px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--muted);
  background: var(--surface);
  font-size: 16px;
  font-weight: 500;
}
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 0;
  background: var(--check);
  color: var(--on-check);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.cta:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.page .err {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--bar);
  color: var(--on-bar);
  font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}
.toast span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.toast button {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 700px) {
  main,
  .page {
    max-width: 640px;
    margin: 0 auto;
  }
  .rows {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }
  .toast {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 420px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fill {
    transition: none;
  }
}
