/* 手机优先：一栏到底，底部固定提交栏 */
:root {
  --bg: #f3f5f1;
  --card: #ffffff;
  --ink: #1c2420;
  --muted: #66716a;
  --line: #dfe5dc;
  --green: #1f7a4d;
  --green-soft: #e3f1e8;
  --chili: #c8361f;
  --amber: #a86a00;
  --amber-soft: #fff3d6;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
[hidden] { display: none !important; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.wrap.wide { max-width: 860px; }
h1 { font-size: 24px; margin: 0; line-height: 1.25; }
h2 { font-size: 17px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.notice { background: var(--amber-soft); color: #5c3b00; border-radius: var(--radius); padding: 10px 14px; white-space: pre-wrap; font-size: 15px; }

button { font: inherit; color: inherit; cursor: pointer; }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; min-height: 42px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.danger { color: var(--chili); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #7fc2a0; outline-offset: 1px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

/* 二选一大按钮：套餐、取餐方式 */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { border: 2px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 12px 8px; text-align: center; }
.seg button b { display: block; font-size: 18px; }
.seg button span { color: var(--chili); font-weight: 600; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }

.dishes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dish { border: 2px solid var(--line); background: var(--card); border-radius: 10px; padding: 11px 10px; text-align: left; min-height: 48px; }
.dish[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); font-weight: 600; }
.dish:disabled { color: var(--muted); text-decoration: line-through; background: var(--bg); cursor: not-allowed; }

.cart-line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.cart-line:first-child { border-top: 0; }
.cart-line .grow { flex: 1; min-width: 0; }
.qty { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.qty button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 18px; line-height: 1; }

label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #c5cec2; border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 76px; resize: vertical; }
.field { position: relative; }
.suggest { position: absolute; z-index: 5; left: 0; right: 0; background: #fff; border: 1px solid #c5cec2; border-radius: 10px; margin-top: 4px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.suggest button { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 12px; font-size: 15px; }
.suggest button:first-child { border-top: 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.hint.ok { color: var(--green); }
.hint.warn { color: var(--amber); }

.bar { 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, 0px)); }
.bar .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.total { font-size: 22px; font-weight: 700; color: var(--chili); font-variant-numeric: tabular-nums; }
.bar .btn { flex: 1; min-height: 48px; font-size: 17px; }

#toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: #1c2420; color: #fff; padding: 9px 16px; border-radius: 20px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 86vw; text-align: center; }
#toast.show { opacity: 1; }

/* 管理页 */
.tabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px; }
.tabs button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 9px 4px; min-height: 42px; }
.tabs button[aria-selected="true"] { background: var(--green); color: #fff; font-weight: 600; }
/* 七个页签的时候（多了“记账”）：手机上挤一点，间距收小，字不换行 */
.tabs.many { gap: 2px; padding: 4px; }
.tabs.many button { padding: 9px 0; white-space: nowrap; }
@media (max-width: 400px) { .tabs.many button { font-size: 15px; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr 1fr; } }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 20px; padding: 2px 9px; vertical-align: middle; }
.pill.pickup { background: #e4ecfb; color: #1f4b99; }
.pill.delivery { background: var(--green-soft); color: var(--green); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.done { background: #e8e8e8; color: #555; }
.order { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.order:first-of-type { border-top: 0; }
.order.is-done { opacity: .55; }
.order .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.order .no { font-weight: 700; font-variant-numeric: tabular-nums; }
.order .who { font-weight: 600; }
.order .amt { margin-left: auto; font-weight: 700; color: var(--chili); font-variant-numeric: tabular-nums; }
.order .note { background: var(--amber-soft); border-radius: 8px; padding: 4px 8px; font-size: 14px; }
.order a, .stop a { color: var(--green); }
.count-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 16px; }
.count-list div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.count-list b { font-variant-numeric: tabular-nums; }
.dish-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.dish-row input[type="text"] { flex: 1; min-width: 0; }
.dish-row label { margin: 0; white-space: nowrap; display: flex; align-items: center; gap: 4px; color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 16px; margin: 0; }
.check input { width: 22px; height: 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.stop { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.stop .n { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.stop.home .n { background: var(--ink); }
.stop .leg { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.routemap { width: 100%; height: auto; background: #f7f9f5; border: 1px solid var(--line); border-radius: 10px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
a.btn:not(.primary) { color: var(--ink); }
.pill.lunch { background: #fff0d9; color: #8a5200; }
.pill.dinner { background: #ece6fb; color: #4b2f9e; }
.pill.unpaid { background: #fde3de; color: #a3260f; }
.payrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.payrow:first-of-type { border-top: 0; }
.payrow .sub { min-width: 6em; }
.payrow b { flex: 1; min-width: 0; }
.paynum { white-space: nowrap; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dish-cell { display: flex; gap: 6px; min-width: 0; }
.dish-cell .dish { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dish .count { color: var(--green); font-variant-numeric: tabular-nums; }
.dish-cell .minus { width: 44px; flex: none; border: 2px solid var(--line); background: var(--card); border-radius: 10px; font-size: 20px; line-height: 1; }
.info { display: grid; grid-template-columns: 3.2em 1fr; gap: 4px 10px; margin: 6px 0 2px; }
.info dt { color: var(--muted); font-size: 14px; padding-top: 1px; }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.info .note { display: inline-block; }
.order .who { font-size: 18px; }
.seg button:disabled { opacity: .5; cursor: not-allowed; background: var(--bg); }
/* 菜品图片 */
.thumb { width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover; background: var(--bg); display: block; }
button.thumb-btn { padding: 0; border: 0; background: none; border-radius: 10px; flex: none; }
.dish.has-img { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; }
.dish.has-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.dish.has-img .cap { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; }
.dish:disabled img { opacity: .45; }
#lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.82); display: grid; place-items: center; padding: 16px; }
#lightbox img { max-width: 100%; max-height: 82vh; border-radius: 12px; }
#lightbox div { color: #fff; margin-top: 10px; text-align: center; font-size: 17px; }
.photo-btn { width: 52px; height: 52px; flex: none; border: 1px dashed #c5cec2; border-radius: 10px; background: var(--bg); padding: 0; font-size: 12px; color: var(--muted); overflow: hidden; }
.photo-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-item { margin-bottom: 10px; }
.dish-item .dish-row { margin-bottom: 0; }
.dish-item .photo-acts { display: flex; gap: 14px; margin: 4px 0 0 60px; font-size: 13px; }
.dish-item .photo-acts button { border: 0; background: none; padding: 2px 0; color: var(--green); }
.dish-item .photo-acts button.del { color: var(--chili); }
/* 对账页：左边还没到账，右边已到账 */
.paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.paycol { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.paycol.owed { border-top: 4px solid var(--chili); }
.paycol.paid { border-top: 4px solid var(--green); }
.payhead { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.payhead b { font-size: 17px; }
.payhead span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.payitem { padding: 9px 2px; border-bottom: 1px dashed var(--line); min-width: 0; }
.payitem:last-child { border-bottom: 0; }
.payitem .top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.payitem .top b { min-width: 0; overflow-wrap: anywhere; }
.payitem .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paycol.owed .amt { color: var(--chili); }
.paycol.paid .amt { color: var(--green); }
.payitem .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.payitem.late { background: #fdeeeb; border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.payitem.late .sub { color: #a3260f; font-weight: 600; }
.roster { margin: 0; padding: 0; list-style: none; max-height: 190px; overflow: auto; }
.roster li { padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 15px; display: flex; gap: 8px; }
.roster li:last-child { border-bottom: 0; }
.roster .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6em; }
.roster .w { color: var(--muted); margin-left: auto; text-align: right; }
/* 开店向导：选你卖什么 */
.tplgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { border: 2px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 12px 10px; text-align: left; display: flex; flex-direction: column; gap: 3px; min-height: 104px; }
.tpl .ico { font-size: 26px; line-height: 1.1; }
.tpl b { font-size: 16px; }
.tpl .d { font-size: 13px; color: var(--muted); line-height: 1.35; }
.tpl[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }

/* 团购店：搜索框、分类按钮、两列大图 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; min-height: 38px; background: var(--card); white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); min-width: 0; }
.tile .pic-btn { padding: 0; border: 0; background: none; display: block; }
.tile .pic { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); }
.tile .nopic { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 20px; }
.tile .add { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; color: var(--green); font-size: 22px; line-height: 1; box-shadow: 0 1px 5px rgba(0,0,0,.22); }
.tile .tinfo { display: block; padding: 8px 10px 10px; overflow-wrap: anywhere; }
.tile .price { font-weight: 700; color: var(--chili); font-size: 17px; }
#gq { display: block; width: 100%; box-sizing: border-box; margin-top: 8px; padding: 10px 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font: inherit; color: var(--ink); -webkit-appearance: none; appearance: none; }
.tile.on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }

/* 安装步骤演示里，要点的地方一闪一闪 */
@keyframes tapHot { 0%,100% { outline-color: #d93025; box-shadow: 0 0 0 0 rgba(217,48,37,.5); } 50% { outline-color: #ff8a80; box-shadow: 0 0 0 7px rgba(217,48,37,0); } }
