:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2329;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #ff7a00;
  --primary-dark: #e56a00;
  --green: #16a34a;
  --blue: #2563eb;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(17, 24, 39, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #111827; color: #fff;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; }
.topbar .brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; font-size: 16px; }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: rgba(255,255,255,.78); font-size: 13px; }
.topbar nav a:hover, .topbar nav a.active { color: #fff; }
.topbar .role { font-size: 12px; color: rgba(255,255,255,.7); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 20px; }
.wrap.narrow { max-width: 760px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card h3 { font-size: 14px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.hr { height: 1px; background: var(--line); margin: 12px 0; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13px;
  transition: .15s ease;
}
.btn:hover { border-color: #cfd4dc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f3f4f6; color: #4b5563; }
.badge.pending_payment { background: #fff7ed; color: #c2410c; }
.badge.paid { background: #eff6ff; color: #1d4ed8; }
.badge.accepted, .badge.preparing { background: #fefce8; color: #a16207; }
.badge.ready { background: #ecfdf5; color: #047857; }
.badge.assigned, .badge.picked_up { background: #f0f9ff; color: #0369a1; }
.badge.delivered, .badge.completed { background: #f0fdf4; color: #15803d; }
.badge.cancelled { background: #fef2f2; color: #b91c1c; }

.kpi { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.kpi .hint { color: var(--muted); font-size: 11px; margin-top: 2px; }

.menu-item, .store-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.menu-item:last-child, .store-item:last-child { border-bottom: 0; }
.menu-item .name { font-weight: 600; }
.menu-item .desc { color: var(--muted); font-size: 12px; }
.price { color: var(--primary); font-weight: 700; }

.cart-bar {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: 0 -4px 16px rgba(17,24,39,.06);
}
.cart-line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: #fff; }

.order-list { display: grid; gap: 10px; }
.order-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.order-card .meta { color: var(--muted); font-size: 12px; }
.order-card .items { margin: 8px 0; font-size: 13px; }
.order-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.timeline { list-style: none; margin: 6px 0 0; padding: 0; }
.timeline li { position: relative; padding-left: 16px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.timeline li .to { color: var(--ink); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafafa; }
tr:hover td { background: #fcfcfd; }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 99;
}
.toast.show { opacity: 1; }
.toast.error { background: #b91c1c; }

.mobile-app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #fff; box-shadow: 0 0 24px rgba(17,24,39,.06); }
.mobile-head { padding: 14px 16px 10px; background: linear-gradient(135deg, #fff7ed, #fff); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.mobile-head h1 { font-size: 18px; }
.mobile-body { padding: 14px 16px 90px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.section-title h2 { font-size: 15px; }
.store-chip { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; }
.store-chip.active { border-color: var(--primary); background: #fff7ed; }

@media (max-width: 640px) {
  .wrap { padding: 14px; }
  .topbar { padding: 10px 14px; }
  .topbar nav { gap: 10px; }
  th, td { padding: 8px 6px; }
}