/* ============================================================
   奶茶店线上订餐 · 全局样式
   零构建：直接 <link> 引入，没有预处理器、没有打包器。
   三端共用同一套变量，配色与 prototype/ 保持一致。
   ============================================================ */

:root {
  --brand: #8b5e3c;
  --brand-dark: #6f4a2e;
  --brand-soft: #f0e4d8;
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2e2a26;
  --muted: #8a8177;
  --line: #eae3d9;
  --paid: #c9741b;
  --making: #2f6fa8;
  --ready: #3f8f5b;
  --done: #6b7280;
  --danger: #c0392b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(46, 42, 38, .06), 0 8px 24px rgba(46, 42, 38, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 .6em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: .92em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 通用容器 ---------- */

.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
.wrap-mid { max-width: 900px; margin: 0 auto; padding: 20px 16px 80px; }
.wrap-wide { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-tight { padding: 12px 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }

/* ---------- 顶部条 ---------- */

.topbar {
  background: var(--brand);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar a { color: #fff; }
.topbar .shop-name { font-size: 18px; font-weight: 600; }
.topbar .notice { font-size: 13px; opacity: .9; }
.topbar-sticky { position: sticky; top: 0; z-index: 20; }

.pagebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.pagebar .title { font-weight: 600; }
.pagebar .spacer { flex: 1 1 auto; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: #f7f3ee; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-danger { color: var(--danger); border-color: #eccfc9; background: #fdf3f1; }
.btn-danger:hover { background: #fbe9e6; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 16px; width: 100%; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */

label.field { display: block; margin-bottom: 12px; }
label.field > .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters label.field { margin-bottom: 0; min-width: 130px; }

/* ---------- 标签 / 徽章 ---------- */

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--brand-soft);
  color: var(--brand-dark);
  white-space: nowrap;
}
.tag-paid { background: #fbeeda; color: var(--paid); }
.tag-making { background: #e3eefa; color: var(--making); }
.tag-ready { background: #e2f2e8; color: var(--ready); }
.tag-completed { background: #eef0f2; color: var(--done); }
.tag-cancelled { background: #fbe9e6; color: var(--danger); }
.tag-dinein { background: #fbeeda; color: var(--paid); }
.tag-takeaway { background: #e3eefa; color: var(--making); }
.tag-warn { background: #fbe9e6; color: var(--danger); }
.tag-ok { background: #e2f2e8; color: var(--ready); }

.code-chip {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 8px;
  letter-spacing: .5px;
}

/* ---------- 顾客端：菜单 ---------- */

.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.cat-tabs button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.cat-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.cat-title { font-size: 14px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }

.product {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}
.product:hover { border-color: var(--brand); }
.product.is-soldout { opacity: .55; cursor: not-allowed; }
.product .thumb {
  width: 58px; height: 58px; flex: 0 0 58px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  overflow: hidden;
}
.product .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product .info { flex: 1 1 auto; min-width: 0; }
.product .name { font-weight: 600; }
.product .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.product .price { color: var(--brand-dark); font-weight: 600; margin-top: 4px; }
.product .price .from { font-size: 12px; color: var(--muted); font-weight: 400; }

.cartbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 30;
}
.cartbar .inner { max-width: 560px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 12px; }
.cartbar .total { font-weight: 700; font-size: 18px; }
.cartbar .count { font-size: 12px; color: var(--muted); }
.cart-badge {
  position: absolute;
  margin-left: -6px; margin-top: -18px;
  background: var(--danger); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 1px 6px;
}

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

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 22, .42);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--card);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheet-up .16s ease-out;
}
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }

/* 管理后台在桌面上用居中对话框，比贴底弹层顺手 */
.sheet-mask.center { align-items: center; padding: 20px; }
.sheet-mask.center .sheet { border-radius: 18px; max-height: 88vh; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head .close { border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }

.opt-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer;
}
.opt-row.on { border-color: var(--brand); background: var(--brand-soft); }
.opt-row .delta { color: var(--muted); font-size: 13px; }
.qty-ctl { display: inline-flex; align-items: center; gap: 10px; }
.qty-ctl button {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; font-size: 17px; cursor: pointer; line-height: 1;
}
.qty-ctl .n { min-width: 22px; text-align: center; font-weight: 600; }

/* ---------- 订单状态 ---------- */

.status-hero { text-align: center; padding: 26px 16px; }
.status-hero .code { font-size: 56px; font-weight: 800; letter-spacing: 2px; color: var(--brand); line-height: 1.1; }
.status-hero .label { font-size: 15px; color: var(--muted); margin-top: 6px; }
.steps { display: flex; gap: 0; margin: 18px 0; }
.steps .step { flex: 1 1 0; text-align: center; position: relative; font-size: 12px; color: var(--muted); }
.steps .step::before {
  content: ''; display: block; height: 3px; background: var(--line); margin: 0 0 8px;
}
.steps .step.done::before { background: var(--brand); }
.steps .step.done { color: var(--brand-dark); font-weight: 600; }

.line-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .nm { font-weight: 500; }
.line-item .sp { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sum-row { display: flex; justify-content: space-between; padding: 5px 0; }
.sum-row.total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* ---------- 店员看板 ---------- */

.board-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 860px) { .board-cols { grid-template-columns: 1fr; } }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; font-weight: 600; }
.col-head .n { color: var(--muted); font-weight: 400; font-size: 13px; }
.col-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.order-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.order-card.urgent { border-color: var(--danger); }
.order-card .oc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.order-card .oc-code { font-size: 22px; font-weight: 800; color: var(--brand); letter-spacing: 1px; }
.order-card .oc-items { margin: 8px 0; }
.order-card .oc-item { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.order-card .oc-remark { background: #fff8ec; border: 1px solid #f3e2c7; border-radius: 8px; padding: 6px 8px; font-size: 13px; margin: 8px 0; }
.order-card .oc-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- 叫号大屏 ---------- */

body.board-screen { background: #1d1a17; color: #fff; }
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  padding: 28px;
}
.board-cell {
  background: #2b2622;
  border-radius: 20px;
  padding: 26px 18px;
  text-align: center;
}
.board-cell .num { font-size: 84px; font-weight: 800; letter-spacing: 4px; line-height: 1; }
.board-cell .sub { color: #b9ada0; margin-top: 8px; font-size: 15px; }
.board-empty { color: #8d8175; font-size: 28px; text-align: center; padding: 90px 20px; }

/* ---------- 管理后台 ---------- */

body.admin { background: #f6f3ee; }
.admin-shell { display: flex; min-height: 100vh; align-items: stretch; }
.admin-side {
  width: 210px; flex: 0 0 210px;
  background: #2f2a25; color: #e9e2d8;
  padding: 16px 12px;
}
.admin-side .brand { font-weight: 700; color: #fff; margin-bottom: 4px; }
.admin-side .who { font-size: 12px; color: #a99e91; margin-bottom: 14px; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a {
  color: #ded5c9; padding: 8px 10px; border-radius: 8px; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.admin-side nav a:hover { background: #3d372f; text-decoration: none; }
.admin-side nav a.on { background: var(--brand); color: #fff; }
.admin-main { flex: 1 1 auto; min-width: 0; padding: 20px 24px 60px; }
.admin-main h1 { font-size: 20px; }
@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: auto; flex: none; }
  .admin-side nav { flex-direction: row; overflow-x: auto; }
}

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.metric .k { font-size: 13px; color: var(--muted); }
.metric .v { font-size: 24px; font-weight: 700; margin-top: 4px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--card); }
table.tbl th, table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.tbl th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fbf9f6; }
table.tbl tr:hover td { background: #fdfbf8; }
table.tbl td.num, table.tbl th.num { text-align: right; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 92px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: #f0ebe4; border-radius: 999px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.bar-fill.alt { background: var(--paid); }
.bar-val { text-align: right; color: var(--muted); }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分页与多选：管理后台用 */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.pager .info { margin-right: auto; color: var(--muted); font-size: 13px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line);
       border-radius: 10px; background: #fff; cursor: pointer; font-size: 14px; }
.chk input { margin: 0; }
.chk.on { border-color: var(--brand); background: var(--brand-soft); }

.hour-chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.hour-chart .hb { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.hour-chart .hb .bar { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.hour-chart .hb .hl { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ---------- 登录 / 空态 / 提示 ---------- */

.page-plain { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }

.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state .empty-emoji { font-size: 40px; margin-bottom: 8px; }
.empty-state h2 { color: var(--ink); }

#toast-root { position: fixed; left: 0; right: 0; bottom: 90px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  background: rgba(40, 34, 28, .94); color: #fff; border-radius: 999px;
  padding: 9px 16px; font-size: 14px; max-width: 90vw; box-shadow: var(--shadow);
}
.toast.err { background: rgba(150, 40, 30, .95); }
.toast.ok { background: rgba(48, 110, 70, .95); }

.banner-warn {
  background: #fff8ec; border: 1px solid #f3e2c7; color: #8a5a12;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px;
}
.banner-info {
  background: #eef5fb; border: 1px solid #d6e6f5; color: #23557f;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px;
}

/* ============================================================
   v2 顾客端新增（多商家）：店铺列表 / 登录双 Tab / 结果页与二维码
   只追加，不改上面任何既有规则。
   ============================================================ */

/* ---------- 小工具 ---------- */

.gap8 { gap: 8px; }

/* 页头里的「退出」：看着像链接，实际是按钮 */
.linklike {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: #fff;
  cursor: pointer;
  text-decoration: underline;
}
.pagebar .linklike { color: var(--brand); }

/* ---------- 首页：搜索 + 店铺卡 ---------- */

.searchbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }

.shop-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  color: inherit;
  margin-bottom: 12px;
}
.shop-card:hover { border-color: var(--brand); text-decoration: none; }
.shop-card .head { display: flex; align-items: flex-start; gap: 10px; }
.shop-card .nm { font-size: 17px; font-weight: 600; }
.shop-card .chev { color: var(--muted); font-size: 22px; line-height: 1.2; }
.shop-card .nt { margin-top: 8px; font-size: 13px; color: var(--muted); }
.shop-card .ad { margin-top: 4px; font-size: 13px; color: var(--muted); }

/* ---------- 登录 / 注册双 Tab ---------- */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}
.tabs .tab-btn {
  flex: 1 1 0;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--brand-dark);
  cursor: pointer;
}
.tabs .tab-btn.on { background: var(--card); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 订单详情：二维码 + 分享 ---------- */

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 13px;
}
.qr-box svg, .qr-box img { width: 180px; max-width: 100%; height: auto; }
.qr-fallback { padding: 18px 10px; color: var(--muted); font-size: 13px; word-break: break-all; }

.share-url {
  background: #fbf9f6;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13px;
  word-break: break-all;
  color: var(--brand-dark);
}

/* ---------- 结算页：购物车行 + 就餐方式 ---------- */

/* 表单下的灰色说明文字（登录页/结算页共用） */
label.field .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 结算页的购物车行也带缩略图，复用 .product .thumb 的观感 */
.line-item .thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
}
.line-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.line-item .right { text-align: right; }
.line-item.is-bad { background: #fff7f5; }
.line-item .sp.err { color: var(--danger); }

.dining-pick { display: flex; gap: 10px; }
.dining-btn {
  flex: 1 1 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.dining-btn .d-name { font-weight: 600; }
.dining-btn .d-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dining-btn.on { border-color: var(--brand); background: var(--brand-soft); }
.dining-btn.on .d-name { color: var(--brand-dark); }

/* ---------- 页脚：商家入口 ---------- */

.site-foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-foot .foot-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}
.site-foot .foot-links a { color: var(--brand-dark); }
.site-foot .sep { color: var(--line); }
.site-foot .foot-note { margin-top: 6px; font-size: 12px; color: var(--muted); }

