/* ==========================================================================
   批管家 · 批发经营管理端
   设计基调：浅色、克制、信息密度优先（批发场景一天要看成百上千行）
   ========================================================================== */

:root {
  --brand: #e8552d;
  --brand-dark: #cf4520;
  --brand-soft: #fff1ec;
  --brand-soft-2: #ffe3d9;
  --ink: #1c2026;
  --ink-2: #4a5361;
  --ink-3: #7d8794;
  --ink-4: #a7b0bc;
  --line: #e9ecf1;
  --line-2: #f1f3f7;
  --bg: #f5f6f9;
  --card: #ffffff;
  --green: #14915b;
  --green-soft: #e8f7f0;
  --red: #d93a3a;
  --red-soft: #fdeeee;
  --amber: #c47a10;
  --amber-soft: #fdf3e2;
  --blue: #2f6bdd;
  --blue-soft: #eaf0fd;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 38, .04);
  --shadow: 0 6px 24px rgba(20, 26, 38, .07);
  --shadow-lg: 0 24px 64px rgba(20, 26, 38, .16);
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::selection { background: var(--brand-soft-2); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6dbe3; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c9d4; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.spacer { flex: 1; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ============================ 登录页 ============================ */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: #fff;
}
.login-left {
  position: relative;
  overflow: hidden;
  padding: 56px 64px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(232, 85, 45, .38), transparent 62%),
    radial-gradient(700px 480px at 92% 92%, rgba(240, 160, 90, .22), transparent 60%),
    linear-gradient(155deg, #1d222b 0%, #232a35 48%, #191e26 100%);
  display: flex;
  flex-direction: column;
}
.login-left::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 25%, #000 10%, transparent 75%);
  pointer-events: none;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(145deg, #ff7a4d, #d8421c);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 19px;
  box-shadow: 0 8px 20px rgba(216, 66, 28, .35);
  flex: none;
}
.login-head { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-brand { font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.login-brand span { display: block; font-size: 11px; font-weight: 400; opacity: .55; letter-spacing: 2.4px; margin-top: 2px; }
.login-hero { margin-top: auto; position: relative; z-index: 1; }
.login-hero h1 {
  font-size: 40px; line-height: 1.28; letter-spacing: -.5px; font-weight: 600;
}
.login-hero h1 em { font-style: normal; color: #ff8d63; }
.login-hero p { margin-top: 16px; font-size: 15px; line-height: 1.8; color: rgba(255,255,255,.6); max-width: 440px; }
.login-features { margin-top: 40px; display: grid; gap: 14px; max-width: 440px; }
.login-feature { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: rgba(255,255,255,.78); }
.login-feature .dot {
  width: 22px; height: 22px; border-radius: 7px; flex: none; margin-top: 1px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  display: inline-flex; align-items: center; justify-content: center; color: #ff9d78;
}
.login-foot { margin-top: auto; padding-top: 40px; font-size: 12px; color: rgba(255,255,255,.28); position: relative; z-index: 1; }

.login-right { display: flex; align-items: center; justify-content: center; padding: 48px 40px; }
.login-box { width: 100%; max-width: 360px; }
.login-box h2 { font-size: 26px; font-weight: 600; letter-spacing: -.3px; }
.login-box .sub { margin-top: 8px; color: var(--ink-3); font-size: 13.5px; }
.login-form { margin-top: 34px; display: grid; gap: 16px; }
.login-row select { width: 100%; }
.login-tip {
  margin-top: 22px; padding: 12px 14px; border-radius: 10px;
  background: #f8f9fb; border: 1px dashed var(--line);
  font-size: 12.5px; color: var(--ink-3); line-height: 1.7;
}
.login-tip b { color: var(--ink-2); font-weight: 600; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; }

/* ============================ 表单控件 ============================ */
.field { display: grid; gap: 7px; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--ink-4); }
.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; line-height: 1.6; }
.input:hover, .select:hover, .textarea:hover { border-color: #d7dce4; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232, 85, 45, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:disabled, .select:disabled { background: #f7f8fa; color: var(--ink-3); cursor: not-allowed; }
.input-lg { height: 44px; font-size: 15px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237d8794' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 36px; }
.input-group .prefix { position: absolute; left: 12px; color: var(--ink-4); display: inline-flex; }
.input-affix { position: absolute; right: 10px; font-size: 12px; color: var(--ink-4); }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .15s ease;
}
.btn:hover { border-color: #d5dae2; color: var(--ink); background: #fcfcfd; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px rgba(232, 85, 45, .22);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #333b47; border-color: #333b47; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #f3f5f8; border-color: transparent; }
.btn-danger { color: var(--red); border-color: #f3dada; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #f0c9c9; color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

.link { color: var(--brand); cursor: pointer; font-weight: 500; }
.link:hover { text-decoration: underline; }
.link-muted { color: var(--ink-3); cursor: pointer; }
.link-muted:hover { color: var(--ink); }

/* ============================ 骨架 ============================ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  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: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--line-2); flex: none;
}
.sidebar-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
.sidebar-brand .name { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.sidebar-brand .env {
  font-size: 10px; color: var(--brand); background: var(--brand-soft);
  padding: 1px 5px; border-radius: 4px; margin-left: 2px; font-weight: 600;
}
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 2px; }
.nav-title { font-size: 10.5px; color: var(--ink-4); letter-spacing: 1.4px; padding: 8px 12px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px; margin-bottom: 2px;
  border-radius: 9px; color: var(--ink-2); font-size: 13.5px; cursor: pointer;
  position: relative; transition: background .14s, color .14s;
}
.nav-item svg { width: 17px; height: 17px; color: var(--ink-3); transition: color .14s; flex: none; }
.nav-item:hover { background: #f6f7fa; color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }
.nav-item .badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600;
  background: var(--red); color: #fff; border-radius: 20px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.sidebar-foot { border-top: 1px solid var(--line-2); padding: 12px; flex: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.user-chip:hover { background: #f6f7fa; }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(140deg, #ffe4d8, #ffd0bd); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-chip .meta { min-width: 0; }
.user-chip .meta b { display: block; font-size: 13px; font-weight: 600; }
.user-chip .meta span { display: block; font-size: 11px; color: var(--ink-4); margin-top: 1px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: none; background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 16px; font-weight: 600; letter-spacing: -.1px; }
.topbar .page-sub { font-size: 12px; color: var(--ink-4); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 20px 24px 40px; flex: 1; }
.content.narrow { max-width: 1240px; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px; min-height: 54px;
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--ink-4); }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.page-head .desc { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi .kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; }
.kpi .chip {
  width: 26px; height: 26px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand);
}
.kpi .chip svg { width: 14px; height: 14px; }
.kpi .value { margin-top: 12px; font-size: 26px; font-weight: 650; letter-spacing: -.7px; line-height: 1.1; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-right: 2px; }
.kpi .foot { margin-top: 8px; font-size: 12px; color: var(--ink-4); display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--red); font-weight: 600; }   /* 中式：涨用红 */
.trend-down { color: var(--green); font-weight: 600; }
.trend-flat { color: var(--ink-4); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }

/* ============================ 表格 ============================ */
.table-wrap { width: 100%; overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fafbfc; color: var(--ink-3);
  font-size: 12px; font-weight: 500; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl thead th:first-child { padding-left: 18px; }
.tbl thead th:last-child { padding-right: 18px; }
.tbl tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody td:first-child { padding-left: 18px; }
.tbl tbody td:last-child { padding-right: 18px; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover, .tbl tbody tr:hover { background: #fafbfd; }
.tbl .t-main { font-weight: 550; color: var(--ink); }
.tbl .t-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.tbl .t-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .55; transition: opacity .15s; }
.tbl tr:hover .t-actions { opacity: 1; }
.tbl-empty { padding: 54px 20px; text-align: center; color: var(--ink-4); }
.tbl-empty .ico { font-size: 26px; opacity: .5; margin-bottom: 8px; }
.tbl-compact tbody td { padding: 8px 12px; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: #f2f4f7; color: var(--ink-2);
}
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-brand { background: var(--brand-soft); color: var(--brand-dark); }
.tag-line { background: #fff; border: 1px solid var(--line); color: var(--ink-3); }

/* 工具条 */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.toolbar .search { width: 240px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: #f4f6f9; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-3); font-size: 12.5px;
  height: 28px; padding: 0 12px; border-radius: 7px; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.pager .info { font-size: 12.5px; color: var(--ink-4); }
.pager .btns { margin-left: auto; display: flex; gap: 4px; }
.pager button {
  min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 12.5px; cursor: pointer; padding: 0 8px;
}
.pager button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ============================ 弹层 ============================ */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 25, 34, .38);
  backdrop-filter: blur(1.5px);
  z-index: 120; display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal.modal-lg { max-width: 760px; }
.modal.modal-xl { max-width: 980px; }
.modal-head { padding: 18px 22px 12px; display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .sub { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.modal-body { padding: 6px 22px 20px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; align-items: center; }
.modal-foot .spacer { flex: 1; }
.close-x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: transparent; color: var(--ink-3); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
}
.close-x:hover { background: #f4f5f8; color: var(--ink); }

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(20,25,34,.34); z-index: 100; animation: fade .16s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 94vw);
  background: #fff; z-index: 101; display: flex; flex-direction: column;
  box-shadow: -18px 0 48px rgba(20, 26, 38, .14);
  animation: slidein .22s cubic-bezier(.2,.9,.3,1);
}
.drawer.drawer-sm { width: min(460px, 94vw); }
.drawer.drawer-lg { width: min(900px, 96vw); }
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; flex: none; }
.drawer-head h3 { font-size: 16px; font-weight: 600; }
.drawer-body { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; flex: none; }
.drawer-foot .spacer { flex: 1; }

/* Toast */
.toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px; min-width: 200px; max-width: 460px;
  background: #232a34; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); animation: toastin .2s ease;
}
.toast.ok { background: #16794c; }
.toast.err { background: #b62d2d; }
.toast svg { width: 15px; height: 15px; flex: none; }
@keyframes toastin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============================ 图表 ============================ */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: #eef1f5; stroke-width: 1; }
.chart .axis-label { fill: #a7b0bc; font-size: 10.5px; }
.chart .area { fill: url(#areaGrad); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.chart .bar { fill: #ffd9cb; transition: fill .15s; }
.chart .bar:hover { fill: #ffc0a9; }
.chart .bar-active { fill: var(--brand); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-tip {
  position: absolute; background: #232a34; color: #fff; font-size: 11.5px;
  padding: 6px 9px; border-radius: 7px; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -120%); z-index: 5; box-shadow: var(--shadow);
}

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; gap: 6px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 12.5px; gap: 10px; }
.bar-row .top b { font-weight: 550; }
.bar-track { height: 6px; background: #f3f5f8; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffb59b, var(--brand)); }
.bar-fill.slate { background: linear-gradient(90deg, #c9d2e0, #8b9aae); }

.rank-list { display: grid; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line-2); }
.rank-item:last-child { border-bottom: 0; }
.rank-no {
  width: 20px; height: 20px; border-radius: 6px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: #f3f5f8; color: var(--ink-3);
}
.rank-no.top { background: var(--brand-soft); color: var(--brand-dark); }
.rank-main { min-width: 0; flex: 1; }
.rank-main b { display: block; font-size: 13px; font-weight: 550; }
.rank-main span { display: block; font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.rank-val { text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================ 开单页 ============================ */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 14px; align-items: start; }
.cart-table table { font-size: 13px; }
.cart-table .input { height: 30px; padding: 0 8px; font-size: 13px; text-align: right; }
.cart-table .input.qty { width: 76px; }
.cart-table .input.price { width: 88px; }
.cart-table td { padding: 8px 10px !important; }
.cart-empty { padding: 64px 20px; text-align: center; color: var(--ink-4); }
.cart-empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; font-weight: 550; }
.summary { position: sticky; top: calc(var(--topbar-h) + 20px); }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 13px; color: var(--ink-2); }
.summary-row .v { font-variant-numeric: tabular-nums; font-weight: 550; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 6px; border-top: 1px dashed var(--line); margin-top: 6px; }
.summary-total .label { font-size: 13px; color: var(--ink-3); }
.summary-total .amount { font-size: 28px; font-weight: 650; color: var(--brand-dark); letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.pick-list { max-height: 340px; overflow: auto; }
.pick-item { display: flex; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; align-items: center; }
.pick-item:hover { background: #f7f8fa; }
.pick-thumb {
  width: 34px; height: 34px; border-radius: 8px; flex: none; background: #f4f5f8;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-4); font-size: 12px; font-weight: 600;
}
.product-cell .name { font-weight: 550; }
.product-cell .meta { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.customer-pick {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: #fff;
}
.customer-pick:hover { border-color: #d7dce4; }
.customer-pick .ph { color: var(--ink-4); }

/* ============================ 详情 ============================ */
.detail-section { margin-bottom: 22px; }
.detail-section h4 { font-size: 12px; color: var(--ink-4); letter-spacing: .6px; margin-bottom: 10px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--ink-4); }
.kv dd { margin: 0; color: var(--ink); }
.hero-amount { text-align: right; }
.hero-amount .label { font-size: 12px; color: var(--ink-4); }
.hero-amount .value { font-size: 24px; font-weight: 650; letter-spacing: -.4px; }

/* 单据状态条 */
.flow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-4); }
.flow .step { display: flex; align-items: center; gap: 6px; }
.flow .dot { width: 6px; height: 6px; border-radius: 99px; background: #dfe3ea; }
.flow .step.on { color: var(--ink); }
.flow .step.on .dot { background: var(--brand); }
.flow .bar { width: 18px; height: 1px; background: #e6e9ef; }

/* 打印小票 */
.receipt {
  width: 302px; margin: 0 auto; background: #fff; padding: 18px 16px;
  font-family: var(--mono); font-size: 12px; color: #222; line-height: 1.65;
  border: 1px dashed #dfe3ea;
}
.receipt h4 { text-align: center; font-size: 14px; margin-bottom: 2px; }
.receipt .center { text-align: center; }
.receipt .sep { border-top: 1px dashed #bbb; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; font-size: 11px; }
.receipt th, .receipt td { text-align: left; padding: 2px 0; font-weight: 400; }
.receipt .r { text-align: right; }

/* 空状态 */
.empty-state { padding: 56px 20px; text-align: center; }
.empty-state .ring {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  background: #f6f7fa; color: var(--ink-4);
  display: flex; align-items: center; justify-content: center;
}
.empty-state h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty-state p { font-size: 12.5px; color: var(--ink-4); }

/* 骨架屏 */
.skeleton { background: linear-gradient(90deg, #f3f5f8 25%, #eceff3 37%, #f3f5f8 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 移动端 */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .order-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .content { padding: 14px 14px 32px; }
  .topbar { padding: 0 14px; }
  .grid-3, .grid-2-even { grid-template-columns: 1fr; }
  .toolbar .search { width: 100%; }
  .menu-btn { display: inline-flex !important; }
}
@media (min-width: 901px) { .menu-btn { display: none !important; } }
@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi .value { font-size: 23px; }
  .topbar .page-sub { display: none; }
}

/* 打印：只输出小票 */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: fixed; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}

/* ==========================================================================
   快速开单 · 分类选货面板
   ========================================================================== */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 4px;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 550;
}
.browse-sep { height: 1px; background: var(--line); margin: 10px 14px 0; }
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
  max-height: 430px;
  overflow: auto;
}
.prod-grid-tip {
  grid-column: 1 / -1;
  padding: 26px 0;
  text-align: center;
  color: var(--ink-4);
  font-size: 13px;
}
.prod-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.prod-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 16px rgba(232, 85, 45, .13);
  transform: translateY(-1px);
}
.prod-card:active { transform: translateY(0); box-shadow: none; }
.prod-card .name { font-weight: 560; font-size: 13px; }
.prod-card .meta { font-size: 11.5px; color: var(--ink-4); }
.prod-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.prod-card-bottom {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}
.prod-card-bottom .spacer { flex: 1; }
.prod-card.out { opacity: .72; }
.prod-src {
  font-size: 10px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* 列表中的金额：点击查看往来明细 */
.amt-link {
  cursor: pointer;
  border-bottom: 1px dashed rgba(232, 85, 45, .4);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.amt-link:hover { border-bottom-color: var(--brand); }

/* ==========================================================================
   商城：会员 / 订货单 / 转单弹窗（T06）
   仅复用上面的设计变量，不引入新配色
   ========================================================================== */

/* 统计条 */
.shop-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shop-stats.four { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.shop-stat { background: #fafbfc; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.shop-stat .k { font-size: 12px; color: var(--ink-3); }
.shop-stat .v { margin-top: 3px; font-size: 18px; font-weight: 650; letter-spacing: -.3px; }
.shop-stat .n { margin-top: 2px; font-size: 11.5px; color: var(--ink-4); }

/* 状态 Tab 上计数小徽标 */
.seg.shop-seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg-count {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
}
.seg.shop-seg button.on .seg-count { background: var(--brand-soft-2); }
.seg-count.hidden { display: none; }
.toolbar.shop-tabs { padding-bottom: 0; border-bottom: none; }

/* 列表里的细节 */
.shop-never-login { color: var(--ink-4); }
.tbl tbody tr.shop-order-row td:first-child .t-main { letter-spacing: -.2px; }

/* 详情抽屉头部 */
.shop-detail-head {
  display: flex; gap: 14px; align-items: flex-start; padding: 2px 0 16px;
  border-bottom: 1px solid var(--line-2); margin-bottom: 14px;
}
.shop-big-amount { font-size: 26px; font-weight: 650; color: var(--brand-dark); letter-spacing: -.6px; margin-top: 2px; }

/* 转单弹窗 */
.shop-convert-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 12px;
}
.shop-money {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fcfdfe; margin-bottom: 12px;
}
.shop-money-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-bottom: 1px solid var(--line-2);
}
.shop-money-row:last-child { border-bottom: none; }
.shop-money-row .k { width: 84px; color: var(--ink-3); font-size: 12.5px; }
.shop-money-row .v { font-size: 15px; font-weight: 650; }
.shop-money-row .h { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }

.shop-warn-box:empty { display: none; }
.shop-warn {
  border: 1px solid var(--amber-soft); background: var(--amber-soft);
  border-radius: 10px; padding: 9px 12px; margin-bottom: 12px;
}
.shop-warn-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--amber); margin-bottom: 6px;
}
.shop-warn-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-2); padding: 3px 0; line-height: 1.55;
}

.shop-convert-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 4px;
}
.shop-form-tip { min-height: 18px; font-size: 12.5px; color: var(--red); margin: 8px 0 4px; }

/* 缺货行浅红底 + 缺货数字 */
.tbl tbody tr.shop-row-short td { background: var(--red-soft); }
.shop-short-num { color: var(--red); font-weight: 600; }
.shop-old-price { color: var(--amber); text-decoration: line-through; }

.shop-tip {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 9px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 12px;
}
.btn.is-disabled { opacity: .5; }

@media (max-width: 900px) {
  .shop-stats, .shop-stats.four { grid-template-columns: repeat(2, 1fr); }
  .shop-convert-grid { grid-template-columns: 1fr; }
}
