/* Petit Chats · 订单管理 · 样式 */
:root {
  --cream: #F5F0E7;
  --cream-2: #FFFDF9;
  --ink: #2B2320;
  --ink-2: #4F453C;
  --muted: #8A7F74;
  --line: #E3D9C9;
  --accent: #B4794A;
  --accent-soft: #EFE2D2;
  --green: #4E7A55;
  --amber: #B8860B;
  --red: #A4453B;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(51, 37, 31, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: calc(64px + var(--safe-b)); }

/* Netlify 免费版角标（iframe）会挡住底部导航，直接隐藏 */
#nl-badge-frame { display: none !important; }

#app { min-height: 100dvh; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(245, 240, 231, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.ghost-btn {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 999px; padding: 7px 12px; font-size: 12px; max-width: 46vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 主体 */
.view { padding: 14px 14px 8px; max-width: 720px; margin: 0 auto; }

.hero-card {
  background: linear-gradient(160deg, #3B2A20, #58402F);
  color: #F7EFE3; border-radius: 20px; padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.hero-card .label { font-size: 12px; opacity: .75; letter-spacing: 2px; }
.hero-card .amount { font-size: 34px; font-weight: 600; margin: 6px 0 2px; letter-spacing: .5px; }
.hero-card .sub { font-size: 12px; opacity: .7; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }

.stat {
  background: var(--cream-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 4px; }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 2px 10px;
}
.section-title h2 { font-size: 15px; margin: 0; letter-spacing: 1px; font-weight: 600; }
.section-title a, .section-title button {
  font-size: 12px; color: var(--accent); background: none; border: 0; padding: 0;
}

/* 列表 */
.card {
  background: var(--cream-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 10px; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 15px; font-weight: 500; }
.row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row .amount { font-size: 15px; font-weight: 600; white-space: nowrap; }

.empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 34px 12px; line-height: 1.8;
}

/* 状态徽章 */
.badge {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.pending { background: #FBF0DC; color: #8a6420; border-color: #EFDDBD; }
.badge.making  { background: #E8F0FB; color: #2f5d8f; border-color: #CFE0F4; }
.badge.done    { background: #E7F1E8; color: #34603B; border-color: #CFE3D2; }
.badge.cancelled { background: #F2EDEA; color: #8a7a70; border-color: #E2D8D0; }
.badge.paid    { background: #E7F1E8; color: #34603B; border-color: #CFE3D2; }
.badge.unpaid  { background: #FBF0DC; color: #8a6420; border-color: #EFDDBD; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; outline: none; appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 74px; resize: vertical; }

.btn {
  width: 100%; border: 0; border-radius: 14px; padding: 15px;
  font-size: 16px; font-weight: 600; color: #FFF8EE;
  background: linear-gradient(180deg, #6B4B33, #4A3426);
  box-shadow: 0 4px 14px rgba(51, 37, 31, .18);
}
.btn:active { transform: scale(.985); }
.btn.secondary {
  background: var(--cream-2); color: var(--ink); border: 1px solid var(--line); box-shadow: none;
}
.btn.danger { background: #A4453B; }
.btn:disabled { opacity: .55; }

.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1; border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 12px; padding: 10px; font-size: 14px;
}
.segmented button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }

/* 加减器 */
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--cream-2); color: var(--ink); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper .qty { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(255, 253, 249, .96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1 1 0; min-width: 0; border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 9.5px; padding: 4px 0; letter-spacing: 0;
  white-space: nowrap;
}

/* 日历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 12px; }
.cal-head .m { font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.cal-head button {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--cream-2); color: var(--ink); font-size: 16px; line-height: 1;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--muted); padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid transparent;
  background: var(--cream-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--ink);
  position: relative; overflow: hidden;
}
.cal-cell.empty { background: none; }
.cal-cell.has { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-cell .thumb {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35;
}
.cal-cell span { position: relative; z-index: 1; }

.cake-item { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cake-item:last-child { border-bottom: 0; }
.cake-item img { width: 66px; height: 66px; border-radius: 10px; object-fit: cover; background: var(--accent-soft); }
.cake-item .grow { flex: 1; min-width: 0; }
.cake-item .t { font-size: 14px; font-weight: 600; }
.cake-item .d { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.cake-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cake-pick button {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 10px; padding: 8px 11px; font-size: 12.5px;
}
.cake-pick button.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); }

.cake-preview {
  margin-top: 10px; padding: 12px; border-radius: 12px;
  background: var(--accent-soft); font-size: 13px; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tab .ico { font-size: 18px; line-height: 1; }
.tab.on { color: var(--ink); font-weight: 600; }
.tab-main .ico {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #F7EFE3;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  margin-top: -18px; box-shadow: 0 6px 16px rgba(51, 37, 31, .25);
}

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(40, 28, 22, .38); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 720px; max-height: 88dvh; overflow: auto;
  background: var(--cream); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 14px; font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(51, 37, 31, .94); color: #FFF6E9; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; z-index: 60; max-width: 86vw; text-align: center;
}

/* 登录 */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 22px; padding: 26px 22px; box-shadow: 0 10px 40px rgba(51,37,31,.10); text-align: center;
}
.auth-card img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 6px; }
.auth-card h1 { font-size: 20px; margin: 6px 0 2px; letter-spacing: 1px; }
.auth-card p.sub { font-size: 12px; color: var(--muted); margin: 0 0 20px; letter-spacing: 2px; }
.auth-card .field { text-align: left; }
.auth-error { color: var(--red); font-size: 13px; margin: 6px 0 12px; min-height: 18px; }

.tabs-mini { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs-mini button {
  flex: 1; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 8px 0;
  border-bottom: 2px solid transparent;
}
.tabs-mini button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 999px; padding: 7px 13px; font-size: 12px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.bar-row .bl { flex: 1; min-width: 0; font-size: 13px; }
.bar-track { flex: 1.2; height: 8px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- 员工订单界面（西班牙语） ---------- */
.staff-top { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px 12px; }
.staff-top h2 { font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.staff-count { font-size: 11px; color: var(--accent); font-weight: 600; }

.staff-card {
  display: block; width: 100%; text-align: left;
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 9px;
  box-shadow: var(--shadow);
  transition: transform .15s cubic-bezier(.22,1.2,.36,1);
}
.staff-card:active { transform: scale(.985); }
.sc-top { display: flex; justify-content: space-between; align-items: baseline; }
.sc-top b { font-size: 13px; letter-spacing: .3px; }
.sc-top span { font-size: 10.5px; color: var(--muted); }
.sc-mid { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.sc-web {
  font-size: 9px; font-weight: 700; color: #fff; background: var(--accent);
  border-radius: 4px; padding: 1px 5px; margin-left: 5px; vertical-align: middle;
}
.sc-items {
  font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sc-bot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.sc-bot b { margin-left: auto; font-size: 14px; }
.sc-when { font-size: 10.5px; color: var(--muted); }

.staff-meta { font-size: 12px; color: var(--ink-2); line-height: 1.8; }
.staff-total {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 18px; font-weight: 700; margin: 6px 2px 12px;
}
.staff-note {
  background: #FBF0DC; border: 1px solid #EFDDBD; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.65; margin-bottom: 12px;
}
.staff-note b { display: block; font-size: 10px; letter-spacing: 1px; color: #8a6420; margin-bottom: 3px; }
.staff-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.staff-actions button {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 10px; padding: 11px 4px; font-size: 11.5px; line-height: 1.3;
  transition: all .15s;
}
.staff-actions button.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); font-weight: 600; }

/* ---------- 网页菜单排序 ---------- */
.sort-box {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.sort-title { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.sort-title span { font-weight: 400; color: var(--muted); font-size: 10.5px; margin-left: 6px; }
.sort-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.sort-row:first-of-type { border-top: 0; }
.sort-name { flex: 1; font-size: 13px; }
.sort-count { font-size: 10.5px; color: var(--muted); }

.mv {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--cream);
  color: var(--ink); font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.mv:disabled { opacity: .28; }
.mv:active:not(:disabled) { background: var(--accent-soft); }
.mv-group { display: flex; flex-direction: column; gap: 4px; margin-right: 2px; }

/* ---------- 编辑模式 / 拖动排序 ---------- */
#web-edit {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 999px; padding: 6px 14px; font-size: 12px;
}
#web-edit.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); font-weight: 600; }

.edit-tip {
  background: var(--accent-soft); border-radius: 10px;
  padding: 9px 12px; font-size: 11.5px; color: var(--ink-2); margin-bottom: 8px;
}

.web-list.editing .row { touch-action: none; }
.web-list.editing .row:active { background: var(--accent-soft); }

.grip {
  font-size: 16px; color: var(--muted); margin-right: 2px;
  letter-spacing: -2px; cursor: grab;
}

.row.dragging {
  background: var(--cream-2) !important;
  box-shadow: 0 10px 26px rgba(51, 37, 31, .22);
  border-radius: 12px;
  opacity: .96;
  z-index: 5;
  position: relative;
  transform-origin: center;
}

/* 拖动时的浮动卡片 */
.drag-ghost {
  background: var(--cream-2) !important;
  box-shadow: 0 16px 36px rgba(51, 37, 31, .28);
  border-radius: 12px;
  transform: scale(1.03);
  opacity: .98;
  border: 1px solid var(--accent);
}
.drag-holder {
  border: 1.5px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-soft);
  box-sizing: border-box;
}
body.dragging-mode { user-select: none; -webkit-user-select: none; }
body.dragging-mode .tabbar { pointer-events: none; opacity: .5; }

/* 编辑模式下：禁止长按选字/拖图片，拖动手感更稳 */
.web-list.editing .row {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-x;
}
.web-list.editing .row img { pointer-events: none; -webkit-user-drag: none; }
.web-list.editing .grip {
  width: 26px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--muted); flex: 0 0 26px;
}

/* ---------- 滑动确认（员工端） ---------- */
.slide-track {
  position: relative; height: 56px; border-radius: 28px;
  background: var(--accent-soft); border: 1px solid #EFDDBD;
  overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none;
  margin-bottom: 6px;
}
.slide-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(124, 156, 107, .22);
}
.slide-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; color: #8a6420; letter-spacing: .4px;
  pointer-events: none;
}
.slide-knob {
  position: absolute; left: 4px; top: 4px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--ink); color: #F7EFE3;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; box-shadow: 0 4px 12px rgba(51, 37, 31, .25);
  cursor: grab;
}
.slide-knob:active { cursor: grabbing; }
.slide-track.done .slide-knob { background: #4E7A55; }
.slide-track.done .slide-fill { background: rgba(78, 122, 85, .35); }

.slide-hint { font-size: 10.5px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.slide-done {
  text-align: center; font-size: 13px; font-weight: 600; color: #4E7A55;
  background: #EAF2EA; border: 1px solid #CFE3D2; border-radius: 28px;
  padding: 14px; margin-bottom: 12px;
}

/* 已关闭订单（员工只读） */
.staff-locked {
  background: #F0EDE8; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; text-align: center; margin-bottom: 12px;
}
.staff-locked b { display: block; font-size: 12.5px; color: var(--ink-2); }
.staff-locked div { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* 预售 / 售罄 开关 */
.flag-row { display: flex; gap: 6px; margin-top: 6px; }
.flag {
  border: 1px solid var(--line); background: var(--cream);
  color: var(--muted); border-radius: 999px;
  padding: 4px 11px; font-size: 10.5px; line-height: 1.4;
}
.flag:active { transform: scale(.94); }
.flag.on-presale { background: #EAF2EA; border-color: #CFE3D2; color: #4E7A55; font-weight: 700; }
.flag.on-soldout { background: #FBEAE8; border-color: #F0CEC9; color: var(--red); font-weight: 700; }

/* 暂停接单按钮 */
.pause-row { margin-bottom: 10px; }
.pause-btn {
  width: 100%; border-radius: 12px; padding: 12px;
  font-size: 13px; font-weight: 600;
  background: #EAF2EA; border: 1px solid #CFE3D2; color: #4E7A55;
}
.pause-btn.paused {
  background: #FBEAE8; border-color: #F0CEC9; color: var(--red);
}
.pause-btn:active { transform: scale(.985); }

/* 顺序保存条（不自动保存） */
.order-bar {
  position: sticky; bottom: calc(66px + var(--safe-b)); z-index: 20;
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 10px 12px;
  background: var(--ink); color: #F7EFE3;
  border-radius: 14px; box-shadow: 0 8px 24px rgba(51,37,31,.28);
  font-size: 11.5px;
}
.order-bar span { flex: 1; opacity: .85; }
.order-bar button {
  border: 0; border-radius: 9px; padding: 9px 14px; font-size: 12px; font-weight: 600;
}
#order-undo { background: rgba(255,255,255,.16); color: #F7EFE3; }
#order-save { background: var(--accent); color: #2b1d15; }
.order-bar button:active { transform: scale(.96); }

/* 合并账单 */
.bill-print {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; font-size: 12.5px;
}
.bill-head { text-align: center; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.bill-brand { font-size: 15px; font-weight: 800; letter-spacing: .06em; }
.bill-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bill-cust { font-size: 12px; margin-top: 6px; font-weight: 600; }
.bill-block { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.bill-block-head {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--muted); margin-bottom: 6px;
}
.bill-line { display: flex; justify-content: space-between; padding: 2px 0; }
.bill-sub { margin-top: 4px; font-weight: 600; }
.bill-total {
  display: flex; justify-content: space-between;
  font-size: 15px; font-weight: 800; padding-top: 12px;
}
.bill-foot { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 8px; }

@media print {
  body.printing-bill * { visibility: hidden !important; }
  body.printing-bill .bill-print,
  body.printing-bill .bill-print * { visibility: visible !important; }
  body.printing-bill .bill-print {
    position: absolute; left: 0; top: 0; width: 100%;
    border: 0; border-radius: 0;
  }
}

/* 订单详情：复制按钮 */
.copy-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 12.5px; color: var(--ink-2);
  flex-wrap: wrap;
}
.copy-btn {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 8px; padding: 3px 9px; font-size: 11px; text-decoration: none;
  line-height: 1.5;
}
.copy-btn:active { transform: scale(.95); }

/* 系列列表 / 系列详情 */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 12px; box-shadow: var(--shadow);
}
.cat-row .grow { flex: 1; min-width: 0; }
.cat-row .name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.cat-row .meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cat-row .chev { font-size: 18px; color: var(--muted); }
.cat-row .drag-h, .prod-row .drag-h {
  flex: 0 0 auto; width: 26px; text-align: center;
  font-size: 16px; color: var(--muted); letter-spacing: -1px;
  touch-action: none; user-select: none; cursor: grab;
}
.dragging { opacity: .9; transform: scale(1.02); box-shadow: 0 8px 22px rgba(51,37,31,.18); }

.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.detail-head button {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 10px; padding: 6px 11px; font-size: 12px;
}
.detail-head .dh-title { flex: 1; font-size: 16px; font-weight: 700; }
.detail-head .dh-count { font-size: 11.5px; color: var(--muted); }

.prod-list { display: flex; flex-direction: column; gap: 8px; }
.prod-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; box-shadow: var(--shadow);
}
.prod-row img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: 0 0 52px; background: var(--accent-soft); }
.prod-noimg {
  width: 52px; height: 52px; border-radius: 10px; flex: 0 0 52px;
  background: var(--accent-soft); color: var(--muted);
  display: grid; place-items: center; font-size: 10px;
}
.prod-row .grow { flex: 1; min-width: 0; }
.prod-row .name { font-size: 13.5px; font-weight: 600; }
.prod-row .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 多选系列 */
.cat-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-check {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px;
}
.cat-check input { accent-color: var(--accent); }
.cat-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* 下单页：左侧分类 + 商品卡 + 底部合计条 */
.ord-main {
  display: flex; gap: 10px; margin: 4px 0 16px;
  align-items: flex-start;
}
.ord-cats {
  flex: 0 0 92px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 8px;
}
.ord-cats button {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 10px; padding: 9px 6px; font-size: 11.5px; text-align: center;
  line-height: 1.25; overflow-wrap: anywhere;
}
.ord-cats button.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); font-weight: 600; }

.ord-items { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ord-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 9px; box-shadow: var(--shadow);
}
.ord-row img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: 0 0 54px; background: var(--accent-soft); }
.ord-noimg {
  width: 54px; height: 54px; border-radius: 10px; flex: 0 0 54px;
  background: var(--accent-soft); color: var(--muted);
  display: grid; place-items: center; font-size: 10px;
}
.ord-row .grow { flex: 1; min-width: 0; }
.ord-row .name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.ord-row .meta { font-size: 11.5px; color: var(--accent); font-weight: 700; margin-top: 3px; }
.ord-add {
  width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: var(--ink); color: #F7EFE3; font-size: 16px; line-height: 1;
  display: grid; place-items: center;
}

/* 合计条：浮在底部导航上方，做窄一点，不挡商品价格 */
.ord-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(68px + var(--safe-b)); z-index: 25;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #F7EFE3;
  border-radius: 14px; padding: 7px 12px;
  box-shadow: 0 6px 18px rgba(51,37,31,.22);
}
.ord-bar .ord-total { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.ord-bar .ord-total span { font-size: 10px; opacity: .6; }
.ord-bar .ord-total b { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.ord-bar .btn {
  flex: 0 0 auto; width: auto; min-width: 84px;
  padding: 8px 16px; font-size: 12.5px; border-radius: 10px;
  background: var(--accent); color: #2A1D14; font-weight: 700;
}
.ord-bar .btn:disabled { opacity: .45; }
/* 给固定条留出空间，最后一行的价格不会被盖住 */
.ord-spacer { height: 62px; }

/* 系列行的改名/删除按钮 */
.cat-tool {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-2); border-radius: 8px; font-size: 11px; padding: 5px 8px;
  line-height: 1;
}
.cat-tool:active { transform: scale(.94); }

/* 拖动手柄：按下即拖，禁止选中/长按菜单 */
.drag-h {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; touch-action: none;
}
.cat-row, .prod-row { -webkit-touch-callout: none; }

/* 切片组合行 */
.group-row { background: var(--accent-soft); border-color: #E2CFB6; }
.grp-tag {
  font-size: 9.5px; font-weight: 700; color: #7A5A3A;
  background: #EADCC6; border-radius: 5px; padding: 1px 5px; margin-left: 4px;
}

/* ---------------- 首页（六宫格） ---------------- */
.home-top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 2px 0;
}
.home-top .brand { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.home-top .brand span { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.home-top .today { font-size: 12px; color: var(--muted); }

.home-stats { display: flex; gap: 8px; margin-top: 12px; }
.hs {
  flex: 1; background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 8px; text-align: center;
}
.hs .k { font-size: 10.5px; color: var(--muted); }
.hs .v { font-size: 20px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; }
.hs.alert .v { color: var(--accent); }

.tiles {
  display: grid; grid-template-columns: 1fr 1fr; gap: 11px;
  margin-top: 12px;
}
.tile {
  position: relative; text-align: left;
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 14px 14px; min-height: 142px;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: 0 2px 10px rgba(51,37,31,.05);
  transition: transform .12s var(--spring);
}
.tile:active { transform: scale(.975); }
.tile .t-ico { position: absolute; top: 15px; left: 14px; width: 26px; height: 26px; color: var(--ink-2); }
.tile .t-ico svg { width: 100%; height: 100%; }
.tile .t-nm { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.tile .t-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.tile .badge {
  position: absolute; top: 12px; right: 12px;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center;
}

/* 二级页页头 */
.page-head {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 2px 0 10px;
  border-bottom: 1px solid var(--line);
}
.page-head .ph-back {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 10px; padding: 7px 11px; font-size: 12px; font-weight: 600;
}
.page-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; }
.page-head .ph-right { flex: 0 0 auto; }

/* 更多 */
.more-list { display: flex; flex-direction: column; gap: 8px; }
.more-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px 14px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.more-row .chev { color: var(--muted); font-size: 18px; }

/* 首页撑满一屏 */
.home-wrap {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - 112px);
}
.home-wrap .tiles { flex: 1; grid-auto-rows: 1fr; }

/* 顶栏品牌 = 回首页按钮 */
button.brand {
  display: flex; align-items: center; gap: 9px;
  border: 0; background: none; padding: 0; margin: 0;
  color: inherit; font: inherit; text-align: left;
  -webkit-tap-highlight-color: transparent;
}
button.brand:active { opacity: .6; }

/* 路由切换进度条 */
#routebar {
  position: fixed; top: 0; left: 0; z-index: 999;
  height: 3px; width: 40%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(180,121,74,.5);
  animation: routebar-run 1.1s ease-in-out infinite;
}
@keyframes routebar-run {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* 系列二级页的小首页按钮 */
.ph-home-sm {
  border: 1px solid var(--line); background: var(--paper); color: var(--muted);
  border-radius: 9px; padding: 6px 10px; font-size: 11.5px; font-weight: 600;
  flex: 0 0 auto;
}
.ph-home-sm:active { transform: scale(.95); }

/* 去掉移动端 300ms 点击延迟，点起来更跟手 */
button, .tile, .more-row, .cat-row, .prod-row { touch-action: manipulation; }

/* ---------------- 打包中心 ---------------- */
.resume-card {
  width: 100%; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #F7EFE3; border: 0; border-radius: 16px;
  padding: 13px 14px; margin-bottom: 12px; text-align: left;
  box-shadow: 0 8px 22px rgba(51,37,31,.18);
}
.resume-card .rc-ico { font-size: 20px; }
.resume-card .rc-t { flex: 1; min-width: 0; }
.resume-card .rc-t b { display: block; font-size: 13.5px; }
.resume-card .rc-t span { font-size: 11px; opacity: .72; }
.resume-card .rc-go {
  flex: 0 0 auto; background: var(--accent); color: #2A1D14;
  border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 700;
}

.pack-row {
  width: 100%; display: block; text-align: left;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 13px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.pack-row:active { transform: scale(.99); }
.pack-row.done { opacity: .6; }
.pr-top { display: flex; align-items: center; gap: 8px; }
.pr-top b { font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; }
.pr-time { font-size: 11.5px; color: var(--muted); }
.pr-done { margin-left: auto; font-size: 10.5px; color: var(--green); font-weight: 700; }
.pr-doing {
  margin-left: auto; font-size: 11px; font-weight: 800; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 2px 8px;
}
.pr-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.pr-bar { height: 4px; background: var(--accent-soft); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.pr-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* 打包详情 */
.pack-head {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 12px;
}
.pack-head .ph-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); padding: 3px 0; }
.pack-head .ph-line b { font-size: 16px; color: var(--ink); font-weight: 800; }
.pack-head .muted { color: var(--muted); }

.zone-block { margin-bottom: 14px; }
.zone-title {
  font-size: 12px; font-weight: 800; color: var(--ink-2);
  padding: 6px 2px 8px; letter-spacing: .02em;
}
.zone-block.warn .zone-title { color: var(--red); }

.ck-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 12px; margin-bottom: 7px; text-align: left;
  transition: background .15s, opacity .15s;
}
.ck-row:active { transform: scale(.99); }
.ck-box {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid var(--line); display: grid; place-items: center;
  font-size: 14px; color: #fff; font-weight: 800;
}
.ck-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.ck-qty { flex: 0 0 auto; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.ck-row.on { background: var(--accent-soft); opacity: .62; }
.ck-row.on .ck-box { background: var(--green); border-color: var(--green); }
.ck-row.on .ck-name { text-decoration: line-through; }

.pack-foot { margin-top: 8px; }
.pack-foot .btn { width: 100%; }

/* 商品汇总 */
.sum-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sum-row:last-child { border-bottom: 0; }
.sum-row .sz { flex: 0 0 auto; font-size: 10px; color: var(--muted); background: var(--accent-soft); border-radius: 5px; padding: 2px 6px; }
.sum-row .sn { flex: 1; min-width: 0; font-size: 13px; }
.sum-row .sq { flex: 0 0 auto; font-size: 15px; font-weight: 800; }

/* ---------- 去掉系统默认的蓝色（链接 / 焦点 / 选中 / 自动填充） ---------- */
a, a:link, a:visited, a:hover, a:active { color: inherit; text-decoration: none; }

button, input, select, textarea {
  color: var(--ink);
  font-family: inherit;
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input::-webkit-input-placeholder { color: var(--muted); }

/* 点击后的焦点框：换成焦糖色细线，不要系统蓝 */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid rgba(180, 121, 74, .45);
  outline-offset: 2px;
  border-radius: 8px;
}

/* 文本选中色 */
::selection { background: #E8D8C1; color: #2B2320; }
::-moz-selection { background: #E8D8C1; color: #2B2320; }

/* 浏览器自动填充不要蓝底 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--cream-2) inset;
  transition: background-color 9999s ease-out 0s;
}

/* 链接一律不要下划线/蓝色（包括 tel: 拨打） */
.copy-btn, .copy-btn:visited { color: var(--ink-2); text-decoration: none; }
/* 已打包折叠按钮 */
.done-toggle {
  width: 100%; margin-top: 18px;
  background: none; border: 1px dashed var(--line); border-radius: 12px;
  padding: 11px; font-size: 12px; color: var(--muted);
}
.done-toggle:active { transform: scale(.99); }

/* 打包列表里的打印按钮 */
.pr-print {
  display: inline-block; margin-top: 8px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
  background: var(--cream-2, #FFFDF9);
}

/* 系统自检 */
.chk-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.chk-row:last-child { border-bottom: 0; }
.chk-row b { font-size: 13px; }
.chk-row .good { color: var(--green); }
.chk-row .bad { color: var(--red); }
.chk-row .muted { color: var(--muted); }

/* ---------------- AI 小球 ---------------- */
#ai-ball {
  position: fixed; right: 14px; bottom: calc(76px + var(--safe-b)); z-index: 60;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  opacity: .92;
  background: linear-gradient(145deg, #B4794A, #8E5A32);
  color: #FFF6EA; display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(90,56,32,.35);
  transition: transform .15s ease;
}
#ai-ball svg { width: 23px; height: 23px; }
#ai-ball:active { transform: scale(.92); }

#ai-panel {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--cream-2); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(51,37,31,.18);
  padding-bottom: var(--safe-b);
}
.ai-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 10px; border-bottom: 1px solid var(--line);
}
.ai-head b { font-size: 15px; }
.ai-head .ai-sub { font-size: 11px; color: var(--muted); flex: 1; }
.ai-head button {
  border: 0; background: none; font-size: 16px; color: var(--muted); padding: 4px 6px;
}
.ai-msgs {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.ai-msg {
  max-width: 86%; padding: 9px 12px; border-radius: 14px;
  font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.ai-msg.me { align-self: flex-end; background: var(--accent); color: #2A1D14; border-bottom-right-radius: 4px; }
.ai-msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg.sys { align-self: center; background: none; color: var(--muted); font-size: 11.5px; text-align: center; }
.ai-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px 0; }
.ai-chips button {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 6px 11px; font-size: 11.5px;
}
.ai-input {
  display: flex; gap: 8px; padding: 10px 14px 14px;
}
.ai-input input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 13px; background: #fff;
}
.ai-input button {
  flex: 0 0 auto; border: 0; border-radius: 12px; padding: 0 16px;
  background: var(--ink); color: #F7EFE3; font-size: 13px; font-weight: 600;
}
.ai-input button:disabled { opacity: .5; }

/* AI 里"记下这个问题"按钮 */
.ai-save {
  border: 1px solid var(--accent); background: var(--accent-soft);
  color: var(--ink); border-radius: 10px; padding: 8px 12px;
  font-size: 12.5px; font-weight: 600;
}
.ai-save:disabled { opacity: .6; }

/* 顶栏刷新按钮 */
#btn-refresh svg { width: 18px; height: 18px; display: block; }
#btn-refresh.spinning svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 悬浮球快捷菜单 */
#fab-menu {
  position: fixed; right: 14px; bottom: calc(132px + var(--safe-b)); z-index: 65;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
#fab-menu button {
  display: flex; align-items: center; gap: 8px;
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px; font-size: 13px; color: var(--ink);
  box-shadow: 0 4px 14px rgba(51,37,31,.14);
}
#fab-menu button:active { transform: scale(.96); }
#fab-menu button span { font-size: 14px; }
#fab-menu button i { font-style: normal; }

/* 手动下单页不需要悬浮球（会被合计条挡住） */
body.is-new #ai-ball, body.is-new #fab-menu { display: none; }