@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");
:root {
  font-family: "DM Sans", "Noto Sans SC", sans-serif;
  color: #173a2d;
  background: #f3f6f2;
  --ink: #173a2d;
  --muted: #738178;
  --wine: #075438;
  --wine-deep: #033c28;
  --rose: #0c6746;
  --blush: #e3eee8;
  --cream: #fbfcf9;
  --sage: #789786;
  --line: #dde6df;
  --white: #fff;
  --shadow: 0 18px 50px rgba(5, 72, 48, 0.08);
}

/* 订单贺卡样品 */
.order-card-sample{display:flex;align-items:center;gap:14px;margin-bottom:12px;padding:12px;border-radius:14px;background:#f4f8f6}.order-card-sample img{width:90px;height:66px;border-radius:10px;object-fit:cover}.order-card-sample strong,.order-card-sample small{display:block}.order-card-sample small{margin-top:4px;color:#84918b}
.shansong-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}.shansong-detail-grid p{margin:0;padding:12px;border-radius:12px;background:#f3f8fb}.shansong-detail-grid span,.shansong-detail-grid b{display:block}.shansong-detail-grid span{color:#7f8d87;font-size:12px}.shansong-detail-grid b{margin-top:5px;overflow-wrap:anywhere;color:#0b5038;font-size:14px}
.shansong-auth-panel .btn{display:block;width:100%;margin-top:14px}.shansong-auth-panel .btn.secondary{border:1px solid #9fbeb0;background:#fff;color:#086042}

/* 小程序同款暖橙主题与页面装修 */
:root {
  --ink: #2f2926;
  --muted: #8d817a;
  --wine: #ff6240;
  --wine-deep: #ed4e2c;
  --rose: #ff6240;
  --blush: #fff0ea;
  --cream: #fffaf6;
  --sage: #d6a08f;
  --line: #eee3dc;
  --shadow: 0 18px 50px rgba(101, 62, 42, 0.09);
}
html, body { background: #f7f4ef; }
.side { background: #302722; }
.side button.active { background: linear-gradient(120deg, #ff6240, #f4815f); }
.side button.active:after { background: #ffe3d8; }
.btn { background: var(--wine); box-shadow: 0 7px 20px rgba(255, 98, 64, 0.2); }
.btn:hover { background: var(--wine-deep); }
.btn.gray { background: #9b918c; }
.btn.danger { background: #b95858; }
.login-brand { background: linear-gradient(150deg, #302722 0%, #574036 55%, #ff6240 140%); }
.login-brand .eyebrow { color: #ffd7c8; }
.login-note { color: #f2ddd4; }
.brand-logo { fill: var(--action, #ff6240); }
.panel, .cfg-card { border: 1px solid #eee3dc; box-shadow: var(--shadow); }
.eyebrow { color: var(--wine); }

.content-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 28px 32px;
  border: 1px solid #f1ded5;
  border-radius: 22px;
  background: linear-gradient(125deg, #fff 0%, #fff 65%, #fff0ea 100%);
  box-shadow: var(--shadow);
}
.content-overview h2 { margin: 0 0 8px; font-size: 29px; }
.content-overview p:not(.eyebrow) { margin: 0; color: var(--muted); }
.content-sync { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: 999px; background: #fff; font-weight: 700; white-space: nowrap; }
.content-sync span { width: 10px; height: 10px; border-radius: 50%; background: #36b477; box-shadow: 0 0 0 6px #e8f7ef; }
.content-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding-bottom: 96px; }
.content-card, .content-images { padding: 26px; border: 1px solid #eee3dc; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.content-card header { padding-bottom: 18px; border-bottom: 1px solid #f1e9e4; }
.content-card h3 { margin: 0 0 7px; font-size: 19px; }
.content-card header p { margin: 0; color: var(--muted); font-size: 13px; }
.content-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-top: 20px; }
.content-field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 700; }
.content-field.full { grid-column: 1 / -1; }
.content-field input, .content-field select, .content-field textarea { width: 100%; border: 1px solid #e8ddd7; border-radius: 12px; outline: none; background: #fffaf7; color: var(--ink); }
.content-field input, .content-field select { height: 46px; padding: 0 13px; }
.content-field textarea { min-height: 142px; padding: 13px; resize: vertical; line-height: 1.7; }
.content-field input:focus, .content-field select:focus, .content-field textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 3px #fff0ea; }
.content-field small { color: var(--muted); font-weight: 400; line-height: 1.6; }
.content-check { display: flex; align-items: center; gap: 9px; min-height: 46px; font-size: 13px; font-weight: 700; }
.content-check input { accent-color: var(--wine); }
.scene-editor { grid-column: 1 / -1; }
.scene-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.scene-editor-head .btn { flex: 0 0 auto; padding: 10px 16px; }
.scene-card-editor-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 20px; }
.scene-card-editor { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; padding: 14px; border: 1px solid #e8e5df; border-radius: 16px; background: #fbfaf7; }
.scene-image-preview { width: 96px; height: 96px; overflow: hidden; display: flex; align-items: center; justify-content: center; border-radius: 14px; color: var(--wine); background: #eef4ef; }
.scene-image-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.scene-image-preview svg { width: 34px; height: 34px; fill: currentColor; }
.scene-card-fields { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.scene-card-fields label:first-child { display: flex; flex-direction: column; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.scene-card-fields input[type="text"], .scene-card-fields input:not([type]) { height: 40px; width: 100%; padding: 0 11px; border: 1px solid #dddcd6; border-radius: 10px; background: #fff; }
.scene-image-upload { width: fit-content; padding: 8px 13px; overflow: hidden; position: relative; border: 1px solid #cbdcd1; border-radius: 9px; color: var(--wine); background: #fff; cursor: pointer; font-size: 12px; font-weight: 700; }
.scene-image-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.scene-remove { position: absolute; right: 9px; top: 9px; width: 26px; height: 26px; border: 0; border-radius: 50%; color: #8e817b; background: rgba(255,255,255,.88); cursor: pointer; font-size: 18px; }
@media (max-width: 900px) { .scene-card-editor-list { grid-template-columns: 1fr; } }
.content-images-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 20px; }
.content-images-head strong, .content-images-head small { display: block; }
.content-images-head small { margin-top: 6px; color: var(--muted); font-size: 12px; }
.image-upload { position: relative; overflow: hidden; white-space: nowrap; }
.image-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.content-image-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.content-image-list article { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 14px; background: #f7f1ed; cursor: grab; }
.content-image-list article.dragging { opacity: .45; }
.content-image-list img { width: 100%; height: 100%; object-fit: cover; }
.content-image-list article span { position: absolute; left: 8px; bottom: 8px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 11px; font-weight: 800; }
.content-image-list article button { position: absolute; top: 7px; right: 7px; width: 25px; height: 25px; border: 0; border-radius: 50%; background: rgba(48,39,34,.75); color: #fff; cursor: pointer; }
.content-savebar { border-color: #f0ddd4; }

@media (max-width: 1050px) {
  .content-layout { grid-template-columns: 1fr; }
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: #f3f6f2;
}
body {
  min-width: 320px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
svg {
  display: block;
}
.icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}
.brand-logo {
  width: 48px;
  height: 48px;
  fill: #0c6746;
  overflow: visible;
}
.brand-logo .stem {
  fill: none;
  stroke: #789786;
  stroke-width: 3;
  stroke-linecap: round;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.muted-copy {
  color: var(--muted);
  line-height: 1.7;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  padding: 10px 16px;
  cursor: pointer;
  background: var(--wine);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 7px 20px rgba(5, 84, 56, 0.15);
  transition: 0.2s ease;
}
.btn:hover {
  background: var(--wine-deep);
  transform: translateY(-1px);
}
.btn.gray {
  background: #8b8285;
}
.btn.danger {
  background: #a64f5f;
}
.btn .icon {
  width: 17px;
  height: 17px;
}
/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(420px, 0.92fr);
  background: #faf8f6;
}
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9vw;
  background: linear-gradient(150deg, #033c28 0%, #075438 55%, #16704e 100%);
  color: #fff;
}
.login-brand:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 18% 18%,
      rgba(255, 255, 255, 0.14),
      transparent 24%
    ),
    linear-gradient(115deg, transparent 55%, rgba(255, 255, 255, 0.04) 55%);
  pointer-events: none;
}
.brand-orbit {
  position: relative;
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  margin-bottom: 42px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
}
.brand-orbit:after {
  content: "";
  position: absolute;
  inset: -13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}
.brand-orbit .brand-logo {
  width: 56px;
  height: 56px;
  fill: #e9d8ad;
}
.brand-orbit .stem {
  stroke: #bfd0bd;
}
.login-brand .eyebrow {
  position: relative;
  color: #dbc99c;
}
.login-brand h1 {
  position: relative;
  margin: 0;
  max-width: 640px;
  font-size: clamp(38px, 4.2vw, 68px);
  line-height: 1.24;
  letter-spacing: -0.04em;
  font-weight: 600;
}
.login-note {
  position: relative;
  max-width: 480px;
  margin: 30px 0 0;
  color: #d8e5dd;
  font-size: 16px;
  line-height: 1.9;
}
.petal {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100% 0 100% 0;
  transform: rotate(25deg);
}
.petal-a {
  width: 280px;
  height: 440px;
  right: -90px;
  top: -100px;
}
.petal-b {
  width: 180px;
  height: 300px;
  right: 10%;
  bottom: -180px;
}
.login-panel {
  display: grid;
  place-items: center;
  padding: 50px;
}
.login-card {
  width: min(410px, 100%);
}
.mobile-brand {
  display: none;
}
.login-card h2 {
  font-size: 36px;
  margin: 0 0 12px;
  letter-spacing: -0.03em;
}
.field-label {
  display: block;
  margin: 34px 0 9px;
  font-size: 13px;
  font-weight: 600;
}
.login-card input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid #ded5d1;
  border-radius: 11px;
  background: #fff;
  outline: none;
  transition: 0.2s;
}
.login-card input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(12, 103, 70, 0.12);
}
.login-btn {
  width: 100%;
  height: 52px;
  margin-top: 16px;
}
.secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0;
  color: #958b8f;
  font-size: 12px;
}
.secure-note span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8eaa8a;
  box-shadow: 0 0 0 4px #e7efe6;
}
/* App frame */
.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  background: var(--wine-deep);
  color: #fff;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px 28px;
}
.side-brand .brand-logo {
  width: 38px;
  height: 38px;
  fill: #e8d8aa;
}
.side-brand .stem {
  stroke: #9eaf9b;
}
.side-brand strong,
.side-brand small {
  display: block;
}
.side-brand strong {
  font-size: 16px;
}
.side-brand small {
  margin-top: 3px;
  color: #beaeb4;
  font-size: 9px;
  letter-spacing: 0.12em;
}
.side nav {
  display: grid;
  gap: 5px;
}
.side button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 11px;
  padding: 12px 13px;
  background: transparent;
  color: #cbbdc2;
  cursor: pointer;
  text-align: left;
  transition: 0.2s;
}
.side button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.side button.active {
  color: #fff;
  background: linear-gradient(120deg, #126a49, #27815d);
  box-shadow: 0 10px 25px rgba(24, 13, 18, 0.24);
}
.side button.active:after {
  content: "";
  width: 4px;
  height: 4px;
  margin-left: auto;
  border-radius: 50%;
  background: #fff;
}
.side-foot {
  margin-top: auto;
}
.store-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 15px;
  padding: 13px 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}
.store-state > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a9c6a5;
  box-shadow: 0 0 0 4px rgba(169, 198, 165, 0.12);
}
.store-state strong,
.store-state small {
  display: block;
}
.store-state strong {
  font-size: 11px;
}
.store-state small {
  margin-top: 3px;
  color: #aa9da2;
  font-size: 9px;
}
.side #logout {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  padding-top: 17px;
}
.main {
  min-width: 0;
  padding: 0 38px 50px;
}
.topbar {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.02em;
}
.admin-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blush);
  color: var(--wine);
  font-weight: 700;
}
.admin-chip strong,
.admin-chip small {
  display: block;
}
.admin-chip strong {
  font-size: 12px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.order-alert-toggle {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid #d8e4dd;
  border-radius: 14px;
  background: #fff;
  color: var(--green);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.order-alert-toggle i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #b8c4bd;
}
.order-alert-toggle.enabled i {
  background: #2ea66d;
  box-shadow: 0 0 0 5px rgba(46, 166, 109, 0.12);
}
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #d65757;
  color: #fff;
  font-size: 10px;
  margin-left: auto;
}
.admin-chip small {
  color: var(--muted);
  font-size: 10px;
}
.content {
  padding-top: 30px;
}
.content > h1 {
  display: none;
}
/* Dashboard */
.welcome {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 154px;
  padding: 30px 36px;
  border-radius: 20px;
  background: linear-gradient(125deg, #fff 0%, #fff 62%, #e5efe9 100%);
  border: 1px solid #eee5e2;
  box-shadow: var(--shadow);
}
.welcome h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.025em;
}
.welcome > div > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.welcome-mark {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
}
.welcome-mark .brand-logo {
  width: 78px;
  height: 78px;
  opacity: 0.75;
}
.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.metric {
  position: relative;
  display: flex;
  gap: 13px;
  min-height: 126px;
  padding: 19px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #e4efe8;
  color: #0c6746;
}
.metric-icon .icon {
  width: 19px;
  height: 19px;
}
.metric span,
.metric b,
.metric small {
  display: block;
}
.metric span {
  color: var(--muted);
  font-size: 11px;
}
.metric b {
  margin: 8px 0 6px;
  font-size: 21px;
  letter-spacing: -0.02em;
}
.metric small {
  color: #aea5a8;
  font-size: 9px;
}
.metric-1 .metric-icon {
  background: #e8edf4;
  color: #60758d;
}
.metric-2 .metric-icon {
  background: #e9efe7;
  color: #667e63;
}
.metric-3 .metric-icon {
  background: #f5eee0;
  color: #9a7a44;
}
.metric-4 .metric-icon {
  background: #eee7f5;
  color: #765f8d;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  margin-top: 18px;
}
.panel {
  margin-top: 18px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 25px rgba(5, 72, 48, 0.04);
}
.dashboard-grid .panel {
  margin: 0;
}
.panel h3 {
  margin: 0 0 18px;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-actions button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf9;
  cursor: pointer;
  text-align: left;
  transition: 0.2s;
}
.quick-actions button:hover {
  border-color: #9fbead;
  background: #fff;
  transform: translateY(-2px);
}
.quick-actions .icon {
  color: var(--rose);
}
.quick-actions strong,
.quick-actions small {
  display: block;
}
.quick-actions strong {
  font-size: 11px;
}
.quick-actions small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.quote-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--wine);
  color: #fff;
}
.line-flower .brand-logo {
  width: 48px;
  height: 48px;
  fill: #e7d39f;
}
.quote-panel p {
  margin: 12px 0 7px;
  font-size: 14px;
}
.quote-panel small {
  color: #d9c8ce;
  font-size: 10px;
}
/* Data pages */
.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.content > .toolbar {
  margin-top: 0;
}
.content > .panel:first-of-type {
  margin-top: 0;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
th,
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid #eee8e5;
  vertical-align: middle;
}
th {
  color: #8f8388;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: #fbfaf9;
}
th:first-child {
  border-radius: 9px 0 0 9px;
}
th:last-child {
  border-radius: 0 9px 9px 0;
}
tr:last-child td {
  border-bottom: 0;
}
td .btn {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 10px;
  box-shadow: none;
}
input,
select {
  padding: 9px 11px;
  border: 1px solid #ded5d1;
  border-radius: 9px;
  background: #fff;
  outline: none;
  max-width: 200px;
}
input:focus,
select:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(12, 103, 70, 0.1);
}
.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(39, 25, 30, 0.56);
  backdrop-filter: blur(4px);
}
.form {
  width: min(580px, 94vw);
  padding: 26px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 25px 70px rgba(30, 17, 22, 0.22);
}
.form h2 {
  margin-top: 0;
}
.form label {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 12px;
  margin: 11px 0;
  color: #6f6469;
  font-size: 12px;
}
.form input,
.form select {
  width: 100%;
  max-width: none;
}
.form .toolbar {
  justify-content: flex-end;
  margin: 22px 0 0;
}
#toast {
  position: fixed;
  z-index: 200;
  right: 25px;
  top: 25px;
  display: none;
  padding: 12px 18px;
  border-radius: 10px;
  background: #382d31;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
}
@media (max-width: 1180px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 78px 1fr;
  }
  .side {
    padding: 22px 11px;
  }
  .side-brand > div,
  .side nav span,
  .side-foot span,
  .side-foot div,
  .side button.active:after {
    display: none;
  }
  .side-brand {
    justify-content: center;
    padding: 0 0 25px;
  }
  .side nav button,
  .side #logout {
    justify-content: center;
  }
  .side-brand .brand-logo {
    width: 36px;
  }
  .main {
    padding: 0 22px 40px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
  }
  .mobile-brand .brand-logo {
    width: 40px;
  }
  .mobile-brand span {
    font-weight: 700;
  }
  .login-panel {
    min-height: 100vh;
  }
}
@media (max-width: 620px) {
  .main {
    padding: 0 14px 30px;
  }
  .topbar {
    height: 92px;
  }
  .admin-chip {
    display: none;
  }
  .content {
    padding-top: 20px;
  }
  .welcome {
    padding: 25px;
  }
  .welcome-mark {
    display: none;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .metric {
    min-height: auto;
  }
  .quick-actions {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 14px;
    overflow-x: auto;
  }
  .form label {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .login-panel {
    padding: 26px;
  }
}
.modal .form {
  max-height: 92vh;
  overflow: auto;
}
.form textarea {
  width: 100%;
  min-height: 76px;
  padding: 9px 11px;
  border: 1px solid #ded5d1;
  border-radius: 9px;
  resize: vertical;
  outline: none;
}
.form textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(12, 103, 70, 0.1);
}
/* 可读错误提示与演示模式标识 */
#toast {
  max-width: min(420px, calc(100vw - 40px));
  background: #934747;
  line-height: 1.6;
  white-space: normal;
}
#toast.success {
  background: #176344;
}
body.demo-mode::after {
  content: "本地演示模式 · 非真实数据";
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 18px;
  padding: 9px 14px;
  border: 1px solid #e5c98f;
  border-radius: 999px;
  background: #fff8e8;
  color: #7d622d;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(85, 61, 29, 0.12);
}
.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}
.product-thumb {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 11px;
  object-fit: cover;
  background: #edf2ee;
  border: 1px solid var(--line);
}
.product-cell strong,
.product-cell small {
  display: block;
}
.product-cell small {
  max-width: 190px;
  margin-top: 4px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e6f0ea;
  color: #0b6645;
  font-weight: 600;
}
.status.off {
  background: #eff1ef;
  color: #7f8983;
}
.status.warn {
  background: #f7f0df;
  color: #846827;
}
.product-form {
  width: min(920px, 96vw);
  padding: 0;
  overflow: hidden;
}
.product-form .form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.product-form .form-head h2 {
  margin: 0;
  font-size: 24px;
}
.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: #edf2ee;
  color: #557064;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.form-scroll {
  max-height: calc(90vh - 148px);
  padding: 22px 28px;
  overflow: auto;
  background: #fbfcfa;
}
.form-section {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.form-section:last-child {
  margin-bottom: 0;
}
.form-section h3 {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
.product-form label {
  display: block;
  margin: 0;
  color: #53655c;
}
.product-form label > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
}
.product-form label small {
  color: #89958e;
  font-weight: 400;
}
.product-form input,
.product-form textarea {
  border-color: #dce5df;
  background: #fbfcfb;
}
.product-form input {
  height: 42px;
}
.product-form textarea {
  min-height: 92px;
  line-height: 1.6;
}
.media-row {
  display: grid;
  grid-template-columns: 144px 1fr;
  gap: 20px;
}
.cover-preview {
  width: 144px;
  height: 144px;
  border-radius: 13px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #edf2ee;
}
.media-fields {
  display: grid;
  align-content: start;
  gap: 15px;
}
.upload-box input {
  padding: 8px;
  height: auto;
  background: #f4f7f5;
}
.upload-state {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}
.wide-field {
  margin-bottom: 14px !important;
}
.text-grid textarea {
  min-height: 118px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.form-actions .btn {
  min-width: 105px;
}
.product-form .gray {
  background: #edf2ee;
  color: #405a4e;
  box-shadow: none;
}
@media (max-width: 720px) {
  .product-form {
    width: 96vw;
  }
  .form-grid,
  .media-row {
    grid-template-columns: 1fr;
  }
  .cover-preview {
    width: 112px;
    height: 112px;
  }
  .form-scroll {
    padding: 16px;
  }
  .form-section {
    padding: 16px;
  }
  .product-form .form-head,
  .form-actions {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* 最终主题覆盖：与小程序的暖橙主操作、米白背景保持一致 */
html, body { background: #f7f4ef; color: var(--ink); }
.side { background: #302722; }
.side button.active { background: linear-gradient(120deg, #ff6240, #f4815f); }
.side button.active:after { background: #ffe3d8; }
.btn { background: var(--wine); box-shadow: 0 7px 20px rgba(255, 98, 64, 0.2); }
.btn:hover { background: var(--wine-deep); }
.btn.gray { background: #9b918c; }
.btn.danger { background: #b95858; }
.login-brand { background: linear-gradient(150deg, #302722 0%, #574036 55%, #ff6240 140%); }
.brand-logo { fill: #ff6240; }
.brand-logo .stem { stroke: #d6a08f; }
.panel, .cfg-card { border-color: #eee3dc; box-shadow: var(--shadow); }
.metric-icon, .admin-chip .avatar { background: #fff0ea; color: #ed4e2c; }
.order-summary, .material-overview, .cfg-overview, .insight-head {
  background: linear-gradient(125deg, #fff 0%, #fff 68%, #fff0ea 100%);
}
.cfg-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 28px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(125deg, #fff 0%, #fff 68%, #e4efe8 100%);
  box-shadow: var(--shadow);
}
.cfg-hero h2 {
  margin: 0 0 7px;
  font-size: 24px;
}
.cfg-hero > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.cfg-state {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 150px;
  padding: 12px 15px;
  border: 1px solid #cfe0d6;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
}
.cfg-state > span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #31a06d;
  box-shadow: 0 0 0 5px #e2f1e8;
}
.cfg-state.off > span {
  background: #9ba49f;
  box-shadow: 0 0 0 5px #ecefed;
}
.cfg-state strong,
.cfg-state small {
  display: block;
}
.cfg-state strong {
  font-size: 12px;
}
.cfg-state small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.cfg-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 96px;
}
.cfg-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 7px 26px rgba(5, 72, 48, 0.035);
}
.cfg-card header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1ee;
}
.cfg-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}
.cfg-card header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.cfg-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.shop-card .cfg-fields,
.pay-card .cfg-fields {
  grid-template-columns: 1fr;
}
.delivery-card {
  grid-column: 1/-1;
}
.delivery-card .cfg-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cfg-field {
  display: block !important;
  margin: 0 !important;
  color: #506258 !important;
}
.cfg-field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 600;
}
.cfg-field small {
  color: #94a098;
  font-size: 9px;
  font-weight: 400;
}
.cfg-field input,
.cfg-field select {
  width: 100%;
  max-width: none;
  height: 42px;
  border-color: #dce5df;
  background: #fbfcfb;
}
.input-unit {
  position: relative;
}
.input-unit input {
  padding-right: 48px;
}
.input-unit i {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #859189;
  font-size: 10px;
  font-style: normal;
}
.cfg-notice {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8f2e5;
  color: #80672e;
  font-size: 10px;
  line-height: 1.6;
}
.cfg-savebar {
  position: fixed;
  z-index: 30;
  right: 38px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 13px 14px 13px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 40px rgba(4, 50, 33, 0.14);
  backdrop-filter: blur(10px);
}
.cfg-savebar strong,
.cfg-savebar small {
  display: block;
}
.cfg-savebar strong {
  font-size: 11px;
}
.cfg-savebar small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}
.cfg-savebar .btn {
  min-width: 145px;
}
@media (max-width: 1050px) {
  .cfg-layout {
    grid-template-columns: 1fr;
  }
  .delivery-card {
    grid-column: auto;
  }
  .delivery-card .cfg-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .cfg-hero {
    align-items: flex-start;
    gap: 18px;
  }
  .cfg-state {
    min-width: auto;
  }
  .cfg-fields,
  .delivery-card .cfg-fields {
    grid-template-columns: 1fr;
  }
  .cfg-savebar {
    left: 92px;
    right: 14px;
    bottom: 14px;
    justify-content: space-between;
  }
  .cfg-savebar > div {
    display: none;
  }
}
.detail-media {
  padding-top: 5px;
}
.detail-media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.detail-media-head strong,
.detail-media-head small {
  display: block;
}
.detail-media-head strong {
  font-size: 12px;
}
.detail-media-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
.detail-upload {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 9px 14px;
  border-radius: 9px;
  background: #e5efe9;
  color: var(--wine) !important;
  font-weight: 600;
  cursor: pointer;
}
.detail-upload input {
  display: none;
}
.detail-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}
.detail-image {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 11px;
  overflow: hidden;
  background: #edf2ee;
  cursor: grab;
}
.detail-image.dragging {
  opacity: 0.45;
  border-color: var(--rose);
}
.detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-image > span {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(3, 60, 40, 0.78);
  color: #fff;
  font-size: 9px;
}
.detail-image button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #934747;
  font-size: 17px;
  cursor: pointer;
}
.gallery-empty {
  grid-column: 1/-1;
  padding: 28px;
  border: 1px dashed #cddbd2;
  border-radius: 11px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  background: #fafcfb;
}
.detail-upload-state {
  min-height: 17px;
  margin-top: 8px;
  color: var(--rose);
  font-size: 10px;
}
.field-help {
  display: block !important;
  min-height: 28px;
  margin-top: 7px !important;
  color: #87968d !important;
  font-size: 9px !important;
  line-height: 1.55;
}
@media (max-width: 720px) {
  .detail-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.structured-source {
  display: none !important;
}
.text-grid {
  display: block;
}
.text-grid > label + label {
  margin-top: 22px !important;
}
.row-editor {
  margin-top: 9px;
}
.row-head,
.row-item {
  display: grid;
  grid-template-columns: minmax(140px, 1.7fr) repeat(3, minmax(82px, 1fr)) 34px;
  gap: 8px;
  align-items: center;
}
.text-grid > label:nth-child(2) .row-head,
.text-grid > label:nth-child(2) .row-item {
  grid-template-columns: minmax(180px, 2fr) minmax(100px, 1fr) 34px;
}
.row-head {
  padding: 0 8px 7px;
  color: #89968f;
  font-size: 9px;
}
.row-item {
  margin-bottom: 8px;
}
.row-item input {
  width: 100%;
  height: 39px !important;
  min-width: 0;
}
.row-item button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #f7eaea;
  color: #a14e4e;
  font-size: 17px;
  cursor: pointer;
}
.row-add {
  margin-top: 4px;
  padding: 8px 13px;
  border: 1px dashed #a9c2b4;
  border-radius: 9px;
  background: #f4f8f5;
  color: var(--wine);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.row-empty {
  padding: 17px;
  border: 1px dashed #d3dfd7;
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}
.tag-editor {
  margin-top: 0;
}
.tag-list {
  min-height: 42px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid #dce5df;
  border-radius: 9px;
  background: #fbfcfb;
}
.tag-list > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #e5efe9;
  color: #155c41;
  font-size: 10px;
  white-space: nowrap;
}
.tag-list > span button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #628174;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.tag-entry {
  flex: 1;
  min-width: 130px !important;
  height: 28px !important;
  padding: 3px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.cfg-field:has(.tag-editor) .input-unit {
  display: none;
}
@media (max-width: 720px) {
  .row-head {
    display: none;
  }
  .row-item,
  .text-grid > label:nth-child(2) .row-item {
    grid-template-columns: 1fr 1fr;
  }
  .row-item button {
    grid-column: 2;
    justify-self: end;
  }
  .row-item input:first-child {
    grid-column: 1/-1;
  }
}
.order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(125deg, #fff 0%, #fff 70%, #e4efe8 100%);
  box-shadow: var(--shadow);
}
.order-summary h2 {
  margin: 0 0 6px;
}
.order-summary > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.summary-badge {
  padding: 8px 12px;
  border-radius: 9px;
  background: #e4efe8;
  color: var(--wine);
  font-size: 10px;
  font-weight: 600;
}
/* 旧版分销压缩样式已移除，新样式见文件末尾「用户与分销」区块 */
.order-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) 160px 170px auto auto;
  gap: 10px;
  margin: 16px 0;
}
.order-filters input,
.order-filters select {
  width: 100%;
  max-width: none;
}
.order-panel {
  margin-top: 0;
}
.order-row {
  cursor: pointer;
}
.order-row:hover td {
  background: #fafcfb;
}
.order-row td:first-child strong,
.order-row td:first-child small,
.order-row td:nth-child(2) strong,
.order-row td:nth-child(2) small {
  display: block;
}
.order-row small {
  margin-top: 4px;
  color: var(--muted);
}
.order-actions {
  min-width: 290px;
}
.order-actions .btn {
  margin: 3px 2px;
}
.alert-text {
  display: block !important;
  color: #a25b30 !important;
}
.no-data {
  padding: 50px !important;
  color: var(--muted);
  text-align: center;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 18px;
}
.pager .btn {
  box-shadow: none;
}
.pager .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.order-drawer-wrap {
  position: fixed;
  z-index: 300;
  inset: 0;
}
.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(16, 28, 22, 0.45);
  backdrop-filter: blur(3px);
}
.order-drawer {
  position: absolute;
  right: 0;
  top: 0;
  width: min(590px, 94vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f5f7f4;
  box-shadow: -20px 0 60px rgba(3, 38, 25, 0.18);
  animation: drawer-in 0.22s ease-out;
}
@keyframes drawer-in {
  from {
    transform: translateX(30px);
    opacity: 0.4;
  }
}
.order-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.order-drawer h2 {
  margin: 0;
  font-size: 18px;
}
.drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: #edf2ee;
  color: #526b5f;
  font-size: 24px;
  cursor: pointer;
}
.drawer-print {
  margin-left: auto;
  margin-right: 10px;
  min-height: 36px;
  padding: 0 14px;
}
.drawer-scroll {
  padding: 20px;
  overflow: auto;
}
.order-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.progress-step {
  position: relative;
  flex: 1;
  text-align: center;
  color: #9aa49e;
}
.progress-step:before {
  content: "";
  position: absolute;
  left: -50%;
  right: 50%;
  top: 6px;
  height: 2px;
  background: #dce5df;
}
.progress-step:first-child:before {
  display: none;
}
.progress-step > span {
  position: relative;
  z-index: 1;
  display: block;
  width: 13px;
  height: 13px;
  margin: 0 auto 8px;
  border: 3px solid #dce5df;
  border-radius: 50%;
  background: #fff;
}
.progress-step small {
  font-size: 8px;
}
.progress-step.done:before {
  background: #4e9777;
}
.progress-step.done > span {
  border-color: #4e9777;
  background: #4e9777;
}
.progress-step.current small {
  color: var(--wine);
  font-weight: 700;
}
.drawer-card {
  margin-bottom: 13px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.drawer-card h3 {
  margin: 0 0 13px;
  font-size: 13px;
}
.drawer-card p {
  margin: 7px 0;
  color: #526258;
  font-size: 11px;
  line-height: 1.6;
}
.drawer-card .accent {
  color: var(--wine);
  font-weight: 600;
}
.drawer-goods {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf1ee;
}
.drawer-goods img {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  object-fit: cover;
}
.drawer-goods strong,
.drawer-goods small {
  display: block;
}
.drawer-goods strong {
  font-size: 11px;
}
.drawer-goods small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}
.drawer-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 15px;
}
.drawer-total.compact {
  padding-top: 8px;
  color: var(--muted);
  font-size: 10px;
}
.drawer-total.compact b {
  color: var(--ink);
  font-size: 12px;
}
.drawer-total b {
  color: var(--wine);
  font-size: 18px;
}
.proof-list {
  display: flex;
  gap: 8px;
}
.proof-list img {
  width: 70px;
  height: 70px;
  border-radius: 9px;
  object-fit: cover;
}
.metadata {
  background: #eef3ef;
}
.metadata p {
  font-size: 9px;
}
.status.order-pending {
  background: #f3f1e8;
  color: #826d35;
}
.status.order-paid,
.status.order-refunding {
  background: #fff0dd;
  color: #9a6221;
}
.status.order-shipped {
  background: #e5edf5;
  color: #496b8b;
}
.status.order-closed,
.status.order-refunded,
.status.order-refund_failed {
  background: #f0f1f0;
  color: #747e78;
}
@media (max-width: 900px) {
  .order-filters {
    grid-template-columns: 1fr 1fr;
  }
  .order-filters #order-keyword {
    grid-column: 1/-1;
  }
  .order-actions {
    min-width: 230px;
  }
}
@media (max-width: 620px) {
  .order-summary {
    align-items: flex-start;
  }
  .summary-badge {
    display: none;
  }
  .order-filters {
    grid-template-columns: 1fr;
  }
  .order-filters #order-keyword {
    grid-column: auto;
  }
  .order-panel {
    overflow: auto;
  }
  .order-drawer {
    width: 100vw;
  }
  .progress-step small {
    display: none;
  }
}
.delivery-form {
  width: min(660px, 94vw);
  padding: 0;
  overflow: hidden;
}
.delivery-form .form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 25px;
  border-bottom: 1px solid var(--line);
}
.delivery-form h2 {
  margin: 0;
}
.delivery-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}
.delivery-fields label {
  display: block;
  margin: 0;
  color: #53655c;
  font-size: 11px;
  font-weight: 600;
}
.delivery-fields input,
.delivery-fields select,
.delivery-fields textarea {
  width: 100%;
  max-width: none;
  margin-top: 7px;
}
.delivery-fields textarea {
  min-height: 78px;
}
.delivery-fields .full {
  grid-column: 1/-1;
}
@media (max-width: 620px) {
  .delivery-fields {
    grid-template-columns: 1fr;
  }
  .delivery-fields .full {
    grid-column: auto;
  }
}
.material-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 28px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(125deg, #fff 0%, #fff 67%, #e5efe9 100%);
  box-shadow: var(--shadow);
}
.material-hero h2 {
  margin: 0 0 7px;
  font-size: 24px;
}
.material-hero p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.material-stats {
  display: flex;
  gap: 10px;
}
.material-stats span {
  min-width: 108px;
  padding: 12px 15px;
  border: 1px solid #d6e3db;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: #617168;
  font-size: 10px;
}
.material-stats b {
  display: block;
  margin-bottom: 4px;
  color: var(--wine);
  font-size: 18px;
}
.material-stats .danger-text {
  border-color: #ead2cd;
  background: #fff8f6;
}
.material-stats .danger-text b {
  color: #a64e44;
}
.material-toolbar {
  margin: 16px 0 0;
}
.material-toolbar input {
  margin-left: auto;
  min-width: 230px;
}
.material-panel {
  margin-top: 12px;
}
.cell-note {
  display: block;
  max-width: 220px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stock-number {
  font-weight: 700;
  color: #176344;
}
.stock-number.low {
  color: #a24c42;
}
.low-label {
  display: block;
  margin-top: 4px;
  color: #a24c42;
  font-size: 8px;
}
.material-actions {
  min-width: 235px;
}
.material-actions .gray {
  background: #edf2ee;
  color: #405a4e;
}
.material-form {
  width: min(700px, 94vw);
  padding: 0;
  overflow: hidden;
}
.material-form .form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 25px;
  border-bottom: 1px solid var(--line);
}
.material-form h2 {
  margin: 0;
}
.material-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 24px;
}
.material-form-grid label {
  display: block;
  margin: 0;
  color: #53655c;
  font-size: 11px;
  font-weight: 600;
}
.material-form-grid input,
.material-form-grid select,
.material-form-grid textarea {
  width: 100%;
  max-width: none;
  margin-top: 7px;
}
.material-form-grid label > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}
.material-form-grid .full {
  grid-column: 1/-1;
}
.current-stock {
  margin: 20px 24px 0;
  padding: 14px 16px;
  border-radius: 11px;
  background: #edf4ef;
  color: #63736a;
  font-size: 11px;
}
.current-stock strong {
  margin-left: 8px;
  color: var(--wine);
  font-size: 15px;
}
.log-list {
  max-height: 60vh;
  padding: 12px 24px 24px;
  overflow: auto;
}
.log-list article {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid #edf1ee;
}
.log-list article:last-child {
  border-bottom: 0;
}
.log-list strong,
.log-list p,
.log-list small {
  display: block;
}
.log-list p {
  margin: 5px 0;
  color: #526258;
  font-size: 10px;
}
.log-list small {
  color: var(--muted);
  font-size: 9px;
}
.log-type {
  align-self: start;
  padding: 6px 7px;
  border-radius: 8px;
  background: #e5efe9;
  color: #176344;
  font-size: 9px;
  text-align: center;
}
.log-type.out {
  background: #f7ede8;
  color: #985643;
}
.log-type.count {
  background: #eef0f5;
  color: #596b8b;
}
@media (max-width: 720px) {
  .material-hero {
    align-items: flex-start;
    gap: 18px;
  }
  .material-stats {
    display: none;
  }
  .material-toolbar input {
    margin-left: 0;
    min-width: 100%;
  }
  .material-form-grid {
    grid-template-columns: 1fr;
  }
  .material-form-grid .full {
    grid-column: auto;
  }
  .material-panel {
    overflow: auto;
  }
}
.sale-request {
  margin: 22px 24px 0;
  padding: 16px 18px;
  border: 1px solid #ead9b6;
  border-radius: 12px;
  background: #fbf7ed;
}
.sale-request span,
.sale-request strong {
  display: block;
}
.sale-request span {
  color: #8b7a56;
  font-size: 9px;
}
.sale-request strong {
  margin: 5px 0;
  color: #6d5422;
  font-size: 13px;
}
.sale-request p {
  margin: 0;
  color: #6e6a60;
  font-size: 11px;
  line-height: 1.6;
}
.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 27px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(125deg, #fff 0%, #fff 70%, #e5efe9 100%);
  box-shadow: var(--shadow);
}
.insight-head h2 {
  margin: 0 0 6px;
  font-size: 23px;
}
.insight-head > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.period-tabs {
  display: flex;
  padding: 4px;
  border: 1px solid #d7e2db;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
}
.period-tabs button {
  min-width: 68px;
  padding: 9px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #718078;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.period-tabs button.active {
  background: var(--wine);
  color: #fff;
  box-shadow: 0 5px 14px rgba(4, 72, 48, 0.18);
}
.insight-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}
.insight-metrics article {
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 11px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(5, 72, 48, 0.035);
}
.insight-metrics .metric-icon {
  grid-row: 1/4;
}
.insight-metrics span,
.insight-metrics b,
.insight-metrics small {
  display: block;
}
.insight-metrics span {
  color: var(--muted);
  font-size: 9px;
}
.insight-metrics b {
  margin: 5px 0 3px;
  color: var(--ink);
  font-size: 18px;
}
.insight-metrics small {
  color: #a2999c;
  font-size: 8px;
}
.insight-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 14px;
}
.insight-grid .panel {
  margin-top: 14px;
}
.insight-grid header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}
.insight-grid header h3 {
  margin: 2px 0 0;
}
.trend-panel > header > strong {
  color: var(--wine);
  font-size: 18px;
}
.trend-chart {
  height: 168px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding-top: 15px;
}
.dashboard-empty {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d7e3dc;
  border-radius: 13px;
  background: linear-gradient(145deg, #fbfdfb, #f3f8f5);
  text-align: center;
}
.dashboard-empty > div {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e4efe9;
  color: var(--wine);
}
.dashboard-empty .icon {
  width: 20px;
}
.dashboard-empty strong {
  margin-top: 11px;
  font-size: 11px;
}
.dashboard-empty p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 9px;
}
.dashboard-empty button {
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: var(--wine);
  color: #fff;
  font-size: 9px;
  cursor: pointer;
}
.compact-empty {
  display: grid;
  place-items: center;
  min-height: 155px;
  color: #78877f;
  text-align: center;
  font-size: 10px;
}
.compact-empty small {
  margin-top: 5px;
  color: #a0aaa4;
  font-size: 8px;
}
.trend-col {
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-width: 6px;
}
.trend-col > span {
  width: min(22px, 72%);
  min-height: 5px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(#3b8d6c, #0c6746);
  transition: 0.2s;
}
.trend-col:hover > span {
  background: #d4ac69;
}
.trend-col small {
  margin-top: 7px;
  color: #98a29c;
  font-size: 7px;
}
.rank-list article {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 14px;
}
.rank-list article > b {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: #edf3ef;
  color: var(--wine);
  font-size: 9px;
}
.rank-list strong {
  display: block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}
.rank-list span {
  display: block;
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: #edf1ee;
  overflow: hidden;
}
.rank-list i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #5a9a7d;
}
.rank-list em {
  color: var(--wine);
  font-size: 9px;
  font-style: normal;
}
.category-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.category-list article {
  padding: 13px;
  border-radius: 11px;
  background: #f5f8f6;
}
.category-list span,
.category-list strong,
.category-list small {
  display: block;
}
.category-list span {
  color: var(--muted);
  font-size: 9px;
}
.category-list strong {
  margin: 7px 0 4px;
  font-size: 14px;
}
.category-list small {
  color: #86948c;
  font-size: 8px;
}
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.status-grid span {
  padding: 12px;
  border: 1px solid #e1e9e4;
  border-radius: 10px;
  text-align: center;
}
.status-grid b,
.status-grid small {
  display: block;
}
.status-grid b {
  color: var(--wine);
  font-size: 15px;
}
.status-grid small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
}
.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 275px;
}
.material-panel tbody tr:hover td {
  background: #fafcfb;
}
.material-panel tbody td {
  transition: background 0.16s;
}
.material-panel .stock-number {
  font-size: 12px;
}
.material-panel th {
  height: 48px;
}
.material-panel td {
  height: 66px;
}
.material-actions .btn {
  margin: 0;
}
.material-actions .material-in {
  background: #176344;
}
.material-actions .material-out {
  background: #9b5a45;
}
.reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.reason-chips button {
  padding: 7px 10px;
  border: 1px solid #d9e3dc;
  border-radius: 999px;
  background: #f7faf8;
  color: #53685d;
  font-size: 9px;
  cursor: pointer;
}
.reason-chips button.active {
  border-color: #267653;
  background: #e4f1e9;
  color: #0c6746;
}
.current-stock {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.current-stock strong {
  margin-left: 0;
}
.current-stock small {
  width: 100%;
  color: var(--muted);
  font-size: 9px;
}
.adjust-form.out .form-head {
  border-top: 4px solid #a25d48;
}
.adjust-form.in .form-head {
  border-top: 4px solid #27805c;
}
.adjust-form.count .form-head {
  border-top: 4px solid #6d7892;
}
.log-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 18px 24px 8px;
}
.log-summary span {
  padding: 12px;
  border-radius: 10px;
  background: #f3f7f4;
}
.log-summary small,
.log-summary b {
  display: block;
}
.log-summary small {
  color: var(--muted);
  font-size: 8px;
}
.log-summary b {
  margin-top: 5px;
  color: var(--wine);
  font-size: 12px;
}
.log-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.log-row-title em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}
@media (min-width: 768px) and (max-width: 1180px) {
  .layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .side {
    padding: 24px 14px;
  }
  .side-brand {
    gap: 9px;
  }
  .side-brand strong {
    font-size: 15px;
  }
  .side nav button {
    padding: 12px 11px;
    font-size: 11px;
  }
  .main {
    padding: 0 18px 34px;
  }
  .topbar {
    height: 104px;
  }
  .content {
    padding-top: 18px;
  }
  .insight-head {
    padding: 21px;
  }
  .insight-metrics {
    grid-template-columns: repeat(3, 1fr);
  }
  .insight-grid {
    grid-template-columns: 1fr;
  }
  .trend-chart {
    height: 180px;
  }
  .category-list {
    grid-template-columns: repeat(3, 1fr);
  }
  .material-hero {
    padding: 20px;
  }
  .material-panel {
    padding: 10px;
    overflow-x: auto;
  }
  .material-panel table {
    min-width: 980px;
  }
  .material-toolbar input {
    min-width: 190px;
  }
  .form {
    max-height: 94vh;
  }
  .material-form {
    width: min(720px, 94vw);
  }
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
  .cfg-layout {
    grid-template-columns: 1fr;
  }
  .delivery-card .cfg-fields {
    grid-template-columns: repeat(2, 1fr);
  }
  .order-filters {
    grid-template-columns: 1fr 1fr;
  }
  .order-filters #order-keyword {
    grid-column: 1/-1;
  }
  .topbar h1 {
    font-size: 23px;
  }
  .btn,
  input,
  select {
    min-height: 42px;
  }
  .material-actions .btn {
    min-height: 34px;
  }
}
@media (min-width: 768px) and (max-width: 900px) {
  .side-brand > div,
  .side nav span,
  .side-foot span,
  .side-foot div {
    display: block;
  }
  .side nav button,
  .side #logout {
    justify-content: flex-start;
  }
  .side-brand {
    justify-content: flex-start;
  }
  .side button.active:after {
    display: block;
  }
  .side-foot .store-state {
    display: flex;
  }
  .side-foot .store-state > span {
    display: block;
  }
}
@media (max-width: 767px) {
  .insight-head {
    align-items: flex-start;
    gap: 14px;
  }
  .period-tabs button {
    min-width: 52px;
    padding: 8px;
  }
  .insight-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .insight-grid {
    grid-template-columns: 1fr;
  }
  .category-list,
  .status-grid {
    grid-template-columns: 1fr 1fr;
  }
  .trend-col small {
    display: none;
  }
  .log-summary {
    grid-template-columns: 1fr 1fr;
  }
}
.flash-status {
  margin-left: 6px;
  background: #f6e8e4;
  color: #99503c;
}
.flash-btn {
  background: #7a2f3a !important;
}
.flash-note {
  margin: 18px 24px 0;
  padding: 13px 15px;
  border-radius: 10px;
  background: #fbf1ee;
  color: #805247;
  font-size: 10px;
  line-height: 1.6;
}
.flash-toggle {
  display: flex !important;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-radius: 10px;
  background: #f5f8f6;
}
.flash-toggle input {
  width: 18px !important;
  height: 18px;
  margin: 0;
}

/* UI hierarchy polish */
.topbar {
  height: 96px;
}
.content {
  padding-top: 22px;
}
.material-overview,
.cfg-overview {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(110deg, #fff 0%, #fff 72%, #edf4ef 100%);
}
.material-overview > div:first-child strong,
.material-overview > div:first-child span,
.cfg-overview > div:first-child strong,
.cfg-overview > div:first-child span {
  display: block;
}
.material-overview > div:first-child strong,
.cfg-overview > div:first-child strong {
  color: var(--wine);
  font-size: 14px;
}
.material-overview > div:first-child span,
.cfg-overview > div:first-child span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}
.material-overview .material-stats span {
  min-width: 92px;
  padding: 9px 12px;
}
.material-overview .material-stats b {
  display: inline;
  margin: 0 5px 0 0;
  font-size: 15px;
}
.material-workspace {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(5, 72, 48, 0.035);
}
.material-workspace .material-toolbar {
  min-height: 68px;
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #edf1ee;
}
.material-search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}
.material-search input {
  min-width: 235px;
}
.material-search select {
  min-width: 130px;
}
.material-table-wrap {
  padding: 10px 16px 14px;
  overflow-x: auto;
}
.material-table-wrap th {
  height: 44px;
}
.material-table-wrap td {
  height: 62px;
}
.cfg-overview .cfg-state {
  min-width: 132px;
  padding: 9px 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.72);
}
.cfg-layout {
  gap: 12px;
  margin: 12px 0;
}
.cfg-card {
  padding: 20px;
  box-shadow: 0 5px 18px rgba(5, 72, 48, 0.025);
}
.cfg-savebar {
  position: sticky;
  left: auto;
  right: auto;
  bottom: 14px;
  width: fit-content;
  margin: 14px 0 0 auto;
  box-shadow: 0 10px 30px rgba(4, 50, 33, 0.11);
}
@media (min-width: 768px) and (max-width: 1180px) {
  .material-overview,
  .cfg-overview {
    padding: 14px 16px;
  }
  .material-search input {
    min-width: 180px;
  }
  .material-table-wrap table {
    min-width: 980px;
  }
}
@media (max-width: 720px) {
  .material-overview,
  .cfg-overview {
    align-items: flex-start;
  }
  .material-overview .material-stats {
    display: none;
  }
  .material-search {
    width: 100%;
    margin-left: 0;
  }
  .material-search input {
    flex: 1;
    min-width: 0;
  }
  .material-workspace .material-toolbar {
    align-items: stretch;
  }
  .cfg-savebar {
    left: auto;
    right: auto;
    bottom: 10px;
    width: 100%;
    margin-top: 10px;
  }
  .cfg-savebar .btn {
    width: 100%;
  }
}

/* theme-final */
html, body { background: #f7f4ef; color: var(--ink); }
.side { background: #302722; }
.side button.active { background: linear-gradient(120deg, #ff6240, #f4815f); }
.side button.active:after { background: #ffe3d8; }
.btn { background: var(--wine); box-shadow: 0 7px 20px rgba(255, 98, 64, 0.2); }
.btn:hover { background: var(--wine-deep); }
.btn.gray { background: #9b918c; }
.btn.danger { background: #b95858; }
.login-brand { background: linear-gradient(150deg, #302722 0%, #574036 55%, #ff6240 140%); }
.brand-logo { fill: #ff6240; }
.brand-logo .stem { stroke: #d6a08f; }
.panel, .cfg-card { border-color: #eee3dc; box-shadow: var(--shadow); }
.metric-icon, .admin-chip .avatar { background: #fff0ea; color: #ed4e2c; }
.order-summary, .material-overview, .cfg-overview, .insight-head { background: linear-gradient(125deg, #fff 0%, #fff 68%, #fff0ea 100%); }

/* final responsive pass: desktop, tablet and narrow browser windows */
.main { min-width: 0; }
.content { min-width: 0; }
.panel { max-width: 100%; overflow-x: auto; }
.panel table { min-width: 860px; }
.content-field input,
.content-field textarea,
.cfg-field input,
.cfg-field select { max-width: 100%; box-sizing: border-box; }
.content-card header p,
.field-help,
.cfg-notice,
.order-summary p { overflow-wrap: anywhere; }

@media (min-width: 768px) and (max-width: 1180px) {
  .side { width: 216px; }
  .main { margin-left: 216px; }
  .content { padding: 18px; }
  .topbar { padding: 0 20px; }
  .content-layout,
  .cfg-layout { grid-template-columns: 1fr; }
  .order-summary,
  .content-overview { padding: 18px 20px; }
}

@media (max-width: 767px) {
  .layout { display: block; }
  .side {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    z-index: 30;
  }
  .side-brand,
  .side-foot { display: none !important; }
  .side nav {
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
  }
  .side nav button {
    min-width: max-content;
    padding: 10px 12px;
    border-radius: 10px;
  }
  .side nav button svg { width: 17px; }
  .main { margin-left: 0; }
  .topbar {
    height: auto;
    min-height: 76px;
    padding: 12px 14px;
    gap: 10px;
  }
  .topbar h1 { font-size: 22px; }
  .admin-chip { display: none; }
  .order-alert-toggle span { display: none; }
  .content { padding: 12px; }
  .order-summary,
  .content-overview,
  .material-overview,
  .cfg-overview {
    min-height: 0;
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }
  .content-layout,
  .cfg-layout,
  .form-grid,
  .insight-metrics { grid-template-columns: 1fr; }
  .content-card,
  .cfg-card { padding: 16px; }
  .content-images-head,
  .material-toolbar { align-items: stretch; flex-direction: column; }
  .content-image-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cfg-savebar { width: 100%; }
  .cfg-savebar > div { display: none; }
  .cfg-savebar .btn { width: 100%; }
  .panel table { min-width: 760px; }
}

/* 运营后台最终视觉：与小程序深绿主题统一 */
:root {
  --ink: #173a2d;
  --muted: #738178;
  --wine: #075438;
  --wine-deep: #033c28;
  --rose: #0c6746;
  --blush: #e7f0eb;
  --cream: #fbfcf9;
  --sage: #789786;
  --line: #dde6df;
  --shadow: 0 16px 42px rgba(5, 72, 48, 0.07);
}
html, body { background: #f4f6f2; color: var(--ink); }
.side { background: #043d2b; }
.side button.active { background: linear-gradient(120deg, #0b6a49, #238462); }
.side button.active:after { background: #dff1e8; }
.btn { background: var(--wine); box-shadow: 0 7px 20px rgba(5, 84, 56, .15); }
.btn:hover { background: var(--wine-deep); }
.btn.secondary { border: 1px solid #bcd3c6; background: #fff; color: var(--wine); box-shadow: none; }
.btn.secondary:hover { border-color: var(--wine); background: #f1f7f4; }
.login-brand { background: linear-gradient(150deg, #043d2b 0%, #075438 58%, #2c8465 130%); }
.login-brand .eyebrow { color: #cce9dc; }
.login-note { color: #d7e7df; }
.brand-logo { fill: #e7d39f; }
.brand-logo .stem { stroke: #c9b978; }
.metric-icon, .admin-chip .avatar { background: #e8f2ed; color: var(--wine); }
.order-summary, .material-overview, .cfg-overview, .insight-head,
.content-overview { background: linear-gradient(125deg, #fff 0%, #fff 70%, #eaf3ee 100%); border-color: var(--line); }
.content-field input:focus, .content-field select:focus, .content-field textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 3px #e8f2ed; }

/* ============================================================
   用户与分销 · 现代简约表格版重设计（2026-09 完全重做）
   ============================================================ */

/* 顶部 KPI 数据条 */
.dist-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.dist-kpi { min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.dist-kpi small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.dist-kpi b { display: block; margin: 8px 0 5px; overflow: hidden; color: var(--ink); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.dist-kpi span { display: block; color: #9aa69e; font-size: 10.5px; }

/* 状态分栏 + 搜索筛选工具条 */
.dist-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 18px 0 14px; }
.dist-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #f1f4f0; }
.dist-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 0; border-radius: 9px; background: transparent; color: #5f6d64; cursor: pointer; font-size: 12.5px; font-weight: 600; transition: background .15s ease, color .15s ease; }
.dist-tabs button:hover { color: var(--ink); }
.dist-tabs button.active { background: #fff; color: var(--wine); box-shadow: 0 2px 8px rgba(5, 72, 48, 0.1); }
.dist-tabs button em { color: #a3ada6; font-size: 11px; font-style: normal; font-weight: 700; }
.dist-tabs button.active em { color: var(--wine); opacity: .6; }
.dist-toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dist-toolbar-right select { width: auto; max-width: none; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.dist-toolbar-right select:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(7, 84, 56, 0.08); outline: none; }
.dist-search { display: flex; align-items: center; gap: 8px; width: 230px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.dist-search .icon { width: 16px; height: 16px; color: #a3ada6; flex: none; }
.dist-search input { flex: 1; min-width: 0; max-width: none; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 12.5px; }
.dist-search:focus-within { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(7, 84, 56, 0.08); }

/* 表格面板 */
.dist-panel { margin-top: 0; padding: 6px 10px 10px; }
.dist-panel table { min-width: 1200px; }
.dist-table th { padding: 12px 14px; border-bottom: 1px solid #e9efe9; background: transparent; color: #8a978e; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap; }
.dist-table th.ta-r { text-align: right; }
.dist-table td { padding: 14px; border-bottom: 1px solid #f0f4f0; vertical-align: middle; }
.dist-row[hidden] { display: none; }
.dist-row td { transition: background .12s ease; }
.dist-row:hover td { background: #f8faf7; }
.dist-table tbody tr:last-child td { border-bottom: 0; }

/* 用户单元格 */
.dist-cell-user { display: flex; align-items: center; gap: 11px; min-width: 180px; max-width: 230px; }
.dist-avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #e8f2ed; color: var(--wine); font-size: 15px; font-weight: 800; }
.dist-cell-user-text { min-width: 0; }
.dist-cell-user-text strong, .dist-cell-user-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-cell-user-text strong { color: var(--ink); font-size: 13.5px; font-weight: 700; }
.dist-cell-user-text small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.dist-cell-user-text .dist-joined { color: #7d8c83; font-variant-numeric: tabular-nums; }

/* 资格状态徽章 */
.dist-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.dist-badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dist-badge-approved { background: #e6f2ec; color: #0d6a4a; }
.dist-badge-pending { background: #fbf0da; color: #96691c; }
.dist-badge-none { background: #f0f2ef; color: #7d8a81; }
.dist-badge-rejected { background: #f7e6e4; color: #a04a3f; }
.dist-badge-disabled { background: #eee; color: #8a8a8a; }
.dist-level { display: block; margin-top: 5px; color: var(--muted); font-size: 10.5px; font-weight: 600; }

/* 数字单元格 */
.dist-num b { display: block; color: var(--ink); font-size: 14.5px; font-weight: 800; letter-spacing: -0.01em; }
.dist-num small { display: block; margin-top: 3px; color: #9aa69e; font-size: 10.5px; white-space: nowrap; }
td.dist-num.ta-r, td.dist-num.ta-r b, td.dist-num.ta-r small { text-align: right; }
.dist-money b { color: var(--wine); }
.dist-balance b { color: var(--ink); }

/* 上级与备注：单行省略 */
.dist-parent { max-width: 130px; }
.dist-parent span { display: block; overflow: hidden; color: var(--ink); font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
td.dist-note { max-width: 150px; }
td.dist-note span { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

/* 行内操作按钮 */
.dist-ops { white-space: nowrap; }
.dist-op { display: inline-block; margin-right: 4px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #4a5a50; cursor: pointer; font-size: 12px; font-weight: 600; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.dist-op:hover { border-color: var(--wine); color: var(--wine); }
.dist-op-primary { border-color: transparent; background: var(--wine); color: #fff; }
.dist-op-primary:hover { background: var(--wine-deep); border-color: transparent; color: #fff; }
.dist-op-subtle { border-color: transparent; background: transparent; color: var(--muted); }
.dist-op-subtle:hover { background: #f0f4f0; border-color: transparent; color: var(--wine); }
.dist-op-danger { border-color: transparent; background: transparent; color: #c0392b; }
.dist-op-danger:hover { background: #fbecea; border-color: transparent; color: #a02a1e; }

/* 空状态 */
.dist-empty-row { padding: 60px 20px; color: var(--muted); font-size: 13px; text-align: center; }

/* 推广明细弹窗 */
.dist-detail-modal { width: min(980px, calc(100vw - 40px)); max-height: 86vh; overflow: auto; padding: 26px; }
.dist-detail-modal .dist-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid #eef2ee; }
.dist-detail-modal .dist-detail-head h2 { margin: 0 0 6px; font-size: 20px; }
.dist-detail-modal .dist-detail-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.dist-detail-modal .dist-note { display: flex; align-items: baseline; gap: 14px; margin: 18px 0 4px; padding: 13px 16px; border-radius: 12px; background: #f6f8f5; }
.dist-detail-modal .dist-note strong { color: #5d6c63; font-size: 12px; white-space: nowrap; }
.dist-detail-modal .dist-note span { color: #3c4d44; font-size: 13px; }
.dist-detail-modal .dist-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dist-detail-modal section { margin-top: 20px; }
.dist-detail-modal section h3 { margin: 0 0 10px; font-size: 14px; }
.dist-record-list { display: grid; gap: 8px; }
.dist-record-list article { display: grid; grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.4fr) minmax(150px, 1fr); gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid #eef2ee; border-radius: 12px; background: #fcfdfc; }
.dist-record-list article strong { font-size: 13px; }
.dist-record-list article span, .dist-record-list article small { color: var(--muted); font-size: 12px; }
.dist-detail-modal .dist-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }

/* 推广员开通与上级绑定 */
.distribution-modal { width: min(640px, calc(100vw - 40px)); max-height: 86vh; overflow: auto; }
.distribution-modal .form-head small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.distribution-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.distribution-levels label { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.distribution-levels label:has(input:checked) { border-color: var(--wine); background: rgba(7, 84, 56, .05); }
.distribution-levels input { width: auto; margin-top: 3px; }
.distribution-levels span, .distribution-candidate span:last-child { display: grid; gap: 4px; }
.distribution-levels strong, .distribution-candidate strong { color: var(--ink); font-size: 13px; }
.distribution-levels small, .distribution-candidate small { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.distribution-note { display: grid; gap: 8px; margin: 0 0 20px; color: var(--ink); font-size: 13px; font-weight: 700; }
.distribution-note textarea { min-height: 86px; resize: vertical; }
.distribution-help { margin: 18px 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.distribution-search input { width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.distribution-search input:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(7, 84, 56, .08); outline: 0; }
.distribution-candidates { display: grid; gap: 8px; max-height: 310px; margin: 12px 0 20px; overflow: auto; }
.distribution-candidate { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; text-align: left; cursor: pointer; }
.distribution-candidate:hover, .distribution-candidate.selected { border-color: var(--wine); background: rgba(7, 84, 56, .05); }
.distribution-modal .save:disabled { cursor: not-allowed; opacity: .45; }

/* 响应式 */
@media (max-width: 1360px) {
  .dist-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .dist-toolbar { flex-direction: column; align-items: stretch; }
  .dist-toolbar-right { justify-content: flex-start; }
}
@media (max-width: 767px) {
  .dist-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dist-toolbar-right { flex-direction: column; align-items: stretch; }
  .dist-search { width: 100%; }
  .dist-detail-modal { padding: 18px; }
  .distribution-levels { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dist-detail-modal .dist-detail-grid { grid-template-columns: 1fr; }
  .dist-record-list article { grid-template-columns: 1fr; }
}
