/* ==========================================================================
   玥佑通 · eMAG 卖家中文工作台 — 高保真前端原型
   设计令牌复刻自原站实测值（品牌墨蓝 #324a70 / MiSans 字体栈 / 8px 圆角卡片）
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --ink: #2b2b2b;
  --ink-soft: #555555;
  --ink-mute: #888888;
  --ink-faint: #a8a8a8;

  --line: #d4d4d4;
  --line-soft: #e5e5e5;
  --line-faint: #efefec;

  --brand-ink: #324a70;
  --brand-ink-2: #26405f;
  --brand: #6b8ec7;
  --brand-hover: #5c81bd;
  --brand-soft: #dbe5f3;
  --brand-softer: #eaf0f9;

  --page: #f2f2ee;
  --page-alt: #fafaf7;
  --surface: #ffffff;

  --good-bg: #ecfdf5; --good-bd: #6ee7b7; --good-fg: #047857;
  --warn-bg: #fffbeb; --warn-bd: #fcd34d; --warn-fg: #b45309;
  --bad-bg:  #fef2f2; --bad-bd:  #fca5a5; --bad-fg:  #b91c1c;
  --info-bg: #f0f9ff; --info-bd: #7dd3fc; --info-fg: #0369a1;
  --mute-bg: #f2f2ee; --mute-bd: #d4d4d4; --mute-fg: #888888;

  --up: #c0392b;    /* 涨 = 红（中国市场惯例） */
  --down: #1f8a4c;  /* 跌 = 绿 */
  --accent-plum: #a0328c;
  --accent-blue: #0082e6;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(50, 74, 112, .08), 0 1px 2px rgba(50, 74, 112, .06);
  --shadow: 0 8px 28px rgba(50, 74, 112, .13);
  --shadow-drawer: -6px 0 8px -6px rgba(50, 74, 112, .18);

  --sidebar-w: 232px;
  --topbar-h: 56px;

  --font: MiSans, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --z-drawer: 60;
  --z-modal: 70;
  --z-toast: 90;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; border-spacing: 0; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfcfc9; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6b6b0; background-clip: content-box; }

/* ---------- Utility ---------- */
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.ic { width: 16px; height: 16px; flex: 0 0 auto; }
.ic-sm { width: 13px; height: 13px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-mute); }
.soft { color: var(--ink-soft); }
.up { color: var(--up); }
.down { color: var(--down); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.center { text-align: center; }
.right { text-align: right; }
.flex { display: flex; }
.iflex { display: inline-flex; }
.ac { align-items: center; }
.jc { justify-content: center; }
.jb { justify-content: space-between; }
.je { justify-content: flex-end; }
.wrap { flex-wrap: wrap; }
.col { flex-direction: column; }
.g4 { gap: 4px; } .g6 { gap: 6px; } .g8 { gap: 8px; }
.g12 { gap: 12px; } .g16 { gap: 16px; } .g20 { gap: 20px; } .g24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--brand-ink);
  color: #dfe6f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
}
.sidebar__brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 9px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  flex: 0 0 auto;
}
.sidebar__brand:hover { text-decoration: none; }
.brandmark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #6b8ec7, #a0328c 55%, #4359c7);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  flex: 0 0 auto;
}
.sidebar__name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .02em; }
.sidebar__tag { font-size: 10px; color: #8fa6c6; margin-left: auto; letter-spacing: .06em; }

.sidebar__scroll { overflow-y: auto; overflow-x: hidden; padding: 10px 0 20px; flex: 1; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); background-clip: content-box; }

.navgroup { padding: 12px 12px 2px; }
.navgroup__title {
  font-size: 10.5px; letter-spacing: .12em; color: #7f97b8;
  padding: 0 8px 6px; font-weight: 600; text-transform: uppercase;
}
.navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; margin-bottom: 1px;
  border-radius: 7px;
  color: #cbd6e6; font-size: 13.5px;
  cursor: pointer; user-select: none;
  transition: background .12s, color .12s;
}
.navitem:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.navitem.is-active { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.navitem svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .92; }
.navitem__badge {
  margin-left: auto; font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: rgba(255,255,255,.16); color: #fff; font-family: var(--mono);
}
.navitem.is-active .navitem__badge { background: rgba(255,255,255,.28); }
.navitem__badge.bad { background: #c0392b; }

.sidebar__foot { flex: 0 0 auto; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.10); }

/* main */
.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar__crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-mute); min-width: 0; }
.topbar__crumbs b { color: var(--ink); font-weight: 600; font-size: 15px; }
.topbar__crumbs .sep { color: var(--line); }
.topbar__spacer { flex: 1; }

.shopswitch {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius); padding: 5px 10px 5px 8px;
  cursor: pointer; max-width: 260px;
}
.shopswitch:hover { border-color: var(--brand); }
.shopswitch__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good-fg); flex: 0 0 auto; }
.shopswitch__dot.off { background: var(--ink-faint); }
.shopswitch__dot.warn { background: var(--warn-fg); }
.shopswitch__name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shopswitch__label {
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  color: var(--ink-mute); background: var(--page-alt);
  border-radius: 4px; padding: 1px 5px; flex: 0 0 auto;
}

/* 自定义日期区间（订单页工具栏） */
.daterange {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 8px; height: 30px; border-radius: 6px;
  background: var(--page); border: 1px solid var(--line-soft);
  color: var(--ink-mute); flex: 0 0 auto;
}
.daterange .input {
  height: 24px; padding: 0 4px; border: none; background: transparent;
  font-size: 12px; color: var(--ink); width: 116px; font-family: var(--mono);
}
.daterange .input:focus { outline: none; box-shadow: none; }
.daterange__sep { font-size: 12px; color: var(--ink-faint); }
.shopswitch__site {
  font-size: 10.5px; font-family: var(--mono); color: var(--brand-ink);
  background: var(--brand-softer); border-radius: 4px; padding: 1px 5px; flex: 0 0 auto;
}

.iconbtn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-soft);
  position: relative;
}
.iconbtn:hover { background: var(--page); color: var(--ink); border-color: var(--line-soft); }
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn__dot {
  position: absolute; top: 6px; right: 6px; min-width: 15px; height: 15px;
  border-radius: 999px; background: #c0392b; color: #fff;
  font-size: 9.5px; line-height: 15px; text-align: center; padding: 0 3px;
  font-family: var(--mono); border: 1.5px solid #fff;
}

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; cursor: pointer; flex: 0 0 auto;
}

.connchip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--page-alt); color: var(--ink-mute);
  white-space: nowrap; cursor: default;
}
.connchip.is-on { border-color: var(--good-bd); background: var(--good-bg); color: var(--good-fg); }
@media (max-width: 900px) { .connchip span { display: none; } }

.content { padding: 20px 22px 40px; flex: 1; }
.content--wide { max-width: 1560px; }

/* ==========================================================================
   Page header
   ========================================================================== */
.pagehead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead__main { min-width: 0; }
.pagehead h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.pagehead__sub { font-size: 13px; color: var(--ink-mute); margin-top: 3px; }
.pagehead__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: var(--radius); padding: 11px 14px;
  font-size: 13px; margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.banner svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.banner--info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }
.banner--warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.banner--bad  { background: var(--bad-bg);  border-color: var(--bad-bd);  color: var(--bad-fg); }
.banner--good { background: var(--good-bg); border-color: var(--good-bd); color: var(--good-fg); }
.banner--brand { background: var(--brand-softer); border-color: var(--brand-soft); color: var(--brand-ink); }
.banner__body { flex: 1; min-width: 0; }
.banner__title { font-weight: 600; }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  padding: 7px 14px; font-size: 13.5px; font-weight: 500; line-height: 1.25;
  background: #fff; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, color .13s, box-shadow .13s;
}
.btn:hover { background: var(--page); }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ink { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-ink:hover { background: var(--brand-ink-2); border-color: var(--brand-ink-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--page); }
.btn-danger { background: #b8503e; border-color: #b8503e; color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-xs { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-grad {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 9px 18px;
  color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  background: linear-gradient(90deg, #ff1d25 -12%, #a0328c 28%, #7040a4, #4359c7 62%, #0082e6 108%);
  box-shadow: 0 2px 10px rgba(67, 89, 199, .30);
}
.btn-grad:hover { box-shadow: 0 4px 16px rgba(67, 89, 199, .42); }
.btn-grad:disabled { cursor: not-allowed; opacity: .5; }
.btn-link { border: 0; background: none; color: var(--brand-ink); padding: 0; cursor: pointer; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }

/* ==========================================================================
   Card / panel
   ========================================================================== */
.card {
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-xs);
}
.card__head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.card__head h3 { font-size: 14.5px; font-weight: 650; }
.card__head .sub { font-size: 12px; color: var(--ink-mute); font-weight: 400; }
.card__body { padding: 16px; }
.card__foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); background: var(--page-alt); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; }

/* stat */
.stat { padding: 14px 16px; }
.stat__label { font-size: 12.5px; color: var(--ink-mute); display: flex; align-items: center; gap: 5px; }
.stat__value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-family: var(--mono); }
.stat__value small { font-size: 13px; font-weight: 500; color: var(--ink-mute); margin-left: 3px; }
.stat__delta { font-size: 12px; margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.stat__hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }
.stat__spark { margin-top: 8px; height: 30px; }

/* ==========================================================================
   Chips / badges
   ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft);
  padding: 1px 9px; font-size: 12px; line-height: 19px; white-space: nowrap;
}
.chip-active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.chip-good { border-color: var(--good-bd); background: var(--good-bg); color: var(--good-fg); }
.chip-warn { border-color: var(--warn-bd); background: var(--warn-bg); color: var(--warn-fg); }
.chip-bad  { border-color: var(--bad-bd);  background: var(--bad-bg);  color: var(--bad-fg); }
.chip-info { border-color: var(--info-bd); background: var(--info-bg); color: var(--info-fg); }
.chip-mute { border-color: var(--mute-bd); background: var(--mute-bg); color: var(--mute-fg); }
.chip-plum { border-color: #e6c9e0; background: #fdf2fb; color: var(--accent-plum); }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dotk { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

/* 无权限查看的字段 */
.masked { color: var(--ink-faint); letter-spacing: 1.5px; cursor: help; font-family: var(--mono); }
.stat--locked { background: var(--page-alt); border-style: dashed; }
.stat--locked .stat__value { font-size: 19px; }
.chip-click { cursor: pointer; }
.chip-click:hover { border-color: var(--brand); }

.pill-svip {
  display: inline-flex; align-items: center; gap: 3px;
  background: linear-gradient(90deg, #a0328c, #4359c7);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 4px; padding: 1px 5px; letter-spacing: .04em;
}
.tag-sq { border-radius: 4px; padding: 1px 6px; font-size: 11.5px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); font-family: var(--mono); white-space: nowrap; }

/* ==========================================================================
   Forms
   ========================================================================== */
.input, .select, .textarea {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; padding: 7px 10px; font-size: 13.5px; line-height: 1.4;
  transition: border-color .13s, box-shadow .13s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-mute); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); outline: none;
  box-shadow: 0 0 0 3px rgba(107, 142, 199, .18);
}
.textarea { min-height: 76px; resize: vertical; }
.select { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.input-sm { padding: 4px 8px; font-size: 12.5px; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.label .req { color: #c0392b; margin-left: 2px; }
.field { margin-bottom: 14px; }
.field__hint { font-size: 11.5px; color: var(--ink-mute); margin-top: 4px; }
.field__err { font-size: 11.5px; color: var(--bad-fg); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13px; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 36px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch__track {
  position: absolute; inset: 0; border-radius: 999px; background: #cfcfc9; transition: background .16s;
}
.switch__track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .16s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.segmented button {
  border: 0; background: #fff; padding: 6px 13px; font-size: 13px; cursor: pointer;
  color: var(--ink-soft); border-right: 1px solid var(--line-soft);
}
.segmented button:last-child { border-right: 0; }
.segmented button.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.segmented button:hover:not(.is-active) { background: var(--page); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 9px 14px; font-size: 13.5px; cursor: pointer;
  color: var(--ink-mute); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); font-weight: 600; }

/* filter bar */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
}
.filters .search { position: relative; flex: 0 1 300px; min-width: 190px; }
.filters .search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-mute); }
.filters .search .input { padding-left: 30px; }
.filters .spacer { flex: 1; }
.filters .select, .filters .input { width: auto; }
.filters__more { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding-top: 4px; }

/* ==========================================================================
   Table
   ========================================================================== */
.tablewrap { width: 100%; overflow-x: auto; }
/* 经营总览：一列里上下堆叠几张卡片，各自按内容高度，不互相拉伸。
   之前用 grid 等高，站点分布只有 3 行却被库存预警拉到几百像素，全是空白。 */
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* 榜单卡片：限高 + 内部滚动。鼠标放进去就能往下翻，表头 sticky 常驻。
   之前 Top 8 只给 8 行，看不够；现在取前 50 名，靠滚动看后面的。
   高度按「一屏能看到前 8~10 名」定，太高会把下面的卡片挤出屏幕。 */
.tablewrap--scroll { max-height: 620px; overflow-y: auto; }
.tablewrap--scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.tablewrap--scroll::-webkit-scrollbar-track { background: transparent; }
.tablewrap--scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.tablewrap--scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
table.dt { width: 100%; font-size: 13px; }
table.dt thead th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-soft);
  padding: 9px 12px; background: var(--page-alt);
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.dt thead th.sortable { cursor: pointer; user-select: none; }
table.dt thead th.sortable:hover { color: var(--brand-ink); }
table.dt thead th .sortind { opacity: .35; margin-left: 3px; font-size: 10px; }
table.dt thead th.is-sorted { color: var(--brand-ink); }
table.dt thead th.is-sorted .sortind { opacity: 1; }
table.dt tbody td {
  padding: 9px 12px; border-bottom: 1px solid var(--line-faint); vertical-align: middle;
}
table.dt tbody tr:hover { background: var(--brand-softer); }
table.dt tbody tr.is-sel { background: var(--brand-soft); }
table.dt tbody tr.clickable { cursor: pointer; }
table.dt td.right, table.dt th.right { text-align: right; }
table.dt td.center, table.dt th.center { text-align: center; }
table.dt .col-check { width: 38px; padding-right: 0; }
table.dt .sticky-r { position: sticky; right: 0; background: #fff; box-shadow: -6px 0 8px -8px rgba(50,74,112,.3); }
table.dt tbody tr:hover .sticky-r { background: var(--brand-softer); }
/* 热销榜排名徽章：前三名用金银铜，其余中性灰。
   排名由订单实时算，订单同步（每 2 分钟）后整张榜会重排。 */
.rankbadge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--page-alt); color: var(--ink-mute);
  border: 1px solid var(--line-faint);
}
.rankbadge.is-top1 { background: #c9a227; border-color: #c9a227; color: #fff; }
.rankbadge.is-top2 { background: #97a3b0; border-color: #97a3b0; color: #fff; }
.rankbadge.is-top3 { background: #b0794f; border-color: #b0794f; color: #fff; }
.rankmove { font-size: 10px; margin-left: 3px; font-weight: 600; }
.rankmove.is-up { color: var(--good-fg); }
.rankmove.is-down { color: var(--ink-mute); }

.dt-empty { padding: 52px 16px; text-align: center; color: var(--ink-mute); }.dt-empty svg { width: 40px; height: 40px; opacity: .3; margin: 0 auto 10px; }
.dt-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-mute);
}
.pager { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pager button {
  min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--ink-soft); padding: 0 7px;
}
.pager button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-ink); }
.pager button.is-active { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--brand-softer);
  border-bottom: 1px solid var(--brand-soft); font-size: 13px; color: var(--brand-ink);
}

/* cell pieces */
.cellprod { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.cellprod__img {
  width: 36px; height: 36px; border-radius: 6px; flex: 0 0 36px;
  background: var(--page); border: 1px solid var(--line-soft);
  display: grid; place-items: center; font-size: 15px; overflow: hidden;
}
.cellprod__main { min-width: 0; flex: 1 1 auto; }
/* 商品名换行完整显示。
   eMAG 的罗马尼亚语标题动辄上百字符，原先单行截断 + 省略号，
   必须横向拖或悬停才看得到后面 —— 改成自动换行，一眼看完。
   overflow-wrap/word-break 是给没有空格的超长串（型号、条码）兜底。 */
.cellprod__name {
  display: block; font-weight: 500; line-height: 1.45;
  white-space: normal; overflow-wrap: anywhere; word-break: break-word;
}
.cellprod__meta { font-size: 11.5px; color: var(--ink-mute); font-family: var(--mono); margin-top: 2px; }

/* 订单列表专用：商品图放大成正方形。
   默认 36px 太小，扫一眼分不清是什么东西（用户要求放大到 ~46px）。 */
.cellprod--lg .cellprod__imgwrap,
.cellprod--lg .cellprod__img { width: 46px; height: 46px; flex: 0 0 46px; }
.cellprod--lg .cellprod__img { font-size: 20px; border-radius: 4px; }
.cellprod--lg .cellprod__imgwrap > img { border-radius: 4px; }

/* 商品中心：PNK / PNK 码 的一键复制标签（点一下即复制，鼠标移上去有反馈） */
.copytag {
  display: inline-block; margin: 1px 4px 1px 0; padding: 1px 6px;
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  color: var(--ink-soft); background: var(--page-alt);
  border: 1px solid var(--line-soft); border-radius: 5px;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.copytag:hover { background: var(--brand-softer); border-color: var(--brand); color: var(--brand-ink); }
.copytag:active { transform: translateY(1px); }

/* 真实商品主图：加载失败时自动显示下面的占位块，不会出现裂图 */
.cellprod__imgwrap { position: relative; width: 36px; height: 36px; flex: 0 0 36px; }
.cellprod__imgwrap > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 6px; background: var(--page);
  border: 1px solid var(--line-soft);
}
.cellprod__imgwrap > img.is-broken { display: none; }
.cellprod__imgwrap > img:not(.is-broken) + .cellprod__img--fb { display: none; }
.cellprod__imgwrap > .cellprod__img--fb { position: absolute; inset: 0; }

/* 店铺小标签：颜色按店铺顺序分配，用来一眼区分是哪个店出的单 */
.shoptag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 6px; border-radius: 4px;
  font-size: 11px; line-height: 17px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; vertical-align: middle;
}
.shoptag__dot { width: 5px; height: 5px; border-radius: 50%; flex: 0 0 5px; }
.minibar { height: 5px; border-radius: 3px; background: var(--line-soft); overflow: hidden; min-width: 44px; }
.minibar > i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }

/* ==========================================================================
   Drawer / Modal / Toast
   ========================================================================== */
.scrim {
  position: fixed; inset: 0; background: rgba(30, 40, 56, .38);
  z-index: var(--z-drawer); opacity: 0; animation: fade .16s forwards;
}
@keyframes fade { to { opacity: 1; } }
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: #fff; z-index: calc(var(--z-drawer) + 1);
  box-shadow: var(--shadow-drawer); display: flex; flex-direction: column;
  animation: slidein .2s cubic-bezier(.32, .72, 0, 1);
}
.drawer--wide { width: min(860px, 96vw); }
.drawer__head {
  display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft); flex: 0 0 auto;
}
.drawer__head h3 { font-size: 16px; font-weight: 650; }
.drawer__head .sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; }
.drawer__body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer__foot {
  padding: 12px 18px; border-top: 1px solid var(--line-soft);
  display: flex; gap: 8px; justify-content: flex-end; flex: 0 0 auto; background: var(--page-alt);
}

.modal-scrim { z-index: var(--z-modal); }
.modal {
  position: fixed; z-index: calc(var(--z-modal) + 1);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 94vw); background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); animation: pop .16s; max-height: 90vh; display: flex; flex-direction: column;
}
.modal--wide { width: min(760px, 94vw); }
.modal__head { padding: 16px 18px 0; }
.modal__head h3 { font-size: 16px; font-weight: 650; }
.modal__body { padding: 14px 18px; overflow-y: auto; font-size: 13.5px; }
.modal__foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; }

.toasts {
  position: fixed; z-index: var(--z-toast); right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 11px 14px; font-size: 13.5px;
  max-width: 380px; animation: pop .16s;
}
.toast svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.toast--good svg { color: var(--good-fg); }
.toast--bad svg { color: var(--bad-fg); }
.toast--info svg { color: var(--info-fg); }
.toast--warn svg { color: var(--warn-fg); }

/* dropdown menu */
.menu {
  position: absolute; z-index: 50; min-width: 190px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 5px; animation: pop .12s;
}
.menu__item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--ink-soft);
}
.menu__item:hover { background: var(--brand-softer); color: var(--brand-ink); }
.menu__item svg { width: 15px; height: 15px; }
.menu__item.is-danger:hover { background: var(--bad-bg); color: var(--bad-fg); }
.menu__sep { height: 1px; background: var(--line-soft); margin: 5px 0; }
.menu__head { padding: 7px 10px 4px; font-size: 11px; color: var(--ink-mute); letter-spacing: .06em; }

/* ==========================================================================
   Misc blocks
   ========================================================================== */
.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--ink-mute); }
.kv dd { margin: 0; word-break: break-word; }
.kv--wide { grid-template-columns: 168px minmax(0, 1fr); }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 20px 0 10px; letter-spacing: .01em;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }
.section-title:first-child { margin-top: 0; }

.empty {
  padding: 48px 20px; text-align: center; color: var(--ink-mute);
}
.empty svg { width: 44px; height: 44px; opacity: .28; margin: 0 auto 12px; }
.empty__title { font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }

.skeleton { background: linear-gradient(90deg, #eee 25%, #f6f6f3 37%, #eee 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.progress { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }
.progress--good > i { background: var(--good-fg); }
.progress--warn > i { background: var(--warn-fg); }
.progress--bad > i { background: var(--bad-fg); }

.stepper { display: flex; align-items: center; gap: 0; }
.stepper__item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-mute); }
.stepper__dot {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 11.5px; font-family: var(--mono); background: #fff;
}
.stepper__item.is-done .stepper__dot { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.stepper__item.is-done { color: var(--ink); }
.stepper__item.is-active .stepper__dot { border-color: var(--brand-ink); color: var(--brand-ink); font-weight: 700; }
.stepper__item.is-active { color: var(--brand-ink); font-weight: 600; }
.stepper__line { width: 34px; height: 1px; background: var(--line); margin: 0 8px; }

.spark { display: block; width: 100%; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* table-ish detail rows */
.dl-rows { font-size: 13px; }
.dl-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-faint); }
.dl-row:last-child { border-bottom: 0; }
.dl-row__k { color: var(--ink-mute); flex: 0 0 140px; }
.dl-row__v { flex: 1; min-width: 0; text-align: right; font-weight: 500; }
.dl-row--total { border-top: 1.5px solid var(--line); border-bottom: 0; margin-top: 4px; padding-top: 10px; font-weight: 700; font-size: 14.5px; }

/* auth */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, #eef2f8 0%, #f2f2ee 46%, #eae7f0 100%);
}
.auth__card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 28px; }
.auth__brand { display: flex; align-items: center; gap: 9px; justify-content: center; margin-bottom: 18px; }
.auth__brand .brandmark { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.auth__brand b { font-size: 18px; color: var(--brand-ink); letter-spacing: .01em; }
.auth h1 { font-size: 19px; text-align: center; margin-bottom: 4px; }
.auth__sub { text-align: center; color: var(--ink-mute); font-size: 13px; margin-bottom: 20px; }
.auth__foot { text-align: center; font-size: 13px; color: var(--ink-mute); margin-top: 16px; }
.auth__legal { text-align: center; font-size: 12px; color: var(--ink-mute); margin-top: 22px; }

/* mobile */
.mobiletop { display: none; }
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s; width: 232px; flex-basis: 232px; }
  .sidebar.is-open { transform: none; }
  .main { margin-left: 0; }
  .mobiletop { display: grid; }
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .content { padding: 14px 12px 32px; }
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: minmax(0, 1fr); }
  .pagehead h1 { font-size: 18px; }
  .kv { grid-template-columns: 108px minmax(0, 1fr); }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

/* print */
@media print {
  .sidebar, .topbar, .filters, .pager, .bulkbar { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; }
}
