/* ========== 设计变量 ========== */
:root {
  --bg: #F7F4EF;
  --card: #FFFFFF;
  --ink: #2B2A26;
  --ink-2: #6F6A62;
  --ink-3: #A9A39A;
  --brand: #1F3A34;
  --brand-2: #2C4F47;
  --brand-soft: #E8EDEA;
  --accent: #C4693B;
  --accent-soft: #F7E9E1;
  --line: #EAE5DC;
  --ok: #3F7A5E;
  --ok-soft: #E6F0EA;
  --warn: #B7791F;
  --warn-soft: #FBF1DE;
  --danger: #B4453A;
  --danger-soft: #F9E7E4;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(43,42,38,.05), 0 4px 12px rgba(43,42,38,.04);
  --shadow-md: 0 8px 32px rgba(43,42,38,.10);
  --sidebar: #17302B;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D9D3C8; border-radius: 4px; }

/* ========== 登录 ========== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #233F38 0%, #17302B 45%, #12241F 100%);
  padding: 24px;
}
.login-card {
  width: 380px; background: #fff; border-radius: 20px; padding: 40px 36px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-brand { font-size: 26px; font-weight: 800; letter-spacing: 8px; color: var(--brand); }
.login-sub { margin-top: 8px; font-size: 13px; color: var(--ink-3); letter-spacing: 2px; }
.login-form { margin-top: 32px; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ========== 布局 ========== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0; background: var(--sidebar); color: #D9E2DD;
  display: flex; flex-direction: column; padding: 26px 16px; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 0 10px 26px; }
.side-brand .name { font-size: 19px; font-weight: 800; letter-spacing: 5px; color: #fff; }
.side-brand .slogan { font-size: 11px; color: #7E958D; letter-spacing: 1px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  color: #A9BDB5; font-size: 14px; margin-bottom: 4px; transition: .16s; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #fff; color: var(--brand); font-weight: 600; }
.nav-item .ico { font-size: 15px; width: 18px; text-align: center; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.08); }
.side-user { font-size: 12px; color: #7E958D; margin-bottom: 8px; }
.side-logout { font-size: 12px; color: #A9BDB5; padding: 4px 0; }
.side-logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: rgba(247,244,239,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.topbar .sub { font-size: 12px; color: var(--ink-3); margin-left: 12px; }
.content { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }

/* ========== 卡片 / 栅格 ========== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid rgba(234,229,220,.7); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.card-head .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 10px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2-1, .grid-3 { grid-template-columns: 1fr; }
}

/* ========== 指标卡 ========== */
.kpi { padding: 20px 22px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--ink-2); letter-spacing: 1px; }
.kpi .value { margin-top: 8px; font-size: 30px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-left: 4px; }
.kpi .foot { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.kpi .ghost { position: absolute; right: 14px; top: 10px; font-size: 34px; opacity: .07; }
.kpi.accent .value { color: var(--accent); }
.kpi.brand .value { color: var(--brand); }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: #F2EEE7; color: var(--ink); transition: .16s; white-space: nowrap;
}
.btn:hover { background: #E9E3D9; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #F3D8D4; }
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-ghost:hover { background: #F2EEE7; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ========== 表单 ========== */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .5px; }
.field .req::after { content: ' *'; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; transition: .16s; font-size: 14px;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,58,52,.08); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.help { font-size: 11px; color: var(--ink-3); margin-top: 5px; }

/* ========== 筛选栏 ========== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search .input { width: 240px; padding-left: 34px; }
.search::before { content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 15px; }

.seg { display: inline-flex; background: #F2EEE7; border-radius: 10px; padding: 3px; }
.seg button { height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--brand); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 12px 16px; background: #FAF8F4; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FCFAF7; }
.t-main { font-weight: 600; }
.t-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.num { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; }
.thumb { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; background: #F2EEE7; }
.cell-flex { display: flex; align-items: center; gap: 12px; }

/* ========== 徽章 ========== */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.sale { background: var(--brand-soft); color: var(--brand); }
.badge.points { background: var(--accent-soft); color: var(--accent); }
.badge.on { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #F1EEE8; color: var(--ink-3); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.shipped { background: #E7EEF7; color: #3B6597; }
.badge.received { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled { background: #F1EEE8; color: var(--ink-3); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ========== 空态 ========== */
.empty { text-align: center; padding: 64px 20px; color: var(--ink-3); }
.empty .ico { font-size: 40px; opacity: .5; margin-bottom: 10px; }

/* ========== 弹层 ========== */
.mask {
  position: fixed; inset: 0; background: rgba(28,26,23,.42); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 100; overflow-y: auto;
}
.modal { width: 100%; max-width: 720px; background: #fff; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.28); animation: rise .2s ease; }
.modal.narrow { max-width: 460px; }
.modal.wide { max-width: 940px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.modal-close { font-size: 18px; color: var(--ink-3); width: 30px; height: 30px; border-radius: 8px; }
.modal-close:hover { background: #F2EEE7; color: var(--ink); }
.modal-body { padding: 22px 26px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 26px; border-top: 1px solid var(--line); background: #FCFAF7; border-radius: 0 0 18px 18px; }

/* ========== 图片上传 ========== */
.uploader { display: flex; flex-wrap: wrap; gap: 10px; }
.up-item { width: 88px; height: 88px; border-radius: 10px; position: relative; overflow: hidden; border: 1px solid var(--line); background: #FAF8F4; }
.up-item img { width: 100%; height: 100%; object-fit: cover; }
.up-item .del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.up-item .tag-main { position: absolute; left: 0; bottom: 0; right: 0; background: rgba(31,58,52,.8); color: #fff; font-size: 10px; text-align: center; padding: 2px 0; }
.up-add {
  width: 88px; height: 88px; border-radius: 10px; border: 1px dashed #D7D0C4; background: #FAF8F4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink-3); font-size: 11px; gap: 2px;
}
.up-add:hover { border-color: var(--brand); color: var(--brand); }
.up-add .plus { font-size: 20px; line-height: 1; }
.video-slot { display: flex; align-items: center; gap: 12px; }
.video-preview { width: 140px; height: 79px; border-radius: 10px; background: #000; object-fit: cover; }

/* ========== 提示条 ========== */
.alert { display: flex; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 12.5px; line-height: 1.7; }
.alert.warn { background: var(--warn-soft); color: #7A5410; }
.alert.info { background: var(--brand-soft); color: var(--brand); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }

/* ========== 统计图 ========== */
.chart-box { padding: 8px 8px 0; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-2); padding: 0 8px 12px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 220px; padding: 10px 8px 0; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; position: relative; min-width: 4px; }
.bar { width: 100%; max-width: 22px; background: linear-gradient(180deg, #4A7268, #2C4F47); border-radius: 4px 4px 0 0; transition: .2s; min-height: 2px; }
.bar-col:hover .bar { filter: brightness(1.15); }
.bar-col .tip {
  position: absolute; bottom: calc(100% + 6px); background: var(--ink); color: #fff; font-size: 11px;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: .15s; z-index: 5;
}
.bar-col:hover .tip { opacity: 1; }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); padding: 6px 8px 0; }

/* ========== 提示 ========== */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 18px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px;
  box-shadow: var(--shadow-md); animation: drop .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ========== 列表条目 ========== */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
/* 品牌 / 分类小图片 */
.meta-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); flex-shrink: 0; }
.meta-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--ink-3); border: 1px dashed var(--line);
}
/* 小程序码 */
.qr-thumb { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); }
.qr-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-3); border: 1px dashed var(--line);
}
/* 上线检查清单序号 */
.step-no {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-soft); color: var(--brand);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.muted { color: var(--ink-3); }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
