:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #23201d;
  --muted: #74706b;
  --accent: #c0442c;
  --accent-dark: #9c3521;
  --line: #e7e2db;
  --ok: #3b8a5d;
  --warn: #c98a1c;
  --danger: #b1362f;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--accent); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.topbar {
  background: var(--ink);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

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

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 10px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  transition: background 0.15s ease;
}

button:hover { background: var(--accent-dark); }

button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.secondary:hover { background: #f0ede8; }

button.danger { background: var(--danger); }
button.danger:hover { background: #8f2a24; }

h2 { margin-top: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}
.badge.prep { background: var(--warn); }
.badge.ready { background: var(--ok); }
.badge.served { background: #667; }
.badge.cancelled { background: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }

.product-card {
  display: flex;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}
.product-card img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  background: #eee;
  flex-shrink: 0;
}
.product-info { flex: 1; display: flex; flex-direction: column; }
.product-info h4 { margin: 0 0 4px; }
.product-info p { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; flex: 1; }
.product-footer { display: flex; align-items: center; justify-content: space-between; }
.price { font-weight: 700; color: var(--accent); }

.qty-control { display: flex; align-items: center; gap: 8px; }
.qty-control button {
  width: 30px; height: 30px; padding: 0; line-height: 1;
  border-radius: 50%; font-size: 1.1rem;
}
.qty-control span { min-width: 18px; text-align: center; font-weight: 600; }

.cart-fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
  border: none;
  z-index: 20;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 30;
}
.modal-sheet {
  background: #fff; width: 100%; max-width: 520px;
  border-radius: 18px 18px 0 0; padding: 20px; max-height: 80vh; overflow-y: auto;
}
.cart-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }

.category-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.category-tabs button {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  white-space: nowrap; border-radius: 999px; padding: 8px 16px; font-weight: 600;
}
.category-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.muted { color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

.qr-thumb { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; }
.flash.ok { background: #e4f4ea; color: var(--ok); }
.flash.error { background: #fbe6e4; color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button {
  background: none; color: var(--muted); border: none; border-radius: 0;
  padding: 10px 16px; font-weight: 600; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.hidden { display: none !important; }

footer.hint { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 30px; }
