:root {
  --primary: #C8422F;
  --primary-soft: #FDF0ED;
  --primary-dark: #A9361F;
  --text: #1F2329;
  --text-2: #5A6270;
  --text-3: #98A0AB;
  --bg: #F4F5F7;
  --card: #ffffff;
  --line: #E5E8EC;
  --ok: #1D9E75;
  --ok-soft: #E6F6F0;
  --warn: #BA7517;
  --warn-soft: #FDF6E7;
  --danger: #D93A3A;
  --danger-soft: #FDECEC;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

/* ------------------------------- 登录 ------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FBF7F2 0%, #F1F2F4 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 32px;
  box-shadow: 0 12px 40px rgba(31, 35, 41, 0.1);
}

.login-brand {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--primary);
  font-weight: 600;
}

.login-title {
  margin: 10px 0 6px;
  font-size: 26px;
  font-weight: 600;
}

.login-sub {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s;
}

.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.input::placeholder, .textarea::placeholder { color: #B9BEC6; }

.field-label + .input { margin-bottom: 18px; }

.textarea { min-height: 76px; resize: vertical; }

.login-error {
  min-height: 20px;
  margin-bottom: 10px;
  color: var(--danger);
  font-size: 13px;
}

.login-tip {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

/* ------------------------------- 布局 ------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: none;
  background: #23272E;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { font-size: 16px; font-weight: 600; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,.5); margin-top: 2px; }

.nav { flex: 1; padding: 12px 10px; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 14px;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.on { background: var(--primary); color: #fff; font-weight: 500; }

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}

.nav-item.on .nav-badge { background: #fff; }

.side-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.who { font-size: 12px; color: rgba(255,255,255,.6); margin-bottom: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title { margin: 0; font-size: 20px; font-weight: 600; }
.page-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.view { padding: 22px 28px 60px; }

/* ------------------------------- 组件 ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  background: #F1F2F4;
  color: var(--text);
  white-space: nowrap;
}

.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); filter: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.card-sub { font-size: 12px; color: var(--text-3); margin-bottom: 14px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-num { font-size: 28px; font-weight: 600; line-height: 1.15; }
.stat-num.hot { color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; color: var(--text-3); font-weight: 500; background: #FAFBFC; white-space: nowrap; }
.table tbody tr:hover { background: #FAFBFC; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.6;
}

.tag-pending { background: var(--primary-soft); color: var(--primary); }
.tag-done { background: var(--ok-soft); color: var(--ok); }
.tag-cancelled { background: #EEF0F2; color: #7A828C; text-decoration: line-through; }
.tag-off { background: #F1F2F4; color: var(--text-3); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-info { background: #EAF1FA; color: #2C6BB0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; margin: 0; padding: 7px 10px; font-size: 13px; }

.thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #F1F2F4;
  display: block;
}

.thumb-ph {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #F1F2F4;
  color: #B9BEC6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
}

.thumb-lg { width: 132px; height: 132px; }
.thumb-lg.thumb-ph { font-size: 32px; }

.empty { padding: 56px 20px; text-align: center; color: var(--text-3); font-size: 13px; }

.form-row { display: grid; grid-template-columns: 108px 1fr; gap: 12px; align-items: start; margin-bottom: 14px; }
.form-row > label { padding-top: 9px; font-size: 13px; color: var(--text-2); }
.form-row .hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.6; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.switch-row { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.switch-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 5px 13px;
  border-radius: 999px;
  background: #F1F2F4;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.chip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }

/* 菜品编辑里的加工方式/规格：块状展开，标题 + 具体选项 */
.chip-list-block { flex-direction: column; align-items: stretch; }
.chip-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 9px 13px;
  border-radius: 10px;
  text-align: left;
}
.chip-block .chip-title { font-weight: 500; }
.chip-block .chip-items { font-size: 12px; opacity: .72; line-height: 1.5; }

.upload-box { display: flex; gap: 16px; align-items: flex-start; }
.upload-actions { display: flex; flex-direction: column; gap: 8px; }
.upload-actions .hint { font-size: 12px; color: var(--text-3); }

/* ------------------------------- 弹窗 ------------------------------- */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  background: #fff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide { max-width: 720px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

.modal-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 0 4px;
}

.modal-body { padding: 20px 22px; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #FAFBFC;
}

.order-items { width: 100%; border-collapse: collapse; }
.order-items th, .order-items td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px; text-align: left; }
.order-items th { color: var(--text-3); font-weight: 500; background: #FAFBFC; }
.order-total { display: flex; justify-content: space-between; padding: 14px 10px 0; font-size: 15px; }
.order-total b { color: var(--primary); font-size: 20px; }

.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.kv .k { color: var(--text-3); }
.mono { font-family: Menlo, Consolas, monospace; }

/* ------------------------------ 小程序码区块 ------------------------------ */

.qr-box {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FAFBFC;
}

.qr-img {
  width: 168px;
  height: 168px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

.qr-meta { flex: 1; min-width: 240px; }
.qr-meta .kv { padding: 3px 0; }

.qr-note {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.8;
}

.qr-note.warn {
  background: var(--warn-soft);
  color: #8A6A2A;
  padding: 12px 14px;
  border-radius: 8px;
}

.qr-box > .qr-note:only-child { flex: 1; }

.qr-actions { display: flex; gap: 10px; margin-top: 12px; }


/* ------------------------------- Toast ------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  background: #23272E;
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  max-width: 80vw;
}

.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border-bottom: 0; padding: 14px 16px; white-space: nowrap; }
  .nav { display: flex; padding: 8px; }
  .nav-item { white-space: nowrap; }
  .side-foot { border-top: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
  .who { margin: 0; white-space: nowrap; }
  .view, .topbar { padding-left: 16px; padding-right: 16px; }
}
