:root {
  --accent: #0f172a;
  --accent-dk: #0b1220;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #dc2626;
  --r: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.05);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg); color: var(--text-1);
  padding-bottom: 120px;
}

/* Header */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--accent); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
}
.appbar .title { font-size: 17px; font-weight: 800; flex: 1; }
.appbar .table-chip {
  background: rgba(255,255,255,.18); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 700;
}
.lang-btn {
  background: rgba(255,255,255,.16); color:#fff; border: none;
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer;
}

/* Offline banner */
.net-banner {
  display: none; align-items: center; gap: 8px;
  background: #fff7ed; color: #c2410c; border-bottom: 1px solid #fed7aa;
  padding: 8px 14px; font-size: 12.5px; font-weight: 700;
}
.net-banner.show { display: flex; }
body.offline .net-banner.offline-b { display: flex; }

/* Category tabs */
.cats {
  position: sticky; top: 52px; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px;
  background: var(--bg); -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.cat.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Menu grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 14px 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.card .thumb {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eef2f7; display: block;
}
.card .no-thumb { width:100%; aspect-ratio:4/3; background:linear-gradient(135deg,#eef2f7,#e2e8f0); }
.card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.card .price { font-size: 15px; font-weight: 800; color: var(--accent); }
.card .soldout { font-size: 11px; color: var(--red); font-weight: 700; }
.qty {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.qty button {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; font-size: 20px; font-weight: 700; cursor: pointer; line-height: 1;
}
.qty button.plus { background: var(--accent); color: #fff; border-color: var(--accent); }
.qty .n { font-size: 16px; font-weight: 800; min-width: 22px; text-align: center; }
.qty .n.has { color: var(--accent); }

/* Cart bar */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px rgba(0,0,0,.06);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.cartbar .row { display: flex; align-items: center; gap: 12px; }
.cartbar .tot { flex: 1; }
.cartbar .tot .lbl { font-size: 11px; color: var(--text-3); font-weight: 700; }
.cartbar .tot .val { font-size: 22px; font-weight: 900; }
.cartbar .sub { font-size: 11px; color: var(--text-3); }
.btn-send {
  border: none; background: var(--accent); color: #fff;
  border-radius: 12px; padding: 14px 22px; font-size: 15px; font-weight: 800; cursor: pointer;
}
.btn-send:disabled { opacity: .5; }
.pending-pill {
  display:none; margin-left:8px; background:#fff7ed; color:#c2410c;
  border-radius:999px; padding:3px 9px; font-size:11px; font-weight:800;
}
.pending-pill.show { display:inline-block; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.55);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.overlay.show { display: flex; }
.sheet {
  background:#fff; border-radius: 18px; padding: 26px 22px; max-width: 340px; width: 100%;
  text-align: center; box-shadow: var(--shadow);
}
.sheet .emoji { font-size: 46px; }
.sheet h3 { margin: 10px 0 6px; font-size: 19px; }
.sheet p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.sheet .ok { margin-top: 18px; }

.loading { text-align: center; padding: 60px 0; color: var(--text-3); }
.spinner {
  width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.shop-banner { width: 100%; max-height: 190px; object-fit: cover; display: block; }
