:root {
  --bg: #faf6f1;
  --card: #ffffff;
  --ink: #1f1a17;
  --muted: #74685f;
  --line: #e9e0d6;
  --brand: #b8321f;
  --brand-dark: #8f2515;
  --brand-soft: #fbe9e5;
  --ok: #1e7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a6200;
  --warn-soft: #fdf1d9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 26, 23, .06), 0 4px 16px rgba(31, 26, 23, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.loading { padding: 80px 20px; text-align: center; color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Header */
.hero {
  background: var(--brand);
  color: #fff;
  padding: 28px 0 22px;
}
.hero h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.01em; }
.hero .addr { opacity: .85; font-size: 14px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 6px 12px;
  background: rgba(255,255,255,.16); border-radius: 999px; font-size: 14px; font-weight: 600;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #7dffb0; }
.status-pill.closed .dot { background: #ffd27d; }
.status-pill.paused .dot { background: #ff9d8f; }

.notice {
  margin: 16px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn); font-size: 14px;
}
.notice a { color: inherit; font-weight: 600; }

/* Kategorinavigering */
.cats {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.cats .wrap { display: flex; gap: 8px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.cats .wrap::-webkit-scrollbar { display: none; }
.cats a {
  flex: none; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px;
}
.cats a.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Meny */
.category { padding-top: 22px; scroll-margin-top: 60px; }
.category h2 { font-size: 20px; margin: 0 0 10px; }
.product {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.product:active { transform: scale(.995); }
.product h3 { margin: 0 0 2px; font-size: 16px; }
.product p { margin: 0; color: var(--muted); font-size: 14px; }
.product .allergens { font-size: 12px; color: var(--muted); margin-top: 4px; }
.product .price { font-weight: 700; white-space: nowrap; text-align: right; }
.product .lunch { display: block; font-size: 12px; font-weight: 600; color: var(--ok); }
.product .add {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; margin-top: 6px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 20px; line-height: 1;
}
.product.sold-out { opacity: .55; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted);
}
.badge.red { background: var(--brand-soft); color: var(--brand); }
.badge.green { background: var(--ok-soft); color: var(--ok); }

footer.page-foot { padding: 30px 16px 120px; text-align: center; color: var(--muted); font-size: 13px; }

/* Varukorgsknapp */
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px 18px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 16px;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #c9bfb6; cursor: not-allowed; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn .count { background: rgba(255,255,255,.22); padding: 2px 9px; border-radius: 999px; font-size: 14px; }
.btn.spread { justify-content: space-between; }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 6px 0; }

/* Produktfönster */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(20, 14, 10, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .18s ease-out;
}
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
}
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; gap: 10px; }
.sheet h2 { margin: 0; font-size: 22px; }
.close-x { background: var(--bg); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; flex: none; }
.sheet .desc { color: var(--muted); margin: 6px 0 0; }
fieldset { border: 0; padding: 0; margin: 20px 0 0; }
legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
legend small { font-weight: 400; color: var(--muted); }
.opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.opt:last-child { border-bottom: 0; }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.opt span:first-of-type { flex: 1; }
.opt .p { color: var(--muted); font-size: 14px; }
.opt.disabled { opacity: .5; }
textarea, input[type=text], input[type=tel], input[type=email], select {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
}
textarea:focus, input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.qty-row { display: flex; gap: 12px; align-items: center; margin-top: 20px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; }
.stepper button { width: 44px; height: 48px; background: none; border: 0; font-size: 22px; }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }
.qty-row .btn { flex: 1; }

/* Kassa */
.page-top { display: flex; align-items: center; gap: 10px; padding: 16px 0; }
.page-top h1 { font-size: 22px; margin: 0; }
.back { background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 40px; height: 40px; font-size: 18px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.panel h2 { font-size: 17px; margin: 0 0 10px; }
.line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .qty { font-weight: 700; min-width: 26px; }
.line .name { flex: 1; }
.line .name small { color: var(--muted); }
.line .amount { font-weight: 600; white-space: nowrap; }
.mod { font-size: 13px; color: var(--muted); }
.mod-remove { color: var(--brand); }
.line-actions { display: flex; gap: 14px; margin-top: 4px; }
.line-actions button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; }
.totals { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; padding-top: 12px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px;
}
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--brand); }
.choice strong { display: block; }
.choice small { color: var(--muted); }
.time-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.error-box { background: var(--brand-soft); color: var(--brand-dark); padding: 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.fine { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 30px; }

/* Orderstatus */
.status-hero { text-align: center; padding: 26px 16px 10px; }
.status-hero .label { color: var(--muted); font-size: 14px; }
.status-hero .number { font-size: 64px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; }
.status-hero .headline { font-size: 22px; font-weight: 800; margin-top: 8px; }
.status-hero .sub { color: var(--muted); margin-top: 4px; }
.steps { display: flex; justify-content: space-between; margin: 22px 0 18px; position: relative; }
.steps::before { content: ""; position: absolute; top: 14px; left: 10%; right: 10%; height: 3px; background: var(--line); }
.step { position: relative; flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.step .circle {
  width: 30px; height: 30px; margin: 0 auto 6px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--line);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.step.done .circle { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.current .circle { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 6px var(--brand-soft); }
.step.current { color: var(--ink); font-weight: 700; }
.big-state {
  border-radius: var(--radius); padding: 16px; text-align: center; font-weight: 700; margin-bottom: 14px;
}
.big-state.ok { background: var(--ok-soft); color: var(--ok); }
.big-state.bad { background: var(--brand-soft); color: var(--brand-dark); }
.big-state.wait { background: var(--warn-soft); color: var(--warn); }
.demo-pay { border: 2px dashed var(--warn); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 15px; }
.kv span:first-child { color: var(--muted); }

#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); }
.toast-error { background: var(--brand-dark); }
