/* Rosaura ERP — 主题：纯白卡面 + 黑色主字 + 黄色记号笔高亮 + 蓝色互动
   参考：Shoaib Hamza 名片（白卡 / 黑粗字 / 黄色记号笔 / 蓝色辅助 / 大圆角 / 大量留白）
   --------------------------------------------------------------- */

:root {
  /* 表面 */
  --bg:        #F5F5F2;   /* 页面底：极浅暖灰，衬托纯白卡片 */
  --surface:   #FFFFFF;   /* 卡片：纯白 */
  --surface-2: #FAFAF8;   /* 卡内浅底 */
  --ink-chip:  #F1F1EE;   /* 图标底 */

  /* 黄色：只用于「记号笔高亮」（关键数字） */
  --accent:      #FFE24B;
  --accent-deep: #F2D21A;
  --accent-soft: #FFF8D9;
  --accent-mist: #FFFCEE;

  /* 蓝色：只用于「互动 / 选中 / 链接」 */
  --blue:      #2F6BFF;
  --blue-dark: #1F52D6;
  --blue-soft: #E9EFFF;

  /* 文字 */
  --ink:   #111111;
  --ink-2: #3A3A38;
  --muted: #8A8A85;
  --faint: #B9B9B4;

  /* 线 */
  --line:   #EDEDE8;
  --line-2: #E2E2DC;

  /* 语义色（与黄色记号笔区分开） */
  --danger: #D93A2B;
  --amber:  #B8862B;
  --green:  #2E8B57;

  /* 尺寸 */
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --sidebar-w: 240px;

  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.03), 0 10px 30px -22px rgba(17, 17, 17, 0.16);
  --shadow-pop:  0 2px 8px rgba(47, 107, 255, 0.22), 0 12px 26px -16px rgba(47, 107, 255, 0.40);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mono {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.muted { color: var(--muted); }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
::selection { background: var(--accent); color: var(--ink); }

/* 黄色记号笔：给关键数字「划重点」 */
.marker,
.metric--hl .metric__val,
.inv-kpi__item--hl .inv-kpi__num {
  background-image: linear-gradient(180deg,
      transparent 58%, var(--accent) 58%, var(--accent) 92%, transparent 92%);
  padding: 0 3px;
  border-radius: 2px;
}

/* ============== 布局 ============== */
body.layout { display: flex; min-height: 100vh; }

/* ============== 侧边栏 ============== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}
.sidebar__brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  padding: 30px 26px 24px;
  color: var(--ink);
  text-decoration: none;
  display: block;
}
.sidebar__brand .dot { color: var(--accent-deep); }
.sidebar__nav {
  display: flex;
  flex-direction: column;
  padding: 4px 14px;
  flex: 1;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--blue-soft); color: var(--blue-dark); }
.nav-item .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: var(--radius-sm);
  background: var(--ink-chip);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  transition: background .16s ease, color .16s ease;
}
.nav-item:hover .icon { background: var(--line-2); }
.nav-item.active .icon { background: var(--blue); color: #fff; }
.sidebar__footer {
  padding: 20px 26px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.sidebar__footer code {
  color: var(--ink-2);
  font-size: 11px;
  background: var(--ink-chip);
  padding: 1px 7px;
  border-radius: 6px;
}

/* ============== 移动端顶部栏 ============== */
.topbar-mobile {
  display: none;
  position: sticky;
  top: 0;
  z-index: 9;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.menu-btn {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.topbar-mobile__brand { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.topbar-mobile__brand .dot { color: var(--accent-deep); }

/* ============== 主内容（大留白） ============== */
.main { flex: 1; min-width: 0; }
.main__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 44px 52px 104px;
}

/* ============== 页面头 ============== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 38px;
  gap: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-weight: 800;
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.035em;
}
.page-subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.page-header__actions { display: flex; gap: 12px; align-items: center; }

/* ============== 卡片 ============== */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 32px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
}
.card__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.card__num {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  margin: 10px 0 4px;
  color: var(--ink);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.card__sub { font-size: 12px; color: var(--muted); }

.cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ============== 面板 ============== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 30px 34px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}
.panel__title {
  font-size: 17px;
  margin: 0 0 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.015em;
}
.panel__sub { font-size: 12px; color: var(--muted); font-weight: normal; }
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.panel__head .panel__title { margin: 0; }
.panel__meta { font-size: 12px; color: var(--muted); font-weight: 400; }
.panel--flush { padding-top: 26px; }
.panel__foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.panel__note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.mini-title {
  margin: 24px 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* 实时销量：自动刷新指示点 */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--blue);
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(47, 107, 255, 0.45);
  animation: live-pulse 2.6s ease-out infinite;
}
.live-dot--busy { background: var(--amber); animation-duration: 1s; }
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0.40); }
  70%  { box-shadow: 0 0 0 8px rgba(47, 107, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
}

/* ============== 表格 ============== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 14px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover td { background: var(--surface-2); }
.table--small th, .table--small td { padding: 10px 12px; font-size: 12.5px; }
.table--tight th, .table--tight td { padding: 12px 12px; font-size: 12.5px; }
.table--rank th, .table--rank td { padding: 12px 12px; font-size: 12.5px; white-space: nowrap; }
.table--rank thead th { background: var(--surface); position: sticky; top: 0; z-index: 2; }
.table--rank th.grp { text-align: center; border-left: 1px solid var(--line); }
.table--rank th.grp--hl, .table--rank td.grp--hl { background: var(--accent-mist); }
.table--rank tbody tr:hover td { background: var(--surface-2); }
.table-scroll { overflow-x: auto; margin: 0 -6px; }
.row--total td {
  font-weight: 700;
  background: var(--surface-2);
  border-top: 1px solid var(--line-2);
  border-bottom: 0;
}

/* ============== 徽章 / 圆点 ============== */
.tag {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tag--red    { background: #FCE7E4; color: var(--danger); }
.tag--yellow { background: var(--accent-soft); color: #8A6D00; }
.tag--green  { background: #E4F2E9; color: var(--green); }
.tag--blue   { background: var(--blue-soft); color: var(--blue-dark); }
.tag--gray   { background: var(--ink-chip); color: var(--muted); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; }
.dot--red    { background: var(--danger); }
.dot--yellow { background: var(--accent-deep); }
.dot--green  { background: var(--green); }
.dot--gray   { background: var(--faint); }

/* ============== 按钮 ============== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.005em;
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  cursor: pointer;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: all .18s ease;
}
.btn:hover { border-color: var(--ink); }
.btn--primary {
  background: var(--blue);
  color: #fff !important;
  border-color: var(--blue);
  box-shadow: var(--shadow-pop);
}
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff !important; }
.btn--sm { padding: 7px 15px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ============== 横幅 ============== */
.banner {
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  font-size: 13px;
  line-height: 1.75;
}
.banner--warn { background: #FDF7E3; border: 1px solid #EFE0AE; color: #6B5300; }
.banner--info { background: var(--blue-soft); border: 1px solid #D3E0FF; color: #1B3A85; }
.banner code {
  background: rgba(17, 17, 17, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 12px;
}

/* ============== 占位（待接入） ============== */
.placeholder {
  text-align: center;
  padding: 68px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  color: var(--muted);
  box-shadow: var(--shadow-card);
}
.placeholder__icon { margin-bottom: 18px; color: var(--blue); opacity: .9; }
.placeholder h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.placeholder p { margin: 6px 0; font-size: 13px; }
.placeholder ul {
  text-align: left;
  max-width: 520px;
  margin: 22px auto 0;
  padding-left: 0;
  list-style: none;
}
.placeholder li { padding: 5px 0; font-size: 13px; }
.placeholder li::before { content: "— "; color: var(--blue); font-weight: 700; }

/* ============== 模块网格（备用） ============== */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.module-card {
  display: block;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: all .18s ease;
}
.module-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.module-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.module-card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--blue-soft); color: var(--blue);
  font-size: 17px; font-weight: 700;
}
.module-card__title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.module-card__desc { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; }
.module-card__status { display: inline-block; margin-top: 12px; font-size: 11px; color: var(--muted); }

/* ============================================================
   总览页
   ============================================================ */

/* 顶部工具条 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}
.toolbar__group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar__label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--pill);
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip--solid { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip--ghost { background: transparent; color: var(--muted); border-color: transparent; }

/* 时钟 */
.clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.clock__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

/* 两列布局 */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
}
.grid-2 > .panel { margin-bottom: 0; }

/* KV 指标卡 */
.kv-grid { display: grid; gap: 16px; }
.kv-grid--2 { grid-template-columns: repeat(2, 1fr); }
.kv-grid--3 { grid-template-columns: repeat(3, 1fr); }
.kv-grid--4 { grid-template-columns: repeat(4, 1fr); }
.kv {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.kv--warn { background: #FDF7E3; border-color: #EFE0AE; }
.kv__label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kv__num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 2px;
  color: var(--ink);
}
.kv__num--muted { color: var(--faint); }
.kv__sub { font-size: 11px; color: var(--muted); }

/* 指标条（业绩趋势） */
.metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--surface);
}
.metrics--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { padding: 18px 20px; border-right: 1px solid var(--line); background: var(--surface); min-width: 0; }
.metric:last-child { border-right: 0; }
.metric--hl { background: var(--surface); }
.metric--ads { background: var(--surface-2); }
.metric__label { font-size: 11.5px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.metric__val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  color: var(--ink);
  display: inline-block;
}
.metric--ads .metric__val { color: var(--faint); }
.metric__unit { font-size: 11px; color: var(--muted); }
.q {
  display: inline-block;
  width: 14px; height: 14px; line-height: 14px;
  text-align: center; border-radius: 50%;
  background: var(--ink-chip);
  color: var(--muted);
  font-size: 9px; font-weight: 700; cursor: help;
}

/* 周期切换 tabs */
.tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 6px 15px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--pill);
  cursor: pointer;
  transition: all .16s ease;
}
.tab:hover { color: var(--ink); border-color: var(--faint); }
.tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: var(--shadow-pop);
}
.tab--ghost { background: transparent; }
.tabs__sep { color: var(--line-2); }
.date-input, .select, .search {
  font-size: 12.5px;
  font-family: inherit;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
}
.date-input:focus, .select:focus, .search:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.search { min-width: 220px; }
.filters { display: flex; gap: 10px; align-items: center; }

/* 图表 */
.chart-wrap { height: 300px; position: relative; }
.chart-wrap--tall { height: 360px; }

/* 排行榜 */
.prod { display: flex; flex-direction: column; gap: 2px; max-width: 260px; }
.prod__id { font-family: "SF Mono", Menlo, monospace; font-size: 11.5px; color: var(--ink); font-weight: 500; }
.prod__name {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.hidden { display: none !important; }
.spark { display: inline-block; width: 96px; height: 26px; vertical-align: middle; }
.spark svg { display: block; }

/* 库存概况：在库 / 在途 两个大数 */
.inv-kpi { display: flex; align-items: center; flex-wrap: wrap; gap: 26px 46px; margin: 4px 0 26px; }
.inv-kpi__item { display: flex; align-items: center; gap: 12px; }
.inv-kpi__dot {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  flex: 0 0 38px;
}
.inv-kpi__label { font-size: 12px; color: var(--muted); font-weight: 500; }
.inv-kpi__num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.donut-row { display: flex; gap: 34px; align-items: center; flex-wrap: wrap; }
.donut-box { width: 180px; flex-shrink: 0; position: relative; text-align: center; }
.donut-box svg { display: block; margin: 0 auto; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; text-align: left; }
.donut-legend__item {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.donut-legend__item i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.donut-row .table { flex: 1; min-width: 260px; }

/* ============== 空状态 / 规划页（广告 / 统计 / 财务） ============== */
.empty { text-align: center; padding: 20px 32px 44px; }
.empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px; height: 58px;
  border-radius: 18px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}
.empty__title {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.empty__lead {
  margin: 0 auto;
  max-width: 580px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.85;
}

.feat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 32px; }
.feat {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.feat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  background: var(--ink-chip);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.feat__title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.feat__desc { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 3px; }

.need-box {
  background: var(--blue-soft);
  border: 1px solid #D3E0FF;
  border-radius: var(--radius-md);
  padding: 18px 22px;
}
.need-box ol, .need-box ul { margin: 0; padding-left: 20px; }
.need-box li { font-size: 12.5px; line-height: 2; color: #1B3A85; }
.need-box strong { color: #12306B; }

.codeblock {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 2;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: var(--ink-2);
  display: inline-block;
  text-align: left;
  white-space: pre;
}

/* ============== 统计 / 财务页组件 ============== */
.table--nowrap th, .table--nowrap td { white-space: nowrap; }
.inv-kpi .metric__unit { white-space: nowrap; }
.delta { font-weight: 700; }
.delta--up { color: var(--green); }
.delta--down { color: var(--danger); }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label {
  flex: 0 0 88px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.bar-track {
  flex: 1;
  height: 10px;
  border-radius: var(--pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar-track--sm { height: 7px; display: inline-block; width: 100%; vertical-align: middle; }
.bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--pill);
  background: var(--blue);
}
.bar-val {
  flex: 0 0 84px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

/* 库龄：100% 堆叠条 */
.stack-bar {
  display: flex;
  width: 100%;
  height: 20px;
  border-radius: var(--pill);
  overflow: hidden;
  background: var(--surface-2);
  margin: 8px 0 14px;
}
.stack-bar__seg { display: block; height: 100%; }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 6px;
}
.stack-legend__item {
  font-size: 11.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stack-legend__item i {
  width: 9px; height: 9px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.stack-legend__item b { color: var(--ink); font-weight: 700; }

/* ============== 响应式 ============== */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .metric:nth-child(4) { border-right: 0; }
  .grid-2 { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards--3, .cards--2 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .feat-grid { grid-template-columns: 1fr; gap: 0; }
  .main__inner { padding: 30px 26px 80px; }
  .ellipsis { max-width: 140px; }
  .page-title { font-size: 26px; }
  .panel { padding: 26px 24px 28px; }
}
@media (max-width: 700px) {
  .metrics, .metrics--4 { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(even) { border-right: 0; }
  .kv-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .kv-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .inv-kpi { gap: 28px; }
}
@media (max-width: 640px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 20;
    box-shadow: 0 24px 64px -24px rgba(17, 17, 17, .28);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar-mobile { display: flex; }
  .main__inner { padding: 24px 18px 64px; }
  .cards { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  body.layout { flex-direction: column; }
  .page-header { margin-bottom: 26px; }
}

/* 4 列指标条：金额较长时略缩小，保证不裁切 */
.metrics--4 .metric__val { font-size: 20px; }
@media (max-width: 1100px) { .metrics--4 .metric__val { font-size: 19px; } }

/* ============== 成本表上传 ============== */
.cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 56px;
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.cost-row__label { font-size: 11.5px; color: var(--muted); }
.cost-row__num {
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.25; font-variant-numeric: tabular-nums; color: var(--ink);
}
.cost-row__sub { font-size: 11.5px; color: var(--muted); }

.upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.file-input {
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  background: var(--surface-2);
  cursor: pointer;
  max-width: 340px;
}
.file-input::file-selector-button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--pill);
  padding: 5px 12px;
  margin-right: 10px;
  cursor: pointer;
}
.checkbox {
  font-size: 12.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.upload-msg { font-size: 12.5px; }

/* SKU 下钻链接 */
.sku-link { color: var(--blue); text-decoration: none; border-bottom: 1px solid transparent; }
.sku-link:hover { border-bottom-color: var(--blue); }

/* ============== 手机访问页 ============== */
.phone-qr { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.phone-qr__img { width: 210px; height: 210px; padding: 10px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-md); flex: 0 0 auto; }
.phone-qr__img svg { width: 100%; height: 100%; display: block; }
.phone-qr__meta { flex: 1 1 260px; min-width: 220px; }
.phone-url { margin-top: 6px; font-size: 16px; font-weight: 700; word-break: break-all;
  background: var(--ink-chip); padding: 10px 12px; border-radius: var(--radius-sm); }
.phone-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.phone-steps ol { margin: 8px 0 0 18px; padding: 0; color: var(--ink-2); font-size: 13px; line-height: 1.9; }
.sidebar__foot-link { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--blue);
  text-decoration: none; }
.sidebar__foot-link:hover { text-decoration: underline; }
@media (max-width: 700px) {
  .phone-steps { grid-template-columns: 1fr; }
  .phone-qr__img { width: 180px; height: 180px; }
}

/* ============== 手机端细节（PWA） ============== */
@media (max-width: 640px) {
  .topbar-mobile {
    padding-top: env(safe-area-inset-top);
    height: calc(58px + env(safe-area-inset-top));
  }
  .main__inner {
    padding: 20px 14px calc(56px + env(safe-area-inset-bottom));
  }
  .page-header { margin-bottom: 22px; gap: 12px; align-items: flex-start; }
  .page-title { font-size: 24px; }
  .page-header__actions { width: 100%; flex-wrap: wrap; }
  .panel { padding: 20px 16px 22px; border-radius: 16px; }
  .panel__head { gap: 8px; flex-wrap: wrap; }
  .metric__val { font-size: 21px; }
  .chart-wrap { height: 240px !important; }

  /* 关键词弹窗：手机上全屏 */
  .kw-modal { align-items: stretch; justify-content: stretch; }
  .kw-modal__card {
    width: 100vw; height: 100vh; max-height: 100vh;
    border-radius: 0; padding: calc(16px + env(safe-area-inset-top)) 14px
      calc(22px + env(safe-area-inset-bottom));
  }
  .kw-stat { gap: 18px; }
  .kw-stat b { font-size: 17px; }
  .kw-bar { gap: 8px 10px; }
  .kw-select, .kw-date { max-width: 100%; }
  .kw-children .kw-table-wrap { max-height: 32vh; }
}
@media (max-width: 640px) {
  /* 手机上子体清单太长，筛选栏已经能选子体，直接收起 */
  .kw-variants { display: none; }
}
