/* Bendi 到店助手 Demo —— 暖纸色底 + 辣椒红点缀，账单区用等宽数字 */

:root {
  --bg: #f4eee6;
  --bg-deep: #ebe2d6;
  --card: #fffdf9;
  --ink: #2a2420;
  --ink-2: #5f564e;
  --ink-3: #958a7f;
  --line: #e4d9cb;
  --accent: #b8402a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3dc;
  --jade: #2f6b57;
  --jade-soft: #e1eee8;
  --amber: #9a6512;
  --amber-soft: #f5ead2;
  --bubble-user: #b8402a;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191613;
    --bg-deep: #120f0d;
    --card: #23201c;
    --ink: #efe7dd;
    --ink-2: #c3b8ac;
    --ink-3: #8c8277;
    --line: #3a342e;
    --accent: #e06a50;
    --accent-ink: #1b1411;
    --accent-soft: #3d2620;
    --jade: #7cc4a6;
    --jade-soft: #1f3530;
    --amber: #e3b45f;
    --amber-soft: #3a2f1c;
    --bubble-user: #c4543b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-deep);
  color: var(--ink);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); letter-spacing: -.01em; }
.muted { color: var(--ink-3); }

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}
@media (min-width: 600px) {
  .shell { box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(0, 0, 0, .08); }
}

/* ── 登录 ─────────────────────────── */
.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px 48px;
}
.brand-mark {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  margin-bottom: 20px;
}
.login h1 { font: 600 28px/1.25 var(--serif); margin: 0 0 6px; letter-spacing: .02em; }
.login .lead { color: var(--ink-2); margin: 0 0 28px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.code { font-family: var(--mono); font-size: 24px; letter-spacing: .35em; text-align: center; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  transition: transform .08s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.link { background: none; border: 0; color: var(--accent); padding: 0; font-size: 14px; }
.form-msg { min-height: 22px; font-size: 13px; margin-top: 10px; color: var(--accent); }
.form-msg.ok { color: var(--jade); }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--ink-3); }

/* ── 顶栏 ─────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.topbar .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex: none;
}
.topbar .title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.topbar .title small { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-3); }
.topbar .grow { flex: 1; min-width: 0; }
.store-chip {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 46vw;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; flex: none;
}
.menu {
  position: absolute; right: 12px; top: 54px; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; min-width: 180px;
}
.menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.menu button:hover { background: var(--bg); }
.menu .who { padding: 8px 12px 6px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }

/* ── 对话 ─────────────────────────── */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  scroll-behavior: smooth;
}
.msg { display: flex; margin: 0 0 12px; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top-left-radius: 6px;
  word-wrap: break-word;
}
.bubble p { margin: 0 0 6px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: 4px 0 6px; padding-left: 20px; }
.msg.user .bubble {
  background: var(--bubble-user);
  color: #fff;
  border-color: transparent;
  border-radius: 16px;
  border-top-right-radius: 6px;
}
.msg.wide .bubble, .card { max-width: 100%; width: 100%; }
.typing { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 14px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card.stale { opacity: .6; box-shadow: none; }
.card.stale .actions, .card.stale .dish-actions, .card.stale .topup button { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--ink-2);
  white-space: nowrap;
}
.badge.ai { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--jade-soft); color: var(--jade); }
.badge.ref { background: var(--amber-soft); color: var(--amber); }
.badge.demo { background: var(--amber-soft); color: var(--amber); }

/* 门店卡 */
.store-name { font: 600 22px/1.25 var(--serif); margin: 2px 0; letter-spacing: .02em; }
.store-en { color: var(--ink-3); font-size: 13px; }
.store-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.stars { color: #d9902b; letter-spacing: 1px; }
.pros { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pros span { font-size: 12.5px; background: var(--bg); border-radius: 8px; padding: 3px 8px; color: var(--ink-2); }
.review-sum { font-size: 14px; color: var(--ink-2); margin: 10px 0 0; }

/* 偏好表单 */
.pref-group { margin: 12px 0 0; }
.pref-group > .label { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; display: flex; justify-content: space-between; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 14px;
  line-height: 1.3;
  transition: background .15s, border-color .15s;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.sq { min-width: 42px; text-align: center; }
.pref-notes { margin-top: 12px; }
.pref-notes .input { padding: 10px 12px; font-size: 15px; }
.actions { margin-top: 14px; display: flex; gap: 8px; }

/* 推荐方案 */
.summary { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; }
.dishes { list-style: none; margin: 4px 0 0; padding: 0; }
.dish { display: flex; gap: 10px; padding: 11px 0; border-top: 1px dashed var(--line); }
.dish:first-child { border-top: 0; }
.dish-main { flex: 1; min-width: 0; }
.dish-name { font-weight: 600; font-size: 15.5px; }
.dish-name .en { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.dish-explain { margin-top: 3px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.dish-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--ink-2); }
.tag.sig { background: var(--accent-soft); color: var(--accent); }
.tag.hot { background: transparent; padding: 0; }
.dish-reason { font-size: 13px; color: var(--ink-2); }
.dish-warn { font-size: 12.5px; color: var(--accent); margin-top: 2px; }
.dish-side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.dish-price { font-size: 14px; }
.dish-actions { display: flex; gap: 4px; align-items: center; }
.mini {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: 2px 8px; font-size: 12.5px; color: var(--ink-2);
  min-width: 28px; height: 28px;
}
.mini:disabled { opacity: .4; }
.qty { min-width: 18px; text-align: center; font-size: 13px; }
.plan-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 14px;
}
.plan-total b { font-size: 17px; }
.warn-list, .tip-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.warn-list li { color: var(--accent); }
.warn-list li::before { content: "⚠ "; }
.tip-list li { color: var(--ink-2); }
.tip-list li::before { content: "· "; }
.portion { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.portion.high, .portion.low { color: var(--amber); background: var(--amber-soft); border-radius: 10px; padding: 7px 10px; }
.checkout-teaser {
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--jade-soft); color: var(--jade); font-size: 13.5px;
}
.checkout-teaser p { margin: 0; flex: 1; }
.checkout-teaser button { flex: none; }
.card.stale .checkout-teaser button { display: none; }

/* 优惠与支付 */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  background: var(--jade-soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0 12px;
}
.hero .label { font-size: 12.5px; color: var(--jade); }
.hero .big { font-size: 30px; font-weight: 700; color: var(--jade); line-height: 1.1; }
.hero .save { font-size: 13px; color: var(--jade); text-align: right; }
.hero .save b { display: block; font-size: 17px; }
.hero .save .was { display: block; margin-top: 2px; font-size: 12px; opacity: 0.7; }

.ticket {
  position: relative;
  display: flex;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  margin: 0 0 12px;
  overflow: hidden;
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; left: 86px; width: 14px; height: 14px; border-radius: 50%; background: var(--card);
}
.ticket::before { top: -7px; }
.ticket::after { bottom: -7px; }
.ticket .amt {
  width: 93px; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 20px; border-right: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 10px 4px;
}
.ticket .amt small { display: block; font-size: 11px; font-weight: 500; text-align: center; }
.ticket .body { padding: 9px 12px; font-size: 12.5px; min-width: 0; }
.ticket .body b { display: block; font-size: 14.5px; color: var(--ink); }
.ticket .body span { color: var(--ink-2); }

.topup {
  display: flex; gap: 10px; align-items: center;
  border: 1px dashed var(--amber);
  background: var(--amber-soft);
  border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: 13.5px;
}
.topup p { margin: 0; flex: 1; }
.topup button { flex: none; }

.steps { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.steps li { margin: 3px 0; }

.receipt { border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); padding: 8px 0; margin-bottom: 12px; font-size: 13.5px; }
.receipt .row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.receipt .row.minus .num { color: var(--jade); }
.receipt .row.total { font-weight: 700; font-size: 15px; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }

.sec-title { font-size: 12.5px; color: var(--ink-3); margin: 0 0 6px; letter-spacing: .04em; }
.pay-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 12px; }
.pay-table td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.pay-table td:last-child { text-align: right; white-space: nowrap; }
.pay-table tr.best td { font-weight: 600; }
.pay-table .why { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }

details.wallet { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
details.wallet summary { cursor: pointer; font-size: 13.5px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.wallet summary::-webkit-details-marker { display: none; }
details.wallet summary::after { content: "展开"; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
details.wallet[open] summary::after { content: "收起"; }
.coupon-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.coupon-row:first-of-type { border-top: 0; margin-top: 6px; }
.coupon-row b { display: block; font-size: 14px; }
.coupon-row .src { color: var(--ink-3); font-size: 12px; }
.coupon-row .st { text-align: right; flex: none; max-width: 48%; font-size: 12px; }
.coupon-row .st.ok { color: var(--jade); }
.coupon-row .st.no { color: var(--ink-3); }

.notes { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-3); }
.notes li { margin: 2px 0; }

/* ── 输入区 ─────────────────────────── */
.composer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
}
.suggest { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest .chip { white-space: nowrap; font-size: 13px; padding: 5px 11px; background: var(--card); }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea {
  flex: 1; resize: none; max-height: 120px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 14px; padding: 10px 12px; font-size: 16px; line-height: 1.4; outline: none;
}
.compose-row textarea:focus { border-color: var(--accent); }
.send {
  width: 42px; height: 42px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none;
}
.send:disabled { opacity: .45; }

/* ── 底部弹层（确认门店） ─────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(20, 14, 10, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
.sheet {
  width: 100%; max-width: 560px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
.sheet .ask { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.sheet .store-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.sheet .store-pick { display: block; width: 100%; text-align: left; background: var(--card); color: inherit; font: inherit; cursor: pointer; margin-bottom: 10px; }
.sheet .store-pick:hover, .sheet .store-pick:focus-visible { border-color: var(--accent); }
.sheet .sheet-foot { margin: 4px 0 6px; font-size: 12.5px; }
.sheet .btns { display: grid; gap: 8px; }
.cand { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.cand b { display: block; }
.cand span { font-size: 12.5px; color: var(--ink-3); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-size: 13.5px; z-index: 40;
  max-width: calc(100% - 32px);
}
