:root {
  --brand: #cf4a1c;
  --brand-dark: #a83712;
  --brand-soft: #fbe9e0;
  --amber: #e8891b;
  --ink: #2b2119;
  --ink-2: #5b4a3d;
  --muted: #92806f;
  --paper: #fffdf9;
  --bg: #f6efe5;
  --line: #ecdfd0;
  --line-2: #dfd0bd;
  --green: #2f8f45;
  --green-soft: #e6f4e9;
  --blue: #1f6fb2;
  --blue-soft: #e4f0fa;
  --red: #b83232;
  --red-soft: #fbe6e6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(58, 38, 20, .05), 0 8px 24px rgba(58, 38, 20, .07);
  --shadow-lg: 0 24px 60px rgba(58, 38, 20, .18);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--brand); text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 62px;
  background: rgba(255, 253, 249, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

.brand .logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--amber));
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(207, 74, 28, .28);
}

.brand small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 1.5px;
  display: block;
  line-height: 1;
  margin-top: 3px;
}

.topnav { display: flex; gap: 4px; margin-left: auto; }

.topnav a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  transition: .18s;
}

.topnav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.topnav a.active { background: var(--ink); color: #fff8f0; }

.topbar .status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.status-dot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(146, 128, 111, .15);
}
.status-dot.online i { background: var(--green); box-shadow: 0 0 0 3px rgba(47, 143, 69, .16); }
.status-dot.offline i { background: var(--red); box-shadow: 0 0 0 3px rgba(184, 50, 50, .16); }

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { background: #fff; border-color: var(--brand); color: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1c1510; color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #256f36; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  outline: none;
  transition: .16s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(207, 74, 28, .12);
}
.textarea { resize: vertical; min-height: 64px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.badge.pending { background: #fdf0dc; color: #a55a00; }
.badge.cooking { background: var(--blue-soft); color: var(--blue); }
.badge.served { background: var(--green-soft); color: var(--green); }
.badge.completed { background: #eee9e1; color: #6b5c4d; }
.badge.cancelled { background: var(--red-soft); color: var(--red); }
.badge.off { background: #eee9e1; color: #8a7a6d; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--muted);
  text-transform: uppercase;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}
.empty .em { font-size: 34px; opacity: .7; }

.price { font-variant-numeric: tabular-nums; }
.price small { font-size: 12px; }

/* ---------- Toast ---------- */

#toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease;
  max-width: 100%;
}
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ---------- 弹层 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(43, 33, 25, .42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade .18s ease;
}
.modal {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: min(100%, 520px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.close-x {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 20px;
  color: var(--muted);
}
.close-x:hover { background: var(--brand-soft); color: var(--brand); }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px) } to { opacity: 1; transform: none } }

/* ---------- 顾客端 ---------- */

.customer-shell { display: flex; flex-direction: column; min-height: 100vh; }

.hero-pick {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 18px 70px;
  text-align: center;
}
.hero-pick h1 { font-size: clamp(26px, 5vw, 38px); letter-spacing: .5px; }
.hero-pick p { color: var(--muted); margin-top: 8px; }
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  margin-top: 30px;
  text-align: left;
}
.table-pick {
  padding: 16px 12px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: .18s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.table-pick:hover { border-color: var(--brand); transform: translateY(-2px); }
.table-pick b { font-size: 17px; letter-spacing: .5px; }
.table-pick span { font-size: 12px; color: var(--muted); }
.table-pick.busy b::after {
  content: "占用";
  font-size: 10px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 3px;
  font-weight: 600;
}

.menu-wrap {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 340px;
  gap: 18px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  align-items: start;
}

.cat-rail {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}
.cat-rail button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-rail button:hover { background: var(--brand-soft); }
.cat-rail button.active {
  background: var(--ink);
  color: #fff8f0;
  font-weight: 600;
}
.cat-rail button .count { font-size: 11px; opacity: .6; }

.dish-area { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.dish-group { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 92px; }
.dish-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 2px 2px 0;
}
.dish-group-head h2 { font-size: 19px; }
.dish-group-head span { font-size: 12px; color: var(--muted); }

.dish-list { display: flex; flex-direction: column; gap: 10px; }

.dish-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: .18s;
}
.dish-card:hover { box-shadow: var(--shadow); border-color: var(--line-2); }
.dish-thumb {
  width: 84px;
  height: 84px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 38px;
  background: radial-gradient(circle at 30% 25%, #fff6ea, #f4e2ce);
  border: 1px solid #f1e2d1;
}
.dish-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dish-name { font-size: 16px; font-weight: 600; }
.dish-desc {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dish-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.dish-tags span {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f6efe6;
  color: #8a6a4a;
  border: 1px solid #efe1cf;
}
.dish-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }
.dish-price { font-size: 18px; font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.dish-price small { font-size: 12px; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px;
  line-height: 1;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  transition: .14s;
}
.stepper button:hover { border-color: var(--brand); color: var(--brand); }
.stepper .add { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper .add:hover { background: var(--brand-dark); color: #fff; }
.stepper .qty { min-width: 20px; text-align: center; font-weight: 600; font-size: 14px; }
.stepper button:disabled { opacity: .4; }

/* 购物车 */

.cart-panel {
  position: sticky;
  top: 80px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}
.cart-head {
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-head h3 { font-size: 15.5px; }
.cart-head .table-chip {
  font-size: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.cart-items { overflow: auto; padding: 6px 17px; flex: 1; min-height: 110px; }
.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.cart-row:last-child { border-bottom: none; }
.cart-row .name { font-size: 14px; font-weight: 500; }
.cart-row .meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cart-row .note-line { font-size: 11.5px; color: var(--amber); margin-top: 2px; }
.cart-row .ops { display: flex; align-items: center; gap: 8px; }
.link-note {
  font-size: 11.5px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-note:hover { color: var(--brand); }

.cart-foot { padding: 14px 17px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; }
.cart-total span { font-size: 13px; color: var(--muted); }
.cart-total b { font-size: 22px; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.cart-hint { font-size: 11.5px; color: var(--muted); text-align: center; }

.cart-fab {
  display: none;
}

/* 订单追踪 */

.track-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}
.track-bar .spacer { flex: 1; }

.order-sheet { display: flex; flex-direction: column; gap: 12px; }
.order-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.order-line .k { color: var(--muted); }

/* ---------- 看板 / 收银 布局 ---------- */

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h1 { font-size: 24px; letter-spacing: .3px; }
.page-head p { color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.kanban-col {
  background: rgba(255, 253, 249, .55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--line);
}
.kanban-col-head h2 { font-size: 15px; }
.kanban-col-head .n {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f0e8dc;
  border-radius: 6px;
  padding: 1px 8px;
}

.order-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: card-in .24s ease;
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.order-card.is-new { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(232, 137, 27, .16), var(--shadow); }
.order-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffaf2, var(--paper));
}
.order-table {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .5px;
  min-width: 44px;
}
.order-no { font-size: 11.5px; color: var(--muted); }
.order-meta { margin-left: auto; text-align: right; font-size: 11.5px; color: var(--muted); }
.order-items { padding: 6px 14px 10px; display: flex; flex-direction: column; }
.oitem {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.oitem:last-child { border-bottom: none; }
.oitem .q { font-weight: 800; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.oitem .nm { font-size: 14px; font-weight: 500; }
.oitem .nt { font-size: 11.5px; color: var(--amber); }
.oitem.done .nm { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.oitem.done .q { color: var(--muted); }
.oitem .mark {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  background: #fff;
}
.oitem .mark:hover { border-color: var(--green); color: var(--green); }
.order-card-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fdf8f2;
}
.order-card-foot .btn { flex: 1; }
.order-note {
  margin: 5px 14px 0;
  font-size: 12px;
  color: var(--amber);
  background: #fdf5e8;
  border: 1px dashed #f0dcbb;
  border-radius: 7px;
  padding: 5px 9px;
}

/* 收银 */

.cashier-layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-card .k { font-size: 12px; color: var(--muted); }
.stat-card .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-card .v small { font-size: 13px; font-weight: 500; color: var(--muted); }

.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-pick {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: .15s;
}
.order-pick:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.order-pick.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(207, 74, 28, .12); }
.order-pick .t { font-weight: 800; font-size: 16px; min-width: 42px; }
.order-pick .info { display: flex; flex-direction: column; min-width: 0; }
.order-pick .info b { font-size: 13px; font-weight: 500; }
.order-pick .info span { font-size: 11.5px; color: var(--muted); }
.order-pick .amt { margin-left: auto; text-align: right; }
.order-pick .amt b { font-size: 15px; font-variant-numeric: tabular-nums; }
.order-pick .amt span { display: block; font-size: 11px; color: var(--muted); }

.detail-panel { display: flex; flex-direction: column; gap: 16px; }
.bill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.bill-head { padding: 16px 20px; border-bottom: 1px dashed var(--line-2); display: flex; justify-content: space-between; gap: 12px; }
.bill-head h2 { font-size: 20px; }
.bill-head .sub { font-size: 12px; color: var(--muted); }
.bill-items { padding: 8px 20px; max-height: 320px; overflow: auto; }
.bill-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px 96px; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.bill-row:last-child { border-bottom: none; }
.bill-row .q { color: var(--muted); text-align: center; }
.bill-row .a { text-align: right; font-variant-numeric: tabular-nums; }
.bill-sum { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; background: #fdf8f2; }
.bill-sum .line { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.bill-sum .line.total { font-size: 17px; font-weight: 700; color: var(--ink); border-top: 1px dashed var(--line-2); padding-top: 9px; margin-top: 2px; }
.bill-sum .line.total b { color: var(--brand-dark); font-size: 23px; font-variant-numeric: tabular-nums; }

.pay-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-methods { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-method {
  flex: 1;
  min-width: 74px;
  padding: 10px 6px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  text-align: center;
  transition: .15s;
}
.pay-method:hover { border-color: var(--brand); }
.pay-method.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.pay-method .ico { display: block; font-size: 18px; margin-bottom: 2px; }

/* ---------- 管理端 ---------- */

.admin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.admin-toolbar .spacer { flex: 1; }

.dish-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; min-width: 680px; }
table.grid th, table.grid td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fdf8f2; letter-spacing: .4px; position: sticky; top: 0; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fffaf3; }
table.grid td.num { font-variant-numeric: tabular-nums; }
table.grid .actions { display: flex; gap: 6px; justify-content: flex-end; }
.dish-emoji { font-size: 21px; }

.table-links { display: flex; flex-wrap: wrap; gap: 8px; }
.table-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
}
.table-link b { font-size: 13px; }
.table-link button { font-size: 11.5px; color: var(--brand); text-decoration: underline; }

/* ---------- 小票 ---------- */

.receipt-modal .modal { width: min(100%, 380px); }
.receipt {
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #1e1a16;
  background: #fff;
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.receipt .r-center { text-align: center; }
.receipt h2 { font-size: 17px; letter-spacing: 2px; margin-bottom: 2px; }
.receipt .r-sep { border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 10px; }
.receipt .r-row.total { font-size: 15px; font-weight: 700; }
.receipt .r-small { font-size: 11px; color: #666; text-align: center; margin-top: 8px; }

@media print {
  body * { visibility: hidden; }
  #receipt-print, #receipt-print * { visibility: visible; }
  #receipt-print { position: absolute; inset: 0 auto auto 0; width: 72mm; padding: 0; border: none; }
  .receipt-modal { background: #fff; }
  .receipt-modal .modal-header, .receipt-modal .modal-footer { display: none; }
  .receipt-modal .modal { box-shadow: none; max-height: none; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .menu-wrap { grid-template-columns: 168px minmax(0, 1fr) 300px; }
}

@media (max-width: 980px) {
  .dish-group { scroll-margin-top: 150px; }
  .menu-wrap { grid-template-columns: 1fr; padding-bottom: 108px; }
  .cat-rail {
    position: sticky;
    top: 62px;
    z-index: 30;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: -20px -20px 0;
    background: rgba(255, 253, 249, .96);
    backdrop-filter: blur(10px);
  }
  .cat-rail button { white-space: nowrap; padding: 7px 12px; }
  .cat-rail button .count { display: none; }
  .cart-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    border-radius: 20px 20px 0 0;
    max-height: 78vh;
    box-shadow: 0 -16px 50px rgba(58, 38, 20, .22);
    transform: translateY(105%);
    transition: transform .26s cubic-bezier(.2, .9, .3, 1);
  }
  .cart-panel.open { transform: none; }
  .cart-fab {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 26px rgba(58, 38, 20, .1);
  }
  .cart-fab .cf-info { display: flex; align-items: center; gap: 10px; }
  .cart-fab .bag {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 19px;
    position: relative;
  }
  .cart-fab .bag .cnt {
    position: absolute;
    top: -5px; right: -5px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    background: var(--ink);
    color: #fff;
    font-size: 10.5px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border: 2px solid var(--paper);
  }
  .cart-fab .cf-total { font-size: 12px; color: var(--muted); }
  .cart-fab .cf-total b { display: block; font-size: 18px; color: var(--ink); }
  .cart-fab .btn { margin-left: auto; padding: 11px 22px; }
  .cart-mask {
    position: fixed; inset: 0; z-index: 58;
    background: rgba(43, 33, 25, .38);
    display: none;
  }
  .cart-mask.show { display: block; }
  .kanban { grid-template-columns: 1fr; }
  .cashier-layout { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topnav { overflow-x: auto; }
  .topnav a { white-space: nowrap; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 12px; gap: 10px; height: 58px; }
  .brand small { display: none; }
  .brand { font-size: 16px; }
  .topnav a { padding: 6px 9px; font-size: 13px; }
  .page { padding: 14px; }
  .dish-card { grid-template-columns: 66px minmax(0, 1fr) auto; gap: 10px; padding: 11px; }
  .dish-thumb { width: 66px; height: 66px; font-size: 30px; }
  .dish-price { font-size: 16px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-grid { grid-template-columns: 1fr; }
  .cash-fab { bottom: 0; }
}