/* =========================================================
   电器折扣店进销存 · 视觉系统 v2
   中性基底(锌灰) + 单一强调色(电光蓝) + 浅色侧栏
   ========================================================= */
:root {
  --brand: #2563eb;
  --brand-700: #1d4ed8;
  --brand-50: #eef4ff;
  --brand-line: #d7e4ff;
  --emerald: #047857;
  --emerald-bg: #e7f6f0;
  --amber: #b45309;
  --amber-bg: #fff4e6;
  --rose: #be123c;
  --rose-bg: #fdecef;
  --ink: #18181b;
  --text: #3f3f46;
  --muted: #8a8a93;
  --line: #e9eaee;
  --line-strong: #dcdde3;
  --bg: #f6f7f9;
  --card: #ffffff;
  --sidebar-w: 248px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow-2: 0 10px 30px -14px rgba(24, 24, 27, .18);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* 兼容旧变量名 */
  --primary: var(--brand);
  --primary-dark: var(--brand-700);
  --primary-bg: var(--brand-50);
  --primary-light: #3b82f6;
  --cyan: #0284c7; --green: var(--emerald); --green-bg: var(--emerald-bg);
  --orange: var(--amber); --red: var(--rose); --red-bg: var(--rose-bg);
  --yellow: var(--amber); --yellow-bg: var(--amber-bg);
  --border: var(--line); --text-light: var(--text);
  --shadow: var(--shadow-1); --shadow-md: var(--shadow-2); --shadow-lg: var(--shadow-2);
  --sidebar-bg: #fff; --sidebar-hover: #f2f4f8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.num, td, .stat-info .num, .pagination { font-variant-numeric: tabular-nums; }

/* ===== Icons ===== */
.icon { width: 20px; height: 20px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ===== Buttons ===== */
.btn { cursor: pointer; border: none; border-radius: var(--radius-sm); padding: 9px 16px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; transition: transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
  background: var(--brand); color: #fff; font-family: inherit; }
.btn:hover { background: var(--brand-700); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: scale(.98); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--brand-50); border-color: var(--brand-line); color: var(--brand-700); }
.btn-danger { background: var(--rose); }
.btn-danger:hover { background: #9f1239; }
.btn-warning { background: var(--amber); }
.btn-warning:hover { background: #92400e; }
.btn-success { background: var(--emerald); }
.btn-success:hover { background: #065f46; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 6px; border-radius: 9px; }
td .actions .btn-icon, .modal-close, .menu-toggle, .card-hide { background: transparent; border: none; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-danger:disabled { background: #fff; color: #9ca3af; border: 1px solid var(--line-strong); }
.topbar label { margin-bottom: 0; }

/* ===== Inputs ===== */
input, select, textarea { width: 100%; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 14px; transition: border .18s var(--ease), box-shadow .18s var(--ease); background: #fff; color: var(--ink); font-family: inherit; }
/* 下拉框：右侧预留原生箭头空间，避免选中文字被箭头遮挡 */
select { padding-right: 28px; }
input[type="date"], input[type="number"] { border-radius: var(--radius-sm); }
.toolbar input, .toolbar select, .filter-bar input, .filter-bar select { height: 36px; padding-top: 0; padding-bottom: 0; }
.toolbar .btn, .filter-bar .btn, .toolbar .quick-dates button, .filter-bar .quick-dates button { height: 36px; display: inline-flex; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; }
.toolbar .btn-icon, .filter-bar .btn-icon { height: 36px; width: 36px; }
.toolbar label > input, .toolbar label > select, .filter-bar label > input, .filter-bar label > select { margin-top: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
label { display: block; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }

/* ===== Login ===== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: radial-gradient(1200px 600px at 15% -10%, #dbe7ff 0%, transparent 60%), radial-gradient(1000px 500px at 100% 110%, #e6fff7 0%, transparent 55%), #f4f6fa; }
.login-card { background: var(--card); padding: 38px 34px; border-radius: 20px; box-shadow: var(--shadow-2); width: 380px; max-width: 92vw; border: 1px solid var(--line); }
.login-logo { width: 54px; height: 54px; margin: 0 auto 16px; background: linear-gradient(140deg, var(--brand), #0ea5e9); border-radius: 16px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-2); }
.login-logo svg { width: 28px; height: 28px; color: #fff; }
.login-card h1 { font-size: 21px; margin-bottom: 6px; text-align: center; color: var(--ink); letter-spacing: -.2px; }
.login-card .subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-card h2 { font-size: 16px; margin-bottom: 16px; color: var(--amber); }

/* ===== App Layout ===== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--text); position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; display: flex; flex-direction: column; z-index: 50; border-right: 1px solid var(--line); }
.sidebar-header { padding: 20px 18px 16px; display: flex; align-items: center; gap: 11px; }
.sidebar-header .logo-icon { width: 38px; height: 38px; background: linear-gradient(140deg, var(--brand), #0ea5e9); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-header .logo-icon svg { width: 20px; height: 20px; color: #fff; }
.sidebar-header .logo-text { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.35; letter-spacing: -.2px; }
.sidebar-header .logo-text small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .3px; }
.nav-group { padding: 6px 12px 12px; flex: 1; }
.nav-group .nav-label { font-size: 12.5px; color: var(--text); letter-spacing: .4px; padding: 15px 10px 7px; font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent; color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; border: none;
  transition: background .18s var(--ease), color .18s var(--ease); margin-bottom: 2px; font-family: inherit; position: relative; }
.nav-item svg { width: 18px; height: 18px; opacity: .78; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--ink); }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--brand); }
.sidebar-footer { padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.sidebar-user { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 13px; margin-bottom: 10px; font-weight: 500; }
.sidebar-user .avatar { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, var(--brand), #0ea5e9); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.nav-item.logout { color: var(--rose); }
.nav-item.logout svg { opacity: .9; }
.nav-item.logout:hover { background: var(--rose-bg); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar { background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(10px); padding: 0 26px; height: 62px;
  display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.3px; }
.topbar .topbar-actions { display: flex; gap: 10px; align-items: center; }
.topbar .topbar-actions label { margin: 0; font-weight: 500; }
.topbar select { width: 78px; height: 30px; padding: 0 24px 0 8px; font-size: 13px; }
.content { padding: 26px; max-width: 1560px; margin: 0 auto; }

/* ===== Pages ===== */
.page { display: none; }
.page.active { display: block; animation: pageIn .28s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Cards / Stats ===== */
.card { background: var(--card); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.stat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 18px; box-shadow: var(--shadow-1);
  display: flex; align-items: center; gap: 12px; transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease); position: relative; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--brand-line); }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card .stat-info { min-width: 0; }
.stat-card .stat-info .num { font-size: 22px; font-weight: 750; line-height: 1.15; color: var(--ink); letter-spacing: -.4px; }
.stat-card .stat-info .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-top: 3px; }
/* 色调（浅底 + 深图标） */
.tone-primary { background: var(--brand-50); color: var(--brand-700); }
.tone-emerald { background: var(--emerald-bg); color: var(--emerald); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-rose { background: var(--rose-bg); color: var(--rose); }
.tone-slate { background: #f1f2f6; color: #52525b; }
.bg-primary { background: var(--brand-50); color: var(--brand-700); }
.bg-cyan { background: var(--brand-50); color: var(--brand-700); }
.bg-green { background: var(--emerald-bg); color: var(--emerald); }
.bg-orange, .bg-yellow { background: var(--amber-bg); color: var(--amber); }
.bg-red { background: var(--rose-bg); color: var(--rose); }
.stat-icon svg, .bg-primary svg, .bg-green svg, .bg-red svg, .bg-yellow svg, .bg-orange svg, .bg-cyan svg { color: currentColor; }
.text-danger { color: var(--rose); } .text-success { color: var(--emerald); } .text-warning { color: var(--amber); }

/* ===== Tables ===== */
.table-wrap { overflow: auto; max-height: calc(100vh - 300px); background: var(--card); border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--line); }
th { background: linear-gradient(#eef4ff, #e9f0ff); color: #4b5563; font-weight: 600; font-size: 12.5px; letter-spacing: 0; position: sticky; top: 0; z-index: 1; }
tbody tr { transition: background .14s var(--ease); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7faff; }
tr.danger td { color: var(--rose); }
td .actions { display: flex; gap: 4px; }
td .actions .btn-icon { padding: 5px; border-radius: 8px; display: inline-flex; align-items: center; color: var(--muted); transition: all .15s var(--ease); }
td .actions .btn-icon:hover { background: var(--brand-50); color: var(--brand-700); }
td .actions .btn-icon.del:hover { background: var(--rose-bg); color: var(--rose); }

/* ===== Checkbox / index ===== */
.check-all, .row-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); vertical-align: middle; }
th .check-all { margin: 0; } td .row-check { display: block; margin: 0 auto; }
th.col-idx, td.col-idx { width: 56px; text-align: center; color: var(--muted); }

/* ===== Badges ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: var(--emerald-bg); color: var(--emerald); }
.badge-danger { background: var(--rose-bg); color: var(--rose); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-info { background: var(--brand-50); color: var(--brand-700); }

/* ===== Forms / toolbar ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 140px; }
.toolbar { display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar label { margin: 0; display: flex; flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.filter-bar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow-1); margin-bottom: 16px; display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar label { margin: 0; display: flex; flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; }
.filter-bar .filter-actions { display: flex; gap: 8px; margin-left: auto; }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-dates button { padding: 6px 12px; font-size: 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted); cursor: pointer; transition: all .18s var(--ease); font-family: inherit; }
.quick-dates button:hover { border-color: var(--brand-line); color: var(--brand-700); background: var(--brand-50); }
.quick-dates button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== Loading ===== */
.loading { position: relative; min-height: 90px; }
.loading::after { content: ''; position: absolute; top: 46px; left: 50%; width: 30px; height: 30px; margin-left: -15px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; flex-wrap: wrap; }
.pagination button { padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; cursor: pointer; font-size: 13px; transition: all .18s var(--ease); font-family: inherit; }
.pagination button:hover:not(:disabled) { border-color: var(--brand-line); color: var(--brand-700); background: var(--brand-50); }
.pagination button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px; letter-spacing: -.2px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(24,24,27,.42); display: flex; align-items: center; justify-content: center; z-index: 300; backdrop-filter: blur(3px); }
.modal { background: #fff; border-radius: 18px; box-shadow: 0 24px 60px -20px rgba(24,24,27,.4); width: 520px; max-width: 92vw; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { color: var(--muted); padding: 5px; border-radius: 8px; transition: all .15s; }
.modal-close:hover { background: var(--bg); color: var(--ink); }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #fff; border-radius: 12px; box-shadow: var(--shadow-2); padding: 13px 18px; display: flex; align-items: center; gap: 10px; min-width: 270px; border: 1px solid var(--line); border-left: 4px solid var(--brand); animation: slideIn .32s var(--ease); }
.toast.success { border-left-color: var(--emerald); }
.toast.error { border-left-color: var(--rose); }
.toast.warning { border-left-color: var(--amber); }
.toast .toast-msg { font-size: 14px; flex: 1; color: var(--ink); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(120%); opacity: 0; } }
.toast.removing { animation: slideOut .3s var(--ease) forwards; }

/* ===== Search / empty / tabs ===== */
.search-box { position: relative; }
.search-box input { padding-left: 38px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.empty-state { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty-state > svg { width: 34px; height: 34px; margin-bottom: 12px; opacity: .5; color: #94a3b8; }
.empty-state > div { font-size: 13.5px; line-height: 1.6; }
.empty-state .btn { margin-top: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { background: none; border: none; padding: 10px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .18s var(--ease); font-weight: 600; font-family: inherit; }
.tab:hover { color: var(--brand-700); }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* ===== Misc ===== */
.muted { color: var(--muted); font-size: 13px; }
.msg { margin-top: 10px; font-size: 13px; min-height: 18px; }
.msg.err { color: var(--rose); } .msg.ok { color: var(--emerald); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.file-drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 24px; text-align: center; cursor: pointer; transition: all .18s var(--ease); background: #fff; }
.file-drop:hover { border-color: var(--brand-line); background: var(--brand-50); }
.file-drop.has-file { border-color: var(--emerald); background: var(--emerald-bg); }

/* ===== Responsive ===== */
@media (max-width: 767px) {
  :root { --sidebar-w: 264px; }
  .sidebar { transform: translateX(-100%); transition: transform .28s var(--ease); width: 264px; box-shadow: none; }
  .sidebar.open { transform: none; box-shadow: 0 0 50px rgba(24,24,27,.28); }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; height: 58px; }
  .topbar .menu-toggle { display: inline-flex; }
  .topbar h2 { font-size: 16px; }
  .content { padding: 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 13px; gap: 10px; }
  .stat-card .stat-icon { width: 38px; height: 38px; border-radius: 11px; } .stat-card .stat-icon svg { width: 19px; height: 19px; }
  .stat-card .stat-info .num { font-size: 18px; } .stat-card .stat-info .lbl { font-size: 11.5px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { width: 100vw; max-width: 100vw; border-radius: 0; height: 100dvh; max-height: 100dvh; }
  .modal-overlay { align-items: stretch; justify-content: stretch; padding: 0; }
  .modal-body { padding: 16px; } .modal-header { padding: 14px 16px; } .modal-footer { padding: 12px 16px; }
  th, td { padding: 9px 11px; font-size: 12.5px; } th { font-size: 11px; }
  .section-title { font-size: 14px; margin: 16px 0 10px; }
  .toolbar { gap: 8px; } .toolbar label { font-size: 12px; }
  .card { padding: 14px; }
  .btn { padding: 9px 14px; font-size: 13px; } .btn-sm { padding: 6px 9px; font-size: 11.5px; }
  .nav-item { font-size: 14.5px; padding: 11px 12px; }
  .toast-container { top: 10px; right: 10px; left: 10px; } .toast { min-width: auto; }
  .search-box input { width: 100% !important; }
  #rpt-pies { grid-template-columns: 1fr !important; }
  #rpt-chart { height: 260px !important; }
  #cmp-chart { height: 260px !important; }
  #quad-chart { height: 280px !important; }
  #rpt-pie-cat, #rpt-pie-brand { height: 240px !important; }
}
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr; } }
.menu-toggle { display: none; padding: 6px; border-radius: 9px; color: var(--text); }
.menu-toggle:hover { background: var(--bg); }
.sidebar-backdrop { display: none; }
@media (max-width: 767px) { .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(24,24,27,.35); z-index: 40; } }

/* ===== Mobile card view (窄屏表格转卡片) ===== */
@media (max-width: 640px) {
  .table-wrap { max-height: none; overflow: visible; background: transparent; border: none; box-shadow: none; }
  .table-wrap table thead { display: none; }
  .table-wrap table tbody tr { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; box-shadow: var(--shadow-1); }
  .table-wrap table tbody tr:hover { background: var(--card); }
  .table-wrap table tbody td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: none; padding: 6px 0; text-align: right; }
  .table-wrap table tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 auto; }
  .table-wrap table tbody td[data-label=""]::before { content: ''; }
  .table-wrap table tbody td.col-idx { display: none; }
  .table-wrap table tbody td[colspan] { display: block; text-align: center; }
  .table-wrap table tbody td .actions { justify-content: flex-end; }
}

/* ===== 经营助手浮窗 ===== */
#assistant-btn { position: fixed; right: 22px; bottom: 22px; z-index: 1200; width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(140deg, var(--brand), #0ea5e9); color: #fff; cursor: pointer; box-shadow: 0 12px 28px -8px rgba(37,99,235,.6);
  display: flex; align-items: center; justify-content: center; transition: transform .22s var(--ease); }
#assistant-btn:hover { transform: translateY(-2px) scale(1.03); }
#assistant-btn svg { width: 24px; height: 24px; }
#assistant-panel { position: fixed; right: 22px; bottom: 88px; z-index: 1200; width: 440px; max-width: 94vw; height: min(78vh, 620px);
  display: flex; flex-direction: column; background: #fff; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 24px 60px -20px rgba(24,24,27,.4); padding: 14px; }
#assistant-panel[hidden] { display: none; }
.assistant-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.assistant-head strong { font-size: 15px; font-weight: 700; color: var(--ink); }
#assistant-msgs { flex: 1; overflow-y: auto; padding: 4px 2px; }
.assistant-msg { font-size: 14.5px; line-height: 1.75; margin-bottom: 14px; }
.assistant-msg.user { display: flex; justify-content: flex-end; }
.assistant-msg.user > div { background: var(--brand-50); color: #1e293b; padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 82%; white-space: pre-wrap; word-break: break-word; }
.assistant-msg.bot { display: flex; justify-content: flex-start; }
.assistant-msg.bot > div { background: #f6f7f9; color: #27272a; padding: 11px 14px; border-radius: 16px 16px 16px 4px; max-width: 96%; word-break: break-word; }
#assistant-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
#assistant-presets button { border-radius: 999px; }
#assistant-nl { display: flex; gap: 6px; margin-top: 4px; }
#assistant-nl[hidden] { display: none; }
#assistant-nl textarea { flex: 1; height: 44px; resize: none; border: 1px solid var(--line-strong); border-radius: 14px; padding: 10px 14px; font-size: 14px; font-family: inherit; }
#assistant-nl .btn { border-radius: 14px; padding: 0 18px; }
#assistant-msgs table { font-size: 13px; }
#assistant-msgs .table-wrap { max-height: 220px; border-radius: 12px; }
#assistant-msgs .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
#assistant-msgs .stat-card { padding: 9px; border-radius: 12px; }
#assistant-msgs .stat-card .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
#assistant-msgs .stat-info .num { font-size: 16px; }
/* ===== 复核修正（P0/P1） ===== */
/* 图表容器在 grid 内可收缩，避免 ECharts canvas 的 min-content 在窄屏撑破网格 */
#rpt-pies > div, #rpt-chart, #cmp-chart, #quad-chart, #rpt-pie-cat, #rpt-pie-brand { min-width: 0; }
/* 报表 KPI 卡片 3 列对齐，避免 5+1 失衡 */
#rpt-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { #rpt-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { #rpt-overview { grid-template-columns: 1fr; } }
/* 助手内迷你指标：横向紧凑，标签不换行 */
#assistant-msgs .stat-card { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; min-height: auto; }
#assistant-msgs .stat-info { min-width: 0; }
#assistant-msgs .stat-info .num { font-size: 17px; }
#assistant-msgs .stat-info .lbl { font-size: 11.5px; white-space: nowrap; }
/* 助手快捷问句区限高，避免挤压消息区 */
#assistant-presets { max-height: 100px; overflow-y: auto; }
/* 序号列宽 */
th.col-idx, td.col-idx { width: 60px; }

/* ===== 主题色增强（减少过白，增加蓝/绿氛围） ===== */
body { background: linear-gradient(180deg, #e9f0fe 0, #eef2f8 100%) fixed; }
.sidebar { background: linear-gradient(180deg, #f3f7ff 0, #f8faff 220px); }
.sidebar-header { background: linear-gradient(135deg, #e4eeff, #f2f7ff); border-bottom: 1px solid #e2e9f7; }
.topbar { background: linear-gradient(90deg, #ffffff, #f2f7ff); border-bottom: 1px solid #dfe7f5; }
.topbar h2::before { content: ''; display: inline-block; width: 4px; height: 18px; border-radius: 3px; background: linear-gradient(var(--brand), var(--emerald)); margin-right: 10px; vertical-align: -3px; }
th, td { border-bottom-color: #e5ebf6; }
.table-wrap { border-color: #dfe7f5; }
.card, .stat-card, .filter-bar { border-color: #e1e8f6; }
.section-title { color: var(--brand-700); }
.card { background: linear-gradient(180deg, #ffffff, #fcfdff); }
.stat-card { background: linear-gradient(180deg, #ffffff, #f9fbff); }
.section-title::before { content: ''; width: 4px; height: 15px; border-radius: 3px; background: var(--brand); display: inline-block; margin-right: 2px; }
.nav-item.active { background: linear-gradient(90deg, #e4eeff, #eef4ff); }

/* ===== 空状态 / 金额对齐 ===== */
.empty-cell { padding: 0 !important; }
td.num-right, th.num-right { text-align: right; font-variant-numeric: tabular-nums; }


/* 关闭会员功能时隐藏售后工单的「会员」列 */
.hide-members #ticket-table th:nth-child(2), .hide-members #ticket-table td:nth-child(2) { display: none; }
.hide-sellers #sale-table th:nth-child(9), .hide-sellers #sale-table td:nth-child(9) { display: none; }

/* ===== 侧栏分组折叠 / 帮助入口 ===== */
.nav-label { cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.nav-label:hover { color: var(--brand-700); }
.nav-label::after { content: '\25BE'; font-size: 15px; line-height: 1; opacity: .7; transition: transform .2s var(--ease); margin-right: 2px; }
.nav-label.collapsed::after { transform: rotate(-90deg); }
.nav-sub.collapsed { display: none; }
.help-btn { margin-left: auto; color: var(--muted); }
.help-doc { font-size: 13.5px; line-height: 1.8; color: var(--text); }
.help-doc .help-lead { color: var(--muted); margin-bottom: 12px; }
.help-doc h4 { font-size: 14px; color: var(--ink); margin: 16px 0 6px; }
.help-doc ul, .help-doc ol { padding-left: 20px; margin: 0 0 6px; }
.help-doc li { margin: 3px 0; }
.help-doc b { color: var(--ink); }

/* ===== 四象限颜色图例 ===== */
.quad-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: -2px 0 10px; font-size: 12.5px; color: var(--text); }
.quad-legend span { display: inline-flex; align-items: center; gap: 6px; }
.quad-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ===== 报表解读说明 ===== */
.rpt-note { margin: -4px 0 10px; font-size: 12.5px; }

/* ===== 首次使用引导（上手清单） ===== */
.onboard-entry { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.onboard-card { padding: 16px 18px; }
.onboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.onboard-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.onboard-steps { display: flex; flex-direction: column; gap: 8px; }
.onboard-step { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.onboard-step.done { opacity: .62; }
.onboard-mark { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.onboard-step.done .onboard-mark { background: var(--emerald-bg); color: var(--emerald); }
.onboard-text { flex: 1; font-size: 13.5px; color: var(--text); }
.onboard-done { font-size: 12px; color: var(--emerald); font-weight: 600; }
.onboard-step .onboard-go { flex: 0 0 auto; }

/* ===== 入库页：待收货订货单 ===== */
.po-inbox-card { padding: 14px 16px; }
.po-inbox-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.po-inbox-title svg { width: 18px; height: 18px; color: var(--brand-700); }
.po-inbox-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.po-inbox-row span { font-size: 13.5px; color: var(--text); }
.po-inbox-row .muted { flex: 1; }
.po-inbox-row b { color: var(--ink); }

/* ===== 主题切换按钮 ===== */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); color: var(--muted); cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease); font-family: inherit; }
.theme-toggle:hover { color: var(--brand-700); border-color: var(--brand-line); background: var(--brand-50); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ===== 暗色模式（[data-theme="dark"] 令牌覆盖） ===== */
[data-theme="dark"] {
  --brand: #4f8dfd;
  --brand-700: #7aa9ff;
  --brand-50: #16233f;
  --brand-line: #26375c;
  --emerald: #34d399;
  --emerald-bg: #123029;
  --amber: #fbbf24;
  --amber-bg: #33260f;
  --rose: #fb7185;
  --rose-bg: #341a22;
  --ink: #f2f3f5;
  --text: #c4c7cf;
  --muted: #858892;
  --line: #262a33;
  --line-strong: #363b46;
  --bg: #0f1115;
  --card: #171a21;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 12px 34px -16px rgba(0, 0, 0, .7);
  --sidebar-bg: #14171d;
  --sidebar-hover: #1e222b;
  color-scheme: dark;
}
[data-theme="dark"] body { background: linear-gradient(180deg, #10131a 0, #0e1015 100%) fixed; }
[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #161a22 0, #12151b 220px); }
[data-theme="dark"] .sidebar-header { background: linear-gradient(135deg, #1a2233, #141821); border-bottom: 1px solid #232936; }
[data-theme="dark"] .topbar { background: rgba(20, 23, 29, .88); border-bottom: 1px solid #262a33; }
[data-theme="dark"] th, [data-theme="dark"] td { border-bottom-color: #262a33; }
[data-theme="dark"] th { background: linear-gradient(#1c2230, #171d29); color: #a9adb8; }
[data-theme="dark"] tbody tr:hover { background: #1b2029; }
[data-theme="dark"] .table-wrap { border-color: #262a33; }
[data-theme="dark"] .card, [data-theme="dark"] .stat-card, [data-theme="dark"] .filter-bar { border-color: #262a33; }
[data-theme="dark"] .card, [data-theme="dark"] .stat-card { background: linear-gradient(180deg, #191d25, #171a21); }
[data-theme="dark"] .nav-item.active { background: linear-gradient(90deg, #1b2b4a, #182338); }
[data-theme="dark"] .btn-ghost { background: #1b1f27; }
[data-theme="dark"] .btn-ghost:hover { background: var(--brand-50); color: var(--brand-700); }
[data-theme="dark"] .btn-danger:disabled { background: #1b1f27; color: #6b7280; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #12151b; color: var(--ink); }
[data-theme="dark"] .quick-dates button { background: #1b1f27; }
[data-theme="dark"] .pagination button { background: #1b1f27; }
[data-theme="dark"] .modal { background: #171a21; }
[data-theme="dark"] .modal-close:hover { background: #232833; }
[data-theme="dark"] .toast { background: #1b1f27; }
[data-theme="dark"] .file-drop { background: #12151b; }
[data-theme="dark"] #assistant-panel { background: #171a21; }
[data-theme="dark"] .assistant-msg.bot > div { background: #1e222b; color: #e4e4e7; }
[data-theme="dark"] .assistant-msg.user > div { color: #e4e4e7; }
[data-theme="dark"] .menu-toggle:hover, [data-theme="dark"] .theme-toggle:hover { background: #1e222b; }
[data-theme="dark"] .empty-state > svg { color: #64748b; }

