/* 樱味有厘 · 运营后台样式（零构建）
 * 令牌与小程序一致：酒红 #9C2019 / 哑光金 #C9A227 / 米白 #F7F2EA / 近黑 #141414
 */
:root {
  --brand-primary: #9c2019;
  --brand-primary-deep: #7b1d1c;
  --brand-deep: #6b1515;
  --brand-gold: #c9a227;
  --brand-gold-deep: #8a7545;
  --brand-ink: #141414;
  --brand-muted: #706a60;
  --brand-line: #e3d9c6;
  --brand-page: #f7f2ea;
  --brand-white: #fffcf7;
  --brand-soft: #f3e7dc;
  --brand-sidebar: #3a1412;
  --brand-success: #2f6b4f;
  --brand-warn: #9a6a12;
  --brand-danger: #a3201a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 30px rgba(58, 20, 18, 0.06);
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--brand-page);
  color: var(--brand-ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-primary); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------------- 布局 ---------------- */
.app-shell { min-height: 100vh; width: 100%; display: flex; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--brand-sidebar);
  color: #f4e7d8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  padding: 26px 22px 20px;
  border-bottom: 1px solid rgba(201, 162, 39, 0.22);
}
.sidebar__mark {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 4px;
  color: #fffcf7;
}
.sidebar__mark em { font-style: normal; color: var(--brand-gold); }
.sidebar__sub {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(244, 231, 216, 0.5);
}
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav__group-label {
  margin: 14px 10px 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(244, 231, 216, 0.4);
}
.nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(244, 231, 216, 0.82);
  font-size: 13px;
}
.nav__link:hover { background: rgba(255, 255, 255, 0.06); color: #fffcf7; }
.nav__link--active {
  background: rgba(201, 162, 39, 0.14);
  color: #fffcf7;
  box-shadow: inset 2px 0 0 var(--brand-gold);
}
.nav__badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d93026;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.sidebar__foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(201, 162, 39, 0.18);
  font-size: 11px;
  color: rgba(244, 231, 216, 0.45);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px 30px;
  background: rgba(247, 242, 234, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--brand-line);
}
.topbar__title { font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.topbar__crumb { margin-top: 2px; font-size: 11px; color: var(--brand-muted); letter-spacing: 1px; }
.topbar__right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  background: var(--brand-white);
  font-size: 12px;
}
.account__role { color: var(--brand-gold-deep); letter-spacing: 1px; }
.content { padding: 26px 30px 64px; max-width: 1180px; width: 100%; }

/* ---------------- 卡片 / 区块 ---------------- */
.card {
  background: var(--brand-white);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.card--flush { padding: 0; overflow: hidden; }
.card__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}
.card__title { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.card__sub { margin-top: 3px; font-size: 12px; color: var(--brand-muted); }
.section-title {
  font-family: var(--font-serif);
  font-size: 25px;
  letter-spacing: 3px;
  margin-bottom: 4px;
}
.section-sub { color: var(--brand-muted); font-size: 12px; letter-spacing: 1px; margin-bottom: 20px; }

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

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--brand-primary);
  color: #fffcf7;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-primary-deep); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--ghost {
  background: transparent;
  border-color: var(--brand-ink);
  color: var(--brand-ink);
}
.btn--ghost:hover { background: var(--brand-ink); color: #fffcf7; }
.btn--line {
  background: transparent;
  border-color: var(--brand-line);
  color: var(--brand-ink);
}
.btn--line:hover { border-color: var(--brand-gold); background: #fcf7ee; }
.btn--danger { background: transparent; border-color: var(--brand-danger); color: var(--brand-danger); }
.btn--danger:hover { background: var(--brand-danger); color: #fffcf7; }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn--block { width: 100%; }
.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand-primary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.linkish:hover { text-decoration: underline; }
.linkish--danger { color: var(--brand-danger); }
/* 无权限的按钮：灰掉并禁用，点击没有任何副作用；原因写在旁边的提示文字里 */
.linkish--disabled { color: var(--brand-muted); cursor: not-allowed; }
.linkish--disabled:hover { text-decoration: none; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 12px; color: var(--brand-muted); letter-spacing: 1px; }
.field__hint { font-size: 11px; color: var(--brand-muted); }
.input, .textarea, .select {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm);
  background: #fffdf9;
  color: var(--brand-ink);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand-primary); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hint-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #faf3e4;
  border: 1px solid #ecdcb8;
  color: var(--brand-gold-deep);
  font-size: 12px;
  line-height: 1.7;
}
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--brand-muted);
  border-bottom: 1px solid var(--brand-line);
  white-space: nowrap;
  background: #fbf6ec;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--brand-line);
  vertical-align: top;
}
.table tbody tr:hover { background: #fdf8ef; }
.table tbody tr:last-child td { border-bottom: none; }
.table__num { text-align: right; font-variant-numeric: tabular-nums; }
.table__actions { white-space: nowrap; display: flex; gap: 10px; }
.table__empty { padding: 36px 14px; text-align: center; color: var(--brand-muted); }
.cell-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cell-sub { margin-top: 2px; font-size: 11px; color: var(--brand-muted); }
.cell-thumb {
  width: 44px; height: 44px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--brand-line); background: var(--brand-soft); display: block;
}

/* ---------------- 状态 / 徽标 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--ok { background: #eaf3ec; color: var(--brand-success); border-color: #cfe3d4; }
.badge--off { background: #f1ede6; color: var(--brand-muted); border-color: #e2dbcd; }
.badge--wait { background: #faf1de; color: var(--brand-warn); border-color: #ecdcb8; }
.badge--bad { background: #fbecea; color: var(--brand-danger); border-color: #f0cfc9; }
.badge--gold { background: #f7efd8; color: var(--brand-gold-deep); border-color: #e8d9ac; }

/* ---------------- 工具栏 / 分页 ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .input, .toolbar .select { width: auto; min-width: 180px; }
.toolbar__spacer { flex: 1; }
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding: 14px 14px 0; font-size: 12px; color: var(--brand-muted); }

/* ---------------- 提示 / 空状态 ---------------- */
.empty {
  padding: 54px 20px;
  text-align: center;
  color: var(--brand-muted);
}
.empty__title { font-family: var(--font-serif); font-size: 19px; color: var(--brand-ink); letter-spacing: 2px; }
.empty__sub { margin-top: 8px; font-size: 12px; }
.empty__action { margin-top: 16px; display: flex; justify-content: center; }
.loading { padding: 40px; text-align: center; color: var(--brand-muted); font-size: 12px; letter-spacing: 2px; }

/* ---------------- Toast ---------------- */
.toast-host { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-sidebar);
  color: #fffcf7;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(58, 20, 18, 0.28);
  animation: toast-in 0.18s ease-out;
}
.toast--error { background: var(--brand-danger); }
.toast--success { background: #2f5d45; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(32, 16, 14, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--brand-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-line);
  box-shadow: 0 30px 80px rgba(32, 16, 14, 0.3);
}
.modal--wide { max-width: 760px; }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--brand-line);
}
.modal__title { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.modal__body { padding: 20px 22px; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--brand-line);
}
.icon-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--brand-line); background: transparent;
  color: var(--brand-muted); cursor: pointer; font-size: 15px; line-height: 1;
}

/* ---------------- 详情 / 键值 ---------------- */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }
.kv__row { display: flex; gap: 10px; font-size: 13px; min-width: 0; }
.kv__k { color: var(--brand-muted); min-width: 76px; flex-shrink: 0; }
.kv__v { word-break: break-all; }
.divider { height: 1px; background: var(--brand-line); margin: 18px 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 1px solid var(--brand-line);
  font-size: 12px;
}
.timeline__item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline__item::before {
  content: '';
  position: absolute;
  left: -4px; top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand-gold);
}
.timeline__type { font-weight: 600; }
.timeline__meta { color: var(--brand-muted); margin-top: 2px; word-break: break-all; }
.stat {
  padding: 16px 18px;
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-md);
  background: var(--brand-white);
}
.stat__label { font-size: 11px; letter-spacing: 1px; color: var(--brand-muted); }
.stat__value { margin-top: 6px; font-family: var(--font-serif); font-size: 26px; letter-spacing: 1px; }
.stat__value--accent { color: var(--brand-primary); }
.stat__note { margin-top: 2px; font-size: 11px; color: var(--brand-muted); }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.image-tile {
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--brand-soft);
  position: relative;
}
.image-tile img { display: block; width: 100%; height: 110px; object-fit: cover; }
.image-tile__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: var(--brand-white);
  font-size: 10px;
  color: var(--brand-muted);
}
.uploader { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.uploader input[type='file'] { font-size: 12px; max-width: 260px; }
.sku-thumb {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--brand-line);
  flex: none;
}

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  background: var(--brand-page);
}
.login-hero {
  position: relative;
  overflow: hidden;
  padding: 64px 64px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(120% 90% at 82% 8%, #7b1d1c 0%, #6b1515 52%, #4f0f0f 100%);
  color: #f7f2ea;
}
.login-hero::after {
  content: '';
  position: absolute;
  right: -120px; bottom: -160px;
  width: 460px; height: 460px;
  border: 1px solid rgba(201, 162, 39, 0.32);
  border-radius: 50%;
}
.login-hero__kicker { font-size: 11px; letter-spacing: 4px; color: rgba(247, 242, 234, 0.6); }
.login-hero__wordmark { margin-top: 22px; font-family: var(--font-serif); font-size: 62px; letter-spacing: 8px; line-height: 1.15; }
.login-hero__wordmark em { font-style: normal; color: var(--brand-gold); }
.login-hero__rule { width: 84px; height: 1px; background: rgba(201, 162, 39, 0.8); margin: 26px 0 18px; }
.login-hero__desc { max-width: 420px; font-size: 14px; line-height: 2; color: rgba(247, 242, 234, 0.76); }
.login-hero__foot { position: relative; z-index: 1; font-size: 11px; letter-spacing: 1px; color: rgba(247, 242, 234, 0.42); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 380px; }
.login-card__title { font-family: var(--font-serif); font-size: 27px; letter-spacing: 3px; }
.login-card__sub { margin-top: 8px; font-size: 12px; color: var(--brand-muted); letter-spacing: 1px; }
.login-card__form { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.login-card__foot { margin-top: 18px; font-size: 11px; line-height: 1.9; color: var(--brand-muted); }
.login-error { color: var(--brand-danger); font-size: 12px; min-height: 18px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; padding-bottom: 0; }
  .site-beian { position: static; left: 0; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { display: flex; gap: 4px; overflow-x: auto; padding: 10px 12px; }
  .nav__group-label, .sidebar__foot { display: none; }
  .nav__link { white-space: nowrap; }
  .topbar { padding: 10px 14px; }
  .topbar__title { font-size: 15px; letter-spacing: 0; }
  .topbar__crumb { display: none; }
  .topbar__right { justify-content: flex-end; }
  .account { padding: 4px 10px; }
  .content { padding: 16px 14px 56px; max-width: 100%; }
  .grid-2, .grid-3, .form-grid, .kv, .login-wrap { grid-template-columns: 1fr; }
  /* 统计卡在手机上排两列：四张卡竖排会把页面拉得很长，员工要滑很久才看到列表 */
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-hero { display: none; }
  .login-panel { padding: 22px 16px; }
  .card { padding: 16px; }
  .card__head { align-items: flex-start; }
  .section-title { font-size: 21px; letter-spacing: 2px; }
  .toolbar { gap: 8px; }
  /* 手机宽度：搜索框和筛选各占一整行，否则会被挤到只剩「搜索」「全」几个字 */
  .toolbar .input, .toolbar .select { flex: 1 1 100%; width: 100%; min-width: 0; }
  .toolbar .btn { flex: 0 0 auto; }
  .toolbar__spacer { display: none; }
  .pager { justify-content: center; padding: 12px 8px 0; }
  /* 表格保留横向滚动，但把最小宽度调小，让「商品名 + 状态 + 操作」在手机上更好读 */
  .table { min-width: 520px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-mask { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .modal__head { padding: 14px 16px; }
  .modal__body { padding: 16px; }
  .modal__foot { padding: 12px 16px 14px; }
  .modal__foot .btn { flex: 1; }
  .toast-host { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .form-actions, .table__actions { flex-wrap: wrap; }
}

/* 更窄的手机：只保留关键列（商品名 + 状态 + 操作），次要列与编号副行收起，
   需要完整信息时在桌面查看；避免表格被挤成每列两个字。 */
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .table { min-width: 0; }
}

/* ============ iPhone 排版语言（只取视觉语言，布局与表格不动） ============
 * 与小程序同口径：系统无衬线字体、无字距装饰、无渐变、卡片靠留白分层，
 * 圆角与文字颜色使用锁定的红白金令牌。后台仍是桌面表格布局，不做手机单列改版。 */
:root {
  --brand-ink: #1d1d1f;
  --brand-muted: #8e8e93;
  --brand-line: #f0ece4;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(29, 29, 31, 0.04);
  --font-serif: var(--font-sans);
}

/* 字距一律归零：去掉画册感的 spaced 标题 */
* { letter-spacing: 0 !important; }

/* 卡片不再靠描边+阴影堆叠，浅分隔线只在行间出现 */
.card, .panel {
  border-color: var(--brand-line);
}

/* 主按钮统一为药丸形，正文不改 */
.btn { border-radius: 999px; }
.btn--primary {
  background: var(--brand-primary);
  color: #ffffff;
}
.btn--primary:hover { background: var(--brand-deep); }

/* 工信部要求网站底部悬挂 ICP 备案号并链接到备案系统（蜀ICP备2026070130号） */
.site-beian {
  position: static;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--brand-line);
  background: var(--brand-page);
  color: var(--brand-muted, #7a7364);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.site-beian a {
  color: inherit;
  text-decoration: none;
}
.site-beian a:hover { text-decoration: underline; }

/* 备案栏随页面内容置于底部，不覆盖表格或分页 */
.app-shell { padding-bottom: 0; }

/* 销售员空态（仅销售员管理页使用；桌面留白与原内联样式一致） */
.salesperson-empty { padding: 8px 24px 24px; }
.salesperson-empty__actions { margin-top: 12px; }

/* 手机端调整（放在文件末尾，确保能覆盖上面的 .app-shell 让位 padding）：
   1) 备案栏改为跟随页尾（static），不再 fixed 常驻底部挡住最后一屏内容；
      备案号与链接保持不变，桌面端仍为 fixed。
   2) 收紧销售员空态留白：全局 .empty 的 54px 大留白 + 外层 padding 会把
      「新增销售员」按钮推得很深；只作用于销售员管理页，不影响其他页空态，文案不变。 */
@media (max-width: 900px) {
  .site-beian { position: static; }
  .app-shell { padding-bottom: 0; }
  .salesperson-empty { padding: 4px 16px 20px; }
  .salesperson-empty .empty { padding: 26px 16px; }
  .salesperson-empty__actions { margin-top: 6px; }
}


