:root {
  --mt-yellow: #ffd100;
  --mt-orange: #ff6a00;
  --mt-red: #ff3b30;
  --bg: #f4f4f4;
  --card: #ffffff;
  --ink: #222222;
  --ink-2: #666666;
  --ink-3: #9a9a9a;
  --line: #ededed;
  --brand: #ff6a00;
  --brand-soft: #fff2e6;
  --green: #2f9e63;
  --green-soft: #e8f6ec;
  --blue: #3a7bd5;
  --blue-soft: #e9f1fd;
  --grey-soft: #f5f5f5;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 52px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #e9e9e9;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: none; }
body.is-menu { overflow: hidden; }

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding-bottom: calc(var(--tab-h) + 22px + var(--safe-b));
  position: relative;
}
body.is-menu #app { padding-bottom: 0; }

/* ---------- 通用 ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--ink-3);
  font-size: 14px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
.btn:active { opacity: .85; }
.btn.ghost { background: var(--grey-soft); color: var(--ink); }
.btn.line { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; display: block; }
.btn[disabled] { opacity: .45; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 76px; }

.label { font-size: 12.5px; color: var(--ink-2); margin: 0 0 6px; font-weight: 700; }
.field { margin-bottom: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(170deg, #fff8e1, #ffffff);
}
.login-emoji { font-size: 56px; line-height: 1; margin-bottom: 14px; }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: .5px; margin: 0 0 8px; }
.login-sub { color: var(--ink-3); font-size: 12.5px; margin: 0 0 26px; }
.login-box { width: 100%; max-width: 300px; }
.login-box input {
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px;
  font-weight: 700;
  padding: 14px;
}
.login-box .btn { margin-top: 12px; background: var(--mt-yellow); color: #3a2c00; }
.login-tip { margin-top: 16px; font-size: 11.5px; color: var(--ink-3); }
.login-err { color: var(--mt-red); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* ---------- 旧顶栏（订单/设置页） ---------- */
.topbar { padding: 18px 16px 8px; background: #fff; }
.kitchen-name {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kitchen-notice { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; }
.role-pill {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}
.role-pill.chef { background: var(--green-soft); color: var(--green); }

/* ---------- 店铺页框架 ---------- */
.mt-page {
  height: calc(100dvh - var(--tab-h) - var(--safe-b));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.mt-shop {
  flex-shrink: 0;
  display: flex;
  gap: 11px;
  padding: 12px 14px 12px;
  background: linear-gradient(165deg, #fff6d2 0%, #ffffff 78%);
  border-bottom: 1px solid var(--line);
}
.mt-shop-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  flex-shrink: 0;
}
.mt-shop-info { flex: 1; min-width: 0; }
.mt-shop-name {
  font-size: 16.5px;
  font-weight: 800;
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 7px;
}
.mt-role {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff0bd;
  color: #a8700a;
  flex-shrink: 0;
}
.mt-role.chef { background: var(--green-soft); color: var(--green); }
.mt-shop-meta {
  display: flex;
  gap: 9px;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.mt-open { color: var(--green); font-weight: 700; }
.mt-notice {
  font-size: 11.5px;
  color: #8a6a1a;
  margin-top: 6px;
  background: #fffbe6;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  max-width: 100%;
}

.mt-body { flex: 1; min-height: 0; display: flex; }

/* 左侧品类栏 */
.mt-side {
  width: 88px;
  flex-shrink: 0;
  overflow-y: auto;
  background: #f0f0f0;
  padding-bottom: 30px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mt-side::-webkit-scrollbar { display: none; }
.mt-side-item {
  position: relative;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1.3;
}
.mt-side-item .ico { font-size: 15px; line-height: 1; opacity: .8; }
.mt-side-item .nm { word-break: break-all; }
.mt-side-item .cnt { font-size: 9.5px; color: var(--ink-3); }
.mt-side-item.on {
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}
.mt-side-item.on::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--mt-orange);
}
.mt-side-item.plus-cat { color: var(--mt-orange); }

/* 右侧商品区 */
.mt-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 0 10px 96px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.mt-group { padding-top: 2px; }
.mt-group-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  padding: 9px 2px 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.mt-group-title small { font-size: 10.5px; color: var(--ink-3); font-weight: 400; }
.mt-group-title .mini { margin-left: auto; }
.mini {
  border: 0;
  background: #fff;
  color: var(--mt-orange);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
}
.mt-empty {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

/* 商品行 */
.dish {
  display: flex;
  gap: 9px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 8px;
}
.dish.out { opacity: .6; }
.dish-img {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #fff3d6, #ffe1b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 31px;
  overflow: hidden;
}
.dish-img img { width: 100%; height: 100%; object-fit: cover; }
.dish-out {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dish-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-name { font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.dish-desc {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.dish-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.dish-tags i {
  font-style: normal;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--grey-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.dish-tags i.hot { background: #fff0ee; color: var(--mt-red); letter-spacing: -.5px; }
.dish-foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dish-sold { font-size: 10.5px; color: #c2c2c2; }

.stepper { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.step-btn.plus { background: var(--mt-yellow); color: #4a3a00; }
.step-btn.minus { background: #fff; color: #4a3a00; border: 1.5px solid var(--mt-yellow); }
.step-btn:active { transform: scale(.9); }
em.qty {
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
  min-width: 14px;
  text-align: center;
}

/* ---------- 购物车条 ---------- */
.cartbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  width: calc(100% - 24px);
  max-width: 536px;
  transform: translateX(-50%) translateY(140%);
  background: #2b2b2b;
  color: #fff;
  border-radius: 999px;
  padding: 7px 7px 7px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  z-index: 45;
  transition: transform .24s cubic-bezier(.3, .9, .3, 1);
}
.cartbar.on { transform: translateX(-50%) translateY(0); }
.cart-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3d3d3d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cart-icon .badge {
  position: absolute;
  top: -3px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--mt-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.cart-info { flex: 1; min-width: 0; }
.cart-info b { display: block; font-size: 13.5px; }
.cart-info small { font-size: 10.5px; color: #9c9c9c; }
.cart-go {
  border: 0;
  background: var(--mt-yellow);
  color: #3a2c00;
  font-weight: 800;
  font-size: 14px;
  font-family: inherit;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
.cart-go[disabled] { opacity: .45; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: var(--safe-b);
  z-index: 50;
}
.tab {
  flex: 1;
  border: 0;
  background: none;
  padding: 7px 0 6px;
  font-family: inherit;
  font-size: 10.5px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  position: relative;
}
.tab .ico { font-size: 19px; line-height: 1.1; filter: grayscale(1); opacity: .5; }
.tab.on { color: var(--mt-orange); font-weight: 700; }
.tab.on .ico { filter: none; opacity: 1; }
.tab .dot {
  position: absolute;
  top: 3px;
  left: 50%;
  margin-left: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--mt-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ---------- 订单 ---------- */
.section { padding: 6px 14px 20px; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  margin: 16px 0 10px;
}
.order {
  background: #fff;
  border-radius: var(--radius);
  padding: 13px;
  margin-bottom: 10px;
  border-left: 3px solid var(--ink-3);
}
.order.waiting { border-left-color: var(--mt-orange); }
.order.cooking { border-left-color: var(--blue); }
.order.done { border-left-color: var(--green); }
.order.cancelled { border-left-color: #ccc; opacity: .65; }

.order-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.order-status {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--grey-soft);
  color: var(--ink-2);
}
.order.waiting .order-status { background: var(--brand-soft); color: var(--brand); }
.order.cooking .order-status { background: var(--blue-soft); color: var(--blue); }
.order.done .order-status { background: var(--green-soft); color: var(--green); }
.order-time { font-size: 11px; color: var(--ink-3); margin-left: auto; }

.order-items { font-size: 13.5px; }
.order-item { display: flex; justify-content: space-between; padding: 3px 0; }
.order-item .nm { color: var(--ink); }
.order-item .qt { color: var(--ink-2); font-weight: 600; }
.order-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-2);
  background: #fafafa;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.5;
}
.order-actions { display: flex; gap: 8px; margin-top: 11px; }
.order-actions .btn { flex: 1; }

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.8;
  background: #fff;
}
.empty .big { font-size: 40px; display: block; margin-bottom: 10px; opacity: .5; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp .24s cubic-bezier(.3, .9, .3, 1);
}
@keyframes slideUp { from { transform: translateY(40px); } to { transform: translateY(0); } }
.sheet-title { font-size: 16.5px; font-weight: 800; margin: 0 0 4px; }
.sheet-sub { font-size: 12px; color: var(--ink-3); margin: 0 0 16px; }
.sheet-handle {
  width: 36px;
  height: 4px;
  background: #e5e5e5;
  border-radius: 999px;
  margin: -8px auto 12px;
}

.pick-row { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.pick {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.pick.on { border-color: var(--mt-orange); background: var(--brand-soft); color: var(--mt-orange); }

.cart-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.cart-line:last-child { border-bottom: 0; }
.cart-line .grow { flex: 1; }

/* ---------- 菜单管理 ---------- */
.manage-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 7px;
}
.manage-row .thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff3d6, #ffe1b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
  flex-shrink: 0;
}
.manage-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.manage-row .info { flex: 1; min-width: 0; }
.manage-row .info b { font-size: 13.5px; font-weight: 700; display: block; }
.manage-row .info small { color: var(--ink-3); font-size: 11px; }
.icon-btn {
  border: 0;
  background: var(--grey-soft);
  color: var(--ink-2);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn.warn { background: #fff0ee; color: var(--mt-red); }

.chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--grey-soft);
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}
.chip.out { background: #f0f0f0; color: #999; }

.img-picker {
  width: 100%;
  height: 128px;
  border-radius: 12px;
  border: 1.5px dashed #ddd;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}
.img-picker img { width: 100%; height: 100%; object-fit: cover; }
.img-picker .emoji { font-size: 24px; }

.row-flex { display: flex; gap: 10px; }
.row-flex > * { flex: 1; }

.spicy-pick { display: flex; gap: 6px; }
.spicy-pick button {
  flex: 1;
  padding: 9px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
}
.spicy-pick button.on { border-color: var(--mt-orange); background: var(--brand-soft); color: var(--mt-orange); font-weight: 700; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 130px;
  transform: translate(-50%, 10px);
  background: rgba(0, 0, 0, .86);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s ease;
  z-index: 200;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 引导 ---------- */
.guide {
  margin: 12px 0;
  padding: 15px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fffaea, #fff3d0);
  font-size: 12.5px;
  color: #8a6a1a;
  line-height: 1.7;
}
.guide b { color: var(--mt-orange); }

.setting-block { padding: 15px; background: #fff; border-radius: var(--radius); }

/* ---------- 手机适配 ---------- */
@supports not (height: 100dvh) {
  .mt-page { height: calc(100vh - var(--tab-h) - var(--safe-b)); }
  #app, .login-wrap { min-height: 100vh; }
}

@media (max-width: 360px) {
  .mt-side { width: 76px; }
  .mt-side-item { font-size: 11.5px; padding: 12px 2px; }
  .dish-img { width: 70px; height: 70px; font-size: 30px; }
  .dish-name { font-size: 14px; }
  .mt-shop-logo { width: 46px; height: 46px; font-size: 23px; }
  .mt-shop-name { font-size: 15.5px; }
  .mt-main { padding: 0 8px 96px; }
  .cart-go { padding: 9px 16px; font-size: 13.5px; }
}

@media (hover: none) {
  .step-btn { width: 26px; height: 26px; }
}

