:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #20242e;
  --line: #2a2f3a;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --brand: #ff5a3c;
  --brand-2: #ff8a3c;
  --green: #2ecc71;
  --red: #ff5a5a;
  --yellow: #f1c40f;
  --blue: #4aa3ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
header.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
header.top .logo { font-weight: 800; font-size: 18px; color: var(--brand); letter-spacing: .5px; }
header.top nav { display: flex; gap: 6px; flex-wrap: wrap; }
header.top nav a {
  color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600;
}
header.top nav a:hover { background: var(--panel-2); color: var(--text); }
.container { max-width: 1180px; margin: 0 auto; padding: 20px; }
.grid { display: grid; gap: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.card .big { font-size: 26px; font-weight: 800; }
button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
}
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-2); }
button.ghost { background: transparent; }
button.danger { color: var(--red); border-color: #5a2a2a; }
button.sm { padding: 5px 10px; font-size: 12px; }
input, select, textarea {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%;
}
label { display: block; color: var(--muted); margin: 8px 0 4px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.pending { background: #3a2f12; color: var(--yellow); }
.tag.preparing { background: #12304a; color: var(--blue); }
.tag.ready { background: #123a22; color: var(--green); }
.tag.completed { background: #2a2f3a; color: var(--muted); }
.tag.delivery { background: #3a1230; color: #ff7ad9; }
.tag.qr { background: #12303a; color: var(--blue); }
.tag.dine_in { background: #2a3a12; color: #b6ff5a; }
.low { color: var(--red); font-weight: 700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 120px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 10px; }
.dish {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  cursor: pointer; transition: .15s;
}
.dish-img { width: 100%; aspect-ratio: 4/3; object-fit: contain; border-radius: 8px; margin-bottom: 8px; background: #0f1218; }
.dish:hover { border-color: var(--brand); transform: translateY(-2px); }
.dish .name { font-weight: 700; }
.dish .name .cn, .cn { font-weight: 400; color: var(--muted); font-size: .82em; margin-left: 6px; }
.dish .price { color: var(--brand-2); font-weight: 800; margin-top: 4px; }
.dish.disabled { opacity: .4; }
.cat-title { margin: 18px 0 8px; font-weight: 800; color: var(--muted); }
.cart { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 14px; }
.cart-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kds-order { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.kds-order .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qr-img { background:#fff; padding:10px; border-radius:10px; display:inline-block; }
.pay-panel { position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:40; display:flex; align-items:center; justify-content:center; padding:18px; }
.pay-panel .box { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; width:330px; text-align:center; max-width:92vw; }
.pay-panel .box img { width:230px; height:230px; object-fit:contain; background:#fff; border-radius:10px; padding:10px; }
.pay-panel .amount { font-size:24px; font-weight:800; color:var(--brand-2); margin:10px 0; }
.pay-uploader { display:flex; align-items:center; gap:10px; padding:10px; background:var(--panel-2); border-radius:10px; margin-bottom:10px; }
.pay-uploader img { width:64px; height:64px; object-fit:contain; background:#fff; border-radius:6px; }
.pay-uploader .info { flex:1; text-align:left; }
.muted { color: var(--muted); }
.pill { background: var(--panel-2); border:1px solid var(--line); border-radius:999px; padding:4px 10px; font-size:12px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #04210f; padding: 10px 18px; border-radius: 10px; font-weight: 700;
  opacity: 0; transition: .25s; z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; }
.split { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
@media (max-width: 820px){ .split { grid-template-columns: 1fr; } }

/* ---------- 小票打印 ---------- */
.print-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: #fff; color: #111; padding: 10px 14px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 60; }
/* 屏幕预览/打印内容（打印时独立成页） */
.receipt { display: none; font-family: "Courier New", ui-monospace, Menlo, Consolas, monospace; color: #000; background: #fff; }
.receipt .r-shop { text-align: center; font-size: 16px; font-weight: 800; letter-spacing: .5px; }
.receipt .r-sub { text-align: center; font-size: 11px; color: #333; }
.receipt .r-meta { font-size: 11px; line-height: 1.5; }
.receipt .r-head, .receipt .r-row { display: flex; font-size: 12px; }
.receipt .r-name { flex: 1; text-align: left; }
.receipt .r-qty { width: 38px; text-align: center; }
.receipt .r-amt { width: 70px; text-align: right; }
.receipt .r-head { font-weight: 700; border-bottom: 1px dashed #000; padding-bottom: 3px; }
.receipt .r-row { padding: 2px 0; }
.receipt .r-total { font-weight: 800; font-size: 13px; }
.receipt .r-center { text-align: center; }
.receipt .r-thanks { font-weight: 800; margin-top: 6px; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }

@media print {
  @page { size: 80mm auto; margin: 3mm; }   /* 58mm 打印机改为 size: 58mm */
  html, body { background: #fff !important; }
  body > *:not(#receipt) { display: none !important; }
  #receipt { display: block !important; width: 74mm; margin: 0 auto; padding: 0; background: #fff; color: #000; }
  .print-bar { display: none !important; }
}
