/* ============================================================
   盛林 ERP · 设计系统
   浅色后台风格，强调信息密度与可读性
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e3e8f2;
  --border-strong: #cfd7e6;
  --text: #17223b;
  --muted: #6b7a93;
  --muted-2: #8f9cb0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #15803d;
  --success-soft: #e8f7ee;
  --warning: #b45309;
  --warning-soft: #fef3e2;
  --danger: #c62828;
  --danger-soft: #fdeaea;
  --info: #0e7490;
  --info-soft: #e3f6fa;
  --violet: #6d28d9;
  --violet-soft: #f1ecfe;
  --neutral-soft: #eef1f7;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(23, 34, 59, 0.04);
  --shadow: 0 4px 16px rgba(23, 34, 59, 0.07);
  --shadow-lg: 0 18px 48px rgba(23, 34, 59, 0.16);
  --sidebar-w: 228px;
  --topbar-h: 62px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
a {
  color: var(--primary);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #d3dae6;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #b9c3d4;
  background-clip: content-box;
}

/* ---------- 启动态 ---------- */
.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  color: var(--muted);
}
.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 登录 / 注册 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.auth-hero {
  background: linear-gradient(155deg, #1b3a8c 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  right: -180px;
  bottom: -200px;
}
.auth-hero::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  left: -90px;
  top: 22%;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}
.auth-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.32);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}
.auth-hero h1 {
  font-size: 36px;
  line-height: 1.32;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.auth-hero p {
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  max-width: 430px;
  margin: 0;
  position: relative;
  z-index: 1;
}
.auth-points {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  z-index: 1;
  margin-top: 34px;
}
.auth-point {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}
.auth-point .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 11px;
  flex: 0 0 22px;
  margin-top: 1px;
}
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}
.auth-card {
  width: 100%;
  max-width: 384px;
}
.auth-card h2 {
  font-size: 24px;
  margin-bottom: 6px;
}
.auth-sub {
  color: var(--muted);
  margin: 0 0 26px;
  font-size: 13.5px;
}
.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}
.auth-switch button {
  background: none;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  padding: 0 2px;
}
.auth-hint {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field > label {
  font-size: 13px;
  font-weight: 600;
  color: #33415c;
}
.field > label .req {
  color: var(--danger);
  margin-left: 2px;
}
.field .hint {
  font-size: 12px;
  color: var(--muted-2);
}
/* 行内复选框，如「底价按进货价 +15% 自动计算」 */
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}
.check-inline input[type='checkbox'] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}
.input:disabled,
.select:disabled {
  background: #f2f5fa;
  color: var(--muted);
  cursor: not-allowed;
}
/* 只读输入框：用于自动算出的底价，视觉上要能看出「不用填」 */
.input[readonly] {
  background: #f5f7fb;
  color: var(--muted);
  cursor: default;
}
.textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.6;
}
.input.invalid,
.select.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}
.field-error {
  color: var(--danger);
  font-size: 12px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
/* 四列表单：窄屏自动折行，不写死断点 */
.form-row-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--primary-dark);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  background: #fff;
  border-color: var(--border-strong);
  color: #33415c;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-danger {
  background: var(--danger);
}
.btn-danger:hover {
  background: #a51f1f;
}
.btn-success {
  background: var(--success);
}
.btn-success:hover {
  background: #11692f;
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 7px;
}
.btn-block {
  width: 100%;
}
.btn-link {
  background: none;
  border: 0;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
}
.btn-link:hover {
  text-decoration: underline;
}

/* ---------- 应用骨架 ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sb-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(140deg, #2563eb, #1b3a8c);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 34px;
}
.sb-name {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
}
.sb-tenant {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 132px;
}
.sb-nav {
  padding: 12px 10px;
  flex: 1;
}
.sb-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding: 14px 10px 6px;
  text-transform: uppercase;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #44536e;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
  position: relative;
}
.sb-item:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.sb-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 650;
}
.sb-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.sb-item svg {
  flex: 0 0 17px;
  opacity: 0.85;
}
.sb-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 5px;
}
.sb-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 9px;
}
.sb-user:hover {
  background: var(--surface-2);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 32px;
}
.sb-user-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.sb-user-role {
  font-size: 11.5px;
  color: var(--muted);
}

.main-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 680;
}
.topbar .crumb {
  font-size: 12.5px;
  color: var(--muted);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #56637c;
}
.icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.menu-toggle {
  display: none;
}
.content {
  padding: 24px 26px 48px;
  max-width: 1560px;
  width: 100%;
}

/* ---------- 卡片 / 区块 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  font-size: 14.5px;
  font-weight: 680;
}
.card-head .sub {
  font-size: 12.5px;
  color: var(--muted);
}
.card-head .spacer {
  margin-left: auto;
}
.card-body {
  padding: 18px;
}
.card-body.tight {
  padding: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 14px;
}
.section-title h2 {
  font-size: 15.5px;
}

/* ---------- 指标卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
/* .cols-3 比媒体查询里的 .stat-grid 更具体，不单独写这两条，手机上会被挤成三小格 */
@media (max-width: 1180px) {
  .stat-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .stat-grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

.stat-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-label {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-value {
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.02em;
  margin-top: 6px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-value small {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 3px;
}
.stat-foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.stat-accent {
  position: absolute;
  right: -26px;
  top: -26px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: 0.6;
}
.stat.tone-success .stat-accent {
  background: var(--success-soft);
}
.stat.tone-warning .stat-accent {
  background: var(--warning-soft);
}
.stat.tone-danger .stat-accent {
  background: var(--danger-soft);
}
.stat.tone-info .stat-accent {
  background: var(--info-soft);
}

/* ---------- 待办 ---------- */
.todo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.todo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.todo:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.todo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
}
.todo-body {
  min-width: 0;
}
.todo-num {
  font-size: 20px;
  font-weight: 720;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.todo-text {
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.03em;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.table tbody tr:hover {
  background: #f8faff;
}
table.table tbody tr:last-child td {
  border-bottom: 0;
}
table.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.table .strong {
  font-weight: 650;
}
/* 仓库管理：公司仓库 / 外部仓库的分组标题行（夹在 tbody 里，不给 hover 变色） */
table.table tbody tr.group-row:hover {
  background: transparent;
}
table.table tr.group-row td {
  background: var(--surface-2);
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
}
table.table tr.group-row .group-name {
  font-weight: 700;
  color: var(--text);
  margin-right: 10px;
}
table.table tr.group-row .group-sub {
  font-size: 12px;
  color: var(--muted);
}
/* 原生 select 的分组标题（optgroup）：默认那行灰字太淡，勾一下让它像标题 */
select optgroup {
  font-weight: 700;
  color: var(--muted);
}
select option {
  font-weight: 400;
  color: var(--text);
}
/* 列多的表（订单列表）：收一点内边距，1280 屏也能一屏放下不横向滚动 */
table.table-dense th,
table.table-dense td {
  padding-left: 8px;
  padding-right: 8px;
}
/* 均分列：工资单、固定成本明细这类「列少、每列就一句话」的表，
   自动布局会按内容分配（姓名 3 字就把列压得很窄，备注一长又抢走半张表），
   四列宽窄不一看着很乱。fixed 布局下第一行不写宽度 = 各列等分，
   所以只留这一个开关，单元格里不要再写 width（写了就按写的分）。 */
table.table-eq {
  table-layout: fixed;
}
/* 备注偶尔很长：均分后列宽固定，长串（URL、长单号）必须能断行，否则顶破表格 */
table.table-eq td {
  overflow-wrap: anywhere;
}
/* 均分后每列一样宽，金额再靠右就紧贴着下一列的备注（「¥6,000.00 示例科目…」会连成一句），
   居中让左右留白相等，四列的视觉重心才对得齐；表头跟着一起居中，不然表头偏右、数字居中 */
table.table-eq th.num,
table.table-eq .num {
  text-align: center;
}
/* 操作列里的「改 / 删」跟着列走，均分后靠右会和右边距挤在一起，居中最稳 */
table.table-eq td.row-acts {
  text-align: center;
  white-space: nowrap;
}

/* 订单列表：列宽按「这一列装什么」定比例，十列加起来正好 100%，表格永远铺满容器。
   自动布局时富余宽度会被客户、物流单号两列按内容比例吃掉（12 字的名字把客户列撑到
   260px，物流单号只有「—」也占 86px），窗口一窄就把最右边的「操作」挤出可视区。
   fixed + 百分比后，窗口多宽都按同一份比例分，不会横向溢出，也不会某一列空一大片。
   min-width 兜住最窄一档：再窄就横向滚动，不把按钮压到叠字。
   单号本身已经带日期（2026-11-9-004），所以没有单独的日期列，省下的宽度分给客户与操作。 */
.table-orders {
  table-layout: fixed;
  min-width: 1060px;
}
.table-orders .col-code {
  width: 12%;
}
.table-orders .col-cust {
  width: 16.4%;
}
.table-orders .col-amt {
  width: 9%;
}
.table-orders .col-recv {
  width: 6.8%;
}
.table-orders .col-unpaid {
  width: 7.2%;
}
.table-orders .col-status {
  width: 8.8%;
}
.table-orders .col-stage {
  width: 9.8%;
}
.table-orders .col-person {
  width: 7%;
}
.table-orders .col-track {
  width: 6.5%;
}
.table-orders .col-act {
  width: 16.5%;
}

/* 物流单号：点一下跳快递100 查物流，虚线提示可点 */
.tracking-link {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  white-space: nowrap;
}
.tracking-link:hover {
  color: var(--primary-dark);
  border-bottom-style: solid;
}

table.table .mono {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #4a5878;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.cell-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: #4d5b75;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.badge.none::before {
  display: none;
}
.badge.tone-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge.tone-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge.tone-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.tone-info {
  background: var(--info-soft);
  color: var(--info);
}
.badge.tone-primary {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.badge.tone-violet {
  background: var(--violet-soft);
  color: var(--violet);
}
.badge.tone-neutral {
  background: var(--neutral-soft);
  color: #5b6880;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--neutral-soft);
  color: #55637d;
}
.pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill.warning {
  background: var(--warning-soft);
  color: var(--warning);
}
/* 产品层级标记：主要产品用主色强调，次要产品保持中性 */
.pill.tier-main {
  background: var(--primary-soft);
  color: var(--primary);
}
.pill.tier-secondary {
  background: var(--neutral-soft);
  color: #6b7891;
}
/* 成交价相对标准价的折扣提示 */
.price-tag {
  font-size: 11.5px;
  font-weight: 650;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--success-soft);
  color: var(--success);
}
.price-tag.up {
  background: var(--primary-soft);
  color: var(--primary);
}
.price-tag.floor {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .grow {
  flex: 1;
  min-width: 160px;
}
/* 下拉与搜索框同高，工具栏一行看起来齐平 */
.toolbar .select-sm {
  height: 39px;
  padding-top: 0;
  padding-bottom: 0;
}
.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 340px;
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  outline: none;
}
.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}
.select-sm {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  outline: none;
  min-width: 118px;
}
.select-sm:focus {
  border-color: var(--primary);
}

/* ---------- 就地下拉（替换原生弹层） ----------
   原生 select / 月份选择器由系统绘制，位置不受页面控制，弹窗里、窄屏上容易
   弹到屏幕边缘。这里保留原生元素负责取值，只盖一层触发器，点开后在控件
   正下方展开自绘面板。 */
.dd {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}
.field > .dd {
  width: 100%;
}
.dd > select,
.dd > input[type="month"] {
  display: block;
  width: 100%;
  font: inherit;
  color: transparent !important;
  caret-color: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.dd > select option {
  color: var(--text);
}
.dd > input[type="month"] {
  /* 固有宽度兜底，避免 shrink-to-fit 的 .dd 把输入框压成 0 宽 */
  min-width: 140px;
}
.dd > input[type="month"]::-webkit-calendar-picker-indicator {
  display: none;
}

/* 日期输入：与月份同款处理，原生弹层盖住，改成控件下方自绘日历 */
.dd > input[type="date"] {
  display: block;
  width: 100%;
  font: inherit;
  color: transparent !important;
  caret-color: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  min-width: 132px;
}
.dd > input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}
.dd-trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}
.dd-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.dd-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-text.is-empty {
  color: var(--muted-2);
}
.dd-arrow {
  flex: 0 0 auto;
  opacity: 0.55;
  transition: transform 0.15s ease;
}
.dd.open .dd-arrow {
  transform: rotate(180deg);
}
.dd.is-disabled > .dd-trigger,
.dd > select:disabled + .dd-trigger,
.dd > input:disabled + .dd-trigger {
  cursor: not-allowed;
  color: var(--muted);
}

.dd-panel {
  position: fixed;
  z-index: 10050;
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(23, 34, 59, 0.18);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.dd-panel.is-open {
  opacity: 1;
  transform: none;
}
.dd-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.dd-opt:hover,
.dd-opt:focus-visible {
  background: var(--primary-soft);
  color: var(--primary-dark);
  outline: none;
}
.dd-opt.is-selected {
  font-weight: 600;
  color: var(--primary-dark);
}
.dd-opt-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 月份面板 */
.dd-panel-month {
  padding: 10px;
}
.dd-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.dd-cal-year {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
}
.dd-cal-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.dd-cal-nav:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.dd-cal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.dd-cal-cell {
  padding: 8px 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.dd-cal-cell:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.dd-cal-cell.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 日期面板：7 列日格 + 星期表头 + 今天/清空 */
.dd-panel-date {
  padding: 10px;
}
.dd-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: center;
}
.dd-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.dd-cal-days .dd-cal-cell {
  padding: 7px 0;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.dd-cal-cell.is-out {
  color: var(--muted-2);
  background: transparent;
}
.dd-cal-cell.is-today {
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 650;
}
.dd-cal-cell.is-today.is-selected {
  color: #fff;
}
.dd-cal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.dd-cal-link {
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--primary);
  cursor: pointer;
}
.dd-cal-link:hover {
  text-decoration: underline;
}
/* 打印时恢复原生控件外观，否则透明文字打出来是空白 */
@media print {
  .dd > select,
  .dd > input[type="month"],
  .dd > input[type="date"] {
    color: var(--text) !important;
    -webkit-appearance: auto;
    appearance: auto;
  }
  .dd-trigger {
    display: none;
  }
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover {
  color: var(--primary);
}
.tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}
.tab .count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 9px;
  background: var(--neutral-soft);
  font-size: 11px;
  color: #55637d;
}
.tab.active .count {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

/* ---------- 空状态 / 加载 ---------- */
.empty {
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--muted-2);
}
.empty h4 {
  font-size: 14.5px;
  color: #3d4a63;
  margin-bottom: 4px;
}
.empty p {
  margin: 0 0 16px;
  font-size: 13px;
}
.skeleton {
  background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 50%, #eef1f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 6px;
  height: 14px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.pager .spacer {
  margin-left: auto;
}

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  z-index: 100;
  overflow-y: auto;
  animation: fade 0.16s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  animation: pop 0.18s ease;
  margin-bottom: 40px;
}
.modal.wide {
  max-width: 860px;
}
.modal.xwide {
  max-width: 1040px;
}
@keyframes pop {
  from {
    transform: translateY(10px) scale(0.99);
    opacity: 0;
  }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-size: 16px;
}
.modal-head p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.modal-close {
  margin-left: auto;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-body {
  padding: 20px 22px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  min-width: 250px;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 12px 15px;
  font-size: 13.5px;
  animation: slideIn 0.2s ease;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
@keyframes slideIn {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}
.toast.success {
  border-left-color: var(--success);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.warning {
  border-left-color: var(--warning);
}
.toast-title {
  font-weight: 650;
  margin-bottom: 2px;
}
.toast-msg {
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.6;
}

/* ---------- 详情布局 ---------- */
/*
 * 订单详情原来是「左边明细 + 右边 306px 窄栏」，合同、项目跟踪、金额、客户备注
 * 全塞在那条窄柱子里，看一单要往下滚三四屏。老板把右栏整个圈出来写「移到这里 两行排布」，
 * 所以改成单栏：明细 → 流程 → 四张卡两列排（合同 / 项目跟踪 一行，金额 / 客户备注 一行）。
 */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
/* 栅格子项默认 min-width:auto，里面表格一宽就把整页顶出屏幕（手机上尤其明显）；
   放开后表格在 .table-wrap 里自己横向滚，页面不会跟着变宽。 */
.detail-grid > *,
.detail-cards > * {
  min-width: 0;
}
.detail-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
/* 卡片自己带着 margin-bottom（单栏堆叠时用），进了网格由 gap 统一负责，这里清掉 */
.detail-cards > .card {
  margin-bottom: 0 !important;
}
.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  text-align: right;
  font-weight: 550;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13.5px;
}
.summary-line.total {
  border-top: 1px dashed var(--border-strong);
  margin-top: 6px;
  padding-top: 11px;
  font-size: 15px;
  font-weight: 700;
}
.summary-line.total .amount {
  color: var(--danger);
  font-size: 19px;
}
.timeline {
  position: relative;
  padding-left: 18px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 16px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border-strong);
}
.timeline-item.done::before {
  border-color: var(--primary);
  background: var(--primary);
}
.timeline-item .t {
  font-size: 10.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.timeline-item .d {
  font-size: 13px;
  font-weight: 600;
  margin-top: 1px;
}
.timeline-item .m {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 流程进度：横向步骤条 ---------- */
/*
 * 原来是竖排时间轴，五步要往下扫一屏才知道走到哪。
 * 改成横向五步：圆点在上、名字与时间在下，一屏看全；窄屏自动转回竖排。
 */
.flow-steps {
  display: grid;
  grid-template-columns: repeat(var(--flow-n, 5), minmax(0, 1fr));
  align-items: start;
  padding: 2px 0 0;
}
.flow-step {
  position: relative;
  min-width: 0;
  padding-right: 10px;
}
/* 连线：从本步圆点右缘接到下一步圆点左边，只有两端都完成才点亮 */
.flow-step::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 27px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
}
.flow-step:last-child::after {
  display: none;
}
.flow-step.line-done::after {
  background: var(--primary);
}
.flow-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.flow-step.is-done .flow-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.flow-step.is-current .flow-dot {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.flow-step.is-danger .flow-dot {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 0 4px var(--danger-soft);
}
.flow-t {
  margin-top: 9px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.flow-step:not(.is-done) .flow-t {
  color: var(--muted);
}
.flow-step.is-danger .flow-t {
  color: var(--danger);
}
.flow-d {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.flow-step:not(.is-done) .flow-d {
  color: var(--muted-2);
}
.flow-m {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.flow-info {
  min-width: 0;
}

@media (max-width: 900px) {
  .flow-steps {
    grid-template-columns: 1fr;
  }
  .flow-step {
    display: flex;
    gap: 12px;
    padding: 0 0 18px;
  }
  .flow-step:last-child {
    padding-bottom: 0;
  }
  .flow-step::after {
    top: 24px;
    left: 10px;
    right: auto;
    bottom: 4px;
    width: 2px;
    height: auto;
  }
  .flow-dot {
    flex: none;
  }
  .flow-t {
    margin-top: 0;
  }
}

/* ---------- 图表 ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 176px;
  padding: 8px 4px 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}
.bar-stack {
  width: 100%;
  max-width: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  height: 100%;
}
.bar {
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}
.bar.alt {
  background: #c7d7fb;
}
.bar-label {
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}
.bar-val {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* 经营报表的月度柱：整列是链接，悬停给底色，和工作台年度图一个手感 */
a.bar-col {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background 0.15s ease;
}
a.bar-col:hover {
  background: #f2f6fd;
}
a.bar-col:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.bar-col.is-empty {
  cursor: default;
}
.bar-chart .bar-label.is-current {
  color: var(--primary);
  font-weight: 650;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}
.legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
}

.rank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  font-size: 13px;
}
.rank-no {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--neutral-soft);
  color: #5b6880;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 20px;
}
.rank-item:nth-child(1) .rank-no {
  background: #fde9c9;
  color: #a3670a;
}
.rank-item:nth-child(2) .rank-no {
  background: #e6ebf4;
  color: #55637d;
}
.rank-item:nth-child(3) .rank-no {
  background: #f6e2d3;
  color: #9a5326;
}
.rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-amt {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- 明细编辑行 ---------- */
.line-items {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.line-items table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  /* 表头写了列宽百分比，但自动布局会按内容抢（商品名一长就把「仓库」压成 60px，
     仓库名只剩「公司1…」）。fixed 后严格按百分比分，仓库整串名字才显示得全。 */
  table-layout: fixed;
}
.line-items th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.line-items td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.line-items tr:last-child td {
  border-bottom: 0;
}
.line-items .input,
.line-items .select {
  padding: 6px 8px;
  font-size: 12.5px;
}
/* 明细行的仓库列：一件货从哪个仓出（跨仓单每行可以不一样）。
   列宽固定 17%，仓库名（「公司1号仓库」）要能整串显示，窄了就只留下拉箭头。 */
.line-items .wh-cell {
  /* 百分比宽度在 fixed 单元格里被 Chrome 当 auto 处理（实测 100% 仍只有内容宽），
     这里给显式像素：够放「公司1号仓库」7 个字 + 下拉箭头 */
  width: 116px;
  /* 仓库名比数字长（「公司1号仓库」7 个字），压一档字号和内边距才塞得下整串 */
  padding: 6px 4px;
  font-size: 12px;
}
/* 明细工具条：「添加商品」+「从 [仓] 挑商品」+ 说明，窄屏自动折行 */
.line-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.li-del {
  border: 0;
  background: none;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 5px;
}
.li-del:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
.totals-box {
  display: flex;
  justify-content: flex-end;
  gap: 26px;
  padding: 12px 4px 0;
  font-size: 13px;
}
.totals-box .k {
  color: var(--muted);
  margin-right: 6px;
}
.totals-box .v {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.totals-box .v.big {
  color: var(--danger);
  font-size: 17px;
}

/* ---------- 角色卡 ---------- */
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.role-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface-2);
}
.role-card .r-name {
  font-weight: 650;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.role-card .r-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 提示条 ---------- */
.alert {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid;
}
.alert.info {
  background: var(--info-soft);
  border-color: #bfe7f0;
  color: #0b5f75;
}
.alert.warning {
  background: var(--warning-soft);
  border-color: #f5ddb5;
  color: #8a4708;
}
.alert.danger {
  background: var(--danger-soft);
  border-color: #f6cfcf;
  color: #97211f;
}
.alert.success {
  background: var(--success-soft);
  border-color: #c3e9d1;
  color: #12643a;
}
.alert strong {
  font-weight: 700;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .stat-grid,
  .todo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chart-grid,
  .detail-grid,
  .detail-cards {
    grid-template-columns: 1fr;
  }
  /* 单栏时子项默认 min-width:auto，里面的表格一宽就会把整页顶出屏幕；
     放开后表格在 .table-wrap 里自己横向滚动 */
  .chart-grid > * {
    min-width: 0;
  }
}
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: none;
  }
  .menu-toggle {
    display: grid;
  }
  .auth-wrap {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    display: none;
  }
  .content {
    padding: 16px 16px 40px;
  }
  .topbar {
    padding: 0 16px;
  }
  .form-row,
  .form-row-3,
  .role-grid {
    grid-template-columns: 1fr;
  }
  .stat-grid,
  .todo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-value {
    font-size: 21px;
  }
}
@media (max-width: 560px) {
  .stat-grid,
  .todo-grid {
    grid-template-columns: 1fr;
  }
  .toolbar .search {
    max-width: none;
  }
}
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.36);
  z-index: 55;
}

/* ---------- 权限配置 ---------- */
.perm-layout {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.perm-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.perm-role-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
}
.perm-role-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.perm-role-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.perm-role-item .pr-body {
  min-width: 0;
  flex: 1;
}
.perm-role-item .pr-name {
  font-weight: 650;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.perm-role-item .pr-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perm-role-item .pr-count {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--neutral-soft);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}
.perm-role-item.active .pr-count {
  background: rgba(37, 99, 235, 0.14);
  color: var(--primary-dark);
}

.perm-module {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
}
.perm-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.perm-module-head .pm-title {
  font-weight: 650;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.perm-module-head .pm-desc {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}
.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.perm-item:last-child {
  border-bottom: none;
}
.perm-item.disabled {
  opacity: 0.55;
}
.perm-item .pi-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.perm-item .pi-label {
  font-size: 13px;
  font-weight: 550;
}
.perm-item .pi-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}
.perm-item .pi-tag {
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--mono);
  background: var(--neutral-soft);
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 6px;
}

.perm-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex: 0 0 38px;
  margin-top: 1px;
}
.perm-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.perm-switch span {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 11px;
  transition: background 0.16s;
  pointer-events: none;
}
.perm-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 34, 59, 0.25);
  transition: transform 0.16s;
}
.perm-switch input:checked + span {
  background: var(--primary);
}
.perm-switch input:checked + span::after {
  transform: translateX(16px);
}
.perm-switch input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.perm-switch input:disabled {
  cursor: not-allowed;
}
.perm-switch input:disabled + span {
  opacity: 0.5;
}

.perm-savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.perm-savebar .ps-text {
  flex: 1;
  min-width: 180px;
  font-size: 12.5px;
  color: var(--muted);
}
.perm-savebar.dirty .ps-text {
  color: var(--warning);
  font-weight: 600;
}

@media (max-width: 900px) {
  .perm-layout {
    grid-template-columns: 1fr;
  }
  .perm-roles {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .perm-roles::-webkit-scrollbar {
    display: none;
  }
  .perm-role-item {
    flex: 0 0 auto;
    min-width: 132px;
  }
  .perm-role-item .pr-meta {
    display: none;
  }
  .perm-savebar {
    position: static;
  }
}

/* ============================================================
   手机端适配（iPhone / Android）
   ============================================================ */

/* iOS Safari 地址栏伸缩会让 100vh 溢出屏幕，优先使用动态视口单位 */
@supports (height: 100dvh) {
  .boot,
  .sidebar {
    height: 100dvh;
  }
  .app-shell,
  .auth-wrap {
    min-height: 100dvh;
  }
  .modal-backdrop {
    padding-top: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* 刘海屏 / 底部指示条安全区，避免内容被遮挡 */
@supports (padding: env(safe-area-inset-left)) {
  .topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .sidebar {
    padding-left: env(safe-area-inset-left);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .content {
    padding-bottom: calc(44px + env(safe-area-inset-bottom));
  }
}

/* 触摸屏：去掉点击高亮、按下有轻微反馈，更像原生应用 */
@media (hover: none) {
  .btn,
  .icon-btn,
  .tab,
  .nav-item,
  .sb-user {
    -webkit-tap-highlight-color: transparent;
  }
  .btn:active:not(:disabled) {
    transform: scale(0.985);
  }
  .nav-item:active {
    background: var(--primary-soft);
  }
}

@media (max-width: 900px) {
  /* 输入框字号必须 ≥16px，否则 iOS 聚焦时会自动放大整页 */
  .input,
  .select,
  .textarea,
  .search input,
  input[type='date'],
  input[type='number'] {
    font-size: 16px;
  }

  /* 触控目标不低于 40px，手指点得准 */
  .btn {
    min-height: 42px;
    padding: 10px 16px;
  }
  .btn-sm {
    min-height: 34px;
  }
  .icon-btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* 表格：横向滑动 + 惯性滚动，列不换行保证数字不被截断 */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  table.table {
    font-size: 13px;
  }
  table.table th,
  table.table td {
    white-space: nowrap;
  }

  /* 顶部栏：标题与面包屑压缩，避免挤成两行 */
  .topbar h1 {
    font-size: 17px;
  }
  .crumb {
    font-size: 12px;
  }

  /* 弹窗贴近屏幕边缘，按钮不被挤出可视区 */
  .modal-backdrop {
    padding-left: 10px;
    padding-right: 10px;
  }
  .modal {
    border-radius: 14px;
  }
  .modal-body {
    -webkit-overflow-scrolling: touch;
  }
  .modal-foot {
    flex-wrap: wrap;
  }
  .modal-foot .btn {
    flex: 1;
  }

  /* 标签页可横向滑动，不折行 */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }

  /* 登录页：去掉左右留白，表单单列铺满 */
  .auth-form-side {
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
    align-items: flex-start;
  }
}

/* ---------------- 权限配置页：窄屏适配 ---------------- */
@media (max-width: 900px) {
  .perm-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  /* 岗位列表改为横向滑动标签，避免占掉半屏 */
  .perm-roles {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .perm-roles::-webkit-scrollbar {
    display: none;
  }
  .perm-role-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 136px;
    min-height: 44px;
    padding: 9px 12px;
  }
  .perm-role-item .pr-meta {
    display: none;
  }
  .perm-savebar {
    margin-bottom: calc(4px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .perm-item {
    padding: 10px 12px;
    gap: 10px;
  }
  .perm-item .pi-tag {
    display: none;
  }
  .perm-module-head .pm-desc {
    display: none;
  }
  .perm-savebar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .perm-savebar .ps-text {
    min-width: 0;
  }
  .perm-savebar .btn {
    width: 100%;
    min-height: 42px;
  }
}


/* ---------------- 经营损益（报表页） ---------------- */
/* 卡头里「经营损益」四个字不许折行；说明文字在窄屏让位给按钮 */
#profit-card > .card-head h3 {
  white-space: nowrap;
}
#profit-card > .card-head .sub {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
@media (max-width: 1180px) {
  #profit-card > .card-head .sub {
    display: none;
  }
}

/* 年度 / 月度各一行六个 KPI，是老板 Excel 里的那张表；窄屏依次回落到 3 列、1 列 */
.pf-kpi-row + .pf-kpi-row {
  margin-top: 16px;
}
.pf-kpi-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 9px;
}
.pf-kpi-head strong {
  font-size: 13px;
  font-weight: 660;
  color: var(--text);
}
.pf-kpi-head .sub {
  font-size: 12px;
  color: var(--muted);
}

/* 一行五张跳转框（销售订单 / 财务审核顶部）：4 张在 1440 下已经铺满，
   加第 5 张必须收窄一档，否则要么挤成两行、要么金额被折行 */
.stat-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.stat-grid.cols-5 .stat {
  padding: 14px 15px;
  min-width: 0;
}
.stat-grid.cols-5 .stat-label {
  font-size: 12px;
}
.stat-grid.cols-5 .stat-value {
  font-size: 21px;
  margin-top: 5px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.stat-grid.cols-5 .stat-foot {
  font-size: 11.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stat-grid.cols-5 .stat-accent {
  width: 68px;
  height: 68px;
  right: -20px;
  top: -20px;
}
/* .cols-5 比媒体查询里的 .stat-grid 更具体，手机断点要在这里单独写 */
@media (max-width: 1180px) {
  .stat-grid.cols-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 760px) {
  .stat-grid.cols-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .stat-grid.cols-5 {
    grid-template-columns: 1fr;
  }
}

.stat-grid.cols-6 {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
/* 一行六个，卡片比常规 KPI 窄：字号和内边距都要收，否则 ¥1,234,567.89 会顶到边 */
.stat-grid.cols-6 .stat {
  padding: 13px 14px;
}
.stat-grid.cols-6 .stat-label {
  font-size: 12px;
}
.stat-grid.cols-6 .stat-value {
  font-size: 19px;
  margin-top: 5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.stat-grid.cols-6 .stat-foot {
  font-size: 11px;
  line-height: 1.5;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 科目 + 金额不许从中间折行，要折就折在 · 处 */
.stat-grid.cols-6 .stat-foot .nb {
  white-space: nowrap;
}
.stat-grid.cols-6 .stat-accent {
  width: 62px;
  height: 62px;
  right: -18px;
  top: -18px;
}
@media (min-width: 1181px) {
  .stat-grid.cols-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}
@media (max-width: 620px) {
  .stat-grid.cols-6 {
    grid-template-columns: 1fr;
  }
}

/* 一行七张（老板 Excel 的年度 / 月度 / 历年度三排）：比六张再窄一档，
   标签、金额、脚注都跟着收，否则 ¥1,234,567.89 会顶出卡片 */
.stat-grid.cols-7 {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat-grid.cols-7 .stat {
  padding: 13px;
  min-width: 0;
}
.stat-grid.cols-7 .stat-label {
  font-size: 11.5px;
}
.stat-grid.cols-7 .stat-value {
  font-size: 18px;
  margin-top: 5px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.stat-grid.cols-7 .stat-foot {
  font-size: 11px;
  line-height: 1.5;
  margin-top: 5px;
  display: -webkit-box;
  /* 七列一窄，算式类脚注（净利 − 固定成本）会顶到第三行，留三行免得被截成省略号 */
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stat-grid.cols-7 .stat-foot .nb {
  white-space: nowrap;
}
.stat-grid.cols-7 .stat-accent {
  width: 56px;
  height: 56px;
  right: -16px;
  top: -16px;
}
/* 订单页这排七张是「可点跳转」的，右上角有箭头：标签给它让出 18px，别被箭头压住 */
.stat-grid.cols-7 .stat-link .stat-label {
  padding-right: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
@media (min-width: 1181px) {
  .stat-grid.cols-7 {
    grid-template-columns: repeat(7, 1fr);
  }
  /* 七列时列宽随视口变：1440 下约 157px，1280 下约 135px，字号跟着缩一档 */
  .stat-grid.cols-7 .stat-value {
    font-size: clamp(15px, 1.2vw, 18px);
  }
}
@media (max-width: 620px) {
  .stat-grid.cols-7 {
    grid-template-columns: 1fr;
  }
}

/* 订单页那排七个「跳转框」在手机上排两列：一张占一行的话，七行会把订单列表整个推下去 */
@media (max-width: 620px) {
  .stat-grid.boxes-nav {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-grid.boxes-nav .stat {
    padding: 11px 12px;
  }
  .stat-grid.boxes-nav .stat-foot {
    -webkit-line-clamp: 1;
  }
}

/* 一行八张（订单成本 / 员工工资 / 公司固定成本三项单列后，从七张变八张）：
   比七张再窄一档，金额字号跟着收，1440 下每张约 131px，¥1,234,567.89 也放得下 */
.stat-grid.cols-8 {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat-grid.cols-8 .stat {
  padding: 12px;
  min-width: 0;
}
.stat-grid.cols-8 .stat-label {
  font-size: 11.5px;
}
.stat-grid.cols-8 .stat-value {
  font-size: 17px;
  margin-top: 5px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.stat-grid.cols-8 .stat-foot {
  font-size: 10.5px;
  line-height: 1.5;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stat-grid.cols-8 .stat-foot .nb {
  white-space: nowrap;
}
.stat-grid.cols-8 .stat-accent {
  width: 52px;
  height: 52px;
  right: -15px;
  top: -15px;
}
@media (min-width: 1181px) {
  .stat-grid.cols-8 {
    grid-template-columns: repeat(8, 1fr);
  }
  .stat-grid.cols-8 .stat-value {
    font-size: clamp(14px, 1.05vw, 17px);
  }
}
@media (max-width: 620px) {
  .stat-grid.cols-8 {
    grid-template-columns: 1fr;
  }
}

/* 损益卡内的次级指标区（应收与售后）：虚线隔开，免得和上面两排 KPI 混成一片 */
/* 应收账款横条：三排 KPI 之后、固定成本之前，一条入口，不再占四张卡的位置 */
.pf-ar-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  margin: 16px 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.pf-ar-label {
  font-size: 12.5px;
  color: var(--muted);
}
.pf-ar-value {
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--danger);
}
.pf-ar-bar .sub {
  font-size: 12px;
  color: var(--muted-2);
}
.pf-ar-go {
  margin-left: auto;
  gap: 4px;
}
.pf-ar-go svg {
  width: 13px;
  height: 13px;
}

/* 工资小标签：一人一条，卡头直接给出「几个人 · 多少钱」，没录也一眼看得出来 */
.pf-cost-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pf-cost-head strong {
  font-size: 13.5px;
}
/* 按钮整组换行，不会剩一个孤零零的按钮挂在下一行 */
.pf-cost-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* 公司固定成本只留一行汇总：明细在「分析 → 公司固定成本」独立页看 */
.pf-cost-flat .pf-cost-head {
  margin-bottom: 0;
}
/* 这一行自 2026-11 起独占整行（工资表撤掉后不再和近 12 月表分左右两栏） */
.pf-fixed-row {
  margin-top: 18px;
}
.pf-inline-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.pf-inline-link:hover {
  text-decoration: underline;
}
.pf-other-sum {
  font-size: 13px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pf-chain-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pf-chain-head strong {
  font-size: 13.5px;
}
.pf-chain-head .sub {
  font-size: 12px;
  color: var(--muted-2);
}
/* 工资那一行给点底色：老板看链条时能一眼定位「人工花了多少」。
   链条改成整行后不再刷满一条黄带（太长、太吵），只从科目这一侧淡出去 */
.profit-line.is-salary {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  background: linear-gradient(90deg, var(--warning-soft), transparent 62%);
  border-radius: 6px;
  border-top-color: transparent;
}
.profit-line.is-salary .pl-label {
  color: #8a4708;
  font-weight: 620;
}
.profit-line.is-salary .pl-value {
  color: var(--warning);
}

/* 损益卡里的表已经独占整行，内边距回到宽松一档（别跟半栏时一样挤） */
#profit-card table.table th,
#profit-card table.table td {
  padding: 11px 14px;
}

/* 利润链条与近 12 月表各占整行：金额在右、科目在左，中间用点线连起来，
   全宽时才不会读丢行（原来挤在半栏，点线会短得看不见） */
.pf-chain.is-wide .profit-line {
  font-size: 13px;
}
.pf-chain.is-wide .profit-line .pl-label {
  display: flex;
  align-items: baseline;
  flex: 1;
  min-width: 0;
}
.pf-chain.is-wide .profit-line .pl-label::after {
  content: '';
  flex: 1;
  min-width: 24px;
  margin: 0 14px;
  border-bottom: 1px dotted var(--border-strong);
  transform: translateY(-3px);
}
/* 近 12 月表：紧跟链条，独立成段；月份列定宽，六个金额列均分整行 */
.pf-trend-head {
  margin-top: 22px;
}
/* 工资页 / 固定成本页也用这张表：月份列不折行，字略小一点够放 */
.pf-trend {
  font-size: 12.5px;
}
.pf-trend th:first-child,
.pf-trend td:first-child {
  white-space: nowrap;
}

/* 损益卡里这张表独占整行：月份列定宽，六个金额列均分整行 */
#profit-card .pf-trend {
  table-layout: fixed;
  min-width: 720px;
  font-size: 13px;
}
#profit-card .pf-trend th:first-child,
#profit-card .pf-trend td:first-child {
  width: 128px;
}
/* 七列在手机上放不下，表格自己会横滑；给一句提示，别让人以为只有三列 */
.pf-scroll-hint {
  display: none;
  font-size: 11.5px;
  color: var(--muted-2);
}
@media (max-width: 760px) {
  .pf-scroll-hint {
    display: inline;
  }
}

.profit-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 13px;
}
.profit-line + .profit-line {
  border-top: 1px dashed var(--border);
}
.profit-line .pl-label {
  color: var(--muted);
}
.profit-line .pl-value {
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  white-space: nowrap;
}
.profit-line.is-total {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
}
.profit-line.is-total .pl-label {
  color: var(--text);
  font-weight: 650;
}
.profit-line.is-total .pl-value {
  font-size: 16px;
}
.profit-line .is-loss {
  color: var(--danger);
}
.profit-line .is-gain {
  color: var(--success);
}

#profit-card #pf-month {
  width: 158px;
  flex: none;
}
/* 订单成本利润页：筛选栏宽度固定，业务员下拉别被长选项撑开 */
#op-month {
  width: 158px;
  flex: none;
}
#op-person {
  max-width: 260px;
}
@media (max-width: 700px) {
  /* 手机上卡头放不下「标题 + 说明 + 月份」，说明让位给月份选择器 */
  #profit-card .card-head {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #profit-card .card-head .sub,
  #profit-card .card-head .spacer,
  #profit-card .card-head .pf-more {
    display: none;
  }
  #profit-card #pf-month {
    width: 100%;
  }

  /* 筛选栏：月份、状态各占一行；业务员与「只看亏损单」并排 */
  #op-filters #op-month,
  #op-filters #op-status,
  #op-filters #op-person {
    width: 100%;
    max-width: none;
    flex: 1 0 100%;
  }
  /* 下拉与月份都被 .dd 包了一层（inline-block 收缩宽度），要整个包裹块占满一行 */
  #op-filters .dd {
    flex: 1 0 100%;
  }

  /* 卡片头：标题与按钮同行，说明文字另起一行，避免「逐单成本利润」被挤成两行 */
  #op-detail-card .card-head,
  #op-people-card .card-head {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  #op-detail-card .card-head .spacer {
    display: none;
  }
  #op-detail-card .card-head .btn {
    margin-left: auto;
  }
  #op-detail-card .card-head .sub,
  #op-people-card .card-head .sub {
    flex: 1 1 100%;
    order: 3;
  }
}

/* ---------------- 工作台：年度销售 / 采购 ---------------- */
/*
 * 一张图 12 个月，每月是一块整体可点区域（点进去看当月销售与采购明细），
 * 所以这里不用通用的 .bar-chart，改成 grid 式的 .trend-bars：
 * 每列包住「两根柱 + 月份刻度」，鼠标移上去整列高亮，点击目标足够大。
 */
.trend-bars {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 8px 0 0;
}
.trend-month {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 2px 4px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}
a.trend-month:hover {
  background: #f2f6fd;
}
a.trend-month:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
/* 没有记录的月份：仍然是同一列宽，但不可点、不给悬停反馈 */
.trend-month.is-empty {
  cursor: default;
}
.trend-bars-body {
  width: 100%;
  height: 168px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}
.trend-bars-body .bar {
  flex: 1 1 0;
  max-width: 26px;
  min-width: 2px;
}
.trend-bars .bar-label {
  font-size: 10.5px;
}
.trend-hint {
  color: var(--muted-2);
}
#trend-card #ar-year {
  width: 106px;
  flex: none;
}
.trend-total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  /* 手机上「标题 + 说明 + 年份」放不下一行，说明让位给年份选择器 */
  #trend-card .card-head {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #trend-card .card-head .sub {
    display: none;
  }
  #trend-card #ar-year {
    width: 100%;
  }
  .trend-bars {
    gap: 2px;
  }
  .trend-bars .bar-label {
    font-size: 9.5px;
  }
  .trend-hint {
    display: none;
  }
}

/* 没有数据的那根柱子：连 2px 的底座也不要，避免看着像「有量」 */
.bar.is-empty {
  min-height: 0;
  background: transparent;
}

/* ---------------- 月度明细（工作台年度图点月份下钻） ---------------- */
.month-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.month-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.month-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.month-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.month-nav #md-month {
  width: 148px;
  flex: none;
}
.month-nav .dd {
  flex: none;
}
/* 月度明细是报表的下钻页：用面包屑说清「从哪来、现在在哪」，比在月份导航里塞一个返回键清楚 */
.month-crumb {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
/*
 * 月度明细 / 员工工资 / 公司固定成本这一组的页头，右边坐着 40px 的「上一月 / 下一月」，
 * 左边返回键却只有 28px（那是给返回条、日期行用的高度），两头一高一矮像拼错的。
 * 老板要求「和日期前面那个一样大」——订单成本利润工具条里那颗就是 40px / 14px，这里对齐它。
 */
.month-crumb .back-btn {
  height: 40px;
  padding: 0 13px;
  font-size: 14px;
}
.month-crumb a:not(.back-btn) {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #2f5aa8;
  text-decoration: none;
}
.month-crumb a:not(.back-btn):hover {
  text-decoration: underline;
}
.month-crumb span {
  color: var(--muted-2);
}
.head-total {
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-foot.note {
  padding: 10px 16px 14px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--muted);
}
.card-foot.note a {
  color: var(--primary-dark);
}
.month-foot {
  margin: 16px 2px 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted-2);
}

@media (max-width: 700px) {
  .month-head {
    align-items: flex-start;
  }
  .month-nav {
    margin-left: 0;
    width: 100%;
  }
  .month-nav #md-month {
    flex: 1 1 auto;
    width: auto;
  }
}

/* 月度明细：卡头在窄屏折行，「标题 + 合计」一行、说明另一行，避免标题被挤成竖排 */
.month-card .card-head .head-total {
  margin-left: auto;
}
@media (max-width: 760px) {
  .month-card .card-head {
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 14px 16px;
  }
  .month-card .card-head h3 {
    white-space: nowrap;
  }
  .month-card .card-head .spacer {
    display: none;
  }
  .month-card .card-head .sub {
    flex: 1 1 100%;
    order: 3;
    font-size: 12px;
  }
  .month-nav {
    gap: 6px;
  }
  .month-nav #md-month {
    min-width: 0;
  }
  .month-title {
    font-size: 18px;
  }
}
/* ---------------- 工作台美化：年度图 / 排行 ---------------- */
/* 左侧刻度 + 每 1/4 一条虚线：只有一两个月有数时，图也不会看成一片空白 */
.trend-chart {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.trend-yaxis {
  position: relative;
  width: 44px;
  flex: none;
  height: 168px;
  margin-top: 14px;
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.trend-yaxis span {
  position: absolute;
  right: 0;
  transform: translateY(50%);
}
.trend-canvas {
  flex: 1;
  min-width: 0;
}
.trend-bars {
  position: relative;
}
.trend-bars::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  height: 168px;
  background-image: repeating-linear-gradient(to bottom, #e9eef7 0 1px, transparent 1px 25%);
  pointer-events: none;
}
.trend-bars-body {
  position: relative;
  z-index: 1;
}
.trend-bars-body .bar-slot {
  position: relative;
  flex: 1 1 0;
  max-width: 30px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.trend-bars-body .bar-slot .bar {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  min-width: 3px;
  border-radius: 5px 5px 2px 2px;
  transition: height 0.35s ease;
}
/* 柱顶数值：只标两条序列各自的峰值月，避免 12 个月糊成一片 */
.bar-num {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 650;
  color: var(--primary-dark);
  white-space: nowrap;
}
.bar-num.alt {
  color: #7f93b8;
}
.trend-bars .bar-label.is-data {
  color: #5b6880;
}
.trend-bars .bar-label.is-current {
  color: var(--primary-dark);
  font-weight: 700;
}
.trend-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.trend-legend .trend-hint {
  margin-left: auto;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
  vertical-align: 1px;
}
.dot.sales {
  background: var(--primary);
}
.dot.buy {
  background: #c7d7fb;
}
.dot.orders {
  background: #94a3b8;
  border-radius: 50%;
}
/* 全年合计：一条浅色小结，销售 / 采购并排对齐 */
.trend-total {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid #eef2f9;
  border-radius: 10px;
  background: #f7f9fd;
  font-size: 12.5px;
  color: var(--muted);
}
.trend-total .tt-label {
  font-weight: 650;
  color: #3f4b60;
}
.trend-total .tt-item {
  font-variant-numeric: tabular-nums;
}
.trend-total .tt-item b {
  font-size: 13.5px;
  color: #24324a;
  margin-left: 2px;
}

/* 排行：三格小结 + 占比条，只有一两行时也不会留一大片白 */
.rank-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.rank-stat {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #eef2f9;
  border-radius: 10px;
  background: #f7f9fd;
}
.rank-stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.rank-stat b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.rank-item {
  align-items: flex-start;
  padding: 10px 2px;
}
.rank-body {
  flex: 1;
  min-width: 0;
}
.rank-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.rank-track {
  height: 6px;
  border-radius: 4px;
  background: #eef1f7;
  overflow: hidden;
  margin-top: 6px;
}
.rank-track i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #6f9cff, var(--primary));
}
.rank-meta {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 5px;
}
/* 左右两张卡等高，内容不足时由内边距与脚注撑住 */
.chart-grid > .card {
  display: flex;
  flex-direction: column;
}
.chart-grid > .card > .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tier-share {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 12px;
}
.tier-share-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.tier-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  margin-top: 7px;
}
.tier-label {
  width: 60px;
  color: var(--muted);
}
.tier-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #eef1f7;
  overflow: hidden;
}
.tier-track i {
  display: block;
  height: 100%;
}
.tier-pct {
  width: 46px;
  text-align: right;
  font-weight: 650;
}

@media (max-width: 700px) {
  .trend-yaxis,
  .trend-bars::before,
  .bar-num {
    display: none;
  }
  .trend-legend {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
  .rank-summary {
    flex-wrap: wrap;
  }
}
/* 工作台底部两栏：左栏排行 + 库存预警，右栏热销商品，避免单卡被拉出大片空白 */
.dash-bottom { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 900px) { .dash-bottom { grid-template-columns: 1fr; } }
/* 可点击的统计卡：售后工单按状态筛选、财务审核跳转发货/驳回 */
.stat-link {
  display: block;
  width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.stat-link:hover { transform: translateY(-1px); border-color: #d7e3fb; box-shadow: 0 8px 20px rgba(29,78,216,.10); }
.stat-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.stat-link.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.09); }
.stat-link.is-active .stat-label { color: var(--primary-dark); font-weight: 650; }
/* 箭头是「这卡能点」的唯一视觉线索：太浅等于没有，hover 再转主色 */
.stat-go { position: absolute; top: 14px; right: 14px; display: inline-flex; color: #98a7c0; }
.stat-link:hover .stat-go { color: var(--primary); }
/* 从报表「应收 / 已收」卡跳进来时的一句话交代：
   不写清楚，用户只会看到「单子怎么少了」，以为数据丢了 */
.pay-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #dbe6f8;
  border-radius: 8px;
  background: #f4f8fe;
  font-size: 12.5px;
  color: #3d5c8f;
}
/* [hidden] 是浏览器默认样式，一条 .btn / .stat 的 display 声明就能盖掉它：
   「返回全部」曾经 hidden=true 却照样显示在页面上，就是栽在这 */
[hidden] { display: none !important; }
.pay-note .grow { flex: 1; }

/* ---------- 全站统一的「返回键」 ---------- */
/* 老板的截图给的是白底圆角描边那颗，字号跟日期行（.month-sub 13px）一样大。
   位置也统一：都长在页面第一行的 .back-bar 里，滚到表格深处仍贴在顶栏下面，
   不再出现「有的在页头、有的在队列上方、有的在表格上面」三种高度。 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: #33415c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f7faff;
}
.back-btn svg { flex: none; }

/* 返回条：页面上那唯一的一行，sticky 贴住顶栏 */
.back-bar {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  z-index: 12;
  background: #f4f8fe;
  box-shadow: 0 2px 10px rgba(23, 43, 77, 0.06);
}
.back-bar .back-bar-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
/* 返回键永远在左边，说明跟在右边 */
.back-bar .back-bar-text {
  min-width: 0;
  text-align: right;
}

/* 工具条里的返回键要和旁边的月份 / 状态下拉一般高、一般大——
   截图里它比「2026 年 11 月」矮一截、也比下拉窄，像两个系统的控件。
   统一 40px：输入框、下拉、返回键、小按钮排一行时上沿下沿都齐。 */
.toolbar .back-btn,
.toolbar .input,
.toolbar .select-sm,
.toolbar .btn-sm {
  height: 40px;
}
.toolbar .input,
.toolbar .select-sm,
.toolbar .btn-sm {
  padding-top: 0;
  padding-bottom: 0;
}
.toolbar .back-btn {
  padding: 0 14px;
  font-size: 14px;
}

/* 手机上一条放不下「一句说明 + 两个返回键」：说明压成一行（超出省略），
   按钮保持同一行靠右——返回键必须一直看得见，所以窄屏也照样 sticky */
@media (max-width: 620px) {
  .back-bar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
  }
  .back-bar .grow { display: none; }
  .back-bar .back-bar-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .back-bar .back-bar-acts { flex: none; gap: 6px; }
  .back-btn {
    height: 28px;
    padding: 0 9px;
  }
}

/* 页面会「跳过去」的块（指标卡 / 队列卡）统一留出顶栏 + 返回条的高度：
   scrollIntoView 默认把目标顶到视口最上沿，会被固定在顶上的 topbar 和返回条盖住 */
.pay-note,
.stat-grid,
.card {
  scroll-margin-top: calc(var(--topbar-h) + 60px);
}

.stat-flash { animation: stat-flash 1.2s ease; }
@keyframes stat-flash { 0% { box-shadow: 0 0 0 0 rgba(29,78,216,.30); } 100% { box-shadow: 0 0 0 14px rgba(29,78,216,0); } }


/* ---------- 订单成本利润：收款状态 / 提成 ---------- */
.cell-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}
.cell-tags .badge {
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
}
.pay-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pay-tag.is-paid {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.18);
}
.pay-tag.is-part {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(217, 119, 6, 0.18);
}
.pay-tag.is-unpaid {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.16);
}
.th-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
}
/* 还没设提成比例：虚线框提醒一下，但不抢眼到像报错 */
#op-rate.is-unset {
  border: 1px dashed rgba(217, 119, 6, 0.45);
  color: var(--warning);
  background: var(--warning-soft);
}

/* ---------------- 工作台顶部：整体放大 ---------------- */
/*
 * 老板在截图上把「问候语 + 四张待办卡 + 年度图」整块圈出来写「做大一点」。
 * 这三块是每天第一眼看到的内容，原来 22px 的标题 / 20px 的数字在 1440 宽的屏上
 * 需要凑近看；这里统一抬一档字号与留白，卡片和图表也跟着一起长高。
 */
.dash-greet {
  margin-bottom: 22px;
}
.dash-greet h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.dash-greet-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* 老板在截图上又圈了一遍这四张卡，写「加大 再加大」：
   数字是这屏最先被扫到的信息，30px 还嫌小，直接提到 40px，
   图标同比例放大，卡片内边距加厚，四张卡站成一排要压得住下面的图表。 */
.todo-grid {
  gap: 18px;
}
.todo {
  gap: 16px;
  padding: 24px 24px;
  border-radius: 16px;
}
.todo-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 15px;
}
.todo-icon svg {
  width: 28px;
  height: 28px;
}
.todo-num {
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.todo-text {
  margin-top: 4px;
  font-size: 14.5px;
}

/* 图表高度收在一处，纵轴刻度、虚线网格、柱列三者才不会错位 */
#trend-card {
  --trend-h: 320px;
}
#trend-card .card-head {
  padding: 18px 20px;
}
#trend-card .card-head h3 {
  font-size: 16px;
}
#trend-card .card-head .sub {
  font-size: 12.5px;
}
#trend-card .card-body {
  padding: 20px;
}
#trend-card #ar-year {
  width: 118px;
  height: 36px;
  font-size: 13.5px;
}
.trend-yaxis {
  width: 54px;
  height: var(--trend-h, 168px);
  font-size: 12px;
}
.trend-bars::before,
.trend-bars-body {
  height: var(--trend-h, 168px);
}
.trend-bars-body .bar-slot {
  max-width: 56px;
}
.trend-bars .bar-label {
  font-size: 12.5px;
}
/*
 * 柱顶数值压在「本月另一根柱」上面是常事（比如 11 月销售 8.64 万、采购 25.8 万，
 * 矮柱的标签正好落在高柱身上）。默认 DOM 顺序会让后画的柱子盖住标签，
 * 这里把标签提到最上层，再加一圈白描边，压在浅色柱子上也读得清。
 */
.bar-num {
  z-index: 2;
  padding: 0 3px;
  border-radius: 4px;
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.88);
}
.trend-legend {
  margin-top: 14px;
  font-size: 12.5px;
}
.trend-total {
  padding: 12px 16px;
  font-size: 13px;
}
.trend-total .tt-item b {
  font-size: 14.5px;
}

@media (max-width: 1180px) {
  .dash-greet h2 {
    font-size: 25px;
  }
  .bar-num {
    font-size: 10px;
    padding: 0 2px;
  }
  #trend-card {
    --trend-h: 190px;
  }
}
@media (max-width: 700px) {
  .dash-greet h2 {
    font-size: 23px;
  }
  .dash-greet-sub {
    font-size: 13.5px;
  }
  .todo {
    padding: 15px 16px;
  }
  .todo-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 11px;
  }
  .todo-num {
    font-size: 24px;
  }
  #trend-card {
    --trend-h: 164px;
  }
  #trend-card .card-body {
    padding: 16px;
  }
  .trend-yaxis {
    font-size: 10px;
  }
  .bar-num {
    display: none;
  }
}

/* ================= 订单成本利润：美化 ================= */
/*
 * 这一页是老板对账的地方：七张汇总卡 → 逐单明细 → 业务员排行 → 口径说明。
 * 原来五张卡长得一模一样、表格十一列糊成一片、底下压着四行灰字，
 * 所以这里的改造只做三件事：把卡分出层次、把「毛利→三项扣减→净利」的因果在表格里画出来、
 * 把口径说明收起来不占版面。
 *
 * 卡片只留「标签 / 数字 / 两行脚注」三层，数字 18px、脚注 10.5px，
 * 比别处 25px 的汇总卡小一档：同排最高那张决定整排高度，
 * 多一行字整排就高出十几像素，所以次要信息（几单填过回扣）收进 title。
 */
/*
 * 七张卡而不是五张：12 列网格让两排都填满——
 * 上面一排四个主指标（销售额 → 成本 → 毛利 → 净利）各占 3 列，
 * 下面一排三张（未收 / 销售提成 / 其他扣款）各占 4 列，脚注字多，格子宽一点才不折行。
 * 1366 下第一排每张约 265px、第二排约 353px，金额 ¥9,999,999.00 也放得下。
 *
 * 列宽必须写 minmax(0, 1fr)：1fr 的最小值是 auto，长脚注（「占应收 32.9% · 已收 ¥20,000.00」）
 * 会把那一列顶宽，四张卡就成了一张宽一张窄。
 */
#op-summary {
  gap: 8px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}
#op-summary .stat {
  grid-column: span 3;
  min-width: 0;
}
#op-summary .stat:nth-child(n + 5) {
  grid-column: span 4;
}
/* 窄屏两列 / 一列：span 让位，别让一张卡只剩半格 */
@media (max-width: 1080px) {
  #op-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #op-summary .stat,
  #op-summary .stat:nth-child(n + 5) {
    grid-column: auto;
  }
}
@media (max-width: 560px) {
  #op-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* 净利是这张页面的落点，给它一点底色，眼睛最后会停在这里 */
#op-summary .stat.is-focus {
  background: linear-gradient(180deg, #f9fbff 0%, #eff5ff 100%);
  border-color: #d9e5fa;
}

/* 工具栏：右边那句「2026-11 · 9 单 / 19 行明细」原来被挤到第二行行首，
   现在不再让占位块抢满宽度，换行时也靠右对齐，不会孤零零挂在左边 */
#op-filters {
  row-gap: 12px;
}
#op-filters .grow {
  min-width: 0;
}
#op-note {
  margin-left: auto;
  padding: 4px 11px;
  border-radius: 20px;
  background: #eef2fa;
  color: #55617a;
  font-size: 12px;
  white-space: nowrap;
}
#op-summary .stat {
  display: flex;
  flex-direction: column;
  padding: 9px 12px 8px;
  border-color: #e8eef8;
  box-shadow: 0 1px 2px rgba(23, 34, 59, 0.04), 0 10px 24px -18px rgba(23, 34, 59, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
#op-summary .stat:hover {
  transform: translateY(-1px);
  border-color: #d7e2f4;
  box-shadow: 0 2px 4px rgba(23, 34, 59, 0.05), 0 14px 28px -18px rgba(23, 34, 59, 0.32);
}
#op-summary .stat-accent {
  width: 64px;
  height: 64px;
  right: -18px;
  top: -18px;
  opacity: 0.45;
}
/* 图标先用底色把五张卡分开，扫一眼就知道哪张是成本、哪张是净利 */
#op-summary .stat-ico {
  width: 16px;
  height: 16px;
  margin-left: -2px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex: none;
}
#op-summary .stat.tone-success .stat-ico {
  background: var(--success-soft);
  color: var(--success);
}
#op-summary .stat.tone-warning .stat-ico {
  background: var(--warning-soft);
  color: var(--warning);
}
#op-summary .stat.tone-danger .stat-ico {
  background: var(--danger-soft);
  color: var(--danger);
}
#op-summary .stat.tone-info .stat-ico {
  background: var(--info-soft);
  color: var(--info);
}
/* 未收 / 亏损的卡：数字本身也上色，光靠标签旁边一枚小图标不够醒目 */
#op-summary .stat.tone-danger .stat-value {
  color: var(--danger);
}
#op-summary .stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #55617a;
  gap: 5px;
}
#op-summary .stat-value {
  font-size: 18px;
  margin-top: 3px;
  letter-spacing: -0.02em;
}
#op-summary .stat-foot {
  margin-top: auto;
  padding-top: 3px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--muted);
}
#op-summary .stat-foot-sub {
  color: var(--muted-2);
  font-size: 10.5px;
}
/*
 * 「其他扣款」卡的脚注：四项名称照抄「登记」弹窗（回扣 / 技术提成 / 个人费用 / 坏账损失），
 * 没花钱的也列出来显示 ¥0 —— 只列有金额的两项时，老板在卡上找不到刚登记的那一笔。
 * 一行排不下就 2+2 折行，格子窄也不会把「技术提成」拆成两截。
 */
#op-summary .stat-foot .fee-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}
#op-summary .stat-foot .fee-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
#op-summary .stat-foot .fee-item b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#op-summary .stat-foot .fee-item.is-on {
  color: var(--text);
}
#op-summary .stat-foot .fee-item.is-on b {
  font-weight: 700;
}

/* ---- 明细表：一单两行，表头按老板给的 Excel 截图 ---- */
/*
 * 十四列平铺那版每格只有 72px，一个 ¥3,250,000.00 就把格子顶满，
 * 十几列连成一片糊在一起 —— 老板连着两次说「太挤」。
 * 现在一单占两行，明细区五组上下对齐：
 *   主行：合同金额 / 成本 / 个人费用 / 技术提成 / 毛利
 *   副行：已收 / 未收 / 回扣 / 坏账 / 销售提成
 * 表头只剩「单号 / 状态」「客户 / 销售」「明细（跨五列）」「净利」四块——
 * 每格的标签写在自己格子里，因为上下两格标签不同（「成本」底下坐的是「未收」），
 * 一行表头说不清十件事。
 * 九列合计 1072px，1366 屏（可用 1074）一屏到底，不用横滚。
 */
.op-table {
  table-layout: fixed;
  min-width: 1066px;
}
.op-table .col-code {
  width: 164px;
  padding-left: 12px;
  padding-right: 10px;
}
.op-table .cell-tags {
  gap: 4px;
  margin-top: 3px;
}
.op-table .cell-tags .badge,
.op-table .cell-tags .pay-tag {
  padding: 1px 5px;
  font-size: 11px;
}
.op-table .price-tag {
  white-space: nowrap;
}
.op-table .mono {
  font-size: 12.5px;
}
.op-table .col-cust {
  width: 164px;
  padding-left: 10px;
  padding-right: 10px;
}
.op-table .col-cust .strong {
  width: 142px;
  font-size: 13px;
}
.op-table .col-cust .cell-sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 明细五列同宽：110px 里留 94px 给数字，¥3,250,000.00 装得下 */
.op-table .op-cell {
  width: 110px;
  padding-left: 8px;
  padding-right: 8px;
}
/* 净利是这行的结论，多给 34px：金额 + 下面一行净利率 */
.op-table .col-net {
  width: 130px;
  padding-left: 12px;
  padding-right: 12px;
  box-shadow: inset 2px 0 0 #e7eefb;
}
.op-table .col-act {
  width: 58px;
  padding-left: 4px;
  padding-right: 6px;
}
/* 「登记」两个字自己撑到 65px，把 58px 的列顶出 7px 横向滚动；这里把它的留白收掉 */
.op-table .col-act .btn {
  padding: 4px 7px;
  font-size: 12px;
}

/* 主行：上边距给足，和上一单的副行拉开 */
.op-table tbody .op-row-main td {
  padding-top: 12px;
  padding-bottom: 2px;
  border-bottom: none;
  font-size: 12.5px;
}
/* 跨两行的四格（单号 / 客户 / 净利 / 登记）垂直居中，底边自己收口，
   和副行那条线接上，一整块看起来才是一张单 */
.op-table tbody .op-row-main td.col-code,
.op-table tbody .op-row-main td.col-cust,
.op-table tbody .op-row-main td.col-net,
.op-table tbody .op-row-main td.col-act {
  vertical-align: middle;
  border-bottom: 1px solid #eef2f9;
}
.op-table tbody .op-row-fees td {
  padding-top: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef2f9;
  font-size: 12px;
  vertical-align: top;
}
/* 每格的标签：上下两格标签不同，没有这行小字，「成本」底下坐着的「未收」会被读成同一件事 */
.op-table .op-cell i {
  display: block;
  margin-bottom: 2px;
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #818da4;
}
/* 标签里的附注：毛利率、成本未维护 */
.op-table .op-cell i em {
  font-style: normal;
  font-weight: 500;
  color: #a9b3c6;
}
.op-table .op-cell i em.op-warn {
  color: var(--warning);
}
.op-table thead th {
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  color: #55617a;
  background: #f7f9fd;
  border-bottom: 1px solid #e1e9f6;
}
.op-table thead .th-group {
  text-align: center;
  letter-spacing: 0.16em;
  color: #8b96ab;
}
.op-table thead .th-hint {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: #8b96ab;
}
/* 亏损单：整块（主行 + 副行）浅红，红条只画在单号格上 */
.op-table tbody tr.is-loss td {
  background: #fffafa;
}
.op-table tbody tr.is-loss td.col-code {
  box-shadow: inset 3px 0 0 var(--danger);
}
/* 没有合计行之后，最后一单的底边靠单号 / 客户 / 净利 / 登记这四格（rowspan）画出来；
   副行那五格会被全局的 tr:last-child 规则清成 0，这里补回来，否则收口线只画到一半 */
.op-table tbody tr.op-row-fees:last-child td {
  border-bottom: 1px solid #eef2f9;
}
/* 一条单拆成两个 tr，悬停要整块一起亮，否则只亮半行像断开了 */
.op-table tbody tr.op-row-main:hover td,
.op-table tbody tr.op-row-main:hover + tr td,
.op-table tbody tr.op-row-fees:hover td,
.op-table tbody tr:has(+ tr.op-row-fees:hover) td {
  background: #f5f8ff;
}
.op-table tbody tr.is-loss.op-row-main:hover td,
.op-table tbody tr.is-loss.op-row-main:hover + tr td,
.op-table tbody tr.is-loss.op-row-fees:hover td,
.op-table tbody tr:has(+ tr.is-loss.op-row-fees:hover) td {
  background: #fff5f5;
}

/* 「未收齐」小胶囊：一屏七八行都写这三个字太吵 */
.op-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  background: #eef1f7;
  color: #5b6880;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
}

/* ---- 业务员排行 ---- */
.op-rank-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.op-rank {
  padding: 2px 0;
}
.op-rank-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.op-rank-ava {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 700;
}
.op-rank.is-loss .op-rank-ava {
  background: var(--danger-soft);
  color: var(--danger);
}
.op-rank-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.op-rank-meta {
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.op-rank-amt {
  margin-left: auto;
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.op-rank-amt i {
  margin-left: 6px;
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.op-rank .btn {
  flex: none;
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
}
.op-rank-track {
  height: 8px;
  border-radius: 5px;
  background: #eef1f7;
  overflow: hidden;
}
.op-rank-track i {
  display: block;
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}
.op-rank.is-active .op-rank-track {
  background: #e2ebfb;
}

/* ---- 口径说明：默认收起，别让四行灰字压在页面底部 ---- */
.op-scope {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.op-scope summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  color: #3f4b60;
  list-style: none;
  user-select: none;
}
.op-scope summary::-webkit-details-marker {
  display: none;
}
.op-scope summary:hover {
  background: #f8fafd;
}
.op-scope summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.op-scope-ico {
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
}
.op-scope-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted-2);
}
/* 收起时给一个向下的箭头，展开后翻上来 */
.op-scope summary::after {
  content: '';
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted-2);
  border-bottom: 1.6px solid var(--muted-2);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.18s ease;
}
.op-scope[open] summary::after {
  transform: translateY(1px) rotate(-135deg);
}
.op-scope-body {
  padding: 2px 18px 16px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--muted);
}
.op-scope-body p {
  margin: 10px 0 0;
}
@media (max-width: 700px) {
  .op-scope-hint {
    display: none;
  }
  #op-summary .stat-value {
    font-size: 17px;
  }
  .op-rank-meta {
    display: none;
  }
}

/* ---- 收款：单号下的标签 + 单独的收款框 ---- */
/*
 * 老板的原话是「未收和已收 另外起一个框」。
 * 标签（单号下面）负责「有没有收」，这一列负责「收了多少、还差多少」：
 * 框里上排已收、下排未收，收齐了整框转绿。
 * 单独成列之后，金额列只放应收，不再被「未收 ¥22,160.00」撑宽、短金额左侧也不空一截。
 */
.op-paybox {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  padding: 2px 5px;
  border-radius: 8px;
  background: #fbfcfe;
  border: 1px solid #e9eef7;
  font-size: 10.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.op-paybox .p-recv {
  color: var(--success);
  font-weight: 600;
}
.op-paybox .p-recv.is-zero {
  color: var(--muted-2);
  font-weight: 500;
}
.op-paybox .p-rest {
  color: var(--danger);
  font-weight: 600;
}
.op-paybox.is-done {
  background: #f8fdfa;
  border-color: #ddf0e5;
}
.op-paybox.is-done .p-rest {
  color: var(--muted-2);
  font-weight: 500;
}
/* 收款标签提到 12px 并加一点内边距：11.5px 的小胶囊在整屏里太容易漏看 */
.op-table .pay-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* ---- 订单详情：收款记录（每笔可修正 / 作废） ---- */
/*
 * 老板的截图批注是「原有登记错误的收款，不能修改」。
 * 这块就是那笔「不能改的收款」：一行一笔，右边两个小按钮，改错的直接修、录错的作废。
 * 作废的行不删——划掉留着，账才查得清。
 */
.pay-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.pay-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: #3f4b60;
}
.pay-block-sum {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
}
.pay-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f2f5fa;
}
.pay-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.pay-row-main {
  flex: 1;
  min-width: 0;
}
.pay-row-amt {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.pay-row-meta {
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted-2);
  word-break: break-all;
}
.pay-row-acts {
  flex: none;
  display: flex;
  gap: 2px;
}
.pay-row-acts .btn {
  height: 22px;
  padding: 0 7px;
  font-size: 11.5px;
}
.pay-row.is-void .pay-row-amt {
  font-weight: 500;
  color: var(--muted-2);
  text-decoration: line-through;
}
.pay-row.is-void .pay-row-meta {
  text-decoration: line-through;
  opacity: 0.7;
}
.pay-row-void {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--danger);
}

/* 收款记录底部一行说明：这条就是告诉老板「能改」的地方，别写成灰色小字看不见 */
.pay-block-tip {
  margin-top: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f7f9fd;
  font-size: 11.5px;
  line-height: 1.65;
  color: #5b6880;
}

/* ---- 合同文件（扫描件 / Word 原件）：订单详情右栏的入口 ---- */
/* 列表要轻：文件名是主角，大小 / 上传人 / 时间退成一行小字 */
.contract-list { list-style: none; margin: 0; padding: 0; }
.contract-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px dashed #e8eef8;
}
.contract-item:last-child { border-bottom: 0; }
.ci-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #eef4ff;
  color: #2f6bed;
}
.ci-main { flex: 1; min-width: 0; }
.ci-name {
  display: block;
  font-size: 12.8px;
  font-weight: 600;
  color: #24324a;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-name:hover { color: var(--primary); text-decoration: underline; }
.ci-meta { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.ci-act { flex: none; display: flex; gap: 2px; }
/* 空态做成可点的虚线区：手机端点一下就能调起相机 / 相册 */
.contract-drop {
  padding: 16px 12px;
  border: 1px dashed #ccd9ee;
  border-radius: 10px;
  background: #fafcff;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.contract-drop .btn { margin-top: 8px; }
/* 从顶部按钮跳过来时闪一下，告诉眼睛「就是这块」 */
.contract-flash { animation: contract-flash 1.1s ease; }
@keyframes contract-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 107, 237, 0); }
  30% { box-shadow: 0 0 0 3px rgba(47, 107, 237, 0.22); }
}

/* ---------------- 版本更新提示 ---------------- */
/* 页面停在旧代码上时挂在顶部的一条提示，点「刷新页面」即可换成新版本 */
.build-stale {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  font-size: 13px;
}
.build-stale button {
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--warning);
  border: none;
  border-radius: 7px;
  cursor: pointer;
}
.build-stale button:hover {
  filter: brightness(0.94);
}

/* ============================================================
   公司固定成本页
   ============================================================ */
.fc-cats {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* 整宽时三条横排：一眼看到三类各占多少，不用往下滚（工资不在这页） */
.fc-cats.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 22px;
}
@media (max-width: 900px) {
  .fc-cats.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}
.fc-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}
.fc-cat-name {
  font-weight: 650;
  color: var(--text);
}
.fc-cat-val {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}
.fc-cat-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 7px;
}
.fc-cat-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.3s ease;
}
.fc-cat.is-empty .fc-cat-val,
.fc-cat.is-empty .fc-cat-foot {
  color: var(--muted-2);
}
.fc-cat-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted-2);
}
/* 明细表里每个科目一行小计，压在类目下面，不额外占一列 */
.fc-group td {
  background: var(--surface-2);
  font-weight: 650;
  font-size: 12.5px;
  color: var(--muted);
}
.fc-group .badge {
  margin-right: 6px;
}
/* 利润链条：固定成本一行高亮，下面「其中」两行缩进 */
.profit-line.is-fixed {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  background: var(--info-soft);
  border-radius: 6px;
  border-top-color: transparent;
}
.profit-line.is-fixed .pl-label {
  color: #0b5b6b;
  font-weight: 650;
}
.profit-line.is-fixed .pl-value {
  color: var(--info);
}
.profit-line.is-sub {
  padding-left: 14px;
  font-size: 12px;
}
.profit-line.is-sub .pl-label {
  color: var(--muted-2);
}
.profit-line.is-sub .pl-label::before {
  content: "↳ ";
}
.profit-line.is-sub .pl-value {
  font-weight: 560;
  color: var(--muted);
}
/* ---- 均分列表格（工资单 / 固定成本明细）：窄屏兜底 ---- */
/* 四列均分到手机上每格只剩 90px，上面「表格一律不换行」的规则会让超出的字压到隔壁列
   （fixed 布局不撑宽表格，只溢出），所以这里放开换行，并用最小宽度换成横向滚动。 */
@media (max-width: 720px) {
  table.table-eq {
    min-width: 460px;
  }
  table.table-eq th,
  table.table-eq td {
    white-space: normal;
  }
  /* 均分后操作列只有 115px，桌面尺寸的按钮（9px 16px）塞不下两个，缩一档 */
  table.table-eq td.row-acts {
    padding-left: 4px;
    padding-right: 4px;
  }
  table.table-eq td.row-acts .btn {
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* ================= 工作台：年度成本 / 费用 ================= */
/*
 * 与「年度销售 / 采购」同一套画法（纵轴 + 虚线网格 + 12 个月柱列），
 * 只是每天三根柱：订单成本 / 员工工资 / 固定开支。
 *
 * 三色按「花出去的钱」深浅分：成本用蓝色（跟销售额同族，容易对上账），
 * 工资用琥珀（人在费用里最好认），固定开支用灰蓝（房租水电这类被动支出）。
 * 柱子比销售卡细一点、图高矮一点：两张卡上下叠着，上面那张才是主角。
 */
#cost-card {
  --trend-h: 240px;
}
#cost-card .card-head {
  padding: 18px 20px;
}
#cost-card .card-head h3 {
  font-size: 16px;
}
#cost-card .card-head .sub {
  font-size: 12.5px;
}
#cost-card .card-body {
  padding: 20px;
}
#cost-card .js-ar-year {
  width: 118px;
  height: 36px;
  font-size: 13.5px;
}
#cost-card .trend-yaxis {
  height: var(--trend-h);
}
#cost-card .trend-bars::before,
#cost-card .trend-bars-body {
  height: var(--trend-h);
}
#cost-card .trend-bars-body .bar-slot {
  max-width: 34px;
}
/* 三根柱时柱子更窄，圆角跟着收，免得看着像药丸 */
#cost-card .trend-bars-body .bar {
  border-radius: 3px 3px 1px 1px;
}
.bar.salary {
  background: #f0b13c;
}
.bar.fixed {
  background: #aab8cd;
}
.bar-num.salary {
  color: #9a6a12;
}
.bar-num.fixed {
  color: #64748b;
}
.dot.cost {
  background: var(--primary);
}
.dot.salary {
  background: #f0b13c;
}
.dot.fixed {
  background: #aab8cd;
}

@media (max-width: 1180px) {
  #cost-card {
    --trend-h: 190px;
  }
}
@media (max-width: 700px) {
  #cost-card {
    --trend-h: 160px;
  }
  #cost-card .card-body {
    padding: 16px;
  }
  /* 手机上「标题 + 说明 + 年份」一行放不下，说明让位给年份选择器（同销售卡） */
  #cost-card .card-head {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #cost-card .card-head .sub {
    display: none;
  }
  /* 年份下拉宽度交给 .dd（inline-block 收缩到 118px）：写 100% 会让它塌成内容宽，
     只剩「20…」。与销售卡的 #ar-year 保持一致。 */
  #cost-card .trend-bars-body .bar-slot {
    max-width: 12px;
  }
}

/* 手机上两张年度卡都窄：月份刻度从 12.5px 收到 9.5px，
   否则「10月 11月 12月」会挤成一串（3 根柱的成本卡尤其明显）。 */
@media (max-width: 700px) {
  #trend-card .trend-bars .bar-label,
  #cost-card .trend-bars .bar-label {
    font-size: 9.5px;
    letter-spacing: -0.02em;
  }
}

/* ================= 销售退货 ================= */
/*
 * 退货记录一行可能带好几件商品（客户退一批），每件一行、数量跟在后面，
 * 别让商品名和数量在窄列里互相挤成两行字。
 */
.ret-line {
  line-height: 1.55;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/*
 * 退货表列多（单号 / 状态 / 商品 / 仓 / 金额 / 数量 / 操作），
 * 手机上让它横向滚，不要为了塞下而把内容压成竖条。
 */
@media (max-width: 900px) {
  #od-returns table.table {
    min-width: 660px;
  }
  #return-queue table.table {
    min-width: 760px;
  }
}
/* 手机上列太挤：商品名允许折行，操作列钉在右边，横滑时手边始终有按钮 */
@media (max-width: 700px) {
  .ret-line {
    white-space: normal;
    max-width: 150px;
  }
  #od-returns table.table {
    min-width: 560px;
  }
  #od-returns th:last-child,
  #od-returns td:last-child,
  #return-queue th:last-child,
  #return-queue td:last-child {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -6px 0 10px -8px rgba(15, 23, 42, 0.18);
  }
  #od-returns thead th:last-child,
  #return-queue thead th:last-child {
    background: var(--surface-2);
  }
}
/* 退货弹窗里的数量输入框：右对齐，跟表格里的数字列对齐成一列 */
.ret-qty,
.ret-recv {
  max-width: 110px;
  text-align: right;
}

/* 手机上操作列钉在右侧，两个按钮竖排能省出约 100px 给数据列，
   否则「核对入库 / 取消」横着摆就把整列撑到两百多像素。 */
@media (max-width: 700px) {
  #od-returns .row-actions,
  #return-queue .row-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  #od-returns .row-actions .btn,
  #return-queue .row-actions .btn {
    width: 100%;
  }
}

/* 数量输入框：去掉数字步进箭头（它会压在窄框的数字上），并给够宽度 */
.ret-qty,
.ret-recv {
  width: 96px;
  -moz-appearance: textfield;
}
.ret-qty::-webkit-outer-spin-button,
.ret-qty::-webkit-inner-spin-button,
.ret-recv::-webkit-outer-spin-button,
.ret-recv::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   人事管理大纲（/hr）
   一页讲清「要建什么、建到哪一步」，不接接口、不出现假数字
   ============================================================ */
.section-title .sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 400;
}
.hr-intro .card-body {
  padding: 18px 20px;
}
.hr-intro-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}
.hr-intro-title h3 {
  font-size: 15.5px;
  color: var(--text);
}
.hr-intro-text {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.72;
  max-width: 100ch;
}
.hr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted-2);
}
.hr-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(318px, 1fr));
  gap: 14px;
  align-items: start;
}
.hr-mod {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.hr-mod-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.hr-ico {
  flex: none;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.hr-mod-head h4 {
  font-size: 13.5px;
  font-weight: 680;
  line-height: 1.3;
}
.hr-mod-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.4;
  margin-top: 1px;
}
.hr-count {
  margin-left: auto;
  flex: none;
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.hr-list {
  padding: 5px 15px 11px;
  flex: 1;
}
.hr-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.hr-item:last-child {
  border-bottom: 0;
}
.hr-item-main {
  min-width: 0;
  flex: 1;
}
.hr-item-name {
  font-size: 13px;
  font-weight: 620;
  line-height: 1.45;
}
.hr-item-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 2px;
}
.hr-item .badge,
.hr-item-link {
  flex: none;
  margin-top: 2px;
}
.hr-item-link {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.hr-item-link svg {
  transition: transform 0.15s ease;
}
.hr-item-link:hover svg {
  transform: translateX(2px);
}
.hr-dim {
  color: var(--muted);
}
/* 边界表：第一列给个下限，别被第三列挤成一条 */
.hr-mapping th:first-child,
.hr-mapping td:first-child {
  min-width: 190px;
}

.hr-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}
.hr-phase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}
.hr-phase-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hr-phase-top strong {
  font-size: 13.5px;
  font-weight: 680;
}
.hr-phase-when {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted-2);
}
.hr-phase-list {
  margin: 11px 0 0;
  padding-left: 17px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.85;
}
.hr-phase-list li::marker {
  color: var(--muted-2);
}
.hr-phase-why {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.hr-note {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 980px) {
  .hr-phases {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .hr-grid {
    grid-template-columns: 1fr;
  }
  .hr-legend > span {
    width: 100%;
  }
}

/* ============================================================
   人事管理（/hr/employees、/hr/org）
   与经营报表那套「一屏看数」不同，这两页是台账：先能查人、能改人
   ============================================================ */

/* 弹窗里的表单统一两列：字段成对出现，手机上回落单列。
   之前 fixed-costs / salary 也用了 .form-grid，但样式一直没写，等于单列堆叠 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* 工具条：搜索 + 两个筛选，挤在卡片右上角 */
.hr-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hr-toolbar .input {
  height: 32px;
  padding: 0 9px;
  font-size: 13px;
}

/* 姓名做成按钮：点开详情，但看起来像链接 */
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--primary);
  font-weight: 640;
  cursor: pointer;
  text-align: left;
}
.link-btn:hover {
  text-decoration: underline;
}

/* 离职的人留在花名册里但对账要一眼分开，整行压暗 */
.hr-roster tr.is-left td {
  color: var(--muted);
}
.hr-roster tr.is-left .link-btn {
  color: var(--muted);
  font-weight: 600;
}

/* 详情弹窗：字段两列铺开，长字段（身份证、备注）单独占行 */
.hr-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px 18px;
  padding: 2px 0 4px;
}
.hr-fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.hr-fact > span {
  font-size: 11.5px;
  color: var(--muted-2);
}
.hr-fact > strong {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}
.hr-sub-title {
  font-size: 13px;
  font-weight: 680;
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.hr-remark {
  margin: 10px 0 0;
  padding: 8px 11px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
}

/* 组织架构：部门 / 岗位两张表并排，窄屏上下排 */
.org-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 980px) {
  .org-grid {
    grid-template-columns: 1fr;
  }
}
/* 子部门缩进一格，一眼看出层级 */
.org-child-name {
  padding-left: 24px !important;
  color: var(--muted);
  font-size: 13px;
}
/* 岗位表按部门分组的小标题行 */
.org-group td {
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* 只读输入框（例如工资单里从档案带出的姓名）：灰底表示「这里不让改」 */
.input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

/* 员工档案页在手机上：四张指标卡压成 2×2，表格只留关键列（其余横滑看） */
@media (max-width: 560px) {
  .stat-grid.hr-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-grid.hr-stats .stat {
    padding: 12px 13px;
  }
  .stat-grid.hr-stats .stat-value {
    font-size: 20px;
  }
  .stat-grid.hr-stats .stat-foot {
    font-size: 11px;
    line-height: 1.45;
  }
}
@media (max-width: 760px) {
  /* 卡片头原来是一行 flex：工具条一换行就把标题挤成竖条 */
  .hr-card-head {
    flex-wrap: wrap;
  }
  .hr-card-head h3,
  .hr-card-head .sub {
    flex: none;
    white-space: nowrap;
  }
  .hr-card-head .spacer {
    display: none;
  }
  .hr-toolbar {
    width: 100%;
    margin-top: 4px;
  }
  .hr-toolbar .input {
    flex: 1 1 96px;
    min-width: 0;
    width: auto !important;
  }
  .hide-sm {
    display: none !important;
  }
}

/* 手机上花名册仍会横滑：把「操作」列固定在右侧，滑到哪都能改人 */
@media (max-width: 760px) {
  .hr-roster th:last-child,
  .hr-roster td:last-child {
    position: sticky;
    right: 0;
    background: var(--surface);
    box-shadow: -8px 0 10px -8px rgba(23, 34, 59, 0.28);
  }
  .hr-roster th:last-child {
    background: var(--surface-2);
  }
}

/* 手机端花名册只留「姓名 / 部门 / 操作」：岗位、工龄、手机在详情弹窗里看，
   硬挤进来的结果是被固定列遮掉半个字，不如不显示 */
@media (max-width: 760px) {
  .hr-roster td .cell-sub {
    font-size: 11px;
  }
}

/* 手机端把花名册的单元格内边距收窄，四列才装得下（不然状态列被固定列切掉） */
@media (max-width: 760px) {
  .hr-roster th,
  .hr-roster td {
    padding: 9px 7px;
    font-size: 12.5px;
  }
  .hr-roster th:last-child,
  .hr-roster td:last-child {
    width: 92px;
    min-width: 92px;
  }
  .hr-roster td .row-actions {
    gap: 2px;
  }
  .hr-roster td .row-actions .btn {
    padding: 2px 6px;
    font-size: 11.5px;
  }
}

/* 登录页页脚备案号：法规要求首页底部展示，链接到工信部备案系统 */
.auth-form-col {
  width: 100%;
  max-width: 384px;
}
.auth-beian {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted-2);
}
.auth-beian a {
  color: inherit;
  text-decoration: none;
}
.auth-beian a:hover {
  color: var(--muted);
  text-decoration: underline;
}
