/* 高池商城 · 内容管理 — 浅色企业后台 */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --primary: #2f54eb;
  --primary-weak: #f0f5ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e8eaed;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #8f959e;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #d97706;
  --sidebar-w: 208px;
  --radius: 8px;
}

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1; margin-left: var(--sidebar-w); padding: 20px 24px 40px; min-width: 0; }

/* ---------- 侧栏 ---------- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px; border-bottom: 1px solid var(--line); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 8px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--text-3); }
.nav { padding: 10px 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 6px; color: var(--text-2); cursor: pointer; user-select: none;
}
.nav-item:hover { background: #f2f3f5; color: var(--text); }
.nav-item.active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav-ico { width: 18px; text-align: center; font-size: 13px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.sync-info { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.ver { font-size: 11px; color: #b8bcc4; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-time { color: var(--text-3); font-size: 13px; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.chart { height: 280px; }

.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 6px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .9; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.input {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13px;
  background: var(--card); color: var(--text); outline: none;
}
.input:focus { border-color: var(--primary); }
.input.sel { width: 130px; }
.input.date { width: 130px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-count { color: var(--text-3); font-size: 12px; margin-left: auto; }
.toolbar-sep { color: var(--text-3); font-size: 12px; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); cursor: pointer; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 700; }
.kpi-value small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 2px; }
.kpi-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ---------- TOP 榜 ---------- */
.top-list { display: flex; flex-direction: column; gap: 10px; }
.top-item { display: flex; align-items: center; gap: 12px; }
.top-rank { width: 22px; height: 22px; border-radius: 4px; background: var(--primary-weak); color: var(--primary); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.top-item img { width: 42px; height: 56px; object-fit: cover; border-radius: 4px; background: #f2f3f5; }
.top-info { flex: 1; min-width: 0; }
.top-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.top-amount { font-weight: 600; color: var(--red); }

/* ---------- 商品网格 ---------- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.prod-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: box-shadow .15s; }
.prod-card:hover { box-shadow: 0 4px 16px rgba(31,35,41,.1); }
.prod-pic-wrap { position: relative; padding-top: 130%; background: #f2f3f5; }
.prod-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.prod-status-tag { position: absolute; top: 8px; left: 8px; }
.prod-body { padding: 10px 12px 12px; }
.prod-title { font-size: 13px; line-height: 1.45; height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prod-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.prod-amount { color: var(--red); font-weight: 700; font-size: 14px; }
.prod-cate { margin-top: 6px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; line-height: 18px; }
.tag-onsale { background: #ecfdf3; color: var(--green); }
.tag-offsale { background: #f2f3f5; color: var(--text-3); }
.tag-cate { background: var(--primary-weak); color: var(--primary); }
.tag-warn { background: #fff7e8; color: var(--orange); }
.tag-gray { background: #f2f3f5; color: var(--text-2); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-2); background: #fafbfc; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; cursor: pointer; }
.tl { text-align: left; }
.ta-r { text-align: right; }
.order-item { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.order-item img { width: 32px; height: 42px; object-fit: cover; border-radius: 3px; background: #f2f3f5; flex: none; }
.order-item-txt { min-width: 0; }
.order-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.order-item-sku { font-size: 12px; color: var(--text-3); }
.money { font-weight: 600; }
.star { cursor: pointer; font-size: 15px; color: #d4d7dc; }
.star.on { color: #f59e0b; }
.remark-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-left: 4px; }

/* ---------- 物流 ---------- */
.logi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.logi-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.logi-card:hover { box-shadow: 0 4px 16px rgba(31,35,41,.08); }
.logi-no { font-weight: 600; font-size: 14px; }
.logi-po { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.logi-latest { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.logi-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* ---------- 抽屉 ---------- */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 92vw;
  background: var(--card); z-index: 100; box-shadow: -8px 0 30px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 15px; }
.drawer-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--text-3); padding: 4px; }
.drawer-close:hover { color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }

.d-sec { margin-bottom: 22px; }
.d-sec-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; padding-left: 8px; border-left: 3px solid var(--primary); }
.d-gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.d-gallery img { width: 120px; height: 156px; object-fit: cover; border-radius: 6px; background: #f2f3f5; flex: none; }
.d-title { font-size: 15px; font-weight: 600; line-height: 1.5; margin-bottom: 10px; }
.d-kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; font-size: 13px; }
.d-kv dt { color: var(--text-3); }
.d-kv dd { color: var(--text); word-break: break-all; }
.d-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.d-table th, .d-table td { border-bottom: 1px solid #f0f1f3; padding: 7px 8px; text-align: left; }
.d-table th { color: var(--text-3); font-weight: 500; background: #fafbfc; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.tl-item:first-child::before { background: var(--red); transform: scale(1.3); }
.tl-time { font-size: 12px; color: var(--text-3); }
.tl-text { font-size: 13px; line-height: 1.55; margin-top: 2px; }

/* 编辑表单 */
.form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.form-row label { width: 64px; color: var(--text-2); font-size: 13px; flex: none; }
.form-row .input { flex: 1; }
textarea.input { min-height: 64px; resize: vertical; font-family: inherit; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 9px 18px; border-radius: 6px; font-size: 13px;
  z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
