:root {
  --coral: #ff6b57;
  --coral-dark: #e85845;
  --sea: #2e8b9e;
  --ink: #22303c;
  --muted: #7b8892;
  --line: #e9e3da;
  --bg: #f7f4ef;
  --card: #ffffff;
  --sand: #fff3ea;
  --green: #3e8b5b;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

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

/* ---------- sidebar ---------- */
.sidebar {
  width: 226px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fffdfa;
  border-right: 1px solid var(--line);
}

.sidebar__brand { padding: 26px 22px 20px; border-bottom: 1px solid var(--line); }
.sidebar__logo { font-size: 27px; font-weight: 800; letter-spacing: 4px; }
.sidebar__sub { margin-top: 5px; font-size: 10px; letter-spacing: 1.4px; color: #bbada0; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; }
.nav__group { padding: 16px 10px 8px; font-size: 11px; letter-spacing: 1.2px; color: #b0a496; }
.nav__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #5c6a75;
  text-align: left;
  font-size: 13px;
}
.nav__item:hover { background: #faf5ee; }
.nav__item.is-active { background: var(--coral); color: #fff; font-weight: 600; }
.nav__ico { width: 18px; text-align: center; font-size: 14px; opacity: .9; }

.sidebar__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #c9c2b8; }
.dot.is-on { background: var(--green); }
.dot.is-off { background: #d69b4a; }

/* ---------- topbar ---------- */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 30px;
  background: rgba(255, 253, 250, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 19px; font-weight: 700; }
.topbar__desc { margin-top: 3px; color: var(--muted); font-size: 12px; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.dirty { color: var(--coral); font-size: 12px; font-weight: 600; }

.banner { margin: 16px 30px 0; padding: 12px 16px; border-radius: 10px; background: #fff4dc; color: #8a6a2f; font-size: 13px; }
.banner code { padding: 1px 6px; border-radius: 4px; background: #f6e7bd; }

.content { flex: 1; padding: 26px 30px 60px; }

/* ---------- shared ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #f2ede6;
  color: #5c6a75;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: .15s;
}
.btn:hover { filter: brightness(.97); }
.btn--primary { background: var(--coral); color: #fff; }
.btn--ghost { background: #fff; border-color: var(--line); color: #5c6a75; }
.btn--sea { background: #e8f4f6; color: var(--sea); }
.btn--soft { background: var(--sand); color: #b4684c; }
.btn--danger { background: #fff0ee; color: #c85544; }
.btn--sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 4px 18px rgba(34, 48, 60, .035);
}
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card__title { font-size: 15px; font-weight: 700; }
.card__sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.7; }

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat__label { color: var(--muted); font-size: 12px; }
.stat__num { margin-top: 10px; font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.stat__foot { margin-top: 6px; color: #a8b2ba; font-size: 11px; }

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field__label { display: block; margin-bottom: 7px; color: #6c7b85; font-size: 12px; font-weight: 600; }
.field__input, .field__textarea, .field__select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbf9f6;
  outline: none;
  font-size: 13px;
  transition: .15s;
}
.field__input:focus, .field__textarea:focus, .field__select:focus { border-color: var(--coral); background: #fff; }
.field__textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field__tip { display: block; margin-top: 6px; color: #aab3ba; font-size: 11px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbf9f6; font-size: 12px; cursor: pointer; }
.check.is-on { border-color: var(--coral); background: #fff3ef; color: var(--coral-dark); font-weight: 600; }
.check input { accent-color: var(--coral); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .field__input, .toolbar .field__select { width: auto; min-width: 160px; height: 36px; }
.toolbar__spacer { flex: 1; }

/* ---------- rows / table ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.row:hover { border-color: #dfd3c5; }
.row__img { width: 56px; height: 70px; flex: none; object-fit: cover; border-radius: 8px; background: #f4efe8; }
.row__badge { width: 62px; height: 62px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 11px; font-weight: 700; }
.row__body { flex: 1; min-width: 0; }
.row__name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { margin-top: 5px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__price { color: var(--coral); font-weight: 700; font-size: 14px; white-space: nowrap; }
.row__actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge--on { background: #e9f6ec; color: var(--green); }
.badge--off { background: #f1f1f1; color: #9aa5b1; }
.badge--new { background: #fff0e9; color: var(--coral); }
.badge--sea { background: #e7f3f5; color: var(--sea); }

.empty { padding: 46px 0; text-align: center; color: #a8b2ba; font-size: 13px; }

.tier { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tier .field__input { width: 130px; }
.tier__x { color: var(--muted); font-size: 12px; }

.preview { margin-top: 8px; padding: 16px; border-radius: 10px; background: var(--sand); color: #7b6252; font-size: 12px; line-height: 1.9; }
.kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--muted); }
.kv__v { font-weight: 600; }

.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery__item { width: 62px; height: 78px; object-fit: cover; border: 3px solid transparent; border-radius: 8px; background: #f4efe8; cursor: pointer; }
.gallery__item.is-on { border-color: var(--coral); }
.gallery--banner .gallery__item { width: 108px; height: 54px; }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 50; }
.modal__mask { position: absolute; inset: 0; background: rgba(30, 40, 48, .48); }
.modal {
  position: relative;
  width: min(720px, calc(100vw - 40px));
  max-height: 88vh;
  margin: 6vh auto 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(20, 30, 40, .22);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close { border: 0; background: transparent; font-size: 24px; color: #a8b2ba; line-height: 1; }
.modal__body { padding: 22px 24px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fcfaf7; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 11px 22px;
  border-radius: 24px;
  background: #22303c;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 26px rgba(20, 30, 40, .25);
}

@media (max-width: 980px) {
  .sidebar { width: 190px; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2, .field-row, .field-row--3 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .content { padding: 20px 18px 50px; }
  .banner { margin: 14px 18px 0; }
}

/* 团购设置 / 订单物流 */
.muted { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #FFF3E0; color: #E65100; font-size: 11px; }
.tl { margin: 0; padding-left: 14px; }
.tl li { color: var(--muted); font-size: 12px; line-height: 1.6; }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider { position: absolute; inset: 0; background: #ccc; border-radius: 999px; transition: .2s; }
.switch__slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .switch__slider { background: var(--coral); }
.switch input:checked + .switch__slider::before { transform: translateX(22px); }
.orders-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.orders-table th, .orders-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
.orders-table th { color: var(--muted); font-weight: 600; background: #fafafa; }
