/* ============================================================
   MOKA COFFEE · 样式
   手机优先，桌面居中成一条 430px 的窄栏。
   ============================================================ */

:root {
  /* 明亮 · 默认。这一套是给招聘方看的 */
  --page: #f2eee7;
  --bg: #faf8f4;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f5f2ec;
  --line: #e7e1d6;
  --line2: #d6cec0;
  --txt: #1d1a16;
  --dim: #78716a;
  --dim2: #a49c90;
  --acc: #8a5a2b;
  --acc-soft: rgba(138, 90, 43, .09);
  --on-acc: #ffffff;
  --ok: #2f8f63;
  --bad: #c9503f;
  --blue: #3a76b8;
  --r: 14px;
  --safe: env(safe-area-inset-bottom, 0px);
  --shadow: 0 6px 20px rgba(80, 60, 35, .10);
  --card-shadow: 0 1px 2px rgba(60, 45, 25, .05);
  --dock-bg: rgba(255, 255, 255, .94);
  --bar-bg: rgba(255, 255, 255, .97);
  --toast-bg: rgba(29, 26, 22, .93);
  --panel-bg: #f7f4ee;
  --overlay: rgba(30, 25, 18, .42);
}

html[data-theme="dark"] {
  --page: #07080a;
  --bg: #0b0d10;
  --bg2: #111419;
  --card: #16191f;
  --card2: #1c2027;
  --line: #252a33;
  --line2: #343b47;
  --txt: #e9ecf1;
  --dim: #8b93a1;
  --dim2: #5c6472;
  --acc: #e0a458;
  --acc-soft: rgba(224, 164, 88, .13);
  --on-acc: #17140f;
  --ok: #3ecf8e;
  --bad: #ef6b6b;
  --blue: #6aa9f0;
  --shadow: 0 6px 22px rgba(224, 164, 88, .26);
  --card-shadow: none;
  --dock-bg: rgba(17, 20, 25, .92);
  --bar-bg: rgba(28, 32, 39, .96);
  --toast-bg: rgba(30, 34, 42, .96);
  --panel-bg: #0d1015;
  --overlay: rgba(0, 0, 0, .58);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

@media (min-width: 520px) {
  body { background: var(--page); }
  .app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

#view { padding: 0 16px; }

/* ---------- 点单页 ---------- */

.shop-hd { padding: 26px 0 6px; }
.shop-hd h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--acc);
}
.shop-hd p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--dim);
}

.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
}
.chip.on {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--on-acc);
  font-weight: 500;
}

.dishes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding-top: 12px;
}

.dish {
  box-shadow: var(--card-shadow);
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.dish-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--acc-soft);
  color: var(--acc);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 500;
}

/* 图片盖在首字上面；图挂了就把首字露出来，不会留个空方块 */
.dish-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-body { flex: 1; min-width: 0; }

.dish-name {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-hot {
  font-size: 10px;
  font-weight: 400;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--acc-soft);
  color: var(--acc);
}

.dish-desc {
  font-size: 12px;
  color: var(--dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dish-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.price { font-size: 16px; font-weight: 500; color: var(--acc); }

.add {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--acc);
  background: transparent;
  color: var(--acc);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.qty-badge {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

/* 商品卡右侧控件区。宽度固定住，从「+」变成「− 1 +」时右边的加号不会跳位置 */
.dish-ctrl {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 84px;
}

.stepper.mini { gap: 6px; }
.stepper.mini button {
  width: 28px; height: 28px;
  border-color: var(--acc);
  color: var(--acc);
}
.stepper.mini span {
  font-size: 14px;
  min-width: 16px;
}

.pad80 { height: 96px; }

/* ---------- 我的 ---------- */

.me-card {
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.me-av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--acc-soft);
  color: var(--acc);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 500;
}

.me-info { flex: 1; }
.me-name { font-size: 15px; font-weight: 500; }
.me-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.me-coupon {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--acc-soft);
  color: var(--acc);
}

.sec-title {
  font-size: 11px;
  color: var(--dim2);
  letter-spacing: 1px;
  margin: 22px 0 10px;
}

.order {
  box-shadow: var(--card-shadow);
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 10px;
}

.order-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.order-no { font-size: 13px; color: var(--dim); letter-spacing: .5px; }

.st {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.st-paid     { background: var(--acc-soft); color: var(--acc); }
.st-making   { background: rgba(106,169,240,.13); color: var(--blue); }
.st-done     { background: rgba(62,207,142,.12); color: var(--ok); }
.st-refunded { background: rgba(139,147,161,.12); color: var(--dim); }
.st-unpaid   { background: rgba(139,147,161,.12); color: var(--dim); }
.st-closed   { background: rgba(139,147,161,.12); color: var(--dim); }

.order-items { margin: 10px 0 8px; }
.oi-row {
  display: flex;
  font-size: 13px;
  color: var(--dim);
  gap: 10px;
  line-height: 1.9;
}
.oi-row span:first-child { flex: 1; color: var(--txt); }

.order-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.order-total { font-size: 15px; color: var(--acc); font-weight: 500; }

.order-link {
  margin-top: 8px;
  font-size: 11px;
  color: var(--dim2);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
}

.order-tag {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ok);
}

.empty { text-align: center; padding: 56px 0; }
.empty-ico { font-size: 40px; color: var(--dim2); }
.empty p { color: var(--dim); font-size: 13px; margin: 10px 0 18px; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn.primary { background: var(--acc); color: var(--on-acc); }
.btn.ghost { background: transparent; border-color: var(--line2); color: var(--dim); }

.dim { color: var(--dim); }
.center { text-align: center; }

/* ---------- 底部 ---------- */

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  bottom: 0;
  z-index: 50;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.tabbar {
  display: flex;
  height: calc(58px + var(--safe));
  padding-bottom: var(--safe);
  background: var(--dock-bg);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--dim2);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
}
.tab .tab-ico { font-size: 17px; line-height: 1; }
.tab.on { color: var(--acc); }

.fab {
  position: absolute;
  right: 16px;
  bottom: calc(100% + 14px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.fab-ico { font-size: 13px; }

/* 购物车条占住底部那一条时，按钮往上让 70px，别压住「去结算」 */
body[data-cart="1"] .fab {
  bottom: calc(100% + 84px);
}
.fab.dot::after {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid var(--bg);
}

#cartbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  bottom: calc(58px + var(--safe) + 8px);
  padding: 0 16px;
  z-index: 45;
  pointer-events: none;
}
#cartbar > * { pointer-events: auto; }

.cartbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 16px;
  background: var(--bar-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line2);
  border-radius: 14px;
}
.cartbar-l { display: flex; align-items: baseline; gap: 10px; }
.cartbar-n { font-size: 12px; color: var(--dim); }
.cartbar-t { font-size: 17px; font-weight: 500; color: var(--acc); }

.cartbar-go {
  border: none;
  border-radius: 10px;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 10px 20px;
  cursor: pointer;
}

/* ---------- 遮罩 / 弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  z-index: 100;
}
.overlay.on { display: flex; }

.chatbox {
  width: 100%;
  max-width: 430px;
  height: 78vh;
  height: 78dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line2);
  box-shadow: 0 -10px 40px rgba(50, 38, 20, .13);
  overflow: hidden;
}

.chat-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--acc-soft);
  color: var(--acc);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 500;
  flex: none;
}
.ch-meta { flex: 1; min-width: 0; }
.ch-name { font-size: 14px; font-weight: 500; }
.ch-sub {
  font-size: 11px;
  color: var(--dim);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.live {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  cursor: pointer;
  flex: none;
}

/* 技术面板 */
.panel {
  display: none;
  flex: none;
  padding: 12px 14px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  max-height: 42vh;
  overflow-y: auto;
}
.panel.on { display: block; }

.pn-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(37, 42, 51, .6);
}
.pn-row span { color: var(--dim2); }
.pn-row b, .pn-row code {
  color: var(--txt);
  font-weight: 400;
  text-align: right;
  word-break: break-all;
}
.pn-row b.ok { color: var(--ok); }
.pn-row code { color: var(--acc); }
.pn-note {
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--dim2);
}
.pn-empty { font-size: 12px; color: var(--dim2); line-height: 1.7; }

/* 消息 */
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; gap: 8px; }
.msg.me { justify-content: flex-end; }

.bubble {
  max-width: 78%;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.msg.bot .bubble {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
}
.msg.me .bubble {
  background: var(--acc);
  color: var(--on-acc);
  border-radius: 14px 4px 14px 14px;
}

.typing { display: flex; gap: 4px; align-items: center; padding: 14px 13px; }
.typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--dim);
  animation: blink 1.1s infinite;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }

@keyframes blink {
  0%, 60%, 100% { opacity: .25; }
  30% { opacity: 1; }
}

.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 0 42px;
}
.quick button {
  font-size: 12px;
  font-family: inherit;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--acc);
  cursor: pointer;
}

.chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  flex: none;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chips-row button {
  flex: none;
  font-size: 12px;
  font-family: inherit;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--card);
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
}

.chat-ft {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + var(--safe));
  border-top: 1px solid var(--line);
  flex: none;
  background: var(--bg2);
}

#input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--txt);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
#input::placeholder { color: var(--dim2); }
#input:focus { border-color: var(--acc); }

#sendBtn {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 20px;
  background: var(--acc);
  color: var(--on-acc);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 购物车面板 ---------- */

.sheet {
  width: 100%;
  max-width: 430px;
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line2);
  box-shadow: 0 -10px 40px rgba(50, 38, 20, .13);
  padding-bottom: var(--safe);
}

.sheet-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}
.sheet-hd h3 { margin: 0; font-size: 15px; font-weight: 500; }
.x {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--card2);
  color: var(--dim);
  font-size: 12px;
  cursor: pointer;
}

.sheet-body { padding: 6px 16px 14px; max-height: 46vh; overflow-y: auto; }

.cart-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
}
.cart-thumb {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--acc-soft);
  color: var(--acc);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex: none;
}
.cart-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cart-body { flex: 1; min-width: 0; }
.cart-name { font-size: 14px; }
.cart-price { font-size: 12px; color: var(--dim); margin-top: 2px; }

.stepper { display: flex; align-items: center; gap: 9px; }
.stepper span { font-size: 14px; min-width: 14px; text-align: center; }
.stepper button {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--txt);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.sheet-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px calc(14px + var(--safe));
  border-top: 1px solid var(--line);
}
.ft-total { font-size: 13px; color: var(--dim); }
.ft-total b { font-size: 18px; color: var(--acc); font-weight: 500; margin-left: 4px; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--toast-bg);
  border: 1px solid transparent;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 200;
  white-space: nowrap;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 外观切换 ---------- */

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 2px;
}
.tr-label { font-size: 12px; color: var(--dim); }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 14px;
  border-radius: 7px;
  cursor: pointer;
}
.seg button.on {
  background: var(--acc);
  color: var(--on-acc);
}
