/* DISHINE ERP —— 桌面端样式(紧凑、表格优先) */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #1d2733;
  --ink-2: #4b5866;
  --ink-3: #7b8794;
  --line: #dde3ea;
  --line-2: #eef1f5;
  --brand: #1f4e79;
  --brand-2: #2d6aa6;
  --brand-soft: #e7eff8;
  --ok: #1e7b4a;   --ok-soft: #e3f4ea;
  --warn: #9a6200; --warn-soft: #fdf1dc;
  --bad: #b3261e;  --bad-soft: #fbe6e4;
  --info: #2d6aa6; --info-soft: #e7eff8;
  --mute-soft: #eceff3;
  --radius: 6px;
  --font: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.boot { padding: 48px; color: var(--ink-3); }

/* ---------- 布局 ---------- */
.shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); height: 100vh; }
.topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--brand); color: #fff; }
.topbar .brand { font-weight: 600; font-size: 15px; letter-spacing: .5px; }
.topbar .brand small { font-weight: 400; opacity: .75; margin-left: 8px; }
.topbar .spacer { flex: 1; }
.topbar .who { opacity: .9; color: #fff; }
.topbar a.who:hover { opacity: 1; text-decoration: underline; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; padding: 4px 0; }
.check-grid label { display: flex; align-items: center; gap: 6px; }
.check-grid input { min-height: 0; }
td .wrap, .wrap { white-space: normal; }
.panel-body.hint { padding: 10px 14px 0; }
.topbar button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); }
.topbar button:hover { background: rgba(255,255,255,.12); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 0; }
.sidebar .group { padding: 12px 18px 4px; font-size: 12px; color: var(--ink-3); }
.sidebar a { display: block; padding: 7px 18px; color: var(--ink-2); border-left: 3px solid transparent; }
.sidebar a:hover { background: var(--line-2); text-decoration: none; }
.sidebar a.active { color: var(--brand); background: var(--brand-soft); border-left-color: var(--brand); font-weight: 600; }
.main { overflow-y: auto; padding: 18px 22px 40px; flex: 1; min-height: 0; }

/* 顶部模块栏 */
.topbar .modules { display: flex; align-self: stretch; margin-left: 12px; }
.topbar .modules a { display: flex; align-items: center; padding: 0 16px; color: rgba(255,255,255,.82); border-bottom: 3px solid transparent; white-space: nowrap; }
.topbar .modules a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.topbar .modules a.active { color: #fff; font-weight: 600; background: rgba(255,255,255,.14); border-bottom-color: #fff; }
.sidebar .group { font-size: 13px; font-weight: 600; color: var(--ink); }

/* 页签区:每个打开的页面一个页签 */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabbar { display: flex; align-items: flex-end; gap: 2px; padding: 6px 10px 0; background: var(--line-2); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.tabbar .tab { display: flex; align-items: center; gap: 2px; max-width: 220px; padding: 0 4px 0 12px; height: 30px; background: #e3e8ee; border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; }
.tabbar .tab a { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .tab a:hover { text-decoration: none; color: var(--ink); }
.tabbar .tab.active { background: var(--panel); margin-bottom: -1px; height: 31px; }
.tabbar .tab.active a { color: var(--brand); font-weight: 600; }
.tabbar .tab-btn { border: none; background: none; min-height: 0; padding: 0 4px; color: var(--ink-3); font-size: 14px; line-height: 1; }
.tabbar .tab-btn:hover { color: var(--bad); background: none; }
.tabbar .tab-closeall { margin-left: auto; align-self: center; min-height: 24px; padding: 0 8px; font-size: 12px; }

/* ---------- 页头 ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h1 { font-size: 18px; margin: 0; font-weight: 600; }
.page-head .crumb { color: var(--ink-3); }
.page-head .spacer { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.panel > .panel-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.panel > .panel-head .spacer { flex: 1; }
.panel > .panel-body { padding: 14px; }

/* ---------- 工具条 / 表单控件 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; background: #fff; min-height: 30px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-2); }
input[type=number] { text-align: right; }
input.invalid, select.invalid { border-color: var(--bad); }
textarea { resize: vertical; min-height: 56px; }
button { font: inherit; cursor: pointer; border-radius: 4px; padding: 5px 14px; min-height: 30px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
button:hover { background: var(--line-2); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-2); }
button.danger { color: var(--bad); border-color: #efc2be; }
button.link { border: none; background: none; color: var(--brand-2); padding: 0 4px; min-height: 0; }
button:disabled { opacity: .55; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--ink-2); font-size: 12px; }
.field > span.req::after { content: " *"; color: var(--bad); }
.field.wide { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 18px; }
.kv div span { display: block; color: var(--ink-3); font-size: 12px; }
.kv div b { font-weight: 500; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
table.grid th { position: sticky; top: 0; background: #f7f9fb; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tbody tr.selected { background: var(--brand-soft); }
table.grid tfoot td { font-weight: 600; background: #fafbfc; border-top: 1px solid var(--line); }
table.grid td input, table.grid td select { width: 100%; min-width: 80px; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }

/* ---------- 状态标签 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.badge.mute { background: var(--mute-soft); color: var(--ink-2); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok   { background: var(--ok-soft); color: var(--ok); }
.badge.bad  { background: var(--bad-soft); color: var(--bad); }

/* ---------- 概览卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { color: var(--ink-3); font-size: 12px; }
.stat b { display: block; font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.link { cursor: pointer; }
.stat.link:hover { border-color: var(--brand-2); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #1f4e79 0%, #2d6aa6 55%, #e7eff8 55%); }
.login-card { width: 340px; background: var(--panel); border-radius: 8px; padding: 28px; box-shadow: 0 10px 30px rgba(20,40,70,.18); }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p { margin: 0 0 20px; color: var(--ink-3); }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; min-height: 36px; }
.login-card .err { color: var(--bad); min-height: 20px; margin-bottom: 8px; }

/* ---------- 提示 ---------- */
#toasts { position: fixed; right: 18px; top: 60px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { min-width: 240px; max-width: 420px; padding: 10px 14px; border-radius: 6px; background: var(--ink); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }
.muted { color: var(--ink-3); }
.hint { color: var(--ink-3); font-size: 12px; }
.total-line { display: flex; justify-content: flex-end; gap: 22px; padding: 10px 14px; font-variant-numeric: tabular-nums; }
.total-line b { font-size: 15px; }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 8px 14px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--ink-3); }
.pager button { min-height: 26px; padding: 0 10px; font-size: 12px; }
.pager span { margin: 0 6px; }

/* ---------- 报表 ---------- */
.report-filters label.inline { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--ink-3); }
.report-filters input[type="date"] { width: 9.5em; }
.print-only { display: none; }

/* ---------- 单据打印(A4)---------- */
body.printing { background: #e9ecf0; }
body.printing #app { display: block; height: auto; }
.print-toolbar { display: flex; gap: 10px; align-items: center; max-width: 210mm; margin: 16px auto 0; }
.print-sheet { width: 210mm; min-height: 297mm; margin: 12px auto 24px; padding: 14mm 14mm 12mm; background: #fff; color: #000;
  box-shadow: 0 1px 6px rgba(0,0,0,.15); font-size: 12px; line-height: 1.5; box-sizing: border-box; }
.print-company { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.print-company-sub { text-align: center; font-size: 11px; color: #333; min-height: 1em; }
.print-title { text-align: center; font-size: 18px; letter-spacing: 8px; margin: 8px 0 12px; }
.print-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; margin-bottom: 8px; }
.print-meta span { color: #444; }
.print-lines { width: 100%; border-collapse: collapse; }
.print-lines th, .print-lines td { border: 1px solid #000; padding: 4px 5px; vertical-align: top; }
.print-lines th { background: #f1f1f1; font-weight: 600; }
.print-lines .num { text-align: right; white-space: nowrap; }
.print-lines .center { text-align: center; }
.print-lines tfoot td { font-weight: 600; }
.print-amount { float: right; }
.print-note { margin-top: 8px; }
.print-signs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 28px; }
.print-signs div { display: flex; align-items: flex-end; gap: 4px; white-space: nowrap; }
.print-signs i { flex: 1; border-bottom: 1px solid #000; height: 1.4em; }
.print-foot { margin-top: 18px; font-size: 10px; color: #666; text-align: right; }

@media print {
  @page { size: A4; margin: 10mm; }
  .no-print, .sidebar, .topbar, .tabbar, .page-head button, .page-head .crumb, #toasts { display: none !important; }
  .print-only { display: block; }
  body, body.printing { background: #fff; }
  .shell, .workspace { display: block; height: auto; }
  .main { overflow: visible; padding: 0; }
  .panel { box-shadow: none; border: none; }
  .print-sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .print-lines thead { display: table-header-group; }
  .print-lines tr { page-break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table.grid th, table.grid td { border: 1px solid #999; }
}
.report-filters input.narrow { width: 6em; }
.topbar { overflow: hidden; }
.topbar .brand, .topbar .who { white-space: nowrap; flex: none; }
.topbar .modules { overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabbar { scrollbar-width: thin; }
.tabbar > * { flex: none; }
.tabbar .tab-closeall { white-space: nowrap; }
.topbar button { white-space: nowrap; flex: none; }

/* ---------- 模块首页的流程图 ---------- */
.flow-wrap { padding: 14px; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 4px 0; margin-bottom: 10px; }
.flow:last-child { margin-bottom: 0; }
.flow.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.flow-arrow { display: flex; align-items: center; padding: 0 8px; color: var(--ink-3); font-size: 18px; }
.flow-node { display: flex; flex-direction: column; gap: 3px; justify-content: flex-start; width: 186px; min-height: 84px;
  padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--brand-2); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); }
a.flow-node:hover { background: var(--brand-soft); border-color: var(--brand-2); text-decoration: none; box-shadow: 0 1px 4px rgba(31,78,121,.15); }
.flow-node b { font-size: 14px; }
.flow-node small { color: var(--ink-3); white-space: normal; line-height: 1.4; }
.flow-node .flow-count { margin-top: auto; align-self: flex-start; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  background: var(--brand-soft); color: var(--brand); }
.flow-node.auto { border-left-color: var(--ink-3); background: #f7f9fb; color: var(--ink-2); }
.flow-node.off { border-left-color: var(--line); background: #f7f9fb; color: var(--ink-3); }
.flow.grid .flow-node { width: auto; min-height: 66px; }
.flow-steps { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.flow-step { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-step select { min-width: 220px; }
.flow-step input.narrow { width: 7em; }
.topbar .todo { display: inline-flex; align-items: center; gap: 6px; color: #fff; padding: 0 10px; height: 26px; border-radius: 13px; background: rgba(255,255,255,.16); }
.topbar .todo:hover { background: rgba(255,255,255,.28); text-decoration: none; }
.topbar .todo b { background: var(--bad); border-radius: 9px; padding: 0 6px; font-size: 12px; }

/* ================= 模块首页:仿原系统的流程图 ================= */
.fboard { display: grid; grid-template-columns: 34px 1fr minmax(260px, 34%); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fboard .fside { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; }
.fboard .fside span { writing-mode: vertical-rl; letter-spacing: 3px; }
.fboard .fmain { padding: 14px 18px 20px; border-right: 1px solid var(--line); min-width: 0; }
.fboard .freports { padding: 14px 18px 20px; min-width: 0; }
.fboard .fcap { font-weight: 600; margin-bottom: 10px; }
.tone-blue   { --fc: #2f6fd0; } .tone-orange { --fc: #e8871e; } .tone-teal { --fc: #12857f; }
.tone-purple { --fc: #6b4bb5; } .tone-green  { --fc: #1e7b4a; }
.fboard.tone-blue .fside, .fboard.tone-orange .fside, .fboard.tone-teal .fside,
.fboard.tone-purple .fside, .fboard.tone-green .fside { background: var(--fc); }
.fboard .fcap { color: var(--fc); }

/* 网格 + 节点 */
.fchart { position: relative; }
.fgrid { display: grid; gap: 22px 30px; align-items: center; justify-items: start; }
.fgrid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fgrid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.col-1 { grid-column: 1; } .col-2 { grid-column: 2; } .col-3 { grid-column: 3; } .col-4 { grid-column: 4; } .col-5 { grid-column: 5; }
.row-1 { grid-row: 1; } .row-2 { grid-row: 2; } .row-3 { grid-row: 3; } .row-4 { grid-row: 4; } .row-5 { grid-row: 5; }
.fnode { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; color: var(--ink); max-width: 100%; }
.fnode .fn-ico { display: inline-flex; flex: none; }
.fnode .ico { width: 22px; height: 22px; fill: none; stroke: var(--fc); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fnode .fn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnode .fn-count { flex: none; padding: 0 6px; border-radius: 9px; font-size: 11px; background: var(--mute-soft); color: var(--ink-3); }
.fnode .fn-todo { flex: none; padding: 0 6px; border-radius: 9px; font-size: 11px; background: var(--mute-soft); color: var(--ink-3); }
a.fnode:hover { background: var(--brand-soft); text-decoration: none; }
a.fnode:hover .fn-label { color: var(--fc); }
.fnode.missing, .fnode.off { color: var(--ink-3); }
.fnode.missing .ico, .fnode.off .ico { stroke: #b9c2cc; }
.fnode.auto .fn-label { color: var(--ink-2); }

/* 箭头层 */
.flines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.fline { fill: none; stroke: var(--fc); stroke-width: 1.3; opacity: .85; }
.fline.dashed { stroke-dasharray: 5 4; }
.fmark path { fill: var(--fc); }

/* 流程图尺寸:按内容排,不够宽就横向滚动(挤成一团反而看不清) */
.fboard { grid-template-columns: 34px minmax(0, 1fr) minmax(240px, 32%); }
.fboard .fmain, .fboard .freports { overflow-x: auto; }
.fgrid.cols-2, .fgrid.cols-3, .fgrid.cols-4, .fgrid.cols-5 { grid-template-columns: repeat(var(--fcols), max-content); }
.fgrid.cols-2 { --fcols: 2; } .fgrid.cols-3 { --fcols: 3; } .fgrid.cols-4 { --fcols: 4; } .fgrid.cols-5 { --fcols: 5; }
.fchart { width: max-content; min-width: 100%; }
.fnode { max-width: none; }
.fnode .fn-label { overflow: visible; text-overflow: clip; }
.page-head h1 { white-space: nowrap; }
.page-head .crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgrid { gap: 16px 20px; }
.fnode { padding: 3px 4px; gap: 5px; }
.fnode .fn-count, .fnode .fn-todo { font-size: 10px; padding: 0 5px; }
.topbar .todo { white-space: nowrap; }
/* 箭头要看得见:列间距留足线的长度(原来只有 20px,线被箭头尖占满了) */
.fgrid { gap: 20px 46px; }
.freports .fgrid { gap: 16px 30px; }
/* 行距:竖向箭头也要看得见(原来 20px,减掉两端留白只剩 4px) */
.fgrid { gap: 34px 46px; }
.freports .fgrid { gap: 16px 30px; }
/* 流程区行距要够:分叉线上下各要有一段看得见的竖线 */
.fmain .fgrid { gap: 56px 46px; }
.rowspan-2 { grid-row: span 2; align-self: center; }
.fline.brace { stroke-width: 1.2; }

/* ---------- 单据列表:筛选条 + 选中行操作栏(仿原系统) ---------- */
.toolbar.filters label.inline { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); white-space: nowrap; }
.toolbar.filters input { width: 10em; }
.toolbar.filters input[type="date"] { width: 9.5em; }
.doc-actions { gap: 2px 10px; background: #fafbfc; border-bottom: 1px solid var(--line); padding: 7px 14px; }
.doc-actions > .muted { margin-right: 6px; }
.doc-actions button, .doc-actions .act { padding: 0 6px; min-height: 24px; font-size: 13px; }
.doc-actions .act { color: var(--brand-2); }
.doc-actions button:disabled { color: var(--ink-3); opacity: .6; }
table.grid td input[type="radio"] { width: auto; min-width: 0; }

/* ---------- 进程追踪 ---------- */
.trace-node { display: inline-flex; align-items: center; gap: 6px; }
.trace-node .ico { width: 18px; height: 18px; fill: none; stroke: var(--brand-2); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.trace-node.depth-1 { padding-left: 22px; } .trace-node.depth-2 { padding-left: 44px; }
.trace-node.depth-3 { padding-left: 66px; } .trace-node.depth-4 { padding-left: 88px; }
.trace-node.depth-1::before, .trace-node.depth-2::before, .trace-node.depth-3::before, .trace-node.depth-4::before {
  content: "└"; color: var(--ink-3); margin-left: -16px; margin-right: 2px; }
.page-head .act { margin-left: 10px; }

/* ---------- 进程追踪:环节时间轴 ---------- */
.stages { padding: 14px 18px; }
.stage { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding-bottom: 16px; position: relative; }
.stage::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line); background: var(--panel); z-index: 1; }
.stage-dot .ico { width: 17px; height: 17px; fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.stage.state-done .stage-dot { border-color: var(--ok); background: var(--ok-soft); }
.stage.state-done .stage-dot .ico { stroke: var(--ok); }
.stage.state-doing .stage-dot { border-color: var(--brand-2); background: var(--brand-soft); }
.stage.state-doing .stage-dot .ico { stroke: var(--brand-2); }
.stage.state-bad .stage-dot { border-color: var(--bad); background: var(--bad-soft); }
.stage.state-bad .stage-dot .ico { stroke: var(--bad); }
.stage.current .stage-body { background: #fffdf3; border-radius: var(--radius); padding: 6px 10px; margin: -6px -10px; }
.stage-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-head b { font-size: 14px; }
.stage-sum { color: var(--ink-2); margin-top: 2px; }
.stage-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stage-bar i { display: block; height: 6px; border-radius: 3px; background: var(--brand-soft); width: 220px; position: relative; overflow: hidden; }
.stage-bar i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand-2); width: var(--w, 0%); }
.stage-bar span { font-size: 12px; color: var(--ink-3); }
.stage-docs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stage-docs .chip { display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 12px; }
a.chip:hover { border-color: var(--brand-2); background: var(--brand-soft); text-decoration: none; }

.stage-bar i.p-0::after { width: 0%; }
.stage-bar i.p-5::after { width: 5%; }
.stage-bar i.p-10::after { width: 10%; }
.stage-bar i.p-15::after { width: 15%; }
.stage-bar i.p-20::after { width: 20%; }
.stage-bar i.p-25::after { width: 25%; }
.stage-bar i.p-30::after { width: 30%; }
.stage-bar i.p-35::after { width: 35%; }
.stage-bar i.p-40::after { width: 40%; }
.stage-bar i.p-45::after { width: 45%; }
.stage-bar i.p-50::after { width: 50%; }
.stage-bar i.p-55::after { width: 55%; }
.stage-bar i.p-60::after { width: 60%; }
.stage-bar i.p-65::after { width: 65%; }
.stage-bar i.p-70::after { width: 70%; }
.stage-bar i.p-75::after { width: 75%; }
.stage-bar i.p-80::after { width: 80%; }
.stage-bar i.p-85::after { width: 85%; }
.stage-bar i.p-90::after { width: 90%; }
.stage-bar i.p-95::after { width: 95%; }
.stage-bar i.p-100::after { width: 100%; }

/* 业务配置页 */
.cfg-list { display: grid; gap: 12px; }
.cfg-item { display: grid; grid-template-columns: 1fr minmax(180px, 280px); gap: 12px; align-items: center;
            padding: 10px 0; border-bottom: 1px solid var(--line); }
.cfg-item:last-child { border-bottom: 0; }
.cfg-label b { display: block; font-weight: 600; }
.cfg-label small { color: var(--ink-3); }
.price-tip { display: block; font-size: 11px; color: var(--ink-3); }
@media (max-width: 720px) { .cfg-item { grid-template-columns: 1fr; } }

/* 共享人:表格下面的一行「选人 + 权限 + 添加」 */
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form select { min-width: 140px; }
button.link.danger { color: var(--bad); }

/* 通用:隐藏(基础资料编辑态的「取消编辑」按钮等) */
.hidden { display: none !important; }

/* 月度损益表:小计行加粗,明细行缩进 */
.pl-sub { font-weight: 700; }
.pl-item { padding-left: 18px; color: var(--ink-2); }
tr.pl-row-sub td { border-top: 1px solid var(--line); background: var(--surface-2); }
.bad-text { color: var(--bad); }

/* 合同条款:录入时一行一条(勾选 · 主题 · 内容),查看时有序列表 */
.clause-list { display: grid; gap: 8px; }
.clause-row { display: grid; grid-template-columns: auto minmax(120px, 200px) 1fr; gap: 8px; align-items: start; }
.clause-row input[type=checkbox] { margin-top: 8px; }
.clause-row:not(:has(input[type=checkbox])) { grid-template-columns: minmax(120px, 200px) 1fr; }
.clause-view { margin: 0; padding-left: 20px; }
.clause-view li { margin: 4px 0; }
label.inline { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 640px) { .clause-row, .clause-row:not(:has(input[type=checkbox])) { grid-template-columns: 1fr; } }
/* 打印:合同条款 */
.print-clauses { margin-top: 10px; font-size: 12px; line-height: 1.7; }
.print-clauses-title { font-weight: 700; margin-bottom: 2px; }
.print-clauses ol { margin: 0; padding-left: 18px; }

/* 合同行怎么凑齐:超量审批卡片(超出数量 · 压了多少钱 · 几个月卖完,下面写依据)*/
.excess-card { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; }
.excess-title { font-weight: 700; color: var(--warn); margin-bottom: 6px; }
.card-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 18px; margin-bottom: 6px; }
.card-nums span { display: block; color: var(--ink-3); font-size: 12px; }
.card-nums b { font-size: 18px; font-weight: 600; }
.basis { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.basis b { font-weight: 600; margin-right: 4px; }
.warn-text { color: var(--warn); }
input.warn-input { border-color: var(--warn); background: var(--warn-soft); }
/* 申购审批:逐行选方案 */
.pick-block { border-top: 1px solid var(--line-2); }
.pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.pick small { flex-basis: 100%; padding-left: 22px; }
/* 进程追踪:库存 / 采购 / 生产 三条凑齐线并排 */
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.lane { border-right: 1px dashed var(--line); min-width: 0; }
.lane:last-child { border-right: 0; }
.lane-title { padding: 8px 18px 0; font-weight: 700; color: var(--brand); }
.lane-empty { padding: 14px 18px; }
@media (max-width: 900px) { .lanes { grid-template-columns: 1fr; } .lane { border-right: 0; border-bottom: 1px dashed var(--line); } }
[hidden] { display: none !important; }
/* 报表中心 */
.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.rc-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); text-decoration: none; }
.rc-card:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.rc-card small { color: var(--ink-2); line-height: 1.4; }
.rc-card .muted { font-size: 11px; color: var(--ink-3); }
.rc-filters { flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.rc-f { display: inline-flex; align-items: center; gap: 6px; }
.rc-f > span { color: var(--ink-2); font-size: 12px; }
.rc-q input { min-width: 260px; }
.rc-desc { margin: 0 0 8px; }
.rc-chart-wrap { overflow-x: auto; padding: 8px 4px 0; }
.rc-chart { height: 260px; min-width: 640px; }
.rc-axis { stroke: var(--line); }
.rc-bar { rx: 2; }
.rc-bar0 { fill: var(--brand-2); background: var(--brand-2); }
.rc-bar1 { fill: #d9822b; background: #d9822b; }
.rc-label { font-size: 10px; fill: var(--ink-2); }
.rc-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.rc-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }

/* ===== 左栏 4 级菜单(照原系统:深色底,大类可展开收起,小类 ▸ / ▾,页面缩进)===== */
.sidebar { background: #2c3236; border-right: 0; padding: 0; color: #d7dde2; }
.sidebar .sec { border-bottom: 1px solid #23282b; }
.sidebar .sec-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; background: #394045; color: #eef1f3; border: 0; border-radius: 0;
  font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.sidebar .sec-h:hover { background: #424a50; }
.sidebar .sec.open .sec-h { background: #434c52; }
.sidebar .sec-ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.sidebar .sec-ico svg { width: 16px; height: 16px; stroke: currentColor; }
.sidebar .sec-t { flex: 1; }
.sidebar .sec-arrow { font-size: 11px; opacity: .7; }
.sidebar .sec-b { display: none; padding: 4px 0 8px; background: #2c3236; }
.sidebar .sec.open .sec-b { display: block; }
.sidebar .grp-h { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 12px 5px 14px; background: transparent; color: #e3e8eb; border: 0; border-radius: 0;
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.sidebar .grp-h:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar .caret { width: 10px; font-size: 11px; opacity: .8; }
.sidebar .grp-b { display: none; }
.sidebar .grp.open .grp-b { display: block; }
.sidebar a.leaf { display: block; padding: 4px 12px 4px 30px; color: #c3cbd1; border-left: 0; font-size: 13.5px; }
.sidebar .grp-b a.leaf { padding-left: 38px; }
.sidebar a.leaf:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar a.leaf.active { color: #fff; background: var(--brand); font-weight: 600; }
