:root {
  --primary: #3370ff;
  --primary-dark: #2459d1;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e4e7ed;
  --text: #24292f;
  --muted: #8a919f;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --orange: #ea580c;
  --orange-bg: #ffedd5;
  --yellow: #ca8a04;
  --yellow-bg: #fef9c3;
  --blue: #3370ff;
  --blue-bg: #dbeafe;
  --gray-bg: #f4f5f7;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 20px rgba(16, 24, 40, .025);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* ---------- 布局：领星风格 ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 64px;
  background: #15181f;
  color: #9aa3af;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 10px;
  z-index: 40;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 0 4px 12px;
  border-bottom: 1px solid #262a33;
  margin-bottom: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.brand-name {
  color: #f2f4f7;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .5px;
  line-height: 1.1;
  text-align: center;
}

.brand-sub {
  font-size: 9px;
  color: #6d7480;
  text-align: center;
}

.module-rail {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  overflow-y: auto;
}

.module-btn {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9aa3af;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-family: inherit;
  transition: background .15s, color .15s;
}

.module-btn svg { width: 20px; height: 20px; }
.module-btn:hover { background: #23262b; color: #fff; }
.module-btn.active { background: #2e6be6; color: #fff; }

.sidebar-foot {
  font-size: 9px;
  line-height: 1.5;
  color: #5b616b;
  text-align: center;
  padding: 8px 4px 0;
  border-top: 1px solid #262a33;
}

/* ---------- 分组子菜单（弹出面板） ---------- */
.submenu {
  position: fixed;
  left: 64px;
  top: 0;
  bottom: 0;
  width: 248px;
  background: #23262b;
  color: #cfd3da;
  z-index: 39;
  display: none;
  flex-direction: column;
  padding: 16px 10px 24px;
  overflow-y: auto;
  box-shadow: 2px 0 14px rgba(0, 0, 0, .28);
}

.submenu.open { display: flex; }

.sm-group-label {
  color: #767d89;
  font-size: 11px;
  padding: 12px 10px 5px;
}

.sm-item {
  display: flex;
  align-items: center;
  width: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #cfd3da;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}

.sm-item:hover { background: #2c3038; color: #fff; }
.sm-item.active { background: #2e6be6; color: #fff; }

/* ---------- 顶部工具栏 ---------- */
.main {
  margin-left: 64px;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.crumb-sep { color: #c4c9d2; }
.crumb-current { color: var(--text); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.global-search {
  width: 248px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #f8f9fb;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.global-search:focus-within {
  background: #fff;
  border-color: #9ab7ff;
  box-shadow: 0 0 0 3px rgba(51,112,255,.1);
}
.global-search svg { width: 16px; height: 16px; flex: none; }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; }

.tb-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-btn svg { width: 18px; height: 18px; }
.tb-btn:hover { background: #f2f3f5; color: var(--text); }

.user-menu { position: relative; }

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  padding: 5px 8px;
  font-family: inherit;
}

.user-trigger:hover { background: #f2f3f5; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2e6be6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-user-role { font-size: 11px; color: var(--muted); }

.caret { width: 14px; height: 14px; color: var(--muted); }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 224px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
  overflow: hidden;
  z-index: 60;
}

.dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #242c38;
  color: #fff;
  padding: 14px 16px;
}

.avatar-lg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2e6be6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex: none;
}

.dropdown-id { min-width: 0; }
.dropdown-name { font-size: 14px; font-weight: 600; }
.dropdown-meta { font-size: 11px; color: #9aa3af; margin-top: 2px; }

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}

.dropdown-item:hover { background: #f2f3f5; color: var(--primary); }
.dropdown-item.danger:hover { background: #fef2f2; color: var(--red); }

/* ---------- 内容区 ---------- */
.view { display: none; }
.view.active { display: block; padding: 20px 24px 40px; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.header-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- 卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card .num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.card .label { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.card .num.red { color: var(--red); }
.card .num.orange { color: var(--orange); }
.card .num.green { color: var(--green); }
.card .num.blue { color: var(--blue); }

/* ---------- 面板 ---------- */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel-inner { background: var(--bg); border-radius: 8px; padding: 14px; margin-top: 14px; }
.panel-inner h4 { font-size: 14px; margin-bottom: 8px; }

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.panel-toolbar h2 { margin-bottom: 0; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table th, .table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  background: var(--gray-bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 12.5px;
  position: sticky;
  top: 0;
}

.table tbody tr:hover { background: #f8fafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table-compact th, .table-compact td { padding: 7px 10px; }

/* ---------- 可排序表头 ---------- */
th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]:hover { color: var(--primary); }
th[data-sort]::after {
  content: " ⇅";
  font-size: 10px;
  color: #c4c9d2;
}
th[data-sort].sort-asc::after { content: " ↑"; color: var(--primary); }
th[data-sort].sort-desc::after { content: " ↓"; color: var(--primary); }
th[data-sales-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sales-sort]:hover { color: var(--primary); }
th[data-sales-sort]::after { content: " ⇅"; font-size: 10px; color: #c4c9d2; }
th[data-sales-sort].sort-asc::after { content: " ↑"; color: var(--primary); }
th[data-sales-sort].sort-desc::after { content: " ↓"; color: var(--primary); }

/* ---------- 产品图片 ---------- */
.prod-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.prod-img-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--gray-bg);
  color: var(--muted);
  font-size: 12px;
}

.sku-cell { font-weight: 600; color: var(--primary-dark); }
.sub-cell { display: block; font-size: 12px; color: var(--muted); font-weight: 400; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  display: none;
}

.empty.show { display: block; }

.operational-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.operational-head h2 { margin-bottom: 3px; font-size: 18px; }
.operational-cards { margin-top: 4px; }
.operational-loading {
  min-height: 280px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.sales-stats-toolbar { align-items: flex-end; }
.sales-stats-summary .cards { margin-bottom: 16px; }
.inline-label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.sales-stats-table td:first-child { min-width: 220px; }
.sales-period.incomplete { color: #9aa3af; background: #fafafa; }
.text-blue { color: var(--blue); }
.status-source { display: inline-block; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.status-source.listing { color: var(--green); }
.status-source.fallback { color: var(--orange); }
.sales-stats-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; color: var(--muted); font-size: 12.5px; }
.pagination-buttons { display: flex; align-items: center; gap: 7px; }
.pagination-buttons .btn:disabled { opacity: .45; cursor: not-allowed; }
.sales-actions-col { min-width: 132px; }
.sales-stats-table th:last-child,.sales-stats-table td:last-child { position: sticky; right: 0; z-index: 3; background: #fff; box-shadow: -8px 0 14px rgba(16,24,40,.05); }
.sales-stats-table th:last-child { background: var(--gray-bg); z-index: 5; }
.sales-stats-table tbody tr:hover td:last-child { background: #f8fafc; }
.sales-row-actions { display: flex; align-items: center; gap: 14px; position: relative; }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 4px 0; font: inherit; }
.more-menu { position: relative; color: var(--primary); }
.more-menu summary { cursor: pointer; list-style: none; padding: 4px 0; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-dropdown { position: absolute; right: 0; top: 28px; width: 126px; padding: 5px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(16,24,40,.15); z-index: 15; }
.more-dropdown button { width: 100%; border: 0; background: transparent; padding: 8px 10px; text-align: left; border-radius: 5px; cursor: pointer; color: var(--text); }
.more-dropdown button:hover { background: var(--blue-bg); color: var(--primary); }
.modal-xl { width: min(1280px, calc(100vw - 48px)); max-width: 1280px; }
.sales-detail-modal .modal-body { background: #f5f6f8; padding: 18px; }
.analysis-section { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-top: 16px; }
.analysis-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.analysis-head h3 { font-size: 16px; }
.sales-chart-legend { display: flex; gap: 24px; flex-wrap: wrap; margin: 0 0 12px 10px; color: var(--muted); font-size: 12.5px; }
.sales-chart-legend .raw { color: #339af0; }.sales-chart-legend .forecast { color: #339af0; }.sales-chart-legend .denoised { color: #7bcf5b; }.sales-chart-legend .yoy { color: #f59f75; }
.sales-line-chart { min-height: 330px; overflow-x: auto; }
.sales-line-chart svg { width: 100%; min-width: 760px; height: 330px; }
.sales-line-chart text { fill: #8a97ab; font-size: 12px; }
.chart-grid { stroke: #e5eaf2; stroke-width: 1; }
.line-raw,.line-denoised,.line-forecast { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line-raw { stroke: #339af0; stroke-width: 1.8; opacity: .8; }
.line-denoised { stroke: #7bcf5b; stroke-width: 2.4; }
.line-forecast { stroke: #339af0; stroke-width: 2.4; stroke-dasharray: 8 7; }
.stockout-timeline { display: flex; gap: 2px; height: 38px; align-items: end; margin: 10px 0 18px; padding: 0 4px 6px; border-bottom: 1px solid var(--border); }
.stockout-timeline i { flex: 1 1 3px; min-width: 2px; height: 8px; border-radius: 2px 2px 0 0; background: #8bc6ff; }
.stockout-timeline i.out { height: 28px; background: #f97066; }
.stockout-timeline i.unknown { height: 4px; background: #c7ced8; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-fbm { background: var(--blue-bg); color: var(--blue); }
.badge-fba { background: #ede9fe; color: #7c3aed; }
.badge-stockout { background: var(--red-bg); color: var(--red); }
.badge-urgent { background: var(--orange-bg); color: var(--orange); }
.badge-warning { background: var(--yellow-bg); color: var(--yellow); }
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-overstock { background: var(--blue-bg); color: var(--blue); }
.badge-no_sales, .badge-no_data { background: var(--gray-bg); color: var(--muted); }
.badge-off { background: #f1f5f9; color: #94a3b8; }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.row-stockout td { background: #fef2f2; }
.row-stockout:hover td { background: #fee2e2; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

.input, .select, .textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input-sm { padding: 5px 8px; font-size: 13px; }
.select-sm { padding: 5px 8px; font-size: 13px; }
.textarea { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.muted { color: var(--muted); font-size: 12.5px; }

.row-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.hidden { display: none !important; }

/* 订单利润 */
.order-profit-panel{padding:0;overflow:hidden}.op-filter-grid{display:grid;grid-template-columns:2fr 1fr 1.2fr 1fr 1fr 2fr;gap:14px;padding:18px 20px;background:#fff;border-bottom:1px solid #e7ebf1}.op-filter-grid>label{font-size:13px;color:#5c667a;display:flex;flex-direction:column;gap:7px}.op-date-row,.op-search-row{display:flex;align-items:center;gap:7px}.op-date-row .input{min-width:135px}.op-search-row .select{width:95px}.op-search-row .input{min-width:135px}.op-summary{display:flex;gap:0;background:#f7f9fc;border-bottom:1px solid #e7ebf1;overflow:auto}.op-summary>div{min-width:145px;padding:14px 20px;border-right:1px solid #e7ebf1}.op-summary span{display:block;color:#7b8496;font-size:12px;margin-bottom:6px}.op-summary strong{font-size:18px}.op-table-wrap{max-height:calc(100vh - 340px);overflow:auto}.op-table{min-width:max-content}.op-table th,.op-table td{white-space:nowrap;max-width:260px;overflow:hidden;text-overflow:ellipsis}.op-fixed{position:sticky;left:0;background:#fff;z-index:2}.op-table th.op-fixed{background:#f6f8fb;z-index:4}.op-fixed-right{position:sticky;right:0;background:#fff;z-index:3;box-shadow:-5px 0 10px rgba(25,45,75,.06)}.op-table th.op-fixed-right{background:#f6f8fb}.link-btn{border:0;background:none;color:#1769e0;cursor:pointer;padding:3px 5px}.op-column-modal{width:min(620px,90vw);max-height:82vh}.op-column-list{max-height:55vh;overflow:auto;border:1px solid #e5e9f0;border-radius:6px}.op-column-item{display:grid;grid-template-columns:1fr 90px 100px;align-items:center;padding:9px 12px;border-bottom:1px solid #edf0f4}.op-column-item:last-child{border-bottom:0}.op-column-item span{text-align:right}.op-detail-modal{width:min(900px,92vw);max-height:85vh;overflow:auto}.op-detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;background:#e7ebf1}.op-detail-grid>div{background:#fff;padding:12px}.op-detail-grid span{display:block;color:#7b8496;font-size:12px;margin-bottom:5px}.op-detail-grid strong{font-size:13px;word-break:break-all}@media(max-width:1100px){.op-filter-grid{grid-template-columns:repeat(2,1fr)}.op-detail-grid{grid-template-columns:repeat(2,1fr)}}
.op-export-wrap{position:relative}.op-export-menu{position:absolute;right:0;top:calc(100% + 6px);width:130px;background:#fff;border:1px solid #dfe4ec;border-radius:6px;box-shadow:0 8px 24px rgba(30,45,70,.16);z-index:20;padding:5px}.op-export-menu button{width:100%;border:0;background:#fff;text-align:left;padding:9px 12px;border-radius:4px;cursor:pointer}.op-export-menu button:hover{background:#f0f5ff;color:#1769e0}.op-column-tools{display:flex;align-items:center;gap:10px;margin:12px 0}.op-column-tools .input{flex:1}.op-column-tools .muted{margin-left:auto}.op-column-group{padding:8px 12px;background:#f6f8fb;color:#7b8496;font-size:12px;font-weight:600;border-bottom:1px solid #e7ebf1}
.op-export-fields{max-height:55vh;overflow:auto;border:1px solid #e5e9f0;border-radius:6px}.op-export-field{display:inline-flex;align-items:center;gap:7px;width:33.333%;padding:9px 12px;box-sizing:border-box;border-bottom:1px solid #f0f2f5;font-size:13px}

/* ---------- 导入 ---------- */
.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mapping-item label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 3px;
}

.mapping-item .select { width: 100%; padding: 5px 8px; font-size: 13px; }
.preview-title { margin: 14px 0 8px; font-size: 14px; }

.pm-editor { display:grid; grid-template-columns:minmax(150px,1fr) minmax(180px,1.2fr) minmax(240px,2fr) 110px auto auto; gap:10px; align-items:center; padding:16px; margin-bottom:16px; border:1px solid var(--border); border-radius:8px; background:#fafcff; }
.supply-settings,.month-factor-grid { display:grid; gap:10px; padding:14px 16px; margin-bottom:12px; border:1px solid var(--border); border-radius:8px; background:#fafcff; }
.supply-settings { grid-template-columns:repeat(5,minmax(130px,1fr)) auto; align-items:end; }
.month-factor-grid { grid-template-columns:repeat(6,minmax(110px,1fr)); }
.supply-settings label,.month-factor-grid label { display:grid; gap:5px; color:var(--muted); font-size:12px; }
@media (max-width:1200px) { .supply-settings,.month-factor-grid { grid-template-columns:repeat(3,1fr); } }
@media (max-width:1100px) { .pm-editor { grid-template-columns:1fr 1fr; } }
.code-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-box.show { display: block; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 640px;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}

.modal-sm { width: 460px; }
.modal-lg { width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--red); }

.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 13px; color: var(--muted); font-weight: 500; }
.form-panel .form-row { margin-bottom: 14px; max-width: 380px; }

/* ---------- 账号中心 ---------- */
.account-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.account-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.account-lines { line-height: 1.5; min-width: 0; }
.account-name { font-size: 16px; font-weight: 700; }
.account-username { font-size: 12px; color: var(--muted); }
.account-role { font-size: 12px; color: var(--muted); }
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

/* ---------- 产品详情 ---------- */
.product-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.pd-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex: none;
}

.pd-name { font-size: 17px; font-weight: 700; }
.pd-sku { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.pd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 16px;
}

.pd-item {
  background: var(--gray-bg);
  border-radius: 8px;
  padding: 9px 11px;
}

.pd-k { font-size: 11.5px; color: var(--muted); }
.pd-v { font-size: 13.5px; font-weight: 600; margin-top: 2px; word-break: break-all; }

/* ---------- 历史断货日历 ---------- */
#sc-table th, #sc-table td { padding: 5px 7px; font-size: 12px; }
.sc-hit { color: var(--red); text-align: center; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.page-info {
  font-size: 13px;
  color: var(--text);
  min-width: 90px;
  text-align: center;
}

/* ---------- 领星同步 ---------- */
.lx-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- 详情 ---------- */
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.detail-metric {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-metric .label { font-size: 12px; color: var(--muted); }
.detail-metric .value { font-size: 18px; font-weight: 700; margin-top: 2px; }

.chart-block h4 { font-size: 13.5px; margin-bottom: 10px; color: var(--muted); font-weight: 500; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 180px;
  padding: 6px 2px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1 0 22px;
  min-width: 16px;
  position: relative;
}

.chart-bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; }
.bar-sales { width: 8px; background: var(--blue); border-radius: 2px 2px 0 0; }
.bar-stock { width: 6px; background: var(--green); border-radius: 2px 2px 0 0; }
.chart-col.stockout .bar-sales { background: var(--red); }
.chart-col.stockout .bar-stock { background: var(--red); }
.chart-col .bar-label {
  font-size: 10px;
  color: var(--muted);
  transform: rotate(-40deg);
  transform-origin: top center;
  white-space: nowrap;
  margin-top: 4px;
}

.chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.legend-sales { color: var(--blue); }
.legend-stock { color: var(--green); }

/* ---------- Toast ---------- */
#toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .3);
  animation: slide-in .2s ease;
  max-width: 420px;
}

.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.help-panel ol, .help-panel ul { padding-left: 22px; margin-bottom: 10px; }
.help-panel li { margin-bottom: 6px; }
.help-panel h2 { margin-top: 20px; }

@media (max-width: 900px) {
  .sidebar { width: 56px; padding: 10px 0 8px; }
  .main { margin-left: 56px; }
  .submenu { left: 56px; width: 220px; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-name, .brand-sub, .sidebar-foot { display: none; }
  .topbar { padding: 0 10px; }
  .topbar-left { font-size: 12px; }
  .global-search { width: min(42vw, 220px); }
  .global-search input::placeholder { color: transparent; }
  .user-meta, .caret { display: none; }
  .tb-btn { display: none; }
  .user-dropdown {
    position: fixed;
    right: 10px;
    top: 56px;
  }
  .view.active { padding: 14px 12px 30px; }
  .form-grid { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
}
.op-multi-value{cursor:help;border-bottom:1px dotted #94a3b8;white-space:nowrap}.op-multi-value small{margin-left:4px;color:#64748b;font-size:11px}
.module-btn.sync-alert{position:relative}.module-btn.sync-alert::after{content:"!";position:absolute;top:2px;right:8px;display:grid;place-items:center;width:17px;height:17px;border-radius:50%;background:#dc2626;color:white;font-size:12px;font-weight:700}
.lx-health-box{margin:12px 0 18px;padding:12px 14px;border:1px solid #dbe3ed;border-radius:8px;background:#f8fafc}
.sync-health-title{font-weight:700;margin-bottom:9px}.sync-health-title small{font-weight:400;color:#64748b;margin-left:12px}
.sync-health-items{display:grid;gap:7px}.sync-health-item{display:grid;grid-template-columns:minmax(140px,1fr) 70px 160px minmax(180px,2fr);gap:8px;align-items:center;font-size:13px}.sync-health-item small{color:#64748b}.sync-health-item.error{color:#b91c1c}.sync-health-item.warning{color:#b45309}.sync-health-item.ok strong{color:#15803d}
@media(max-width:900px){.sync-health-item{grid-template-columns:1fr 70px}.sync-health-item small{grid-column:1}.sync-health-item span:last-child{grid-column:1 / -1}}
