:root {
  --brand: #9E2B25;
  --brand-deep: #6E1B17;
  --brand-weak: #F7E8E4;
  --gold: #B08A4A;
  --bg: #F6F1E7;
  --surface: #FFFDF8;
  --line: #E4DACA;
  --text: #221E1A;
  --text-2: #5C554C;
  --text-3: #9B9287;
  --danger: #B23A2E;
  --ok: #2F6B4F;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(176,138,74,0.16), transparent 60%),
    linear-gradient(160deg, #7D231D 0%, #4A100D 100%);
}
.login__card {
  width: 380px;
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 32px 26px;
  box-shadow: 0 30px 80px rgba(30, 10, 8, 0.35);
}
.login__brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login__seal {
  width: 48px; height: 48px; border-radius: 6px;
  background: var(--brand); color: #FFF6EC;
  display: flex; align-items: center; justify-content: center;
  font-family: "Songti SC", serif; font-size: 26px;
}
.login__name { font-size: 18px; font-weight: 600; letter-spacing: 2px; }
.login__sub { font-size: 11px; letter-spacing: 3px; color: var(--text-3); }

.field { display: block; margin-bottom: 16px; }
.field__label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px;
  outline: none;
}
.field input:focus { border-color: var(--brand); background: #fff; }

.login__error { margin-top: 12px; color: var(--danger); font-size: 13px; min-height: 20px; }
.login__hint { margin-top: 18px; font-size: 12px; color: var(--text-3); line-height: 1.6; }

/* ---------- 框架 ---------- */
.app { display: flex; min-height: 100%; }

.side {
  width: 208px; flex: none;
  background: linear-gradient(180deg, #6E1B17, #4A100D);
  color: #F5E7CE;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side__brand { display: flex; align-items: center; gap: 12px; padding: 24px 20px; }
.side__seal {
  width: 38px; height: 38px; border-radius: 5px;
  background: rgba(245, 231, 206, 0.14);
  border: 1px solid rgba(245, 231, 206, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-family: "Songti SC", serif; font-size: 20px;
}
.side__name { font-size: 16px; letter-spacing: 3px; font-weight: 600; }
.side__sub { font-size: 11px; letter-spacing: 2px; opacity: 0.6; }

.nav { padding: 8px 12px; flex: 1; }
.nav__item {
  display: block;
  padding: 10px 14px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: rgba(245, 231, 206, 0.78);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav__item:hover { background: rgba(245, 231, 206, 0.1); color: #F5E7CE; }
.nav__item.active { background: rgba(245, 231, 206, 0.92); color: var(--brand-deep); font-weight: 600; }

.side__foot { padding: 18px 20px; font-size: 11px; opacity: 0.5; }

.main { flex: 1; min-width: 0; padding: 0 32px 48px; }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 26px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.topbar__crumb { font-size: 12px; color: var(--text-3); letter-spacing: 1px; }
.topbar__title { margin: 4px 0 0; font-size: 24px; font-weight: 600; letter-spacing: 2px; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__who { font-size: 13px; color: var(--text-2); }

/* ---------- 组件 ---------- */
.view { max-width: 1180px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 18px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
}
.btn--primary { background: var(--brand); color: #FFF8F0; }
.btn--primary:hover { background: var(--brand-deep); }
.btn--ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn--ghost:hover { background: var(--brand-weak); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12px; letter-spacing: 0; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 18px 20px; }
.stat__label { font-size: 12px; color: var(--text-3); letter-spacing: 1px; }
.stat__num { margin-top: 8px; font-size: 30px; font-weight: 600; font-family: "DIN Alternate", -apple-system, sans-serif; }
.stat__sub { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.stat--hero { background: linear-gradient(160deg, #A8322B, #6E1B17); border: none; color: #F5E7CE; }
.stat--hero .stat__label, .stat--hero .stat__sub { color: rgba(245, 231, 206, 0.72); }

.section { margin-top: 24px; }
.section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section__title { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.section__more { font-size: 12px; color: var(--text-3); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #FFF8F0; font-weight: 600; }
.search {
  flex: 1; min-width: 180px; max-width: 280px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); font-size: 13px; font-family: inherit;
}
.search:focus { outline: none; border-color: var(--brand); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: 1px; background: rgba(246, 241, 231, 0.5); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: rgba(158, 43, 37, 0.035); }
td.num { font-family: "DIN Alternate", -apple-system, sans-serif; font-weight: 600; }
.t-muted { color: var(--text-3); font-size: 12px; }

.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 4px; font-size: 12px; font-weight: 600;
}
.badge--unpaid { background: #F7EEDA; color: #8A6114; }
.badge--paid { background: var(--brand-weak); color: var(--brand); }
.badge--making { background: #EFE7DA; color: #7A5B2E; }
.badge--sent { background: #E7EFEC; color: #2F6B4F; }
.badge--done { background: #EEECE6; color: #6B665D; }
.badge--canceled { background: #F0EDE8; color: #9B9287; }

.toggle { cursor: pointer; user-select: none; font-size: 12px; }
.toggle--on { color: var(--ok); }
.toggle--off { color: var(--text-3); }

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

/* ---------- 抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(34, 30, 26, 0.32); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px;
  background: var(--surface); z-index: 41;
  box-shadow: -12px 0 40px rgba(34, 30, 26, 0.16);
  display: flex; flex-direction: column;
}
.drawer__head {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__title { font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.drawer__close { border: none; background: none; font-size: 22px; color: var(--text-3); cursor: pointer; line-height: 1; }
.drawer__body { padding-bottom: 28px; flex: 1; overflow: auto; padding: 20px 24px; }
.drawer__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv__k { color: var(--text-3); font-size: 13px; flex: none; }
.kv__v { text-align: right; font-size: 13px; word-break: break-all; }

.items { margin-top: 6px; }
.item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.item:last-child { border-bottom: none; }
.item__sub { color: var(--text-3); font-size: 12px; }

.timeline { margin-top: 6px; }
.tl { display: flex; gap: 10px; padding-bottom: 12px; position: relative; }
.tl::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-top: 5px; flex: none; }
.tl--on .tl__dot { background: var(--brand); }
.tl__text { font-size: 13px; }
.tl__time { font-size: 11px; color: var(--text-3); }

.field-row { margin-bottom: 12px; }
.field-row label { display: block; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.field-row input, .field-row select {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); font-size: 13px; font-family: inherit;
}
.field-row textarea {
  width: 100%; min-height: 92px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); font-size: 13px; font-family: inherit;
  line-height: 1.6; resize: vertical;
}
.field-row input[type="color"] { height: 38px; padding: 3px; cursor: pointer; }
.field-hint { font-size: 11px; color: var(--text-3); margin-top: 5px; }

.spec-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.spec-head {
  display: flex; gap: 10px; padding: 7px 12px;
  font-size: 11px; color: var(--text-3);
  background: rgba(34, 30, 26, 0.03);
  border-bottom: 1px solid var(--line);
}
.spec-head span:nth-child(1) { width: 92px; }
.spec-head span:nth-child(2) { flex: 1; }
.spec-head span:nth-child(3) { width: 26px; }
.spec-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(34, 30, 26, 0.06);
}
.spec-row:last-child { border-bottom: none; }
.spec-row input {
  height: 32px; padding: 0 9px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--text-1);
}
.spec-row .spec-mm { width: 92px; flex: none; }
.spec-row .spec-price { flex: 1; }
.spec-del {
  width: 26px; height: 26px; flex: none; line-height: 1;
  border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--text-3);
  font-size: 16px; cursor: pointer;
}
.spec-del:hover { color: #B23A2E; border-color: rgba(178, 58, 46, 0.3); background: rgba(178, 58, 46, 0.06); }
.spec-add { margin-top: 8px; }

.image-drop {
  position: relative;
  height: 148px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(34,30,26,.05) 25%, transparent 25%, transparent 75%, rgba(34,30,26,.05) 75%),
    linear-gradient(45deg, rgba(34,30,26,.05) 25%, transparent 25%, transparent 75%, rgba(34,30,26,.05) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.image-drop--on { border-color: var(--brand); background-color: #FBF4EC; }
.image-drop--has .image-tip { display: none; }
.image-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-tip { position: absolute; font-size: 12px; color: var(--text-3); }
.image-clear {
  margin-top: 8px; padding: 0; border: none; background: none;
  color: var(--text-3); font-size: 12px; font-family: inherit;
  cursor: pointer; text-decoration: underline;
}
.image-clear:hover { color: #B23A2E; }
.image-drop--has .image-tip { display: none; }
.dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  margin-right: 8px; vertical-align: -1px;
  box-shadow: inset 0 0 0 1px rgba(34, 30, 26, 0.12);
}
.btn--danger { color: #B23A2E; border-color: rgba(178, 58, 46, 0.45); background: transparent; }
.btn--danger:hover { background: rgba(178, 58, 46, 0.07); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(12px);
  background: rgba(34, 30, 26, 0.9); color: #fff;
  padding: 9px 18px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all 0.2s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: rgba(178, 58, 46, 0.94); }

@media (max-width: 900px) {
  .side { width: 64px; }
  .side__name, .side__sub, .nav__item { display: none; }
  .main { padding: 0 16px 32px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .drawer { width: 100%; }
}
/* ---------- 裁剪 ---------- */
.cropper {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(20, 16, 12, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.cropper__panel {
  width: 380px; max-width: 100%;
  background: #fff; border-radius: 12px; padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}
.cropper__title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.cropper__stage {
  position: relative; width: 320px; height: 320px; margin: 0 auto;
  overflow: hidden; border-radius: 8px;
  cursor: grab; touch-action: none; user-select: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, rgba(34,30,26,.06) 25%, transparent 25%, transparent 75%, rgba(34,30,26,.06) 75%),
    linear-gradient(45deg, rgba(34,30,26,.06) 25%, transparent 25%, transparent 75%, rgba(34,30,26,.06) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}
.cropper__stage:active { cursor: grabbing; }
.cropper__img {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0; will-change: transform;
  pointer-events: none; user-select: none; max-width: none;
}
.cropper__mask {
  position: absolute; left: 50%; top: 50%;
  width: 300px; height: 300px; margin: -150px 0 0 -150px;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(20, 16, 12, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.cropper__zoom {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; font-size: 12px; color: var(--text-3);
}
.cropper__zoom input { flex: 1; }
.cropper__check {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.cropper__check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.cropper__tol {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; font-size: 12px; color: var(--text-3);
}
.cropper__tol input { flex: 1; }
.cropper__hint { font-size: 11px; color: var(--text-3); margin-top: 8px; text-align: center; }
.cropper__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.t-warn { color: #B23A2E; font-weight: 600; }
.sku-head span:nth-child(1) { width: 76px; }
.sku-head span:nth-child(2) { flex: 1; }
.sku-head span:nth-child(3) { width: 76px; }
.spec-row .sku-cm { width: 76px; flex: none; }
.spec-row .sku-price { flex: 1; }
.spec-row .sku-stock { width: 76px; flex: none; }
.alert {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px;
  border-radius: 8px;
  background: rgba(178, 58, 46, 0.07);
  border: 1px solid rgba(178, 58, 46, 0.22);
  color: #8E2B24; font-size: 13px;
}
.alert__dot { width: 8px; height: 8px; border-radius: 50%; background: #B23A2E; flex: none; }
/* ---------- 通知 ---------- */
.notify {
  position: relative;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--text-2);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.notify:hover { border-color: rgba(158, 43, 37, 0.4); color: var(--brand); }
.notify__dot { display: none; }
.notify--has .notify__dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #B23A2E; margin-right: 6px; vertical-align: 1px;
}
.notify__panel {
  position: absolute; right: 24px; top: 74px; z-index: 40;
  width: 268px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(34, 30, 26, 0.16);
}
.notify__item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-1);
}
.notify__item:hover { background: rgba(158, 43, 37, 0.05); }
.notify__n { color: var(--brand); font-weight: 600; }
.notify__empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.badge--refunded { background: rgba(34, 30, 26, 0.07); color: var(--text-3); }

/* ---------- 看板 ---------- */
.charts { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.chart { padding: 16px 18px; }
.chart__title { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar__val { font-size: 11px; color: var(--text-3); height: 14px; }
.bar__track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar__fill { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #9E2B25, #C4674F); min-height: 2px; }
.bar__label { margin-top: 8px; font-size: 11px; color: var(--text-3); }
.rank { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.rank__name { width: 60px; color: var(--text-1); }
.rank__bar { flex: 1; height: 8px; border-radius: 999px; background: rgba(34, 30, 26, 0.07); overflow: hidden; }
.rank__bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #B08A4A, #D9B67C); }
.rank__n { width: 48px; text-align: right; color: var(--text-3); font-size: 12px; }
.chart__foot { margin-top: 12px; font-size: 11px; color: var(--text-3); }
.thumb { width: 46px; height: 34px; object-fit: cover; border-radius: 4px; margin-right: 10px; vertical-align: middle; border: 1px solid var(--line); }
.thumb--wide { width: 56px; }
