/* 产品成本核算 —— 钢材回火色系：草黄 / 古铜 / 紫 / 回火蓝 */
:root {
  --mill: #E9EDEF;        /* 页面底色：冷轧钢灰 */
  --sheet: #FFFFFF;
  --slate: #22313A;       /* 主文字 */
  --steel: #5E707A;       /* 次要文字 */
  --rule: #CDD5D9;
  --rule-soft: #E2E7EA;
  --temper-blue: #2F55A4; /* 主操作色 */
  --straw: #D9A521;       /* 待保存 / 变化 */
  --straw-wash: #FBF3DC;
  --bronze: #A0602F;
  --plum: #6E4A86;
  --ash: #8C9AA2;
  --red: #B3261E;
  --green: #2E7D4F;

  --seg-1: #2F55A4;  /* 原材料 */
  --seg-2: #D9A521;  /* 耗材 */
  --seg-3: #A0602F;  /* 运输 */
  --seg-4: #6E4A86;  /* 其他 */
  --seg-5: #3E8E8A;  /* 喷焊 */

  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  --r-s: 3px;
  --r-m: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow-x: hidden; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--slate);
  background: var(--mill);
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--temper-blue); }
:focus-visible { outline: 2px solid var(--temper-blue); outline-offset: 2px; }
.muted { color: var(--steel); }
.err { color: var(--red); min-height: 1.2em; margin: 4px 0; }
[hidden] { display: none !important; }

/* ---------- 框架 ---------- */
.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.rail {
  background: var(--slate);
  color: #C9D3D8;
  display: flex; flex-direction: column;
  padding: 18px 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 22px; color: #fff; font-size: 17px; font-weight: 600; letter-spacing: .04em; }
.brand-rod { width: 34px; fill: var(--straw); }
.rail a {
  color: #C9D3D8; text-decoration: none;
  padding: 9px 20px; border-left: 3px solid transparent;
}
.rail a:hover { color: #fff; background: rgba(255,255,255,.04); }
.rail a.on { color: #fff; border-left-color: var(--straw); background: rgba(255,255,255,.07); }
.rail-foot { margin-top: auto; padding: 0 20px; font-size: 12px; color: #93A3AB; line-height: 1.8; }
.rail-foot b { color: #E4EAED; font-weight: 500; }

main { min-width: 0; padding: 0 32px 120px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 16px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.banner { padding: 9px 14px; border-radius: var(--r-s); margin-bottom: 14px; font-size: 13px; }
.banner.straw { background: var(--straw-wash); border-left: 3px solid var(--straw); }
.banner.red { background: #FBE9E7; border-left: 3px solid var(--red); }
.banner.blue { background: #E8EEF8; border-left: 3px solid var(--temper-blue); }

/* ---------- 控件 ---------- */
.btn {
  border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--r-s);
  padding: 6px 14px; cursor: pointer; white-space: nowrap;
}
a.btn { text-decoration: none; color: inherit; display: inline-block; }
.btn:hover { border-color: var(--steel); }
.btn.primary { background: var(--temper-blue); border-color: var(--temper-blue); color: #fff; }
.btn.primary:hover { background: #26468a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.small { padding: 2px 9px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

input[type=text], input[type=number], input[type=password], input:not([type]), select {
  border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet);
  padding: 5px 8px; min-width: 0;
}
input:disabled, select:disabled { background: var(--rule-soft); color: var(--steel); }
input.changed { background: var(--straw-wash); border-color: var(--straw); }
input.num { text-align: right; width: 110px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--steel); }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 34px; height: 18px; border-radius: 9px; background: var(--rule); position: relative; transition: background .15s; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--straw); }
.switch input:checked + .track .knob { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--temper-blue); outline-offset: 2px; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 14px; cursor: pointer; border-right: 1px solid var(--rule-soft); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--slate); color: #fff; }
.seg button .n { color: var(--ash); margin-left: 4px; font-size: 12px; }
.seg button.on .n { color: #AFC0C8; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar .grow { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--steel); cursor: pointer; }

/* ---------- 表格 ---------- */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); }
.table-wrap { overflow: auto; max-height: calc(100vh - 290px); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--rule-soft); white-space: nowrap; text-align: left; }
.grid th { position: sticky; top: 0; background: #F5F7F8; color: var(--steel); font-weight: 500; z-index: 1; border-bottom-color: var(--rule); cursor: pointer; user-select: none; }
.grid th.nosort { cursor: default; }
.grid th.sorted::after { content: " ▾"; color: var(--temper-blue); }
.grid th.sorted.asc::after { content: " ▴"; }
.grid td.n, .grid th.n { text-align: right; }
.grid td.key { font-weight: 600; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: #F3F6F8; }
.grid tbody tr.sel td { background: #E8EEF8; }
.grid td.err { color: var(--red); font-size: 12px; white-space: normal; min-width: 220px; }
.grid td.fob { font-weight: 600; }
.grid td.up { color: var(--red); }
.grid td.down { color: var(--green); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-size: 13px; color: var(--steel); border-top: 1px solid var(--rule); }
.pager .btns { display: flex; gap: 6px; align-items: center; }
.empty { padding: 48px 24px; text-align: center; color: var(--steel); }

/* ---------- 抽屉：单个产品 ---------- */
.scrim { position: fixed; inset: 0; background: rgba(34,49,58,.25); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(620px, 100vw);
  background: var(--sheet); box-shadow: none; visibility: hidden;
  transform: translateX(100%); transition: transform .2s ease-out, visibility 0s .2s; z-index: 21;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; visibility: visible; box-shadow: -8px 0 28px rgba(34,49,58,.18); transition: transform .2s ease-out; }
.drawer-inner { overflow: auto; padding: 22px 26px 40px; flex: 1; }
.d-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.d-head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.d-code { color: var(--steel); font-size: 13px; }
.d-desc { color: var(--steel); font-size: 13px; margin: 6px 0 14px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--rule); margin: 6px 0 18px; }
.tabs button { border: 0; background: none; padding: 8px 0; cursor: pointer; color: var(--steel); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--slate); border-bottom-color: var(--temper-blue); font-weight: 600; }

.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--rule-soft); border: 1px solid var(--rule-soft); border-radius: var(--r-m); overflow: hidden; margin-bottom: 22px; }
.figures div { background: var(--sheet); padding: 10px 14px; }
.figures span { display: block; font-size: 12px; color: var(--steel); }
.figures b { font-size: 20px; font-weight: 600; }
.figures .hero b { color: var(--temper-blue); font-size: 26px; }

/* 回火色成本条：本应用的标志性元素 */
.rodbar-block { margin-bottom: 22px; }
.rodbar-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.rodbar-title h3 { margin: 0; font-size: 14px; font-weight: 600; }
.rodbar-title span { font-size: 13px; color: var(--steel); }
.rodbar { display: flex; height: 22px; border-radius: 4px 4px 4px 4px; overflow: hidden; background: var(--rule-soft); }
.rodbar i { display: block; height: 100%; min-width: 2px; transition: flex-grow .25s; }
.rodbar i + i { box-shadow: inset 1px 0 0 rgba(255,255,255,.55); }
.legend { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 14px; margin-top: 10px; font-size: 13px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }
.legend .v { text-align: right; }
.legend .p { text-align: right; color: var(--steel); min-width: 48px; }

.calc-list { columns: 2; column-gap: 28px; font-size: 13px; }
.calc-list div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dotted var(--rule-soft); break-inside: avoid; }
.calc-list div span:first-child { color: var(--steel); }
.calc-list div.total { font-weight: 600; }
.calc-list div.total span:first-child { color: var(--slate); }

.form { display: grid; grid-template-columns: 140px 1fr; gap: 10px 14px; align-items: center; }
.form label { color: var(--steel); font-size: 13px; }
.form input, .form select { width: 100%; }
.form .hint { grid-column: 2; font-size: 12px; color: var(--steel); margin-top: -6px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .grow { flex: 1; }

/* ---------- 参数 ---------- */
.params-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { position: sticky; top: 16px; display: flex; flex-direction: column; }
.subnav button { text-align: left; border: 0; background: none; padding: 7px 12px; cursor: pointer; border-radius: var(--r-s); color: var(--steel); }
.subnav button.on { background: var(--sheet); color: var(--slate); font-weight: 600; box-shadow: inset 3px 0 0 var(--temper-blue); }
.subnav button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--straw); margin-left: 6px; vertical-align: 2px; }
.block { margin-bottom: 26px; }
.block h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.block .note { font-size: 13px; color: var(--steel); margin: 0 0 10px; }
.section-note { font-size: 13px; color: var(--steel); margin: -4px 0 16px; }
table.ptable { border-collapse: collapse; width: 100%; font-size: 13px; }
.ptable th, .ptable td { padding: 6px 10px; border-bottom: 1px solid var(--rule-soft); text-align: left; }
.ptable th { color: var(--steel); font-weight: 500; background: #F5F7F8; white-space: nowrap; }
.ptable td.unit { color: var(--steel); }
.ptable td.sz { white-space: nowrap; }
.ptable td.n, .ptable th.n { text-align: right; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable input.num { width: 100px; }
.ptable input.name { width: 110px; }
.ptable .active-col { background: #E8EEF8; }
.ptable th.active-col { color: var(--temper-blue); }
.scroll-x { overflow-x: auto; }
.block-actions { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--rule-soft); flex-wrap: wrap; align-items: center; }

/* ---------- 待保存条 ---------- */
.pending {
  position: fixed; left: 200px; right: 0; bottom: 0; z-index: 15;
  background: var(--slate); color: #E8EDF0;
  border-top: 3px solid var(--straw);
  padding: 12px 32px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
}
.pending .what { flex: 1; min-width: 260px; font-size: 13px; line-height: 1.7; }
.pending .what b { color: #fff; }
.pending .what .warn { color: #F2B8B5; }
.pending .btn.ghost { color: #E8EDF0; border-color: #5E707A; }

/* ---------- 对比 / 说明 ---------- */
.stats { display: flex; gap: 40px; margin: 6px 0 14px; flex-wrap: wrap; }
.stats div span { display: block; font-size: 12px; color: var(--steel); }
.stats div b { font-size: 22px; font-weight: 600; }
.prose { max-width: 760px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 22px 28px; margin-bottom: 18px; }
.prose h2 { font-size: 17px; margin: 0 0 10px; }
.prose ol, .prose ul { padding-left: 20px; margin: 0; }
.prose li { margin-bottom: 6px; }
.prose code { background: var(--rule-soft); padding: 1px 5px; border-radius: 3px; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--slate); color: #fff; padding: 9px 18px; border-radius: var(--r-m);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red); }

dialog { border: 1px solid var(--rule); border-radius: var(--r-m); padding: 22px 26px; width: 340px; }
dialog::backdrop { background: rgba(34,49,58,.35); }
dialog h3 { margin: 0 0 4px; }
dialog input { width: 100%; margin-top: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; align-items: center; }
  .brand { padding: 0 12px 0 4px; }
  .rail a { padding: 6px 10px; border-left: 0; border-bottom: 2px solid transparent; }
  .rail a.on { border-bottom-color: var(--straw); }
  .rail-foot { display: none; }
  main { padding: 0 16px 140px; }
  .params-layout { grid-template-columns: 1fr; }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; }
  .pending { left: 0; padding: 12px 16px; }
  .calc-list { columns: 1; }
  .figures { grid-template-columns: 1fr 1fr; }
  .topbar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- 语言切换 ---------- */
.seg.small button { padding: 5px 11px; font-size: 13px; }

/* ---------- 重复编码 ---------- */
.dup-banner { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; }
.dup-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 2px;
  font-size: 11px; font-weight: 600; line-height: 17px;
  color: #6B4E0A; background: var(--straw-wash); border: 1px solid var(--straw);
}
.grid tbody tr.dup td:first-child { box-shadow: inset 3px 0 0 var(--straw); }
.grid td.name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 导入 ---------- */
.steps { padding-left: 20px; margin: 18px 0; }
.steps li { margin-bottom: 14px; }
.steps li > div { margin-top: 6px; }
.radios { display: flex; flex-direction: column; gap: 4px; }
.note { font-size: 13px; color: var(--steel); }
.imp-stats { gap: 32px; }
.imp-stats b.warn { color: var(--bronze); }
.imp-table { max-height: 46vh; }
.imp-table td { white-space: normal; vertical-align: top; }
.imp-table td.unit { white-space: nowrap; color: var(--steel); font-size: 12px; }
.imp-table tbody tr { cursor: default; }
.act { display: inline-block; padding: 0 6px; border-radius: 2px; font-size: 12px; line-height: 19px; white-space: nowrap; }
.act-add { background: #E3F1E8; color: var(--green); }
.act-update { background: #E8EEF8; color: var(--temper-blue); }
.act-skip { background: #F6E9DF; color: var(--bronze); }
.imp-table .err { font-size: 12px; min-height: 0; margin: 2px 0 0; }

/* ---------- 产品编码 ---------- */
.subnav hr { border: 0; border-top: 1px solid var(--rule); margin: 8px 12px; }
.subnav .cnt { color: var(--ash); font-size: 12px; margin-left: 2px; }
input.cg { width: 100%; min-width: 64px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet); }
input.cg.code { min-width: 0; width: 44px; text-align: center; }
input.cg.hcode { min-width: 0; width: 64px; }
input.cg.wide { min-width: 220px; }
input.cg.changed { background: var(--straw-wash); border-color: var(--straw); }
input.cg:disabled { background: transparent; border-color: transparent; color: var(--slate); }
.cg-grid td, .cg-grid th { padding: 4px 5px; }
.cg-grid th.grp { text-align: center; color: var(--slate); border-left: 1px solid var(--rule); }
.cg-grid tr.hdr td { background: #F5F7F8; }
.cg-grid td:nth-child(2n) { border-left: 1px solid var(--rule-soft); }
.cg-info td { white-space: nowrap; }
.grid tbody tr.static { cursor: default; }

.filters { display: contents; }
.filters select.on { border-color: var(--temper-blue); box-shadow: inset 0 0 0 1px var(--temper-blue); }
.grid td.name { max-width: 380px; }

/* ---------- 参数：计算方法 / 费用项 / 原材料 ---------- */
details.explain { background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--temper-blue); border-radius: var(--r-s); padding: 10px 16px; margin-bottom: 20px; font-size: 13px; }
details.explain summary { cursor: pointer; font-weight: 600; color: var(--slate); }
details.explain ul { margin: 8px 0 2px; padding-left: 18px; color: var(--slate); }
details.explain li { margin-bottom: 4px; line-height: 1.65; }
.items-t input.item-name { width: 220px; }
.items-t select.changed, .items-t input.item-name.changed { background: var(--straw-wash); border-color: var(--straw); }
.mat-t th.corner { min-width: 150px; }
.mat-t th.mat-h { white-space: nowrap; }
.mat-t .x { border: 0; background: none; color: var(--ash); cursor: pointer; font-size: 14px; padding: 0 2px; margin-left: 2px; }
.mat-t .x:hover:not(:disabled) { color: var(--red); }
.mat-t .x:disabled { visibility: hidden; }
.mat-t input.num { width: 82px; }
.mat-t input.name { width: 70px; }
.mat-t input.note-in { width: 82px; }
.mat-t tr.calc-row td { background: #E8EEF8; font-weight: 600; color: var(--temper-blue); border-bottom: 2px solid var(--rule); }
.mat-t tr.calc-row .unit { font-weight: 400; font-size: 12px; color: var(--steel); }
.mat-t tr.active-row td { background: #F4F7FC; }
.mat-t td.date-cell { white-space: nowrap; }
.mat-t .tag { font-size: 11px; color: var(--temper-blue); border: 1px solid var(--temper-blue); border-radius: 2px; padding: 0 4px; margin-left: 4px; }

/* ---------- 产品编码（新版） ---------- */
.subnav button.add { color: var(--temper-blue); }
.fam-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fam-head h2 { font-size: 18px; margin: 0; flex: 1; }
.code-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-s); padding: 4px 4px; }
.chip small { color: var(--steel); font-size: 12px; margin: 0 4px; }
.chip b { font-size: 16px; color: var(--temper-blue); min-width: 14px; text-align: center; }
.chip.pre { padding: 4px 10px; background: #F5F7F8; }
.chip .mv { border: 0; background: none; cursor: pointer; color: var(--ash); font-size: 16px; padding: 0 3px; line-height: 1; }
.chip .mv:disabled { visibility: hidden; }
.chip .mv:hover { color: var(--temper-blue); }
.code-chips .eg { align-self: center; margin-left: 10px; font-size: 13px; color: var(--steel); }
.code-chips .eg b { color: var(--slate); }
.formula { font-size: 14px; margin: 12px 0 0; }
.formula .fx { white-space: nowrap; }
.formula .fx b { color: var(--temper-blue); }
.groups { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.gcard { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 10px 12px 8px; }
.gcard.paired { border-color: var(--temper-blue); box-shadow: inset 3px 0 0 var(--temper-blue); }
.ghead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.ghead .grow { flex: 1; }
.badge { font-size: 11px; padding: 0 6px; border-radius: 2px; line-height: 18px; background: #EEF1F3; color: var(--steel); }
.gcard.paired .badge { background: #E8EEF8; color: var(--temper-blue); }
.gcard .cg-grid th { font-size: 12px; padding: 3px 5px; background: none; }
.gcard .cg-grid td { padding: 2px 3px; border: 0; }
.gcard input.cg { min-width: 0; width: 110px; }
.gcard input.cg.code { width: 44px; }
.gcard .x, .rule .x { border: 0; background: none; color: var(--ash); cursor: pointer; font-size: 15px; }
.gcard .x:hover, .rule .x:hover { color: var(--red); }
.gcard .addrow { margin-top: 4px; }
.block-actions.bare { border: 0; padding: 10px 0 0; }
.rule { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 10px 12px; margin-bottom: 10px; }
.rhead { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.rhead .grow { flex: 1; }
.cond { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 6px 0; }
.cond .cl { font-size: 13px; color: var(--steel); min-width: 72px; }
.vchip { border: 1px solid var(--rule); background: var(--sheet); border-radius: 12px; padding: 1px 10px; font-size: 12px; cursor: pointer; color: var(--steel); }
.vchip.on { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.vchip.gone { border-style: dashed; cursor: default; text-decoration: line-through; }
.tok-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.tok { border: 1px dashed var(--temper-blue); background: #F4F7FC; color: var(--temper-blue); border-radius: var(--r-s); padding: 1px 8px; font-size: 12px; cursor: pointer; }
.tpl-t td:first-child { white-space: nowrap; width: 150px; color: var(--steel); }
.tpl-t input.cg.tpl { width: 100%; font-family: var(--font); }
.tpl-t .eg-line { font-size: 12px; margin-top: 3px; min-height: 1em; }
.note code, .prose code { background: var(--rule-soft); padding: 0 4px; border-radius: 3px; }

/* ---------- 密码 ---------- */
.lock-card { max-width: 440px; margin: 60px auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 28px 32px; }
.lock-card h2 { font-size: 18px; margin: 0 0 6px; }
.lock-card form { display: flex; gap: 8px; margin-top: 16px; }
.lock-card input { flex: 1; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.rail a.locked::after { content: "🔒"; font-size: 11px; margin-left: 6px; opacity: .55; }

/* ---------- 报价 ---------- */
.combo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 250px; gap: 0; }
.combo .slot { padding: 12px 14px; border-right: 1px solid var(--rule-soft); cursor: pointer; min-height: 118px; }
.combo .slot:last-child { border-right: 0; cursor: default; background: #F7F9FA; }
.combo .slot.cur { box-shadow: inset 0 -3px 0 var(--temper-blue); background: #F4F7FC; }
.slot-h { font-size: 12px; color: var(--steel); display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.slot-code { font-weight: 700; color: var(--temper-blue); }
.slot-desc { font-size: 13px; line-height: 1.45; margin: 2px 0 6px; }
.slot-num { display: flex; gap: 10px; font-size: 12px; color: var(--steel); flex-wrap: wrap; }
.slot-empty { color: var(--ash); font-size: 13px; margin-top: 14px; }
.slot .x, .q-lines .x, .cust-t .x { border: 0; background: none; color: var(--ash); cursor: pointer; font-size: 15px; padding: 0 3px; }
.slot .x:hover, .x.del:hover { color: var(--red); }
.add-box label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.add-box input { width: 110px; padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.add-box .muted { font-size: 12px; margin: 6px 0; }
.add-price { min-height: 22px; font-size: 13px; margin-bottom: 8px; }
.add-price b { color: var(--temper-blue); font-size: 16px; }
.q-head { padding: 12px 14px; }
.q-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.q-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--steel); }
.q-grid label.wide { flex-basis: 100%; }
.q-grid input, .q-grid select { padding: 4px 7px; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet); color: var(--slate); }
.q-grid .qno { color: var(--temper-blue); font-size: 15px; }
.cust-line { margin-top: 8px; font-size: 12px; }
.q-lines td { vertical-align: middle; }
.q-lines td.q-desc { white-space: normal; min-width: 170px; font-size: 12px; line-height: 1.45; }
.q-lines th, .q-lines td { padding: 6px 6px; }
.q-lines td.nowrap { white-space: nowrap; }
.q-lines input { width: 48px; padding: 3px 5px; border: 1px solid var(--rule); border-radius: var(--r-s); text-align: right; }
.q-lines input.changed { background: var(--straw-wash); border-color: var(--straw); }
.q-lines td.acts, td.acts.nowrap { white-space: nowrap; }
.q-lines .x:disabled { visibility: hidden; }
.q-sum { display: flex; flex-wrap: wrap; gap: 26px; margin: 14px 0 0; }
.q-sum span { display: block; font-size: 12px; color: var(--steel); }
.q-sum b { font-size: 18px; }
.q-actions { display: flex; gap: 10px; align-items: center; margin: 18px 0; }
.q-actions .grow { flex: 1; }
.doc-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pack-t input { width: 86px; padding: 3px 5px; border: 1px solid var(--rule); border-radius: var(--r-s); text-align: right; }
.pack-t td.pk-desc { font-size: 12px; }
.cust-t input { padding: 3px 5px; border: 1px solid var(--rule-soft); border-radius: var(--r-s); }
.cust-t input.changed { background: var(--straw-wash); }
.cust-t td { padding: 3px 4px; }
textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); }
@media (max-width: 1100px) { .combo { grid-template-columns: 1fr 1fr; } }
.q-lines input[data-l=price_override] { width: 64px; }
.q-lines input[data-l=qty] { width: 62px !important; }

/* ---------- 品牌 / 首页 ---------- */
.brand { flex-direction: column; align-items: flex-start; gap: 8px; text-decoration: none; font-size: 14px; letter-spacing: .02em; }
.brand img { width: 128px; height: auto; background: #fff; padding: 7px 10px; border-radius: var(--r-m); box-sizing: content-box; }
.home { max-width: 920px; margin: 10px auto 40px; }
.home-hero { text-align: center; padding: 34px 20px 26px; }
.home-logo { width: 300px; max-width: 80%; height: auto; }
.home-hero h1 { font-size: 30px; margin: 18px 0 6px; letter-spacing: .06em; color: var(--slate); }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); text-decoration: none; color: var(--slate); }
.tile:hover { border-color: var(--temper-blue); }
.tile b { font-size: 16px; }
.tile span { font-size: 13px; color: var(--steel); line-height: 1.5; }
.tile.main { grid-column: 1 / -1; background: var(--temper-blue); border-color: var(--temper-blue); }
.tile.main b, .tile.main span { color: #fff; }
.tile .lk { font-size: 12px; opacity: .6; }
.home-pw { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: center; margin-top: 26px; }
.home-pw input { padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); width: 180px; }
/* 报价：比例 */
.q-margins { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule-soft); font-size: 13px; }
.m-in { white-space: nowrap; color: var(--steel); font-size: 13px; margin-right: 10px; }
.m-in input { width: 56px; padding: 3px 5px; border: 1px solid var(--rule); border-radius: var(--r-s); text-align: right; }
.cust-t th.mcol { background: #E8EEF8; color: var(--temper-blue); }
.cust-t td.mcol input { text-align: right; }
.rail a.brand { padding: 4px 20px 22px; border-left: 0; background: none; color: #fff; font-weight: 600; }
.rail a.brand:hover { background: none; }
@media (max-width: 900px) { .rail a.brand { flex-direction: row; padding: 0 12px 0 4px; } .brand img { width: 80px; padding: 4px 6px; } }

/* ---------- 登录 / 用户 ---------- */
.login-card { max-width: 360px; margin: 10px auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; font-size: 18px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--steel); }
.login-card input { padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); }
#user-box { display: inline-flex; align-items: center; gap: 10px; }
#user-name { font-size: 13px; }
.users-t input, .users-t select { padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.users-t tr.new-row td { background: #F7F9FA; }
.role-help { margin-top: 12px; }
.role-help td:first-child { white-space: nowrap; width: 90px; }
.file-btn { cursor: pointer; }
.nowrap { white-space: nowrap; }

/* ---------- 使用手册 ---------- */
.help .prose { max-width: 860px; }
.help .prose h3 { font-size: 15px; margin: 18px 0 6px; }
.help .prose p { line-height: 1.75; }
.steps-h { padding-left: 22px; margin: 6px 0 10px; }
.steps-h li { margin-bottom: 7px; line-height: 1.7; }
.help .banner { margin-top: 10px; }
.help .ptable td:first-child { white-space: nowrap; }

/* ---------- 导航层级 / 设置齿轮 ---------- */
.rail a.sub { padding-left: 38px; font-size: 13px; }
.rail a.sub2 { padding-left: 54px; font-size: 13px; }
.rail a.sub::before, .rail a.sub2::before { content: ""; display: inline-block; width: 6px; height: 1px; background: currentColor; opacity: .5; margin: 0 8px 4px -14px; }
.rail a.gear { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.rail a.gear + .rail-foot { margin-top: 10px; }
@media (max-width: 900px) { .rail a.sub, .rail a.sub2 { padding-left: 10px; } .rail a.sub::before, .rail a.sub2::before { display: none; } .rail a.gear { margin-top: 0; } .rail a.gear span { display: none; } }

/* 首页 */
.tile { padding: 0; }
.tile-a { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px; text-decoration: none; color: inherit; flex: 1; }
.tile-subs { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0 18px 14px; font-size: 13px; }
.tile-subs a { text-decoration: none; }
.tile-subs a:hover { text-decoration: underline; }
.remind-box { background: var(--straw-wash); border: 1px solid #EBD38E; border-radius: var(--r-m); padding: 12px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.remind-box > b { color: var(--bronze); margin-bottom: 2px; }
.remind-box a { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--slate); text-decoration: none; padding: 3px 0; border-top: 1px solid #F0E2B6; }
.remind-box a:hover { color: var(--temper-blue); }
.remind-box a.overdue span:last-child { color: var(--red); font-weight: 600; }

/* ---------- 订单管理 ---------- */
.o-steps { display: flex; gap: 0; flex-wrap: wrap; }
.o-steps button { border: 1px solid var(--rule); background: var(--sheet); padding: 6px 14px; margin-left: -1px; cursor: pointer; font-size: 13px; color: var(--steel); }
.o-steps button:first-child { border-radius: var(--r-s) 0 0 var(--r-s); margin-left: 0; }
.o-steps button:last-child { border-radius: 0 var(--r-s) var(--r-s) 0; }
.o-steps button.done { background: #E8EEF8; color: var(--temper-blue); }
.o-steps button.cur { background: var(--temper-blue); color: #fff; border-color: var(--temper-blue); font-weight: 600; }
.o-steps button:disabled { cursor: default; }
.o-mini { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 6px; }
.o-mini i { width: 12px; height: 6px; border-radius: 1px; background: var(--rule); }
.o-mini i.done { background: var(--temper-blue); }
.pay-tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--rule-soft); color: var(--steel); }
.pay-tag.ok { background: #DDEFE3; color: var(--green); }
.pay-tag.part { background: #E8EEF8; color: var(--temper-blue); }
.pay-tag.late { background: #F6DCDA; color: var(--red); }
.pay-tag.soon { background: var(--straw-wash); color: var(--bronze); }
.o-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; margin-top: 14px; }
.o-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 14px 16px; }
.o-card h3 { margin: 0 0 10px; font-size: 15px; }
.o-card .q-grid { gap: 8px 14px; }
.o-log { max-height: 220px; overflow: auto; font-size: 12.5px; margin-top: 10px; border-top: 1px solid var(--rule-soft); }
.o-log div { padding: 4px 0; border-bottom: 1px solid var(--rule-soft); display: flex; gap: 10px; }
.o-log span:first-child { color: var(--steel); white-space: nowrap; }
.o-money { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.o-money b { text-align: right; }
.o-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.o-head h2 { margin: 0; font-size: 20px; color: var(--temper-blue); }
.o-lines td.q-desc { max-width: 520px; }
.manual-tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--straw-wash); color: var(--bronze); margin-left: 6px; }
.code-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.code-box input { padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); width: 170px; }
dialog.mdlg { border: 1px solid var(--rule); border-radius: var(--r-m); padding: 20px 24px; min-width: 380px; max-width: 560px; }
dialog.mdlg h3 { margin: 0 0 12px; }
dialog.mdlg label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--steel); margin-bottom: 10px; }
dialog.mdlg input, dialog.mdlg textarea { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); width: 100%; }
dialog.mdlg::backdrop { background: rgba(20,30,40,.35); }
.rail a.gear[hidden] + .rail-foot { margin-top: auto; }
.o-card.pay { grid-column: span 2; }
.o-card.pay table { width: 100%; }
.o-card.pay td input, .o-card.pay td select { padding: 4px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); }
@media (max-width: 1100px) { .o-card.pay { grid-column: auto; } .o-card.pay table { display: block; overflow-x: auto; } }
.o-list td.cust { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 菜单分组（默认收起） ---------- */
.rail a.collapsed { display: none !important; }
.rail a[data-grp] { display: flex; align-items: center; }
.rail .caret { margin-left: auto; width: 22px; height: 22px; border: 0; background: none; color: inherit; cursor: pointer; opacity: .7; border-radius: var(--r-s); position: relative; }
.rail .caret::before { content: ""; position: absolute; left: 8px; top: 7px; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.rail .caret.open::before { transform: rotate(45deg); top: 5px; }
.rail .caret:hover { background: rgba(255,255,255,.08); opacity: 1; }
.rail a.gear { width: fit-content; }
.gear-btn { display: inline-flex; align-items: center; padding: 4px 8px; }
@media (max-width: 900px) { .rail a.collapsed { display: none; } }
@media (prefers-reduced-motion: reduce) { .rail .caret::before { transition: none; } }

/* ---------- 只读模式（其他用户正在编辑） ---------- */
.ro-banner { display: flex; align-items: center; gap: 14px; justify-content: space-between; background: var(--straw-wash); border-bottom: 1px solid #EBD38E; color: var(--slate); padding: 9px 28px; font-size: 13px; position: sticky; top: 0; z-index: 30; }
body.ro main .btn.primary { opacity: .45; }
.chip-edit { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #DDEFE3; color: var(--green); margin-right: 4px; }
#edit-chip { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- 访问记录 ---------- */
.jr-t td { font-size: 12.5px; }
.jr-t td.k { white-space: nowrap; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 5px; }

/* ---------- 销售统计 ---------- */
.st-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 4px 0 14px; }
.st-kpi { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.st-kpi span { font-size: 12.5px; color: var(--steel); }
.st-kpi b { font-size: 22px; color: var(--slate); font-weight: 600; }
.st-kpi em { font-style: normal; font-size: 13px; color: var(--temper-blue); }
.st-chart { padding: 14px 16px 10px; }
.st-legend { display: flex; gap: 18px; font-size: 12.5px; margin-bottom: 8px; align-items: center; }
.st-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.st-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 170px; align-items: end; }
.st-m { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; }
.st-m span { font-size: 11px; color: var(--steel); }
.st-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--rule); }
.st-pair i { width: 38%; max-width: 18px; min-height: 0; border-radius: 2px 2px 0 0; }
i.q { background: #B9C6DE; }
i.o { background: var(--temper-blue); }
.base-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.base-box select { padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); max-width: 420px; }
.edit-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
td.q-desc.clickable { cursor: pointer; }
td.q-desc.clickable:hover { background: #F1F5FB; }
td.q-desc.clickable:hover b { color: var(--temper-blue); text-decoration: underline; }

/* ---------- 首页 ---------- */
.home { max-width: 980px; margin: 0 auto 40px; }
.home-hero { text-align: center; padding: 30px 20px 28px; }
.home-logo { width: 260px; max-width: 70%; }
.home-hero h1 { font-size: 42px; font-weight: 700; margin: 20px 0 8px; letter-spacing: .12em; color: var(--slate); line-height: 1.2; }
.home-sub { margin: 0; color: var(--steel); font-size: 14px; letter-spacing: .04em; }
.home-body { --cols: 3; width: 100%; max-width: calc(var(--cols) * 300px + (var(--cols) - 1) * 16px); margin: 0 auto; }
.home-body .remind-box { margin-bottom: 16px; }
.home-tiles { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px; }
.home .tile { padding: 0; display: flex; flex-direction: column; min-height: 178px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); color: var(--slate); transition: border-color .15s, box-shadow .15s; }
.home .tile:hover { border-color: var(--temper-blue); box-shadow: 0 0 0 3px rgba(1, 79, 177, .08); }
.home .tile-a { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 6px; padding: 20px 20px 16px; text-decoration: none; color: inherit; flex: 1; }
.tile-ic { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 10px; background: #E8EEF8; color: var(--temper-blue); display: flex; align-items: center; justify-content: center; }
.home .tile-a b { font-size: 17px; align-self: center; }
.home .tile-a .tile-d { font-size: 13px; color: var(--steel); line-height: 1.55; }
.home .tile-subs { margin: 0 20px; padding: 10px 0 14px 58px; border-top: 1px solid var(--rule-soft); display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; }
.home-foot { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; color: var(--steel); font-size: 13px; }
.home-foot a { color: var(--temper-blue); text-decoration: none; }
.home-foot a:hover { text-decoration: underline; }
.home-foot .gear-btn { display: inline-flex; padding: 5px; border: 1px solid var(--rule); border-radius: var(--r-s); color: var(--steel); background: var(--sheet); }
.home-foot .gear-btn:hover { color: var(--temper-blue); border-color: var(--temper-blue); text-decoration: none; }
@media (max-width: 860px) { .home-tiles { grid-template-columns: 1fr; } .home-hero h1 { font-size: 32px; letter-spacing: .06em; } .home-body { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .home .tile { transition: none; } }
.rail .brand span { font-size: 17px; letter-spacing: .06em; }
.st-stages { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 13px; }
.st-stages label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.st-pair i.o { width: 46%; max-width: 26px; }
.home-body .remind-box a { flex-wrap: nowrap; }
.home-body .remind-box a span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-body .remind-box a span:last-child { white-space: nowrap; }
.home .tile { min-height: 150px; }

/* ---------- 报价审核：编号、条款 ---------- */
.q-numbar { display: flex; align-items: baseline; gap: 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rule-soft); }
.q-no { display: flex; align-items: baseline; gap: 10px; }
.q-no span { font-size: 13px; color: var(--steel); }
.q-no .qno { font-size: 22px; color: var(--temper-blue); letter-spacing: .03em; }
.q-terms { display: grid; grid-template-columns: minmax(240px, .8fr) 1.1fr 1.1fr; gap: 14px; }
.q-tbox { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--temper-blue); border-radius: var(--r-m); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.q-tbox h4 { margin: 0; font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.q-tbox h4 span { font-weight: 400; font-size: 12px; color: var(--steel); }
.q-tbox h4 .x { margin-left: auto; font-size: 12px; width: auto; padding: 0 6px; }
.q-tbox label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--steel); }
.q-tbox input { width: 100% !important; }
.q-tbox textarea { width: 100%; flex: 1; min-height: 120px; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); font: inherit; font-size: 13px; line-height: 1.55; resize: vertical; }
@media (max-width: 1000px) { .q-terms { grid-template-columns: 1fr; } }

/* ---------- 菜单层级（下级菜单缩进、竖线） ---------- */
.rail a.sub, .rail a.sub2 { position: relative; font-size: 13px; color: #AEBBC2; padding-top: 7px; padding-bottom: 7px; }
.rail a.sub { padding-left: 42px; }
.rail a.sub2 { padding-left: 58px; }
.rail a.sub::before, .rail a.sub2::before { content: ""; position: absolute; top: 0; bottom: 0; left: 28px; width: 1px; height: auto; margin: 0; background: rgba(255, 255, 255, .2); opacity: 1; display: block; }
.rail a.sub2::before { left: 44px; }
.rail a.sub.on, .rail a.sub2.on { color: #fff; }
.rail a.on-parent { color: #fff; }
@media (max-width: 900px) {
  .rail a.sub, .rail a.sub2 { padding-left: 6px; }
  .rail a.sub::before, .rail a.sub2::before { content: "›"; position: static; display: inline; background: none; width: auto; margin-right: 6px; opacity: .6; }
}
.user-name { display: inline-flex; align-items: center; gap: 6px; }
.ro-banner.upd { background: #E8EEF8; border-bottom-color: #B9C6DE; }
.home .tile { min-height: 0; }

/* ---------- 报价状态 / 版本 ---------- */
.qst { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--rule-soft); color: var(--steel); white-space: nowrap; }
.qst-sent { background: #E8EEF8; color: var(--temper-blue); }
.qst-won { background: #DDEFE3; color: var(--green); }
.qst-lost { background: #F6DCDA; color: var(--red); }
.qst-expired { background: var(--straw-wash); color: var(--bronze); }
.rev-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--temper-blue); color: var(--temper-blue); }
.q-pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rule-soft); font-size: 13px; }
.q-pipe label { display: inline-flex; align-items: center; gap: 6px; }
.q-pipe input[type=date] { padding: 3px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.q-pipe .acts { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.q-pipe-sum { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; font-size: 13px; margin-bottom: 10px; color: var(--steel); }
.q-pipe-sum b { color: var(--slate); font-size: 16px; }
.q-pipe-sum em { font-style: normal; }
.q-pipe-sum .due b { color: var(--red); }
.diff-t td.old { color: var(--steel); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.diff-t td.new { color: var(--slate); }
.rev-t td { vertical-align: middle; }

/* ---------- 订单文件 / 发货批次 / 附件 ---------- */
.doc-t td { vertical-align: middle; }
.doc-t td.doc-name { width: 120px; font-weight: 600; }
.doc-t td.acts { text-align: right; white-space: nowrap; }
.doc-t td.acts > * { margin-left: 4px; }
.doc-changed { margin-top: 4px; font-size: 12px; color: var(--bronze); background: var(--straw-wash); padding: 2px 8px; border-radius: var(--r-s); display: inline-block; }
.ship-card { margin-bottom: 14px; }
.ship-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ship-head h3 { margin: 0; }
.ship-lines { margin-top: 10px; }
.ship-lines td { vertical-align: middle; }
.ship-lines tr.muted-row td { opacity: .55; }
.ship-lines tr.muted-row td input { opacity: 1; }

/* ---------- 生产计划 ---------- */
.sch { padding: 6px 0; overflow: hidden; }
.sch-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; min-height: 44px; border-bottom: 1px solid var(--rule-soft); cursor: pointer; }
.sch-row:hover { background: #F7F9FC; }
.sch-row.open { background: #F1F5FB; }
.sch-axis { min-height: 28px; cursor: default; background: none !important; }
.sch-label { padding: 6px 14px; display: flex; flex-direction: column; gap: 1px; font-size: 13px; min-width: 0; }
.sch-label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--steel); }
.sch-track { position: relative; height: 100%; min-height: 28px; margin-right: 46px; }
.sch-tick { position: absolute; top: 6px; font-size: 11px; color: var(--steel); transform: translateX(-50%); }
.sch-today { position: absolute; top: 6px; font-size: 11px; color: var(--red); transform: translateX(-50%); font-weight: 600; }
.sch-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule-soft); }
.sch-now { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(192, 57, 43, .45); }
.sch-bar { position: absolute; top: 50%; height: 20px; transform: translateY(-50%); border-radius: 4px; color: #fff; font-size: 11px; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.sch-bar.late { box-shadow: 0 0 0 2px var(--red); }
.sch-exw { position: absolute; top: 50%; transform: translate(6px, -50%); font-size: 11px; color: var(--steel); }
.sch-exw.late { color: var(--red); font-weight: 600; }
/* 生产工序颜色：订单准备（灰蓝）→ 车间工序（由浅到深的蓝紫）→ 发货（绿） */
.sch-c0 { background: #A3AFBD; } .sch-c1 { background: #8796AA; } .sch-c2 { background: #6B7E98; }
.sch-c3 { background: #5C8BC4; } .sch-c4 { background: #4475B5; } .sch-c5 { background: #2F5EA4; }
.sch-c6 { background: #34478F; } .sch-c7 { background: #4A3A86; } .sch-c8 { background: var(--green); }
.sch-legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--steel); flex-wrap: wrap; }
.sch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.sch-detail { grid-column: 1 / -1; padding: 10px 14px 14px; background: #F1F5FB; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; cursor: default; }
.sch-note { padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); max-width: 520px; }
.sch-items { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sch-items div { display: flex; justify-content: space-between; gap: 16px; max-width: 760px; border-bottom: 1px dashed var(--rule-soft); padding: 2px 0; }
.sch-cards { display: none; }
.sch-card-h { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
.sch-card-h b { font-size: 17px; }
.sch-card { border-left: 5px solid var(--rule); }
.sch-card.lv-ok { border-left-color: var(--green); }
.sch-card.lv-tight { border-left-color: var(--straw); }
.sch-card.lv-late { border-left-color: var(--red); }
.sch-card.lv-done { border-left-color: #8796AA; }
.sch-dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 4px; }
.sch-dates div { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--steel); }
.sch-dates b { font-size: 15px; color: var(--ink, #1F2933); font-variant-numeric: tabular-nums; }
.sch-cards.always { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.sch-now-st { font-size: 14px; }
.sch-next { align-self: flex-start; }
.sch-steps button.mk { font-weight: 600; }
.sch-est-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.sch-est-row input { padding: 5px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); }
/* 时间条：目标出厂竖线、预计完成 ◆、超出出厂日期的部分 */
.sch-exwline { position: absolute; top: 18%; bottom: 18%; width: 2px; background: #1F2933; transform: translateX(-1px); }
.sch-est { position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 15px; line-height: 1; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.sch-over { position: absolute; top: 50%; height: 12px; transform: translateY(-50%); border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(45deg, rgba(179, 38, 30, .55) 0 4px, rgba(179, 38, 30, .2) 4px 8px); }
.sch-row.lv-late .sch-bar { box-shadow: 0 0 0 2px var(--red); }
.sch-row.lv-tight .sch-bar { box-shadow: 0 0 0 2px var(--straw); }
.sch-lg-est { background: none !important; width: auto !important; height: auto !important; color: #555; font-style: normal; }
.sch-lg-exw { background: #1F2933 !important; width: 2px !important; }
/* 按时 / 紧 / 延误 */
.fin { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.fin-ok { background: #E3F1E8; color: var(--green); }
.fin-tight { background: var(--straw-wash); color: #8A6300; }
.fin-late { background: #FBE4E2; color: var(--red); }
.fin-done { background: #EEF1F5; color: var(--steel); }
.fin-ok-c { color: var(--green); } .fin-tight-c { color: #B07F00; } .fin-late-c { color: var(--red); } .fin-none-c, .fin-done-c { color: var(--steel); }
.fin-late-t { color: var(--red); } .fin-tight-t { color: #8A6300; }
.fin-cell { align-self: end; padding-bottom: 6px; }
@media (max-width: 760px) {
  .sch { display: none; }
  .sch-cards { display: flex; flex-direction: column; gap: 12px; }
  .sch-cards.always { display: flex; }
  .sch-legend { display: none; }
}
.sch-cards .sch-detail { background: none; border: 0; padding: 8px 0 0; }
.sch-cards .sch-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sch-cards .sch-steps button { padding: 12px 6px; font-size: 15px; border-radius: var(--r-s); margin: 0; }
.sch-cards .sch-next { width: 100%; padding: 14px; font-size: 17px; }
.sch-cards .sch-note { max-width: none; padding: 10px; font-size: 15px; }

/* ---------- 全局搜索 ---------- */
.topbar { gap: 16px; }
.gsearch { position: relative; flex: 1; max-width: 460px; margin: 0 16px; }
.gsearch input { width: 100%; padding: 7px 12px; border: 1px solid var(--rule); border-radius: 18px; background: var(--sheet); font: inherit; font-size: 13px; }
.gsearch input:focus { outline: none; border-color: var(--temper-blue); box-shadow: 0 0 0 3px rgba(1, 79, 177, .1); }
.gsearch-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); box-shadow: 0 8px 24px rgba(20, 30, 40, .14); max-height: 70vh; overflow: auto; padding: 6px 0; }
.gsearch-res h4 { margin: 6px 14px 2px; font-size: 12px; color: var(--steel); font-weight: 600; }
.gsearch-res a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px; color: var(--slate); text-decoration: none; font-size: 13px; }
.gsearch-res a:hover, .gsearch-res a.sel { background: #EEF3FA; }
.gsearch-res a span:last-child { color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.gsearch-res .none { padding: 8px 14px; color: var(--steel); font-size: 13px; }
@media (max-width: 900px) { .gsearch { order: 3; max-width: none; flex-basis: 100%; margin: 6px 0 0; } .topbar { flex-wrap: wrap; } }
@media (max-width: 600px) { .topbar-right { flex-wrap: wrap; gap: 8px; } #user-box:not([hidden]) { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; } }

/* ---------- 第三方产品 ---------- */
.manual-tag.tp { background: #E8EEF8; color: var(--temper-blue); }
.tp-chk { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 12px; color: var(--steel); cursor: pointer; white-space: nowrap; font-weight: normal; }
.tp-chk input { margin: 0; }

/* ---------- 参数：各 Grade 的计算公式 ---------- */
.grade-t td { vertical-align: top; }
.grade-t td.formula { font-size: 12.5px; min-width: 230px; }
.grade-t .unit { font-size: 11px; }
.ptext { width: 140px; padding: 5px 6px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.ptext.changed { background: var(--straw-wash); border-color: var(--straw); }
.grade-t td:first-child { white-space: nowrap; min-width: 78px; }
.grade-t td.n { white-space: nowrap; }
.grade-t td.n .unit { white-space: nowrap; }

/* ---------- 账号菜单 ---------- */
#user-box { position: relative; }
button.user-name { background: none; border: 1px solid transparent; border-radius: var(--r-s); padding: 4px 8px; cursor: pointer;
  color: var(--steel); font: inherit; font-size: 13px; }
button.user-name:hover, button.user-name[aria-expanded="true"] { border-color: var(--rule); color: var(--ink, #1F2933); background: #fff; }
.user-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; background: #fff; border: 1px solid var(--rule);
  border-radius: var(--r-s); box-shadow: 0 6px 18px rgba(20, 40, 70, .12); padding: 4px; min-width: 140px; }
.user-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; font: inherit;
  font-size: 13px; border-radius: 4px; cursor: pointer; color: var(--ink, #1F2933); }
.user-menu button:hover { background: #EEF3FA; }

/* ---------- 页面说明按钮、成本核算信息栏 ---------- */
.help-btn { background: none; border: 1px solid var(--rule); border-radius: 14px; padding: 3px 11px; font: inherit; font-size: 12px;
  color: var(--steel); cursor: pointer; align-self: center; }
.help-btn:hover { color: var(--temper-blue); border-color: var(--temper-blue); }
.drawer-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer-h h2 { margin: 0; font-size: 18px; }
.ctx-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 12px; font-size: 12.5px; color: var(--steel); }
.ctx-strip span { display: inline-flex; gap: 8px; align-items: baseline; }
.ctx-strip b { color: var(--ink, #1F2933); font-size: 13.5px; font-variant-numeric: tabular-nums; }
#q-target button { padding: 4px 10px; }
.sys-src { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sys-src input { flex: 1 1 420px; min-width: 260px; max-width: 640px; padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); }
.page-help-row { display: flex; justify-content: flex-end; margin: -4px 0 8px; }
.q-help-slot { display: inline-flex; margin-left: 10px; }
.newver { background: #E8F0FB; color: var(--temper-blue); border-bottom-color: #C9D9F2; }
.newver .btn { margin-left: 6px; }
.idle-dlg { max-width: 380px; }
.idle-dlg p { margin: 8px 0 14px; }
.idle-dlg #idle-n { font-size: 18px; color: var(--red); font-variant-numeric: tabular-nums; }
