/* QCUT design system — silver ground, white surfaces, black actions,
   gold only for badges + section labels, zero border-radius. */

:root {
  --color-primary: #171715;
  --color-primary-dark: #000000;
  --color-bg: #e9e8e4;
  --color-surface: #ffffff;
  --color-text: #171715;
  --color-muted: #7a7975;
  --color-border: #cfceca;
  --color-hairline: #dddcd8;
  --color-tint: #f2f1ea;
  --color-gold: #b8923f;
  --color-gold-dark: #9c7a2e;
  --color-danger: #b3261e;
  --color-danger-bg: #fceceb;
  --color-danger-line: #f2c6c3;
  --radius: 0px;
  --spacing: 16px;
  --tap: 44px;
  --bar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  background: var(--color-bg);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* Phone-width column, centred on larger screens */
.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
}
@media (min-width: 481px) {
  .app { border-left: 1px solid var(--color-hairline); border-right: 1px solid var(--color-hairline); }
}
.app.has-tabbar { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }

.container { max-width: 480px; margin: 0 auto; padding: var(--spacing); }
.pad { padding: 0 var(--spacing); }

h1, h2, h3 { margin: 0; font-weight: 500; }
p { margin: 0; }

/* ---------- Brand ---------- */

.brand-logo { display: block; height: 12px; width: auto; }
.brand-logo.lg { height: auto; width: 105px; max-width: 70%; margin: 0 auto; }
.tagline {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- Alerts ---------- */

#alert { margin-bottom: 0; }
#alert:not(:empty) { padding: 12px var(--spacing) 0; }

.alert { padding: 12px 16px; font-size: 14px; }
.alert.error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-line);
}
.alert.success {
  background: var(--color-tint);
  color: var(--color-gold-dark);
  border: 1px solid var(--color-gold);
}

/* ---------- Buttons ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 0 20px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
button:hover, .btn:hover { background: var(--color-primary-dark); }
button:active, .btn:active { background: var(--color-primary-dark); }

button:disabled, .btn:disabled {
  background: var(--color-hairline);
  border-color: var(--color-hairline);
  color: var(--color-muted);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover, .btn-ghost:active { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-text); }

.btn-sm { width: auto; min-height: 34px; padding: 0 16px; font-size: 11px; }
.btn-auto { width: auto; }

.icon-btn {
  width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.icon-btn:hover, .icon-btn:active { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-text); }

.text-btn {
  width: auto;
  min-height: var(--tap);
  padding: 0 4px;
  background: transparent;
  color: var(--color-muted);
  border: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
}
.text-btn:hover, .text-btn:active { background: transparent; color: var(--color-text); }

/* ---------- Forms ---------- */

input, select {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  color: var(--color-text);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--color-primary); }
input::placeholder { color: var(--color-muted); }

.field-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 6px;
}

.search {
  position: relative;
  margin: 0;
}
.search input { margin: 0; padding-left: 40px; }
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--color-muted);
  fill: none;
  stroke-width: 1.6;
  pointer-events: none;
}

/* ---------- Surfaces ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius);
  padding: var(--spacing);
  margin-bottom: 12px;
}

.label-gold, .eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gold-dark);
}

.badge-gold {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: #ffffff;
  background: var(--color-gold);
  padding: 3px 7px;
}

.muted { color: var(--color-muted); }

.empty-state {
  padding: 56px var(--spacing);
  text-align: center;
  color: var(--color-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px var(--spacing);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-hairline);
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar .title { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.topbar .sub { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-muted); }
.topbar .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-split { justify-content: space-between; }

/* ---------- Chips / tabs ---------- */

.chips {
  display: flex;
  gap: 8px;
  padding: 12px var(--spacing);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-hairline);
}
.chips::-webkit-scrollbar { display: none; }
.chips.sticky { position: sticky; top: var(--sticky-top, 64px); z-index: 9; }
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
}
.chip.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ---------- Lists ---------- */

.list { padding: 12px var(--spacing) 20px; display: flex; flex-direction: column; gap: 8px; }

.row-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.row-card:hover, .row-card:active { border-color: var(--color-primary); }
.row-card .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-card .strong { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; }
.row-card .small { font-size: 12px; color: var(--color-muted); }
.row-card .amount { font-size: 15px; font-weight: 500; margin-top: 10px; }
.row-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.chev { color: var(--color-muted); font-size: 18px; line-height: 1; }

/* ---------- Status badges (one map for every page) ---------- */

.status-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  white-space: nowrap;
}
.status-pending, .status-paid { background: var(--color-tint); color: var(--color-gold-dark); border: 1px solid var(--color-gold); }
.status-outlet_paid, .status-outlet_notified { background: var(--color-primary); color: #fff; }
.status-prepared, .status-awaiting_pickup { background: var(--color-gold); color: #fff; }
.status-picked_up, .status-complete { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); }
.status-cancelled { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-line); }

/* ---------- Section blocks / summaries ---------- */

.section { padding: 20px var(--spacing); border-bottom: 1px solid var(--color-hairline); }
.section > h3 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin: 0 0 12px;
}
.item-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 7px 0; }
.item-row .qty { color: var(--color-muted); }

.summary-row { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; }
.summary-row.credit { color: var(--color-gold-dark); }
.summary-row.total {
  font-weight: 600;
  font-size: 16px;
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  padding-top: 12px;
}

.note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-muted);
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-hairline);
}

/* ---------- Quantity stepper ---------- */

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--color-border); background: var(--color-surface); }
.stepper button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  background: transparent;
  color: var(--color-text);
  border: none;
}
.stepper button:hover, .stepper button:active { background: var(--color-bg); color: var(--color-text); }
.stepper .qty { min-width: 28px; text-align: center; font-size: 14px; font-weight: 600; }

/* ---------- Bottom tab bar (customer) ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 15;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: var(--bar-h);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-muted);
  border-top: 2px solid transparent;
  margin-top: -1px;
}
.tabbar a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.tabbar a.active { color: var(--color-text); border-top-color: var(--color-primary); }

/* ---------- Bottom sheet ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 23, 21, 0.5);
  display: none;
  z-index: 30;
}
.overlay.visible { display: block; }
.sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--color-surface);
  padding: 20px var(--spacing) calc(20px + env(safe-area-inset-bottom));
  animation: sheet-in 0.22s ease-out;
}
@keyframes sheet-in {
  from { transform: translate(-50%, 24px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.01em; }
