:root {
  --bg: #08080a;
  --surface: #111116;
  --card: #16161d;
  --border: rgba(230, 203, 153, 0.14);
  --border-s: rgba(230, 203, 153, 0.36);
  --gold: #ecd5a7;
  --gold-mid: #c69c56;
  --text: #f4f1ea;
  --muted: #8b867d;
  --green: #4ecb8d;
  --amber: #f0b45b;
  --red: #e86b6b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; overflow: hidden; height: 100vh;
}
.hidden { display: none !important; }
.gold { color: var(--gold); }
.muted { color: var(--muted); font-size: 12px; }
code { background: rgba(236, 213, 167, 0.12); color: var(--gold); padding: 2px 6px; border-radius: 4px; }

/* Login */
.login-shell {
  height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 0%, rgba(198, 156, 86, 0.14), transparent 55%), var(--bg);
}
.login-card {
  width: 100%; max-width: 390px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; padding: 34px 28px;
}
.brand-en { text-align: center; font-size: 24px; letter-spacing: 5px; color: var(--gold); font-weight: 600; }
.brand-cn { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 24px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: #0c0c10; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; outline: none;
}
.err-msg { color: var(--red); font-size: 12px; min-height: 18px; margin-bottom: 10px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.login-hint a { color: var(--gold); text-decoration: none; }

/* Buttons */
.btn-gold {
  background: linear-gradient(135deg, #ecd5a7, #c69c56); color: #14110b;
  font-weight: 600; border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer;
}
.btn-gold.big { padding: 14px; font-size: 15px; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05); color: var(--text); text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px;
  padding: 6px 11px; font-size: 12px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--border-s); color: var(--gold); }
.btn-ghost.sm { padding: 4px 9px; font-size: 11px; }
.full { width: 100%; }

/* Topbar */
.pos-shell { display: flex; flex-direction: column; height: 100vh; }
.pos-top {
  height: 58px; padding: 0 18px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.pos-brand { display: flex; align-items: center; gap: 10px; }
.pb-en { font-size: 18px; letter-spacing: 4px; color: var(--gold); font-weight: 600; }
.pb-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.pos-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-pill { font-size: 12px; color: var(--green); margin-right: 4px; }
.staff-chip { font-size: 12px; color: var(--gold); padding: 4px 10px; background: rgba(236, 213, 167, 0.1); border-radius: 999px; }

/* 3-Column POS Workspace */
.pos-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 310px 1fr 340px;
}
.col-left, .col-center, .col-right {
  min-height: 0; display: flex; flex-direction: column; padding: 14px;
}
.col-left { background: #0e0e12; border-right: 1px solid var(--border); }
.col-center { background: var(--bg); }
.col-right { background: #101015; border-left: 1px solid var(--border); }

.col-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; font-size: 13px; font-weight: 500;
}
.badge {
  background: rgba(240, 180, 91, 0.2); color: var(--amber);
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
}

/* Tables */
.pos-table-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pt-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 6px; text-align: center; cursor: pointer; color: var(--text);
}
.pt-btn.OCCUPIED { border-color: rgba(240, 180, 91, 0.45); background: rgba(240, 180, 91, 0.08); }
.pt-btn.RESERVED { border-color: rgba(236, 213, 167, 0.45); }
.pt-btn.selected { border: 2px solid var(--gold); box-shadow: 0 0 0 2px rgba(236, 213, 167, 0.16); }
.pt-no { font-size: 15px; font-weight: 600; color: var(--gold); }
.pt-st { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Incoming Orders */
.pos-order-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.po-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 11px;
}
.po-card.PENDING { border-color: var(--amber); background: rgba(240, 180, 91, 0.07); }
.po-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.po-items { font-size: 12px; color: #d7d2c8; line-height: 1.6; margin-bottom: 8px; }
.po-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* Menu Center */
.cat-bar { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 4px; flex-shrink: 0; }
.cat-pill {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 16px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.cat-pill.active { background: linear-gradient(135deg, #ecd5a7, #c69c56); color: #14110b; border-color: transparent; font-weight: 600; }

.prod-grid {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px; align-content: start;
}
.p-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, transform .1s;
}
.p-tile:hover { border-color: var(--border-s); }
.p-tile:active { transform: scale(0.98); }
.p-tile.soldout { opacity: 0.42; pointer-events: none; }
.p-top { display: flex; gap: 10px; align-items: center; }
.p-img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #0b0b0f; flex-shrink: 0; }
.p-name { font-size: 14px; font-weight: 500; line-height: 1.3; }
.p-desc { font-size: 11px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.p-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.p-price { font-size: 16px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.p-plus {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #ecd5a7, #c69c56); color: #14110b;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Cart Right */
.cart-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.cart-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.cr-name { font-size: 13px; font-weight: 500; }
.cr-spec { font-size: 11px; color: var(--muted); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-s);
  background: transparent; color: var(--gold); cursor: pointer; font-size: 15px;
}

.checkout-box { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.member-row { display: flex; gap: 6px; }
.member-row input, .remark-input {
  flex: 1; width: 100%; background: #0a0a0e; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; outline: none;
}
.member-info { font-size: 12px; color: var(--gold); min-height: 16px; }
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pay-btn {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 8px; border-radius: 9px; font-size: 12px; cursor: pointer;
}
.pay-btn.active { border-color: var(--gold); color: var(--gold); background: rgba(236, 213, 167, 0.12); font-weight: 600; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; }
.total-num { font-size: 26px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }

/* Spec Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 420px; background: #15151b;
  border: 1px solid var(--border-s); border-radius: 16px; padding: 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.icon-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.spec-group { margin-bottom: 14px; }
.spec-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.spec-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #0d0d11; color: var(--text); font-size: 12px; cursor: pointer;
}
.spec-chip.active { background: rgba(236, 213, 167, 0.18); border-color: var(--gold); color: var(--gold); }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 120; background: #1e1d19; border: 1px solid var(--gold-mid);
  color: var(--gold); padding: 9px 18px; border-radius: 999px; font-size: 13px;
}

/* Thermal Receipt Print Styles */
.receipt-print { display: none; }
@media print {
  body * { visibility: hidden; }
  .receipt-print, .receipt-print * { visibility: visible; }
  .receipt-print {
    display: block; position: fixed; left: 0; top: 0; width: 58mm;
    color: #000; background: #fff; font-family: monospace; font-size: 12px; padding: 6px;
  }
}
@media (max-width: 1024px) {
  body { overflow: auto; height: auto; }
  .pos-shell { height: auto; }
  .pos-grid { grid-template-columns: 1fr; }
}
