:root {
  --bg: #faf6f1; --card: #ffffff; --ink: #2b2420; --muted: #7d7069; --line: #ece2d8;
  --accent: #d24a2c; --accent-ink: #ffffff; --soft: #fbe8e1; --ok: #2f8a57; --okSoft: #e3f3ea;
  --warn: #a8641a; --warnSoft: #fdf1df; --bad: #b42318; --badSoft: #fde7e5; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 4px 14px rgba(60,40,20,.06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1613; --card: #26201b; --ink: #f3ebe4; --muted: #b2a398; --line: #3a3029;
    --accent: #ff6d4f; --accent-ink: #1b1613; --soft: #3b231c; --ok: #5fc58a; --okSoft: #1d3326;
    --warn: #f0b05a; --warnSoft: #3a2c17; --bad: #ff7b6e; --badSoft: #3d1d1a; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* 顶部 */
.top { padding: 18px 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: .5px; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* 选项按钮 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 15px; cursor: pointer; min-height: 38px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.soft.on { background: var(--soft); color: var(--accent); border-color: var(--accent); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.stepper button { width: 38px; height: 38px; border: 0; background: none; font-size: 20px; cursor: pointer; }
.stepper span { min-width: 54px; text-align: center; font-weight: 600; }

/* 分类和搜索 */
.bar-sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 0; background: none; padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: 15px; cursor: pointer; }
.tab.on { color: var(--ink); background: var(--card); font-weight: 600; box-shadow: var(--shadow); }
.search { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 12px; outline: none; }
.search:focus { border-color: var(--accent); }

/* 菜卡片 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 6px 0 120px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 800px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { position: relative; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border: 2px solid transparent; cursor: pointer; text-align: left; padding: 0; }
.card.on { border-color: var(--accent); }
.card .pic, .ph { aspect-ratio: 4 / 3; width: 100%; display: block; object-fit: cover; background: var(--soft); }
.ph, .card .ph.pic { display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.card .meta { padding: 8px 10px 10px; }
.card .name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.card .sub { font-size: 12px; color: var(--muted); }
.card .tick { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: none; align-items: center; justify-content: center; font-weight: 700; }
.card.on .tick { display: flex; }
.badge { position: absolute; top: 8px; left: 8px; background: var(--ok); color: #fff; font-size: 12px; border-radius: 6px; padding: 1px 6px; }
.empty { padding: 30px 0; text-align: center; color: var(--muted); }

/* 底部操作条 */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.dock .wrap { display: flex; align-items: center; gap: 12px; padding: 0; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-ink); min-height: 46px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }

/* 区块 */
.sec { background: var(--card); border-radius: var(--r); padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.sec h2 { font-size: 17px; margin: 0 0 10px; }
.sec h3 { font-size: 15px; margin: 12px 0 8px; color: var(--muted); font-weight: 600; }
.field { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; outline: none; }
.field:focus { border-color: var(--accent); }
textarea.field { min-height: 72px; resize: vertical; }
.dish-row { border-top: 1px solid var(--line); padding: 10px 0; }
.dish-row:first-child { border-top: 0; }
.dish-row .head { display: flex; align-items: center; gap: 10px; }
.dish-row .thumb, .dish-row .ph { width: 52px; height: 52px; aspect-ratio: auto; border-radius: 10px; object-fit: cover; flex: none; font-size: 15px; }
.dish-row .grow { flex: 1; min-width: 0; }
.dish-row .x { border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; padding: 4px 8px; }
.more { margin-top: 10px; padding: 10px; background: var(--bg); border-radius: 10px; }
.label { font-size: 13px; color: var(--muted); margin: 8px 0 6px; }

/* 状态 */
.status { display: inline-block; font-size: 13px; border-radius: 999px; padding: 2px 10px; background: var(--soft); color: var(--accent); white-space: nowrap; }
.status.s-收到了 { background: var(--warnSoft); color: var(--warn); }
.status.s-在做了 { background: var(--warnSoft); color: var(--warn); }
.status.s-做好了 { background: var(--okSoft); color: var(--ok); }
.done-hero { text-align: center; padding: 36px 0 12px; }
.done-hero .big { font-size: 46px; }
.done-hero h1 { font-size: 22px; margin: 8px 0 4px; }

/* 遮罩和弹窗 */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet .bar { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sheet .bar .t { font-weight: 700; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { border: 0; background: none; font-size: 16px; color: var(--accent); cursor: pointer; padding: 6px 4px; }
.modal-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: 16px; padding: 18px; width: 100%; max-width: 380px; }
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; z-index: 50; font-size: 14px; max-width: calc(100% - 32px); }

/* 厨房 */
.order { background: var(--card); border-radius: var(--r); padding: 14px; margin: 12px 0; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.order.st-做好了 { border-left-color: var(--ok); opacity: .82; }
.order.st-收到了, .order.st-在做了 { border-left-color: var(--warn); }
.order .who { font-weight: 700; font-size: 17px; }
.kv { font-size: 14px; margin: 6px 0; }
.kv b { color: var(--muted); font-weight: 500; margin-right: 6px; }
.note { background: var(--warnSoft); color: var(--ink); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.wish { background: var(--soft); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }
.dish-link { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: var(--bg); border-radius: 12px; padding: 8px; margin: 6px 0; cursor: pointer; text-align: left; }
.dish-link .thumb, .dish-link .ph { width: 56px; height: 56px; aspect-ratio: auto; border-radius: 10px; object-fit: cover; flex: none; font-size: 15px; }
.dish-link .arrow { margin-left: auto; color: var(--muted); font-size: 20px; }

/* 菜谱 */
.hero { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; scroll-snap-type: x mandatory; }
.hero img, .hero .ph { flex: none; width: 100%; max-width: 560px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r); scroll-snap-align: start; }
.alert { border-radius: 10px; padding: 8px 10px; margin: 6px 0; font-size: 14px; }
.alert.bad { background: var(--badSoft); color: var(--bad); }
.alert.warn { background: var(--warnSoft); color: var(--warn); }
.alert.ok { background: var(--okSoft); color: var(--ok); }
table.ing { width: 100%; border-collapse: collapse; font-size: 15px; }
table.ing td { border-top: 1px solid var(--line); padding: 8px 4px; vertical-align: top; }
table.ing tr:first-child td { border-top: 0; }
table.ing td.n { width: 38%; font-weight: 500; }
table.ing td.a { width: 30%; white-space: nowrap; }
table.ing .was { color: var(--muted); text-decoration: line-through; font-size: 12px; display: block; }
table.ing .new { color: var(--accent); font-weight: 700; }
table.ing tr.gone td { color: var(--muted); text-decoration: line-through; }
table.ing .why { text-decoration: none; display: inline-block; font-size: 12px; background: var(--badSoft); color: var(--bad); border-radius: 6px; padding: 0 6px; margin-left: 4px; }
.tag { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; color: var(--muted); margin-left: 4px; }
ol.steps { padding-left: 22px; margin: 0; }
ol.steps > li { margin: 0 0 12px; padding-left: 2px; }
ol.steps ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
ol.steps img { display: block; width: 100%; max-width: 420px; border-radius: 10px; margin-top: 8px; }
.amt { color: var(--accent); font-weight: 700; }
.tok { background: var(--soft); border-radius: 5px; padding: 0 4px; }
del { color: var(--muted); }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin-bottom: 10px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { text-decoration: none; }
details summary { cursor: pointer; font-weight: 600; }
.shop li { margin: 4px 0; }
.hrow { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 15px; }
.hrow .hn { width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { flex: 1; height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.foot { padding: 24px 0 60px; text-align: center; font-size: 12px; color: var(--muted); }

/* 主屏幕 App 版补充 */
.pushbar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14px; box-shadow: var(--shadow); }
.pushbar .grow { flex: 1; min-width: 0; }
.pushbar .x { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 2px 6px; }
.pushbar.warn { background: var(--warnSoft); border-color: transparent; }
/* 底部四个页签 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .tb { flex: 1; border: 0; background: none; padding: 12px 0 13px; font-size: 15px; color: var(--muted); cursor: pointer; }
.tabbar .tb.on { color: var(--accent); font-weight: 700; }
.dock.above-tabs { bottom: calc(50px + env(safe-area-inset-bottom)); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
/* 买菜清单 */
.shoprow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; cursor: pointer; }
.sec > .shoprow:first-of-type, details > .shoprow:first-of-type { border-top: 0; }
.shoprow input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.shoprow .grow { flex: 1; min-width: 0; }
.shoprow.done .grow { text-decoration: line-through; color: var(--muted); }
.order.st-点菜中 { border-left-color: var(--accent); }
.status.s-点菜中 { background: var(--soft); color: var(--accent); }
@media (display-mode: standalone) {
  .top { padding-top: 10px; }
}
