/* 星标 ERP · 公共主题。app.css 保留业务布局，此文件统一全站视觉规则。 */
:root {
  --bg: #f3f6fa;
  --surface: #fff;
  --surface-soft: #f7f9fc;
  --line: #e3e8f0;
  --line-strong: #cfd8e6;
  --text: #1c2940;
  --ink: #101a2b;
  --muted: #64748b;
  --faint: #77859a;
  --brand: #356df3;
  --brand-hover: #2859d2;
  --brand-soft: #edf3ff;
  /* 历史业务组件使用 teal 命名；保留别名以兼容现有脚本和组件。 */
  --teal: var(--brand);
  --teal-deep: #2859d2;
  --teal-soft: var(--brand-soft);
  --blue: #3564c5;
  --blue-soft: #edf3ff;
  --violet: #6264be;
  --violet-soft: #f0f0fa;
  --green: #167451;
  --green-soft: #eaf6ef;
  --amber: #95600d;
  --amber-soft: #fff5df;
  --red: #bc3e47;
  --red-soft: #fff0f0;
  --radius: 8px;
  --shadow-sm: none;
  --shadow: 0 12px 40px rgb(28 41 64 / 12%);
  --sidebar-width: 220px;
  --control-height: 38px;
  --focus-ring: 0 0 0 3px rgb(53 109 243 / 13%);
}
body { background: var(--bg); font-size: 14px; line-height: 1.5; }
.page-glow { display: none; }
button, input, select, textarea { font-family: inherit; }
button { transition: background .15s, border-color .15s, color .15s; }
button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
input, select, textarea { accent-color: var(--brand); }
input:read-only, textarea:read-only { color: var(--muted); background: var(--surface-soft); }

/* 固定导航和公共工具栏 */
.sidebar { width: var(--sidebar-width); padding: 20px 12px 12px; gap: 14px; background: #fff; box-shadow: none; backdrop-filter: none; }
.sidebar-brand { padding: 0 10px 18px; }
.sidebar .brand-mark { width: 36px; height: 36px; border-radius: 9px; box-shadow: none; }
.sidebar .brand-text .brand-name { font-size: 18px; letter-spacing: .12em; }
.sidebar .brand-text .brand-sub { font-size: 10px; letter-spacing: 0; }
.erp-nav { gap: 10px; padding: 0; }
.nav-module > summary { padding: 6px 12px; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.nav-module.is-current > summary { color: var(--muted); }
.nav-module .nav-item { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 6px; font-size: 15px; font-weight: 500; color: #526079; }
.nav-module .nav-item:hover { background: var(--surface-soft); color: var(--text); transform: none; }
.nav-module .nav-item.active { background: var(--brand-soft); color: var(--brand-hover); font-weight: 600; box-shadow: none; }
.sidebar .nav-tag { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; background: #7553ed; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .03em; flex: none; }
.sidebar .side-card { padding: 10px 12px; background: var(--surface-soft); border-radius: 6px; border-color: var(--line); }
.sidebar .side-card-value { color: #2856d5; font-weight: 700; }
.sidebar .side-foot .dot-live { width: 7px; height: 7px; margin-inline: 2px; background: #88cbb6; box-shadow: 0 0 0 4px #e8f5f0; }
.sidebar .side-foot { padding-inline: 10px; font-size: 11px; }
.dot-live { animation: none; box-shadow: none; width: 6px; height: 6px; }
.main { width: calc(100% - var(--sidebar-width)); max-width: none; margin-left: var(--sidebar-width); padding: 0 24px 32px; min-width: 0; }
.main > .topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px;
  min-height: 68px; margin: 0 -24px 24px; padding: 12px 24px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: #fff; box-shadow: none; backdrop-filter: none;
}
.main > .topbar.is-scrolled { background: #fff; box-shadow: 0 2px 8px rgb(28 41 64 / 4%); }
.topbar .crumb { flex: 0 1 auto; min-width: 0; gap: 8px; font-size: 12px; letter-spacing: 0; white-space: nowrap; }
.topbar .crumb > span:first-child { display: none; }
.topbar .crumb > i:first-of-type { display: none; }
.topbar .crumb i { color: var(--line-strong); font-style: normal; }
.topbar .crumb strong { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.topbar .top-search { display: flex; flex: 1 1 180px; width: auto; min-width: 110px; max-width: 240px; height: 36px; margin-left: auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); box-shadow: none; }
.topbar .top-search:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.topbar .top-search svg { flex: none; width: 16px; height: 16px; }
.topbar .top-search input { width: 100%; min-width: 0; height: auto; padding: 0; border: 0; background: transparent; font-size: 12px; outline: none; box-shadow: none; }
.topbar .top-search kbd { padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; background: #fff; font-size: 10px; white-space: nowrap; }
.topbar .top-actions { display: flex; flex: 0 1 auto; min-width: 0; align-items: center; gap: 12px; padding: 0; border: 0; }
.topbar .store-scope { display: flex; flex: 0 1 220px; min-width: 0; gap: 8px; height: 36px; padding: 0; border: 0; border-radius: 0; background: #fff; }
.topbar .store-scope-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.topbar .store-scope-label svg { width: 16px; height: 16px; }
.topbar .store-scope .select { width: 148px; min-width: 100px; max-width: 190px; padding: 7px 24px 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); font-size: 12px; font-weight: 600; text-overflow: ellipsis; }
.topbar .clock { display: none; }
.topbar .ghost-btn { min-height: 34px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.topbar .user-box { display: flex; flex: none; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); border-radius: 0; background: transparent; }
.topbar .user-meta { display: grid; max-width: 90px; min-width: 0; }
.topbar .user-meta strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .user-meta small { display: none; }
.topbar #accountSettingsBtn { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hover); }
.topbar #accountSettingsBtn:hover { background: var(--brand); color: #fff; }

/* 页面标题、筛选、卡片、表格 */
.view { min-width: 0; }
.section-head { min-height: 52px; margin-bottom: 20px; gap: 16px; }
.section-head h2, .profit-head h2 { margin: 0; font-size: 24px; font-weight: 650; line-height: 1.4; letter-spacing: -.02em; }
.section-head p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.head-actions { gap: 8px; }
.card, .bid-kpi, .bid-switch-card, .profit-card, .summary-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.card:hover { border-color: var(--line); box-shadow: none; }
.card { padding: 18px 20px; }
.card-head { align-items: center; gap: 14px; margin-bottom: 16px; }
.card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: 0; }
.card-head p, .field-hint { font-size: 12px; line-height: 1.6; }
.toolbar { gap: 12px; flex-wrap: wrap; margin: 16px 0; border-radius: 0; }
.toolbar > *, .card-head > div, .form-grid, .form-row, .field { min-width: 0; }
.button, .ghost-btn, .mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 8px 14px; border-radius: 6px; font-size: 13px; line-height: 20px; font-weight: 550; box-shadow: none; white-space: nowrap; }
.button.primary { border: 1px solid var(--brand); background: var(--brand); color: #fff; box-shadow: none; }
.button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); box-shadow: none; transform: none; }
.button.secondary, .ghost-btn, .mini-btn { border: 1px solid var(--line-strong); background: #fff; color: #526079; }
.button.secondary:hover, .ghost-btn:hover, .mini-btn:hover { background: var(--surface-soft); border-color: #a7b8d1; color: var(--text); transform: none; }
.button.sm, .ghost-btn.sm, .mini-btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button svg, .ghost-btn svg { width: 16px; height: 16px; flex: none; }
.seg-tabs { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: #eaf0f7; }
.seg-tabs button { min-height: 34px; padding: 6px 18px; border-radius: 4px; color: #596a82; font-size: 13px; font-weight: 550; }
.seg-tabs button.active { color: var(--brand-hover); background: #fff; box-shadow: none; }
.range-tabs { padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.range-tabs button { padding: 7px 13px; border-radius: 4px; font-size: 12px; }
.range-tabs button.active { color: var(--brand-hover); background: var(--brand-soft); box-shadow: none; }
.chip, .ops-chip { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge { padding: 3px 7px; border-radius: 4px; font-size: 11px; font-weight: 550; line-height: 18px; }
.badge.gray { background: #f0f3f7; color: #63738a; }
.badge.violet { color: #5d5e9d; }
.table-wrap { width: 100%; max-width: 100%; margin: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.data-table { font-size: 13px; }
.data-table th { padding: 11px 12px; background: var(--surface-soft); color: #65758c; font-size: 12px; font-weight: 550; letter-spacing: 0; border-bottom: 1px solid var(--line); }
.data-table td { padding: 13px 12px; border-bottom: 1px solid #edf0f5; font-size: 13px; }
.data-table tr:hover td { background: #f8faff; }
.data-table .num, .data-table .col-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.cell-product-main { min-width: 0; }
.cell-title { font-weight: 550; line-height: 1.6; }
.cell-sub { color: var(--muted); font-size: 11px; line-height: 1.6; }
.row-actions { align-items: center; flex-wrap: nowrap; gap: 8px; white-space: nowrap; }
.link-btn { font-size: 12px; font-weight: 550; }
.table-empty { padding: 48px 16px; font-size: 13px; color: var(--muted); white-space: normal; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 16px; margin-top: 0; border-top: 1px solid var(--line); font-size: 12px; }
.pagination-actions { display: flex; gap: 8px; }

/* 表单、弹窗及统一反馈 */
.field { gap: 7px; }
.field label, .auth-field > span, .profit-field > span { color: #526079; font-size: 12px; font-weight: 550; letter-spacing: 0; }
.field input, .field select, .field textarea, .select, .search-input-wrap input, .auth-field input, .cs-trigger, .dr-trigger { min-height: var(--control-height); border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; font-size: 13px; font-weight: 400; }
.field input:focus, .field textarea:focus, .field select:focus, .select:focus, .search-input-wrap input:focus, .auth-field input:focus, .cs-trigger:focus-visible, .dr-trigger:focus-visible { border-color: var(--brand); box-shadow: var(--focus-ring); outline: none; background: #fff; }
input::placeholder, textarea::placeholder { color: #8a97a9; }
.form-grid, .form-row { gap: 16px; }
.form-actions { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal-overlay { padding: 24px; background: rgb(19 33 55 / 30%); backdrop-filter: none; }
.modal { border: 1px solid var(--line); border-radius: 10px; max-height: calc(100dvh - 48px); box-shadow: var(--shadow); }
.modal-head { flex: none; padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 650; }
.modal-head p { font-size: 12px; line-height: 1.6; }
.modal-body { min-width: 0; padding: 20px 22px; overscroll-behavior: contain; }
.modal-close { width: 32px; height: 32px; border-radius: 6px; }
.modal-body > .form-grid > .form-actions, .listing-confirm-actions, .listing-dialog > .form-actions { position: sticky; bottom: -20px; z-index: 2; margin-bottom: -20px; padding: 16px 0 20px; background: #fff; border-top: 1px solid var(--line); }
.auth-error, .page-feedback { padding: 11px 14px; border: 1px solid #f0cdd0; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
.page-feedback { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toast { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }

/* 登录与注册：完整的独立浅色页面 */
.auth-gate { background: var(--bg); backdrop-filter: none; padding: 32px 20px; overflow-y: auto; }
.auth-card { width: min(440px, 100%); max-height: 100%; padding: 30px 32px 24px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 6px 24px rgb(28 41 64 / 4%); }
.auth-head { gap: 12px; margin-bottom: 28px; }
.auth-head .brand-mark { width: 40px; height: 40px; }
.auth-head strong { font-size: 18px; font-weight: 650; }
.auth-head small { font-size: 12px; }
.auth-welcome { margin-bottom: 22px; }
.auth-welcome h1 { margin: 0 0 6px; font-size: 23px; font-weight: 650; letter-spacing: -.02em; }
.auth-welcome p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-tabs { margin-bottom: 22px; border-radius: 6px; background: var(--surface-soft); }
.auth-tabs button { min-height: 36px; font-size: 13px; font-weight: 550; }
.auth-tabs button.active { background: #fff; color: var(--brand-hover); box-shadow: 0 1px 3px rgb(28 41 64 / 8%); }
.auth-field { margin-bottom: 16px; }
.auth-field input { min-height: 42px; }
.auth-submit { min-height: 42px; margin-top: 4px; }
.auth-note { color: var(--muted); font-size: 12px; line-height: 1.7; }
.auth-note + .auth-note { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.auth-note .link-btn { padding: 0; }

/* 经营总览：指标、趋势、业务表现依次呈现 */
#view-dashboard { --dash-blue: var(--brand); --dash-ink: var(--text); --dash-line: var(--line); --dash-muted: var(--muted); --dash-faint: var(--faint); --dash-soft: var(--surface-soft); }
.dashboard-date { margin-left: 12px; color: var(--faint); }
#view-dashboard .ops-kpi-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 0 0 18px; }
#view-dashboard .ops-kpi { position: relative; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: none; overflow: hidden; }
#view-dashboard .ops-kpi::before, #view-dashboard .ops-kpi::after, #view-dashboard .ops-kpi-glow { display: none; }
.ops-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ops-kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.ops-kpi-icon { display: flex; color: #91a0b6; }
.ops-kpi-icon svg { width: 18px; height: 18px; }
#view-dashboard .ops-kpi-value { margin-top: 10px; color: var(--text); font-size: clamp(24px,2.3vw,32px); font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.ops-kpi-foot { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-top: 8px; gap: 8px; }
.ops-kpi-foot-text { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.ops-spark { display: block; width: 80px; height: 26px; flex: none; }
.ops-spark svg { width: 100%; height: 100%; stroke: none; }
.ops-spark .spark-line { fill: none; stroke: #9cb3da; stroke-width: 1.6; }
.ops-spark .spark-area { fill: #f0f4fb; }
.ops-main-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(300px,1fr); gap: 16px; align-items: start; }
.ops-bottom-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.ops-card-head { align-items: center; }
.ops-chart-wrap { min-height: 286px; }
.ops-chart-frame { position: relative; height: 286px; }
.ops-chart-wrap svg { display: block; width: 100%; height: 286px; overflow: hidden; }
.ops-chart-ylabels { position: absolute; left: 0; top: 17px; bottom: 28px; width: 50px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.ops-chart-ylabels span, .ops-chart-xlabels span { color: var(--muted); font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ops-chart-xlabels { position: absolute; inset: auto 0 9px; height: 14px; }
.ops-chart-xlabels span { position: absolute; transform: translateX(-50%); }
.ops-chart-line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.ops-chart-halo { fill: var(--brand-soft); }
.ops-chart-dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.ops-chart-peak { fill: var(--brand); }
#view-dashboard .chart-area { fill: #edf3ff; }
#view-dashboard .chart-grid-line { stroke: var(--line); }
.ops-refresh { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--muted); font-size: 12px; }
.ops-refresh svg { width: 14px; height: 14px; }
.sales-status { color: var(--muted); font-size: 11px; line-height: 1.7; margin-bottom: 10px; overflow-wrap: anywhere; }
.ops-sales-table td, .ops-sales-table th { padding: 10px; font-size: 12px; }
.sales-range-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
.sales-status-warn { color: var(--amber); }
.ops-store-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ops-store-row:last-child { border: 0; }
.ops-store-rank { color: var(--faint); font-size: 11px; }
.ops-store-main { flex: 1; min-width: 0; }
.ops-store-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; font-size: 12px; }
.ops-store-name { min-width: 0; overflow-wrap: anywhere; }
.ops-store-rev { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.ops-store-sub { color: var(--muted); margin: 5px 0; font-size: 11px; }
.ops-store-bar { height: 3px; border-radius: 2px; background: var(--surface-soft); }
.ops-store-bar i { display: block; height: 100%; background: #9cb8ef; border-radius: 2px; }
.ops-rank-row { display: grid; grid-template-columns: 16px 30px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ops-rank-row .thumb { width: 30px; height: 30px; font-size: 11px; }
.ops-rank-no { font-size: 11px; color: var(--faint); }
.ops-rank-meta { min-width: 0; }
.ops-rank-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.ops-rank-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.ops-rank-value { font-size: 12px; font-weight: 600; white-space: nowrap; }
#activityFeed { max-height: 290px; overflow-y: auto; }
.ops-act { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ops-act-dot { flex: none; width: 6px; height: 6px; margin-top: 6px; border-radius: 50%; background: #a6b6cf; }
.ops-act-body { min-width: 0; }
.ops-act-title { font-size: 12px; overflow-wrap: anywhere; }
.ops-act-title em { display: inline-block; margin-left: 6px; color: var(--blue); font-size: 11px; font-style: normal; }
.ops-act-sub, .ops-act-time { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.ops-empty { display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 180px; padding: 24px; text-align: center; }
.ops-empty-icon { color: #9badc7; }
.ops-empty strong { font-size: 13px; font-weight: 550; }
.ops-empty p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.dashboard-insights { display: flex; align-items: start; gap: 16px; margin-top: 18px; padding: 16px 0; border-top: 1px solid var(--line); font-size: 12px; }
.dashboard-insights > strong, .dashboard-insights > a { flex: none; }
.dashboard-insights > a { margin-left: auto; }
#aiInsights { display: grid; gap: 8px; color: var(--muted); }
.ops-insight b { margin-right: 8px; color: #526079; font-weight: 550; }

/* 商品、竞价、采购、企业管理 */
#view-products > .section-head { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
#view-products > .section-head h2 { font-size: 24px; }
#view-products #productSummary .summary-card { padding: 14px 18px; border: 1px solid var(--line); background: #fff; }
#view-products #productSummary .summary-card strong { font-size: 24px; }
#view-products .product-table thead th { background: var(--surface-soft); }
#view-products .product-filters { grid-template-columns: minmax(220px,1fr) repeat(2,minmax(160px,.55fr)); }
#view-products .product-table .cell-title { max-width: 320px; }
.bid-kpi-grid { margin-top: 0; gap: 16px; }
.bid-kpi { padding: 16px 20px; }
.bid-kpi-label { font-size: 12px; font-weight: 500; letter-spacing: 0; }
.bid-kpi-value { margin-top: 8px; font-size: 25px; color: var(--text); font-weight: 650; }
.bid-kpi-note { font-size: 11px; color: var(--muted); }
.bid-toolbar { gap: 12px; margin: 16px 0; }
.bid-toolbar-left { flex: 1; }
.bid-search { min-width: 200px; flex: 1 1 260px; max-width: 420px; }
.bid-filter-group { flex-wrap: wrap; border: 0; padding: 0; background: transparent; }
.bid-filter-select { min-height: 36px; font-size: 12px; }
.bid-table { min-width: 1210px; }
.bid-table .cell-title { min-width: 250px; max-width: 310px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bid-table th:nth-child(6), .bid-table th:nth-child(7), .bid-table th:nth-child(8) { text-align: right; }
.floor-edit { justify-content: flex-end; }
.floor-edit input { text-align: right; }
.bid-switch-card, .bid-config-card { margin-top: 0; margin-bottom: 16px; }
.bid-switch-card .switch-line { gap: 8px; }
.bid-rule-box, .source-detail, .calc-box { background: var(--surface-soft); border-color: var(--line); color: var(--muted); }
.purchase-toolbar { padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: none; }
.purchase-toolbar-left, .purchase-toolbar-right, .batch-actions { flex-wrap: wrap; gap: 10px; }
.purchase-table { min-width: 980px; }
.purchase-table td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.purchase-table td:nth-child(5) { min-width: 240px; max-width: 340px; }
#purchaseTabOrders .data-table { min-width: 850px; }
#view-sales-orders .data-table td { font-size: 13px; }
#view-sales-orders .data-table th { font-size: 12px; }
#view-sales-orders .sales-order-title { max-width: 300px; }
#view-company .enterprise-info-card, #view-enterprise .member-list-card, #view-bindings .card { border-color: var(--line); box-shadow: none; }
#view-bindings .enterprise-product-title { max-width: 300px; }
.enterprise-shop-option { border-radius: 6px; }

/* 智能上架与详情工作台，步骤、状态及操作保留现有流程 */
.sourcing-workflow { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin: 0 0 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; list-style: none; }
.sourcing-workflow li { min-width: 0; }
.sourcing-workflow button { display: flex; align-items: center; width: 100%; min-width: 0; gap: 10px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; }
.sourcing-workflow button:hover { background: var(--surface-soft); }
.sourcing-workflow button > span { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; }
.sourcing-workflow strong { display: block; font-size: 13px; font-weight: 550; }
.sourcing-workflow small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.sourcing-workflow [aria-current="step"] > span { color: #fff; background: var(--brand); border-color: var(--brand); }
.sourcing-workflow [aria-current="step"] strong { color: var(--brand-hover); }
#view-sourcing .workbench { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: none; }
#view-sourcing .wb-search { background: #fff; border-bottom: 1px solid var(--line); padding: 16px; flex-wrap: wrap; }
#view-sourcing .wb-search .search-input-wrap { min-width: 200px; }
#view-sourcing .wb-body { grid-template-columns: minmax(0,1.2fr) minmax(320px,1fr); }
#view-sourcing .wb-main, #view-sourcing .wb-detail { min-width: 0; }
#view-sourcing .wb-detail { background: #fbfcfe; border-left: 1px solid var(--line); }
#view-sourcing .wb-list-head { padding: 14px 16px; gap: 12px; flex-wrap: wrap; background: var(--surface-soft); }
#view-sourcing .wb-detail-empty { padding: 48px 24px; color: var(--muted); }
#view-sourcing .wb-detail-icon { width: 36px; height: 36px; background: var(--surface-soft); color: var(--faint); box-shadow: none; font-size: 24px; }
#view-sourcing .wb-detail-icon + .wb-detail-icon { display: none; }
#view-sourcing .pl-row { box-shadow: none; border-color: var(--line); border-radius: 6px; }
#view-sourcing .pl-row.active { background: var(--brand-soft); border-color: #b9cdfa; }
#view-sourcing .bulk-bar { background: #fff; border-color: var(--line); box-shadow: 0 -3px 12px rgb(28 41 64 / 5%); }
#view-sourcing .queue-card, #view-sourcing .queue-group, .source-item, .listing-dialog .profit-card { border-radius: 6px; box-shadow: none; }
#sourcingTabQueue .listing-toolbar { align-items: center; }
#sourcingTabQueue .listing-stages { margin: 0; }
.listing-confirm-note { background: var(--surface-soft); border-color: var(--line); border-left-color: var(--brand); }

/* 利润测算和成本详情共享单位、输入和结果层级 */
#profitRules { padding: 0; border: 0; background: transparent; box-shadow: none; }
.profit-head { padding: 0; margin-bottom: 20px; }
.profit-head-icon { display: none; }
.profit-head p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.profit-card { padding: 18px 20px; }
.profit-card h4 { font-size: 14px; font-weight: 600; }
.profit-grid { grid-template-columns: minmax(0,1fr) 300px; gap: 18px; }
.profit-fields { gap: 14px; }
.profit-input { border-color: var(--line-strong); border-radius: 6px; background: #fff; }
.profit-input:focus-within { border-color: var(--brand); box-shadow: var(--focus-ring); }
.profit-input input { text-align: right; font-variant-numeric: tabular-nums; }
.profit-radio label span { border-radius: 5px; }
.profit-metrics { gap: 10px; }
.profit-metric { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 16px; }
.profit-metric.good { border-color: #cfe5d8; background: #f3faf6; }
.profit-metric.bad { border-color: #efd0d3; background: var(--red-soft); }
.profit-metric strong { font-size: 27px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.profit-lines b { font-variant-numeric: tabular-nums; }
.profit-side { position: sticky; top: 90px; align-self: start; }

@media (min-width: 821px) and (max-width: 1320px) {
  .main > .topbar { gap: 12px; }
  .topbar .crumb > span, .topbar .crumb > i { display: none; }
  .topbar .store-scope .select { width: 135px; }
  .topbar .top-search { max-width: 190px; }
  .ops-main-grid { grid-template-columns: minmax(0,1.5fr) minmax(280px,1fr); }
  .ops-bottom-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ops-bottom-grid > :last-child { grid-column: 1 / -1; }
  #activityFeed { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 24px; }
  .profit-grid { grid-template-columns: minmax(0,1fr) 270px; }
  .profit-fields.cols-5 { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 1080px) {
  .topbar .store-scope-label { display: none; }
  .topbar .top-search kbd { display: none; }
  #view-sourcing .wb-body { grid-template-columns: minmax(0,1fr); }
  #view-sourcing .wb-detail { border-left: 0; border-top: 1px solid var(--line); }
  .ops-main-grid { grid-template-columns: minmax(0,1fr); }
  .bid-kpi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .profit-grid { grid-template-columns: minmax(0,1fr); }
  .profit-side { position: static; }
}
@media (max-width: 820px) {
  .sidebar { position: static; width: 100%; padding: 10px 12px; gap: 10px; flex-direction: row; align-items: center; overflow-x: auto; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0; border: 0; }
  .sidebar .brand-mark { width: 30px; height: 30px; }
  .sidebar .brand-text, .sidebar .side-card, .sidebar .side-foot { display: none; }
  .erp-nav { display: flex; flex: none; gap: 8px; overflow: visible; }
  .nav-module > .nav-module-items { display: flex; }
  .nav-module .nav-item { min-height: 38px; font-size: 15px; padding: 7px 10px; }
  .main { width: 100%; margin-left: 0; padding: 0 16px 28px; }
  .main > .topbar { position: relative; display: flex; flex-wrap: wrap; gap: 12px; min-height: auto; margin: 0 -16px 20px; padding: 12px 16px; }
  .topbar .crumb { flex: 1; }
  .topbar .top-search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .topbar .top-actions { flex: 1 1 100%; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .topbar .store-scope { flex: 1; max-width: 240px; }
  .topbar .store-scope .select { width: 100%; max-width: none; }
  .topbar .user-box { padding-left: 8px; gap: 5px; }
  .section-head { flex-direction: row; align-items: start; flex-wrap: wrap; }
  .section-head h2, .profit-head h2 { font-size: 22px; }
  .section-head .head-actions { flex-wrap: wrap; }
  .card { padding: 16px; }
  .card-head { flex-wrap: wrap; }
  .ops-bottom-grid { grid-template-columns: minmax(0,1fr); }
  #view-dashboard .ops-kpi-grid { gap: 10px; }
  #view-dashboard .ops-kpi { padding: 14px; }
  #view-dashboard .ops-kpi-value { font-size: 24px; }
  .ops-spark { display: none; }
  .dashboard-insights { flex-wrap: wrap; }
  .dashboard-insights > a { margin-left: 0; }
  #view-products .product-filters { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  #view-products .product-filters > :first-child { grid-column: 1 / -1; }
  .purchase-toolbar { padding: 14px; }
  .purchase-toolbar-left, .purchase-toolbar-right { width: 100%; }
  .batch-actions { width: 100%; }
  .sourcing-workflow { padding: 12px; gap: 8px; }
  .sourcing-workflow button { align-items: start; gap: 7px; padding: 6px 2px; }
  .sourcing-workflow small { display: none; }
  .sourcing-workflow strong { font-size: 12px; }
  .profit-head { gap: 12px; flex-wrap: wrap; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); }
  .modal-head { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-body > .form-grid > .form-actions, .listing-confirm-actions, .listing-dialog > .form-actions { bottom: -16px; margin-bottom: -16px; padding-bottom: 16px; }
}
@media (max-width: 520px) {
  .topbar .store-scope { max-width: none; flex-basis: calc(100% - 70px); }
  .topbar .user-box { width: 100%; justify-content: flex-end; padding: 8px 0 0; border: 0; border-top: 1px solid var(--line); }
  .topbar .top-search { order: 0; }
  #view-dashboard .ops-kpi-grid { grid-template-columns: minmax(0,1fr); }
  .dashboard-date { display: block; margin: 4px 0 0; }
  .bid-kpi-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .bid-kpi { padding: 12px 16px; }
  .bid-kpi-value { margin: 3px 0; font-size: 22px; }
  .bid-switch-card { flex-wrap: wrap; }
  .bid-search { min-width: 0; max-width: none; }
  .bid-filter-group { gap: 6px; width: 100%; }
  .bid-filter-divider { display: none; }
  #view-products .product-filters { grid-template-columns: minmax(0,1fr); }
  #view-products #productSummary { grid-template-columns: minmax(0,1fr); }
  .profit-fields.cols-5, .profit-fields.cols-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profit-radio-wrap { flex-wrap: wrap; }
  .auth-gate { padding: 16px; }
  .auth-card { padding: 24px; }
  .auth-head { margin-bottom: 20px; }
  .seg-tabs button { padding-inline: 12px; }
  .sourcing-workflow button > span { width: 22px; height: 22px; }
  .sourcing-workflow button { gap: 5px; }
  #view-sourcing .wb-search .search-input-wrap { flex-basis: 100%; }
  #view-sourcing .wb-search .select { flex: 1; }
  .dashboard-insights { gap: 10px; }
  .form-row { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
body.modal-open { overflow: hidden; }
.monitor-state { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.monitor-state > span { font-size: 11px; }
.text-success { color: var(--green); }
#view-sourcing #searchBtn { background: var(--brand); border-color: var(--brand); box-shadow: none; }
#view-sourcing #searchBtn:hover { background: var(--brand-hover); border-color: var(--brand-hover); transform: none; }
#view-sourcing #searchBtn::after { display: none; }
.profit-head-actions .button { border-radius: 6px; }
@media (max-width: 520px) {
  .topbar .store-scope { flex-basis: auto; flex-grow: 1; }
  .topbar .store-scope .select { min-width: 0; }
}

/* 选品工作台：标题与页签同行，保留三步引导，把首屏高度留给候选商品。 */
#view-sourcing .sourcing-page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
#view-sourcing .sourcing-head { min-height: 0; margin: 0; }
#view-sourcing .sourcing-head h2 { font-size: 22px; }
#view-sourcing .sourcing-head p { margin-top: 3px; }
#view-sourcing #sourcingTabs { flex: none; margin: 0; }
#view-sourcing .sourcing-workflow { margin-bottom: 12px; padding: 10px 16px; }
#view-sourcing .workbench { margin-top: 0; gap: 8px; border: 0; background: transparent; }
#view-sourcing .wb-search { padding: 12px 14px 9px; gap: 7px 10px; border: 1px solid var(--line); border-radius: 8px; }
#view-sourcing .wb-search .search-input-wrap input { padding-block: 8px; }
#view-sourcing .wb-search-hint { min-height: 14px; line-height: 1.4; padding-left: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
#view-sourcing .wb-keywords { flex-wrap: nowrap; min-width: 0; overflow-x: auto; max-width: 100%; margin: 0; padding: 3px 0 5px; scrollbar-width: thin; }
#view-sourcing .wb-keyword { flex: 0 0 auto; max-width: 190px; padding: 4px 10px; box-shadow: none; }
#view-sourcing .wb-keyword.active { background: var(--brand); }
#view-sourcing .wb-body { grid-template-columns: minmax(0,1fr) 360px; gap: 14px; }
#view-sourcing .wb-main, #view-sourcing .wb-detail { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
#view-sourcing .wb-list-head { padding: 11px 14px; }
#view-sourcing .p-row { grid-template-columns: 18px 48px minmax(0,1fr) 76px; padding: 10px 14px; gap: 10px; }
#view-sourcing .p-row .thumb { width: 48px; height: 48px; border-radius: 7px; }
#view-sourcing .p-row-title { font-size: 13px; font-weight: 600; }
#view-sourcing .p-row-main { gap: 3px; }
#view-sourcing .wb-detail { padding: 16px; top: 84px; }
@media (min-width: 821px) {
  .main:has(> #view-sourcing:not([hidden])) > .topbar { margin-bottom: 16px; }
}
@media (max-width: 1180px) {
  #view-sourcing .sourcing-head p { max-width: 270px; }
  #view-sourcing .wb-body { grid-template-columns: minmax(0,1fr) 330px; }
}
@media (max-width: 1080px) {
  #view-sourcing .wb-body { grid-template-columns: minmax(0,1fr); }
  #view-sourcing .wb-detail { position: static; }
}
@media (max-width: 820px) {
  #view-sourcing .sourcing-page-head { flex-wrap: wrap; gap: 12px; }
  #view-sourcing .sourcing-head p { max-width: none; }
  #view-sourcing .sourcing-workflow { padding: 10px 12px; }
  #view-sourcing .wb-list-head { gap: 8px; }
}
@media (max-width: 520px) {
  #view-sourcing .p-row { grid-template-columns: 16px 42px minmax(0,1fr) 64px; gap: 8px; padding: 10px; }
  #view-sourcing .p-row .thumb { width: 42px; height: 42px; }
  #view-sourcing .wb-list-actions { flex-wrap: wrap; }
  .sidebar .nav-tag { display: none; }
}
