/* ===== 瓦楞箱报价器 — 牛皮纸棕褐配色体系（贴切瓦楞纸箱本色，与彩盒 Teal 反差）===== */
/* 主色 #8B4513 / 浅主 #B45309 / 深主 #5C3309 / 背景 #F5E9D6 / 浅底 #F3E2C0 / 边框 #E2B97A */
/* 强调色 #EA580C（橙）保留为两页统一锚点（总价/删除/告警） */
/* 仅呈现层，不改任何算价逻辑 */

/* ===== 全局 ===== */
*{margin:0;padding:0;box-sizing:border-box}
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
:root{
  --brand:#8B4513; --brand-2:#B45309; --brand-deep:#5C3309; --brand-ink:#3A2A18;
  --accent:#EA580C; --accent-2:#F97316;
  --bg-1:#F5E9D6; --bg-2:#F2E6D2; --bg-3:#FAF1E0;
  --border:#F3E2C0; --border-2:#E2B97A; --border-soft:#F5EAD3;
  --ink:#3A2A18; --muted:#8B4513; --muted-2:#64748B; --muted-3:#94A3B8;
  --card-bg:rgba(255,255,255,.78); --card-bg-solid:#fff;
  --shadow-sm:0 1px 2px rgba(139,69,19,.04),0 1px 3px rgba(0,0,0,.03);
  --shadow-md:0 4px 16px rgba(139,69,19,.08),0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:0 12px 32px rgba(139,69,19,.12),0 4px 12px rgba(0,0,0,.05);
  --shadow-glow:0 8px 24px rgba(139,69,19,.18);
  --shadow-accent:0 6px 20px rgba(234,88,12,.28);
  --radius-sm:8px; --radius:12px; --radius-lg:16px; --radius-xl:20px;
}
body{font-family:'Plus Jakarta Sans','PingFang SC','Microsoft YaHei',sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%,rgba(180,83,9,.18),transparent 60%),
    radial-gradient(900px 500px at 100% 0%,rgba(234,88,12,.10),transparent 55%),
    radial-gradient(700px 700px at 50% 110%,rgba(139,69,19,.10),transparent 60%),
    linear-gradient(180deg,#F5E9D6 0%,#F2E6D2 100%);
  background-attachment:fixed;
  min-height:100vh;padding:24px 20px 40px;color:var(--ink);position:relative;
}
body::before{content:'';position:fixed;inset:0;pointer-events:none;z-index:0;opacity:.35;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 0 0.05 0 0 0 .04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")}
.container{max-width:880px;margin:0 auto;position:relative;z-index:1}

/* 暗色模式全局色彩平滑过渡（仅过渡颜色，不动布局/动画） */
body,body *{transition:background-color .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}

/* ===== 悬浮按钮组（置顶/置底/清空） ===== */
.fab-group{position:fixed;right:20px;bottom:22px;display:flex;flex-direction:column;gap:10px;z-index:9999}
.fab-btn{width:42px;height:42px;border-radius:50%;border:none;background:linear-gradient(135deg,#EA580C,#F97316);color:#fff;font-size:1.15rem;line-height:1;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 6px 18px rgba(234,88,12,.38),0 2px 6px rgba(0,0,0,.08);transition:transform .18s cubic-bezier(.34,1.56,.64,1),box-shadow .18s,background .15s;font-family:inherit;user-select:none;animation:fabFloat 3.6s ease-in-out infinite}
.fab-btn:nth-child(2){animation-delay:.4s}
.fab-btn:nth-child(3){animation-delay:.8s}
.fab-btn:hover{background:linear-gradient(135deg,#D4520A,#EA580C);transform:scale(1.1) translateY(-2px);box-shadow:0 10px 26px rgba(234,88,12,.48),0 4px 10px rgba(0,0,0,.12)}
.fab-btn:active{transform:scale(.94)}
.fab-btn.fab-reset{background:linear-gradient(135deg,#8B4513,#B45309);box-shadow:0 6px 18px rgba(139,69,19,.38),0 2px 6px rgba(0,0,0,.08)}
.fab-btn.fab-reset:hover{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 10px 26px rgba(139,69,19,.48),0 4px 10px rgba(0,0,0,.12)}
@keyframes fabFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}

/* ===== 卡片 ===== */
.card{background:var(--card-bg);backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%);border-radius:var(--radius);padding:22px;margin-bottom:14px;
  box-shadow:var(--shadow-md);border:1px solid rgba(243,226,192,.85);
  transition:transform .25s cubic-bezier(.34,1.56,.64,1),box-shadow .25s,background-color .3s ease,color .3s ease,border-color .3s ease;
  position:relative;animation:cardFadeIn .5s cubic-bezier(.22,.61,.36,1) both}
.card:nth-child(1){animation-delay:.02s}
.card:nth-child(2){animation-delay:.06s}
.card:nth-child(3){animation-delay:.10s}
.card:nth-child(4){animation-delay:.14s}
.card:nth-child(5){animation-delay:.18s}
.card:nth-child(6){animation-delay:.22s}
.card:nth-child(7){animation-delay:.26s}
.card:nth-child(8){animation-delay:.30s}
.card:nth-child(9){animation-delay:.34s}
.card:nth-child(10){animation-delay:.38s}
.card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg);border-color:rgba(139,69,19,.25)}
.card h2{font-size:1rem;color:var(--brand-deep);margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--border);font-weight:700;letter-spacing:.2px;cursor:default;display:flex;align-items:center;gap:6px}
.card h2::before{content:'';display:inline-block;width:3px;height:14px;background:linear-gradient(180deg,var(--brand),var(--brand-2));border-radius:2px;flex:0 0 auto}
.card h2[onclick],.card h2[style*="cursor:pointer"]{cursor:pointer}
.card h2[style*="display:flex"]::before{margin-right:2px}
.row{display:flex;flex-wrap:wrap;gap:10px}
.field{flex:1;min-width:100px}
.field label{display:block;font-size:0.78rem;color:var(--muted);margin-bottom:4px;font-weight:500;letter-spacing:.1px}
.req::after{content:' *';color:var(--accent);font-weight:700}
@keyframes cardFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* ===== 输入框 / 下拉框（统一基线，不硬编码 height/width） ===== */
.field input,.field select{width:100%;padding:11px 12px;border:1.5px solid var(--border-2);border-radius:var(--radius-sm);font-size:0.9rem;text-align:center;background:rgba(255,255,255,.7);color:var(--ink);transition:border-color .18s,box-shadow .18s,background .18s;font-family:inherit}
.field input:hover,.field select:hover{border-color:rgba(139,69,19,.45);background:rgba(255,255,255,.9)}
.field input:focus,.field select:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 4px rgba(139,69,19,.14),0 2px 8px rgba(139,69,19,.1);background:#fff}
.field input[readonly]{background:linear-gradient(135deg,rgba(245,233,214,.85),rgba(243,226,192,.85));color:var(--brand);cursor:default;border-style:dashed}
.field input::placeholder{color:#94A3B8}
/* 必填项即时反馈（与彩盒一致） */
.field input.input-ok{border-color:var(--brand);box-shadow:0 0 0 2px rgba(139,69,19,.14);background:rgba(255,255,255,.85)}
/* 随自定义裁切开关切换的「当前重点填写项」高亮（正向强调，非错误警告）
   注意：只改 border-color + box-shadow + background，绝不改 border-width/padding，
   避免状态切换时盒模型顶动导致输入框轻微跳动 */
.field input.hl-emph{border-color:var(--brand-deep);background:rgba(245,233,214,.85);box-shadow:0 0 0 3px rgba(139,69,19,.16)}
.field input.hl-emph:focus{outline:none;border-color:var(--brand-deep);box-shadow:0 0 0 4px rgba(139,69,19,.22);background:#fff}
.field input.input-warn{border-color:#DC2626;box-shadow:0 0 0 2px rgba(220,38,38,.12);background:#FFF6F6}
/* 自定义裁切开关打开后禁用的输入框：变灰 */
.field input.input-disabled,.field select.input-disabled{background:#F1F5F9!important;color:#94A3B8!important;border-color:#E2E8F0!important;cursor:not-allowed;opacity:.7}
/* 「其他」卡片主次区分：主输入(加工费/数量)保持标准描边，次级输入降权退后 */
.card h2 ~ .row .field:not(.field-primary) input:not([readonly]):not(.input-disabled),
.card h2 ~ .row .field:not(.field-primary) select:not(.input-disabled){border:1.5px solid #E2E8F0;color:#475569;background-color:rgba(248,250,252,.7)}
.card h2 ~ .row .field:not(.field-primary) input:not([readonly]):not(.input-disabled):focus,
.card h2 ~ .row .field:not(.field-primary) select:not(.input-disabled):focus{border-color:#94A3B8;box-shadow:0 0 0 3px rgba(148,163,184,.14);background-color:#fff}
.card h2 ~ .row .field:not(.field-primary) label{color:#64748B}
/* 下拉框统一棕褐箭头 */
.field select,.toolbar-input,.unit-select,.set-input,.panel select{appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%238B4513' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 10px center;padding-right:28px}
/* 主表单数字框隐藏原生上下箭头 */
.field input[type=number]::-webkit-inner-spin-button,.field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.field input[type=number]{-moz-appearance:textfield}
.field input::-webkit-outer-spin-button,.field input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

/* 其他成本/优惠 单位下拉框：棕褐语义色 */
.unit-select{flex:0 0 auto;min-width:84px;padding:10px 26px 10px 12px!important;text-align:center;font-weight:600;font-size:0.8rem;border-radius:var(--radius-sm);cursor:pointer;box-sizing:border-box;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%238B4513' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 10px center}
.field select.unit-select{width:auto}
.unit-select.unit-green{border:1.5px solid var(--brand);background-color:rgba(245,233,214,.85);color:var(--brand)}
.unit-select.unit-orange{border:1.5px solid var(--accent);background-color:rgba(255,247,237,.85);color:var(--accent)}
.unit-select.unit-blue{border:1.5px solid var(--brand);background-color:rgba(245,233,214,.85);color:var(--brand)}
.flex-input{flex:1;min-width:0;width:auto}
/* 并排容器内的 input：用 flex 填充剩余空间（覆盖通用 width:100%） */
.field > div[style*="display:flex"]{align-items:stretch}
.field > div[style*="display:flex"] > input{flex:1;min-width:0;width:auto}

/* 搜索/筛选排统一输入框 */
.toolbar-input{flex:0 0 auto;padding:10px 14px;border:1.5px solid var(--border-2);border-radius:var(--radius-sm);font-size:0.85rem;background:rgba(255,255,255,.7);color:var(--ink);font-family:inherit;transition:border-color .18s,box-shadow .18s,background .18s;box-sizing:border-box}
.toolbar-input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(139,69,19,.12);background:#fff}
#searchInput.toolbar-input{flex:1;padding:11px 14px}

/* ===== 辅助标签 / 提示气泡 ===== */
.auto-tag{font-size:0.65rem;margin-left:4px;font-weight:600;padding:1px 7px;border-radius:10px;letter-spacing:.3px;background:#F3E2C0;color:#8B4513;border:1px solid #E2B97A;white-space:nowrap}
.auto-tag[data-mode="auto"]{background:#F3E2C0;color:#8B4513;border:1px solid #E2B97A}
.auto-tag[data-mode="manual"]{background:#FFF5EF;color:#EA580C;border:1px solid #FED7AA}
/* 自定义裁切药丸开关（对齐彩盒 .toggle-row 体系，打开色用瓦楞棕褐） */
.toggle-row{display:inline-flex;align-items:center;gap:8px;cursor:pointer;user-select:none;font-size:0.85rem;color:var(--ink);padding:6px 10px;border-radius:var(--radius-sm);transition:background .15s}
.toggle-row:hover{background:rgba(139,69,19,.05)}
.toggle-text{line-height:1;white-space:nowrap}
.toggle{position:relative;display:inline-block;width:42px;height:24px;flex:0 0 auto}
.toggle input{position:absolute;opacity:0;width:100%;height:100%;margin:0;cursor:pointer;z-index:1}
.toggle-track{position:absolute;inset:0;background:#CBD5E1;border-radius:24px;transition:background .25s cubic-bezier(.34,1.56,.64,1);pointer-events:none}
.toggle-track::after{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;background:#fff;border-radius:50%;transition:transform .25s cubic-bezier(.34,1.56,.64,1);box-shadow:0 2px 4px rgba(0,0,0,.2)}
.toggle input:checked + .toggle-track{background:linear-gradient(135deg,#8B4513,#B45309)}
.toggle input:checked + .toggle-track::after{transform:translateX(18px);box-shadow:0 2px 6px rgba(0,0,0,.25)}
.help-tip{position:relative;cursor:help;color:#94A3B8;font-size:0.8rem;margin-left:4px}
/* ? 气泡：挂 body 的独立浮层（tooltip.js 按视口边界定位），不会撑出页面 / 横向滚动条 */
.help-tip-bubble{
  position:fixed;left:0;top:0;display:none;
  background:var(--ink);color:#fff;padding:8px 12px;border-radius:var(--radius-sm);
  font-size:0.75rem;line-height:1.6;white-space:pre-line;overflow-wrap:anywhere;
  width:max-content;min-width:min(220px, calc(100vw - 16px));
  max-width:320px;max-width:min(320px, calc(100vw - 16px));
  z-index:99999;box-shadow:0 4px 12px rgba(0,0,0,.2);pointer-events:none;
}

/* ===== 页签切换 ===== */
.mode-tabs{display:flex;gap:6px;margin-bottom:18px;padding:6px;border-radius:var(--radius);background:rgba(255,255,255,.65);backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%);box-shadow:var(--shadow-md),inset 0 1px 0 rgba(255,255,255,.6);border:1px solid rgba(243,226,192,.7)}
.mode-tab{flex:1;padding:11px 14px;text-align:center;font-size:0.92rem;font-weight:600;cursor:pointer;border:none;border-radius:8px;background:transparent;color:var(--muted);transition:all .25s cubic-bezier(.34,1.56,.64,1);text-decoration:none;display:block;font-family:inherit}
.mode-tab:hover{color:var(--brand-deep);background:rgba(139,69,19,.06)}
.mode-tab.active{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff;box-shadow:0 4px 14px rgba(139,69,19,.35),inset 0 1px 0 rgba(255,255,255,.2)}

/* ===== 步进器（高度对齐彩盒 42px，不破坏同行统一高度） ===== */
.stepper{display:flex;align-items:stretch;height:44px;border:1.5px solid var(--border-2);border-radius:var(--radius-sm);overflow:hidden;background:rgba(255,255,255,.7);backdrop-filter:blur(6px)}
.stepper button{flex:0 0 auto;padding:0 14px;border:none;background:transparent;cursor:pointer;font-size:1.35rem;line-height:1;color:#B07A45;display:flex;align-items:center;justify-content:center;transition:background .15s,transform .12s,color .15s;font-family:inherit;user-select:none}
.stepper button:hover{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff}
.stepper button:active{transform:scale(.88)}
.stepper input{flex:1;min-width:0;text-align:center;border:none;font-size:0.9rem;font-family:inherit;color:var(--ink);background:transparent}
.stepper input:focus{outline:none;box-shadow:inset 0 0 0 2px rgba(139,69,19,.18)}

/* ===== 按钮体系 ===== */
.btn{display:block;width:100%;padding:15px;border:none;border-radius:var(--radius);background:linear-gradient(135deg,#8B4513 0%,#B45309 50%,#8B4513 100%);background-size:200% 100%;color:#fff;font-size:1.1rem;font-weight:700;cursor:pointer;margin-top:8px;transition:transform .12s cubic-bezier(.34,1.56,.64,1),box-shadow .2s,background-position .4s;font-family:inherit;letter-spacing:.5px;box-shadow:0 6px 20px rgba(139,69,19,.32),0 2px 6px rgba(0,0,0,.06);position:relative;overflow:hidden}
.btn::before{content:'';position:absolute;inset:0;background:linear-gradient(120deg,transparent 30%,rgba(255,255,255,.25) 50%,transparent 70%);transform:translateX(-100%);transition:transform .6s}
.btn:hover{background-position:100% 0;box-shadow:0 10px 28px rgba(139,69,19,.42),0 4px 10px rgba(0,0,0,.08)}
.btn:hover::before{transform:translateX(100%)}
.btn:active{transform:scale(.96)}
.btn-copy{flex:1.4;padding:14px;border:none;border-radius:var(--radius);background:linear-gradient(135deg,#8B4513,#5C3309);color:#fff;font-size:1rem;font-weight:600;cursor:pointer;transition:transform .12s cubic-bezier(.34,1.56,.64,1),box-shadow .2s;font-family:inherit;box-shadow:0 4px 14px rgba(139,69,19,.3)}
.btn-copy:hover{box-shadow:0 8px 22px rgba(139,69,19,.42);transform:translateY(-1px)}
.btn-copy:active{transform:scale(.96)}
.btn-secondary{flex:1;padding:12px;border:1.5px solid var(--border-2);background:rgba(255,255,255,.7);color:var(--brand);border-radius:var(--radius);font-size:0.85rem;font-weight:600;cursor:pointer;transition:background .18s,border-color .18s,transform .12s;font-family:inherit;backdrop-filter:blur(6px)}
.btn-secondary:hover{background:#fff;border-color:var(--brand);transform:translateY(-1px);box-shadow:0 4px 12px rgba(139,69,19,.15)}
.btn-secondary:active{transform:scale(.97)}
.btn-secondary.blue{border-color:var(--border-2);color:var(--brand)}
.btn-secondary.blue:hover{background:rgba(245,233,214,.7)}
.btn-secondary.gray{border-color:#D8E8E6;color:#64748B}
.btn-secondary.gray:hover{background:#F5FAF9}

/* ===== 吸底操作栏 ===== */
.sticky-actions{position:sticky;bottom:0;z-index:50;background:linear-gradient(0deg,rgba(245,233,214,.96) 75%,rgba(245,233,214,0) 100%);backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%);padding:14px 0 18px;margin:-12px 0 0}
.sticky-actions .btn{margin-top:0}

/* ===== 结果区 ===== */
.result-card{padding:0;overflow:hidden;border:1px solid rgba(226,185,122,.7);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);animation:cardIn .45s cubic-bezier(.22,.61,.36,1)}
#actionBtns{animation:cardIn .35s ease-out;display:flex;gap:8px}
.result-header{background:linear-gradient(135deg,#5C3309 0%,#8B4513 50%,#B45309 100%);background-size:200% 100%;color:#fff;padding:28px 20px 24px;text-align:center;position:relative;overflow:hidden}
.result-header::before{content:'';position:absolute;inset:0;background:radial-gradient(circle at 30% 20%,rgba(255,255,255,.18),transparent 50%),radial-gradient(circle at 80% 80%,rgba(255,255,255,.1),transparent 45%);pointer-events:none}
.result-header::after{content:'';position:absolute;top:-50%;right:-20%;width:60%;height:200%;background:linear-gradient(45deg,transparent,rgba(255,255,255,.08),transparent);transform:rotate(15deg);pointer-events:none}
.result-header .rh-label{font-size:0.85rem;opacity:.9;letter-spacing:1.5px;font-weight:500;text-transform:uppercase;position:relative}
.result-header .rh-total{font-size:3rem;font-weight:800;margin:8px 0 4px;font-family:'Plus Jakarta Sans',monospace;letter-spacing:-1.5px;text-shadow:0 2px 12px rgba(0,0,0,.15);position:relative;background:linear-gradient(180deg,#fff,rgba(255,255,255,.92));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent}
.result-header .rh-sub{font-size:0.82rem;opacity:.88;position:relative;font-weight:500}
.result-header .rh-tax{font-size:0.72rem;opacity:.7;margin-top:4px;position:relative}

/* ===== 成本链 ===== */
.cost-chain{display:flex;padding:16px 18px;background:linear-gradient(135deg,rgba(252,252,255,.9),rgba(245,233,214,.7));border-bottom:1px solid var(--border);gap:4px;align-items:center;backdrop-filter:blur(8px)}
.cost-chain .cc-item{flex:1;text-align:center;transition:transform .2s}
.cost-chain .cc-item:hover{transform:translateY(-2px)}
.cost-chain .cc-label{font-size:0.7rem;color:var(--muted-2);font-weight:500;letter-spacing:.3px}
.cost-chain .cc-val{font-size:1rem;font-weight:700;color:var(--ink);font-family:'Plus Jakarta Sans',monospace}
.cost-chain .cc-val.accent{font-size:1.1rem;font-weight:800;color:var(--accent);text-shadow:0 1px 3px rgba(234,88,12,.15)}
.cost-chain .cc-arrow{color:#94A3B8;font-size:1.1rem}

/* ===== 成本明细表 ===== */
.cost-table{width:100%;border-collapse:collapse;font-size:0.8rem}
.cost-table th{padding:8px 10px;text-align:left;border-bottom:2px solid var(--border);background:linear-gradient(180deg,rgba(245,233,214,.9),rgba(243,226,192,.7));color:var(--brand-deep);font-weight:700;letter-spacing:.3px}
.cost-table th.num{text-align:right}
.cost-table td{padding:6px 10px;border-bottom:1px solid var(--border-soft)}
.cost-table tr:hover td{background:rgba(245,233,214,.5)}
.cost-table td.num{text-align:right;font-family:'Plus Jakarta Sans',monospace}
.cost-table td.muted{color:#64748B;font-size:0.75rem}
.cost-table .cat-header td{padding:5px 10px;font-size:0.72rem;font-weight:700;border-bottom:1px solid var(--border);letter-spacing:.5px}
.cost-table .cat-header.cat-material{color:#8B4513;background:linear-gradient(90deg,rgba(243,226,192,.9),rgba(245,233,214,.5))}
.cost-table .cat-header.cat-process{color:#8E44AD;background:linear-gradient(90deg,rgba(248,240,255,.9),rgba(252,245,255,.5))}
.cost-table .cat-header.cat-other{color:#8B4513;background:linear-gradient(90deg,rgba(243,226,192,.9),rgba(245,233,214,.5))}
.cost-table .total-row{background:linear-gradient(135deg,rgba(252,252,255,.95),rgba(245,233,214,.85))}
.cost-table .total-row td{padding:10px;font-weight:800}
.cost-table .total-row .total-val{color:var(--accent);font-size:1.05rem;font-family:'Plus Jakarta Sans',monospace;text-shadow:0 1px 3px rgba(234,88,12,.15)}

/* ===== 公式区 ===== */
.formula-toggle{border-top:1px solid #F3E2C0;padding:10px 16px;text-align:center;cursor:pointer;user-select:none}
.formula-toggle span{font-size:0.78rem;color:#8B4513;font-weight:500}
.formula-detail{max-height:0;opacity:0;padding:0 16px;overflow:hidden;background:#FCFCFF;font-size:0.75rem;color:#8B4513;line-height:1.5;border-top:1px solid transparent;transition:max-height .28s ease,opacity .28s ease,padding .28s ease}
.formula-detail.open{max-height:4000px;opacity:1;padding:12px 16px;border-top-color:#F3E2C0}
/* 段标题行（容器）+ 内部 inline 排版（瓦楞棕褐色系） */
.formula-detail .fhead{display:block;margin-top:32px;padding-bottom:4px;border-bottom:1px dashed #B07A45}
.formula-detail .fhead:first-child{margin-top:0}
.formula-detail .fsec{display:inline;color:#8B4513;font-weight:700;font-size:0.84rem}
.formula-detail .fsub{color:#64748B;font-weight:400;font-size:0.78rem;margin-left:10px}
/* 两栏参数行：标签右对齐+算式 mono */
.formula-detail .frow{margin-top:4px}
.formula-detail .flabel{display:inline-block;width:72px;color:#5C3309;font-weight:600;text-align:right;margin-right:10px;vertical-align:top}
.formula-detail .fval{display:inline-block;color:#334155;font-family:'Plus Jakarta Sans',monospace;font-weight:500;letter-spacing:.2px}
/* 成本汇总：统一两栏 */
.formula-detail .fsum{display:block;margin-top:4px}
.formula-detail .fsum .flabel{color:#475569;font-weight:600}
.formula-detail .fsum .fval{color:#0F172A;font-weight:600}
.formula-detail .fsum.total .flabel{color:#EA580C;font-weight:700}
.formula-detail .fsum.total .fval{color:#EA580C;font-weight:700}

/* ===== 结果占位卡 ===== */
.result-placeholder{background:linear-gradient(135deg,rgba(245,233,214,.8),rgba(242,230,210,.7));border:2px dashed rgba(226,185,122,.7);border-radius:var(--radius);padding:52px 20px;text-align:center;color:#94A3B8;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);position:relative;overflow:hidden}
.result-placeholder::before{content:'';position:absolute;top:-30%;left:-10%;width:50%;height:80%;background:radial-gradient(circle,rgba(139,69,19,.08),transparent 60%);pointer-events:none}
.result-placeholder .ph-icon{font-size:2.8rem;margin-bottom:12px;display:inline-block;animation:phBob 2.8s ease-in-out infinite}
.result-placeholder .ph-title{font-size:1rem;font-weight:700;color:var(--brand);margin-bottom:6px;letter-spacing:.3px}
.result-placeholder .ph-sub{font-size:0.8rem;color:#99B5B2}
@keyframes phBob{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}

/* ===== 统计栏 ===== */
.stats-bar{display:flex;gap:0;margin-bottom:14px;border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow-md);border:1px solid rgba(243,226,192,.7)}
.stat-item{flex:1;padding:12px 8px;text-align:center;background:linear-gradient(180deg,rgba(255,255,255,.85),rgba(252,252,255,.7));border-right:1px solid var(--border);transition:background .2s;position:relative;overflow:hidden}
.stat-item:hover{background:linear-gradient(180deg,#fff,rgba(252,252,255,.9))}
.stat-item:last-child{border-right:none}
.stat-item .stat-num{font-size:1.3rem;font-weight:800;color:var(--brand);font-family:'Plus Jakarta Sans',monospace;letter-spacing:-.5px}
.stat-item .stat-label{font-size:0.7rem;color:var(--muted-2);margin-top:2px;font-weight:500;letter-spacing:.3px}
.stat-item.accent .stat-num{color:var(--accent)}
.stat-item.accent::after{content:'';position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg,transparent,var(--accent),transparent)}

/* ===== 历史记录表 ===== */
.history-table{width:100%;border-collapse:collapse;font-size:0.8rem}
.history-table th{padding:10px;border-bottom:2px solid var(--border);text-align:left;background:linear-gradient(180deg,rgba(245,233,214,.9),rgba(243,226,192,.7));white-space:nowrap;color:var(--brand-deep);font-weight:700;letter-spacing:.3px}
.history-table td{padding:8px 10px;border-bottom:1px solid var(--border-soft)}
.history-table tbody tr{transition:background .18s}
.history-table tbody tr:hover{background:rgba(245,233,214,.6)}
.history-table .col-cb{width:30px;text-align:center}
.history-table .col-name{cursor:pointer}
.history-table .col-time{white-space:nowrap;font-size:0.75rem;color:var(--muted-2)}
.history-table .col-num{text-align:right;white-space:nowrap;font-family:'Plus Jakarta Sans',monospace}
.history-table .col-action{text-align:center;white-space:nowrap}
.history-table .action-btn{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff;border:none;padding:4px 9px;border-radius:6px;cursor:pointer;font-size:0.72rem;margin:0 1px;transition:all .15s;font-family:inherit;box-shadow:0 2px 6px rgba(139,69,19,.2)}
.history-table .action-btn:hover{background:linear-gradient(135deg,#5C3309,#8B4513);transform:translateY(-1px);box-shadow:0 4px 10px rgba(139,69,19,.3)}
.history-table .action-btn.del{background:linear-gradient(135deg,#EA580C,#F97316);box-shadow:0 2px 6px rgba(234,88,12,.2)}
.history-table .action-btn.del:hover{background:linear-gradient(135deg,#D4520A,#EA580C);box-shadow:0 4px 10px rgba(234,88,12,.3)}
.history-table .action-btn.exp{background:linear-gradient(135deg,#8B4513,#B45309)}

/* ===== 客户标签 ===== */
.cust-tag{display:inline-block;padding:1px 6px;border-radius:4px;font-size:0.72rem;font-weight:500}
.cust-tag.c1{background:#F3E2C0;color:#8B4513}
.cust-tag.c2{background:#E0F2FE;color:#0EA5E9}
.cust-tag.c3{background:#FFF5EF;color:#EA580C}
.cust-tag.c4{background:#F8F0FF;color:#8E44AD}
.cust-tag.c5{background:#FEF2F2;color:#DC2626}
.cust-tag.c0{background:#F0F2F5;color:#999}
.no-result{text-align:center;color:#94A3B8;padding:20px;font-size:0.85rem}

/* ===== 页脚 ===== */
.footer{text-align:center;color:#94A3B8;font-size:0.7rem;margin-top:20px;font-weight:500}
.foot-update{text-align:center;color:#94A3B8;font-size:0.75rem;padding:14px 0 22px;margin-top:10px;border-top:1px solid #F3E2C0}

/* ===== 弹窗通用 ===== */
.overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(15,23,42,.55);z-index:100;justify-content:center;align-items:center;backdrop-filter:blur(8px) saturate(140%);-webkit-backdrop-filter:blur(8px) saturate(140%)}
.overlay.show{display:flex}
.panel{background:rgba(255,255,255,.95);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);border-radius:var(--radius-lg);padding:28px;max-width:700px;width:95%;max-height:85vh;overflow-y:auto;box-shadow:0 24px 64px rgba(0,0,0,.28),0 8px 24px rgba(139,69,19,.12);animation:panelPop .25s cubic-bezier(.34,1.56,.64,1);border:1px solid rgba(255,255,255,.6)}
.panel h3{font-size:1.1rem;margin-bottom:16px;color:var(--ink);font-weight:800;letter-spacing:.5px}
@keyframes panelPop{from{opacity:0;transform:translateY(16px) scale(.96)}to{opacity:1;transform:none}}
@keyframes cardIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}

/* ===== 后台设置表单（对齐彩盒 .set 体系） ===== */
.set-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px}
.set-card{background:rgba(255,255,255,.75);backdrop-filter:blur(10px);border:1px solid var(--border);border-left:4px solid var(--brand);border-radius:var(--radius);padding:14px;box-shadow:var(--shadow-sm)}
.set-card h4{font-size:0.82rem;margin-bottom:10px;color:var(--ink);font-weight:700}
.set-card .srow{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.set-card .srow label{font-size:0.82rem;color:var(--ink);min-width:120px;font-weight:500;white-space:normal;line-height:1.3}
.set-input{width:90px;padding:7px 9px;border:1.5px solid var(--border-2);border-radius:7px;font-size:0.82rem;text-align:right;background:rgba(255,255,255,.7);transition:border-color .15s,box-shadow .15s;color:var(--ink);font-family:inherit}
.set-input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(139,69,19,.12);background:#fff}
.set-card .srow .unit{font-size:0.78rem;color:var(--muted-2);min-width:38px}
.set-card .srow span{font-size:0.78rem;color:var(--muted-2);margin:0 2px}
.set-card .srow textarea{width:100%;min-height:50px;padding:8px;border:1.5px solid var(--border-2);border-radius:7px;font-size:0.82rem;font-family:inherit;resize:vertical;color:var(--ink);background:rgba(255,255,255,.7);box-sizing:border-box}
.set-card .srow textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(139,69,19,.12);background:#fff}

/* ===== 统一小按钮（弹窗/工具栏用） ===== */
.btn-sm{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:10px 18px;font-size:0.85rem;font-weight:700;border-radius:var(--radius-sm);border:none;cursor:pointer;transition:all .18s cubic-bezier(.34,1.56,.64,1);font-family:inherit;letter-spacing:.3px}
.btn-sm:hover{transform:translateY(-1px);filter:brightness(1.05)}
.btn-sm:active{transform:scale(.96)}
.btn-sm.green{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff;box-shadow:0 3px 10px rgba(139,69,19,.25)}
.btn-sm.blue{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff;box-shadow:0 3px 10px rgba(139,69,19,.25)}
.btn-sm.orange{background:linear-gradient(135deg,#EA580C,#F97316);color:#fff;box-shadow:0 3px 10px rgba(234,88,12,.25)}
.btn-sm.red{background:linear-gradient(135deg,#DC2626,#EF4444);color:#fff;box-shadow:0 3px 10px rgba(220,38,38,.25)}
.btn-sm.gray{background:rgba(243,226,192,.8);color:var(--brand);backdrop-filter:blur(6px);border:1px solid var(--border-2)}
.btn-sm.gray:hover{background:#fff;border-color:var(--brand);color:var(--brand-deep)}

/* ===== 密码弹窗 ===== */
.pwd-panel{background:rgba(255,255,255,.95);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);border-radius:var(--radius-lg);padding:0;max-width:340px;width:90%;box-shadow:0 24px 64px rgba(0,0,0,.28),0 8px 24px rgba(139,69,19,.12);overflow:hidden;animation:panelPop .25s cubic-bezier(.34,1.56,.64,1);border:1px solid rgba(255,255,255,.6)}
.pwd-body{padding:24px 24px 22px;text-align:center}
.pwd-body h3{font-size:1.1rem;margin:0 0 18px;color:#3A2A18;font-weight:700}
.pwd-input{width:100%;padding:11px 12px;border:1.5px solid #E2B97A;border-radius:9px;font-size:16px;text-align:center;background:#FCFCFF;transition:border-color .15s,box-shadow .15s;box-sizing:border-box;font-family:inherit;color:#3A2A18}
.pwd-input:focus{outline:none;border-color:#8B4513;box-shadow:0 0 0 3px rgba(139,69,19,.12);background:#fff}
.pwd-err{font-size:0.75rem;color:#DC2626;margin-top:10px;display:none}
.pwd-actions{display:flex;gap:10px;margin-top:16px}
.pwd-actions .btn-sm{flex:1}

/* ===== 保存弹窗 ===== */
.modal-mask{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:10000;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(8px) saturate(140%);-webkit-backdrop-filter:blur(8px) saturate(140%)}
.modal-card{position:relative;width:360px;max-width:92vw;background:rgba(255,255,255,.96);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);border-radius:var(--radius-lg);box-shadow:0 24px 64px rgba(0,0,0,.28),0 8px 24px rgba(139,69,19,.12);padding:20px 20px 16px;box-sizing:border-box;animation:panelPop .25s cubic-bezier(.34,1.56,.64,1);overflow:hidden;border:1px solid rgba(255,255,255,.6)}
.modal-close{position:absolute;top:10px;right:12px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;font-size:1.05rem;line-height:1;color:#94A3B8;cursor:pointer;border-radius:5px;user-select:none}
.modal-close:hover{background:#F5E9D6;color:#3A2A18}
.modal-title{font-size:1rem;font-weight:700;color:#3A2A18;margin-bottom:4px}
.modal-sub{font-size:0.72rem;color:#64748B;margin-bottom:12px;line-height:1.4}
.modal-form{display:flex;flex-direction:column;gap:9px}
.modal-row{display:flex;align-items:center;gap:8px}
.modal-row label{flex:0 0 64px;font-size:0.8rem;color:#8B4513;text-align:right}
.modal-row input,.modal-row textarea{flex:1;min-width:0;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;resize:vertical;color:#3A2A18;background:#FCFCFF}
.modal-row input:focus,.modal-row textarea:focus{outline:none;border-color:#8B4513}
.spec-group{display:flex;align-items:center;gap:6px;flex:1;min-width:0}
.spec-group input{flex:1;min-width:0;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;color:#3A2A18;background:#FCFCFF}
.spec-group input:focus{outline:none;border-color:#8B4513}
.spec-x{flex:0 0 auto;color:#94A3B8;font-size:0.85rem}
.paper-group{display:flex;align-items:center;gap:6px;flex:1;min-width:0}
.gram-wrap{flex:1;min-width:0;display:flex;align-items:center;gap:3px;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;background:#FCFCFF}
.gram-wrap input{flex:1;min-width:0;border:none;outline:none;padding:0;font-size:0.85rem;font-family:inherit;background:transparent;color:#3A2A18}
.gram-wrap input:focus{outline:none}
.gram-unit{flex:0 0 auto;color:#64748B;font-size:0.85rem}
.paper-group select{flex:1;min-width:0;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;background:#FCFCFF;color:#3A2A18}
.paper-group select:focus{outline:none;border-color:#8B4513}
.flute-group{display:flex;align-items:center;gap:6px;flex:1;min-width:0}
.flute-group input[type=text]{flex:1;min-width:0;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;color:#3A2A18;background:#FCFCFF}
.flute-group input[type=text]:focus{outline:none;border-color:#8B4513}
.flute-group select{flex:1;min-width:0;box-sizing:border-box;padding:7px 9px;border:1.5px solid #E2B97A;border-radius:6px;font-size:0.85rem;font-family:inherit;line-height:1.4;background:#FCFCFF;color:#3A2A18}
.flute-group select:focus{outline:none;border-color:#8B4513}
.cross-label{flex:0 0 auto;display:flex;align-items:center;gap:3px;font-size:0.8rem;color:#8B4513;white-space:nowrap;cursor:pointer}
.cross-label input[type=checkbox]{width:15px;height:15px;cursor:pointer}
.modal-actions{display:flex;gap:10px;margin-top:16px}
.modal-actions button{flex:1;padding:11px 0;border-radius:8px;font-size:0.88rem;font-weight:600;cursor:pointer;border:none;transition:background .15s,transform .1s;font-family:inherit}
.modal-actions button:active{transform:scale(.97)}
.btn-cancel{background:rgba(243,226,192,.85);color:var(--brand);border:1px solid var(--border-2);backdrop-filter:blur(6px)}
.btn-cancel:hover{background:#fff;border-color:var(--brand)}
.btn-confirm{background:linear-gradient(135deg,#8B4513,#B45309);color:#fff;box-shadow:0 3px 10px rgba(139,69,19,.25)}
.btn-confirm:hover{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 5px 14px rgba(139,69,19,.35)}
.modal-input-err,.modal-input-err:focus{border:2px solid #DC2626 !important;background:#FFF6F6 !important;outline:none}

/* ===== 全局提示条 ===== */
.gtip{background:#3A2A18;color:#fff;padding:10px 14px;border-radius:8px;font-size:0.7rem;max-width:320px;line-height:1.7;box-shadow:0 4px 20px rgba(0,0,0,.4);pointer-events:auto;text-align:left;z-index:99999}
.gtip hr{border-color:#3A2A18;margin:4px 0}
.tip-edit{margin-top:8px;text-align:right}
.tip-edit .action-btn{background:#8B4513;color:#fff;border:none;border-radius:5px;padding:5px 10px;font-size:0.7rem;cursor:pointer}
.tip-edit .action-btn:hover{background:#5C3309}

/* ===== 移动端 ===== */
@media (max-width: 640px) {
  html{scroll-behavior:smooth;scroll-padding-top:20px}
  body{-webkit-overflow-scrolling:touch}
  .container{max-width:100%;padding:8px}
  .card{padding:10px;scroll-margin-top:20px}
  input[type=password],.field input,.field select,.panel input,.panel select{font-size:16px!important;padding:10px 8px}
  .mode-tab{font-size:0.85rem;padding:10px}
  h2{font-size:0.95rem}
  .btn{padding:12px;font-size:1rem}
  .set-grid{grid-template-columns:1fr}
  .set-card .srow input{width:60px}
  .overlay .panel{width:95%;max-height:90vh;overflow-y:auto}
  #actionBtns{flex-wrap:wrap}
  #actionBtns .btn{flex:1 1 45%!important;min-width:45%;font-size:0.85rem!important;padding:10px 8px!important}
  #multiQtyTable{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .qb-textarea{font-size:0.8rem!important;min-height:200px}
  .cost-table td .desc{display:block;font-size:0.7rem;margin-top:2px}

  /* —— 手机端参数卡片：每行最多 2 个 field，杜绝输入框被压成 60px —— */
  .row{display:flex;flex-wrap:wrap;gap:10px}
  /* !important 覆盖 HTML 内联 flex（如其他成本 flex:1.5），移动端统一两列等宽 */
  .field{flex:1 1 calc(50% - 5px) !important;min-width:0 !important;max-width:100% !important}
  /* 标题允许换行，但给固定最小高度（单行高），保证同一行各 field 的输入框顶部对齐、不参差不齐 */
  .field label{white-space:normal;min-height:1.05rem;line-height:1.05rem;display:flex;align-items:baseline;flex-wrap:wrap}
  .auto-tag,.help-tip{flex:0 0 auto;white-space:nowrap;align-self:baseline}
  /* 带下拉的 field 也保持两列等宽 */
  .field select{width:100%}
  /* 复合横排字段（input + 单位选择器等）整行显示，避免被挤成 60px */
  .field:has(> div[style*="display:flex"]){flex:1 0 100% !important}
  /* 复合横排字段内部：input/select 改竖排堆叠（先 input 占满，下一行 select 全宽） */
  .field > div[style*="display:flex"]{flex-wrap:wrap;gap:6px}
  .field > div[style*="display:flex"] > input,
  .field > div[style*="display:flex"] > select{flex:1 0 100% !important;min-width:0 !important}
}

/* ===== 暗色模式 ===== */
body.dark{
  background:
    radial-gradient(1200px 600px at 10% -10%,rgba(180,83,9,.16),transparent 60%),
    radial-gradient(900px 500px at 100% 0%,rgba(234,88,12,.10),transparent 55%),
    radial-gradient(700px 700px at 50% 110%,rgba(139,69,19,.10),transparent 60%),
    linear-gradient(180deg,#0A1019 0%,#151D29 100%);
  background-attachment:fixed;color:#CBD5E1}
body.dark::before{opacity:.55;filter:invert(1) hue-rotate(180deg)}
body.dark .card{background:rgba(22,31,43,.72);backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%);border-color:rgba(45,58,77,.6);box-shadow:0 4px 16px rgba(0,0,0,.3),0 1px 4px rgba(0,0,0,.2)}
body.dark .card:hover{box-shadow:0 8px 24px rgba(0,0,0,.4),0 2px 8px rgba(0,0,0,.25)}
body.dark .card h2{color:#E2B97A;border-bottom-color:#3A2A18}
body.dark .field label{color:#94A3B8}
body.dark .field input,.dark .field select{background:rgba(15,23,42,.7);border:1.5px solid #475569;color:#E2E8F0}
body.dark .field input:hover,.dark .field select:hover{border-color:rgba(180,83,9,.45);background:rgba(15,23,42,.9)}
body.dark .field input:focus,.dark .field select:focus{border-color:#8B4513;box-shadow:0 0 0 4px rgba(180,83,9,.18),0 2px 8px rgba(180,83,9,.12);background:#0F172A}
body.dark .field input.hl-emph{border-color:#E2B97A;background:rgba(58,42,24,.85);box-shadow:0 0 0 3px rgba(139,69,19,.32)}
body.dark .field input.hl-emph:focus{outline:none;border-color:#E2B97A;box-shadow:0 0 0 4px rgba(139,69,19,.42);background:#1E293B}
body.dark .field input[readonly]{background:linear-gradient(135deg,rgba(26,35,51,.85),rgba(15,23,42,.85));color:#E2B97A}
body.dark .field input.input-disabled,body.dark .field select.input-disabled{background:rgba(30,41,59,.7)!important;color:#64748B!important;border-color:#334155!important;opacity:.6}
body.dark .card h2 ~ .row .field:not(.field-primary) input:not([readonly]):not(.input-disabled),
body.dark .card h2 ~ .row .field:not(.field-primary) select:not(.input-disabled){border:1.5px solid #475569;color:#94A3B8;background-color:rgba(15,23,42,.7)}
body.dark .card h2 ~ .row .field:not(.field-primary) input:not([readonly]):not(.input-disabled):focus,
body.dark .card h2 ~ .row .field:not(.field-primary) select:not(.input-disabled):focus{border-color:#64748B;background-color:#1E293B}
body.dark .card h2 ~ .row .field:not(.field-primary) label{color:#94A3B8}
body.dark .btn{background:linear-gradient(135deg,#5C3309,#8B4513,#B45309);box-shadow:0 6px 20px rgba(139,69,19,.32)}
body.dark .btn:hover{box-shadow:0 10px 28px rgba(139,69,19,.42)}
body.dark .btn-copy{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 4px 14px rgba(139,69,19,.3)}
body.dark .btn-copy:hover{box-shadow:0 8px 22px rgba(139,69,19,.42)}
body.dark .btn-secondary{background:rgba(30,41,59,.7);border-color:#334155;color:#E2B97A;backdrop-filter:blur(8px)}
body.dark .btn-secondary:hover{background:#0F172A;border-color:#8B4513;box-shadow:0 4px 12px rgba(180,83,9,.15)}
body.dark .btn-secondary.gray{border-color:#334155;color:#94A3B8}
body.dark .mode-tabs{background:rgba(30,41,59,.65);border-color:rgba(45,58,77,.5)}
body.dark .mode-tab{background:transparent;color:#94A3B8}
body.dark .mode-tab:hover{color:#E2B97A;background:rgba(139,69,19,.08)}
body.dark .mode-tab.active{background:linear-gradient(135deg,#5C3309,#8B4513,#B45309);color:#fff}
body.dark .stepper{background:rgba(15,23,42,.7);border-color:#334155}
body.dark .stepper button{background:transparent;border-color:#334155;color:#E2B97A}
body.dark .stepper button:hover{background:linear-gradient(135deg,#8B4513,#B45309);color:#0F172A;box-shadow:0 2px 6px rgba(139,69,19,.3)}
body.dark .stepper input{background:transparent;border-color:#334155;color:#E2E8F0}
body.dark .unit-select.unit-green{background:rgba(58,42,24,.85);border-color:#8B4513;color:#E2B97A}
body.dark .unit-select.unit-orange{background:rgba(61,26,10,.85);border-color:#F97316;color:#FDBA74}
body.dark .unit-select.unit-blue{background:rgba(58,42,24,.85);border-color:#8B4513;color:#E2B97A}
body.dark .toolbar-input{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .toolbar-input:focus{border-color:#8B4513;box-shadow:0 0 0 3px rgba(217,119,6,.15)}
body.dark .field select,.dark .toolbar-input,.dark .unit-select,.dark .set-input,.dark .panel select{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23FCD9A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 10px center}
body.dark .auto-tag{background:rgba(58,42,24,.85);color:#E2B97A;border-color:#5C3309}
body.dark .auto-tag[data-mode="manual"]{background:rgba(61,26,10,.85);color:#F97316;border-color:#7C2D12}
body.dark .toggle-row{color:#E2E8F0}
body.dark .toggle-row:hover{background:rgba(139,69,19,.08)}
body.dark .toggle-track{background:#334155}
body.dark .toggle input:checked + .toggle-track{background:linear-gradient(135deg,#8B4513,#B45309)}
body.dark .result-card{border-color:rgba(58,42,24,.6);box-shadow:0 12px 32px rgba(0,0,0,.4)}
body.dark .result-header{background:linear-gradient(135deg,#5C3309 0%,#8B4513 50%,#B45309 100%)}
body.dark .cost-chain{background:linear-gradient(135deg,rgba(30,41,59,.85),rgba(15,23,42,.7));border-bottom-color:#334155;backdrop-filter:blur(8px)}
body.dark .cost-chain .cc-val{color:#E2E8F0}
body.dark .cost-chain .cc-val.accent{color:#F97316}
body.dark .cost-table th{background:linear-gradient(180deg,rgba(58,42,24,.85),rgba(92,51,9,.7));border-bottom-color:#5C3309;color:#E2B97A}
body.dark .cost-table td{border-bottom-color:#334155}
body.dark .cost-table tr:hover td{background:rgba(30,41,59,.6)}
body.dark .cost-table .cat-header.cat-material{background:linear-gradient(90deg,rgba(58,42,24,.85),rgba(58,42,24,.5));color:#E2B97A}
body.dark .cost-table .cat-header.cat-process{background:linear-gradient(90deg,rgba(30,16,53,.85),rgba(30,16,53,.5));color:#A78BFA}
body.dark .cost-table .cat-header.cat-other{background:linear-gradient(90deg,rgba(58,42,24,.85),rgba(58,42,24,.5));color:#E2B97A}
body.dark .cost-table .total-row{background:linear-gradient(135deg,rgba(30,41,59,.95),rgba(22,31,43,.85))}
body.dark .cost-table .total-row .total-val{color:#F97316}
body.dark .formula-toggle{border-top-color:#334155}
body.dark .formula-toggle span{color:#E2B97A}
body.dark .formula-detail{background:rgba(30,41,59,.85);color:#94A3B8}
body.dark .formula-detail.open{border-top-color:#334155}
body.dark .formula-detail hr{border-top-color:#334155;opacity:.6}
body.dark .result-placeholder{background:linear-gradient(135deg,rgba(30,41,59,.85),rgba(15,23,42,.85));border-color:rgba(51,65,85,.6);color:#475569;backdrop-filter:blur(10px)}
body.dark .result-placeholder .ph-title{color:#94A3B8}
body.dark .stats-bar{box-shadow:0 2px 8px rgba(0,0,0,.35);border-color:rgba(45,58,77,.5)}
body.dark .stat-item{background:linear-gradient(180deg,rgba(30,41,59,.85),rgba(15,23,42,.7));border-right-color:#334155}
body.dark .stat-item:hover{background:linear-gradient(180deg,rgba(30,41,59,.95),rgba(15,23,42,.85))}
body.dark .stat-item .stat-num{color:#E2B97A}
body.dark .stat-item .stat-label{color:#94A3B8}
body.dark .stat-item.accent .stat-num{color:#F97316}
body.dark .history-table th{background:linear-gradient(180deg,rgba(58,42,24,.85),rgba(92,51,9,.7));border-bottom-color:#5C3309;color:#E2B97A}
body.dark .history-table td{border-bottom-color:#334155}
body.dark .history-table tr:hover{background:rgba(30,41,59,.6)}
body.dark .history-table .action-btn{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 2px 6px rgba(0,0,0,.3)}
body.dark .history-table .action-btn.del{background:linear-gradient(135deg,#B91C1C,#EF4444);box-shadow:0 2px 6px rgba(0,0,0,.3)}
body.dark .footer{color:#475569}
body.dark .foot-update{color:#475569;border-top-color:#334155}
body.dark .sticky-actions{background:linear-gradient(0deg,rgba(10,16,25,.96) 75%,rgba(10,16,25,0) 100%);backdrop-filter:blur(12px) saturate(140%);-webkit-backdrop-filter:blur(12px) saturate(140%)}
body.dark .help-tip{color:#475569}
body.dark .btn-sm.green,body.dark .btn-sm.blue{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 3px 10px rgba(180,83,9,.25)}
body.dark .btn-sm.orange{background:linear-gradient(135deg,#EA580C,#F97316);box-shadow:0 3px 10px rgba(234,88,12,.25)}
body.dark .btn-sm.red{background:linear-gradient(135deg,#B91C1C,#DC2626);box-shadow:0 3px 10px rgba(220,38,38,.25)}
body.dark .btn-sm.gray{background:rgba(51,65,85,.7);color:#94A3B8;backdrop-filter:blur(6px);border:1px solid #334155}
body.dark .btn-sm.gray:hover{background:rgba(30,41,59,.9);border-color:#8B4513;color:#E2B97A}
/* 暗色弹窗 */
body.dark .overlay{background:rgba(0,0,0,.7);backdrop-filter:blur(8px) saturate(140%);-webkit-backdrop-filter:blur(8px) saturate(140%)}
body.dark .panel{background:rgba(22,31,43,.92);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);box-shadow:0 24px 64px rgba(0,0,0,.5),0 8px 24px rgba(0,0,0,.3);border:1px solid rgba(45,58,77,.5)}
body.dark .panel h3{color:#E2E8F0}
body.dark .set-card{background:rgba(22,31,43,.7);border-color:#334155}
body.dark .set-card h4{color:#E2E8F0}
body.dark .set-card .srow label{color:#94A3B8}
body.dark .set-card .srow input,.dark .set-input{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .set-card .srow input:focus,.dark .set-input:focus{border-color:#8B4513;box-shadow:0 0 0 3px rgba(180,83,9,.15)}
body.dark .set-card .srow textarea{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .set-card .srow textarea:focus{border-color:#8B4513;box-shadow:0 0 0 3px rgba(180,83,9,.15)}
body.dark .set-card .srow .unit{color:#475569}
body.dark .set-card .srow span{color:#475569}
body.dark .pwd-panel{background:rgba(22,31,43,.92);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);border:1px solid rgba(45,58,77,.5)}
body.dark .pwd-input{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .pwd-input:focus{border-color:#8B4513;box-shadow:0 0 0 4px rgba(180,83,9,.15)}
body.dark .modal-card{background:rgba(22,31,43,.92);backdrop-filter:blur(20px) saturate(160%);-webkit-backdrop-filter:blur(20px) saturate(160%);border:1px solid rgba(45,58,77,.5)}
body.dark .modal-title{color:#E2E8F0}
body.dark .modal-sub{color:#94A3B8}
body.dark .modal-row label{color:#94A3B8}
body.dark .modal-row input,.dark .modal-row textarea{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .modal-row input:focus,.dark .modal-row textarea:focus{border-color:#8B4513;box-shadow:0 0 0 3px rgba(180,83,9,.15)}
body.dark .spec-group input{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .gram-wrap{background:rgba(15,23,42,.7);border-color:#334155}
body.dark .gram-wrap input{color:#E2E8F0}
body.dark .paper-group select,.dark .flute-group select,.dark .flute-group input[type=text]{background:rgba(15,23,42,.7);border-color:#334155;color:#E2E8F0}
body.dark .btn-cancel{background:rgba(51,65,85,.7);color:#94A3B8;border:1px solid #334155}
body.dark .btn-confirm{background:linear-gradient(135deg,#5C3309,#8B4513);box-shadow:0 3px 10px rgba(180,83,9,.25)}
body.dark .cross-label{color:#94A3B8}
body.dark .cust-tag.c1{background:rgba(58,42,24,.85);color:#E2B97A}
body.dark .cust-tag.c2{background:rgba(30,58,95,.85);color:#7DD3FC}
body.dark .cust-tag.c3{background:rgba(61,26,10,.85);color:#F97316}
body.dark .cust-tag.c4{background:rgba(30,16,53,.85);color:#A78BFA}
body.dark .cust-tag.c5{background:rgba(45,17,17,.85);color:#FCA5A5}
body.dark .cust-tag.c0{background:rgba(30,41,59,.7);color:#475569}
body.dark .gtip{background:rgba(15,23,42,.95);backdrop-filter:blur(12px);box-shadow:0 4px 20px rgba(0,0,0,.5)}

/* ===== CanIRun 工具主题（已合并到源文件） ===== */
/* Quote Tool — CanIRun-inspired quiet utility theme
   Presentation only: no field order, markup behavior, or calculation logic changes. */

:root {
  --brand: #16a34a;
  --brand-2: #22c55e;
  --brand-deep: #15803d;
  --brand-ink: #14532d;
  --accent: #c2410c;
  --accent-2: #ea580c;
  --bg-1: #ffffff;
  --bg-2: #f7f7f8;
  --bg-3: #fafafa;
  --border: #e4e4e7;
  --border-2: #d4d4d8;
  --border-soft: #eeeeef;
  --ink: #18181b;
  --ink-2: #09090b;
  --muted: #52525b;
  --muted-2: #71717a;
  --muted-3: #a1a1aa;
  --card-bg: #ffffff;
  --card-bg-solid: #ffffff;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
  --shadow-accent: none;
  --radius-sm: 6px;
  --radius: 7px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --ui-font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI Variable", system-ui, sans-serif;
  --utility-mono: var(--ui-font);
  --text-meta: 11px;
  --text-small: 12px;
  --text-control: 13px;
  --text-body: 15px;
}

html { background: #fff; }

/* Corrugated-box page: kraft amber accent, while retaining the same neutral theme. */
body.carton-page {
  --brand: #b45309;
  --brand-2: #d97706;
  --brand-deep: #92400e;
  --brand-ink: #78350f;
}
body.carton-page .field input.input-ok {
  border-color: #fcd34d !important;
  background: #fffbeb !important;
}
body.carton-page .surface-grid label:has(input:checked),
body.carton-page .switch-chip:has(input:checked) {
  border-color: #fcd34d;
  background: #fffbeb;
  color: var(--brand-deep);
}
body.carton-page .btn-sm.green,
body.carton-page .btn-sm.blue,
body.carton-page .qb-btn.qb-copy {
  border-color: #fcd34d;
  background: #fffbeb;
  color: var(--brand-deep);
}
body.carton-page .fab-btn:hover,
body.carton-page .fab-btn.fab-reset:hover {
  border-color: var(--brand);
  background: #fffbeb;
  color: var(--brand-deep);
}

body {
  min-height: 100vh;
  padding: 18px 18px 38px;
  color: var(--ink);
  background: #fff;
  background-image: none;
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.55;
}

body::before { display: none; }
body, body * { transition-duration: .12s; }
.container { max-width: 840px; }

/* Minimal segmented navigation */
.mode-tabs {
  gap: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  background: #f4f4f5;
  box-shadow: none;
  backdrop-filter: none;
}

.mode-tab {
  padding: 10px 14px;
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--utility-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.mode-tab:hover { color: var(--ink); background: #ededee; }
.mode-tab.active {
  margin: 3px;
  color: var(--brand-deep);
  background: #fff;
  border: 1px solid var(--border-2);
  box-shadow: none;
}

/* Flat sections: information first, decoration second */
.card {
  margin-bottom: 10px;
  padding: 17px 16px;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
}

.card:hover {
  transform: none;
  border-color: var(--border-2);
  box-shadow: none;
}

.card h2 {
  min-height: 24px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
}

.card h2 > span:first-child,
.toggle-head {
  font-family: var(--utility-mono), "Microsoft YaHei";
}
.card h2 [style*="color"] { color: var(--muted-2) !important; }

.card h2::before {
  width: 5px;
  height: 5px;
  margin-right: 3px;
  border-radius: 1px;
  background: var(--brand);
}

.row { gap: 10px; }
.field { min-width: 112px; }
.field label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .01em;
}

.req::after, .req-x2::after { color: #dc2626; }
.auto-tag {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #f4f4f5;
  color: var(--muted-2);
  font-family: var(--utility-mono);
  font-size: 9px;
}

/* Dense tool controls */
.field input,
.field select,
.toolbar-input,
.set-input,
.panel input,
.panel select,
.modal input,
.modal select,
.modal textarea {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background-color: #f4f4f5;
  color: var(--ink);
  box-shadow: none;
  font-family: var(--utility-mono);
  font-size: 12px;
}

.field input { text-align: center; font-variant-numeric: tabular-nums; }
.field select { text-align: center; text-align-last: center; }
.stepper input { text-align: center; }
.field input[type="text"] { text-align: center; }
.field input[readonly] { text-align: center; }

.field select.unit-select,
.unit-select.unit-green,
.unit-select.unit-orange {
  width: auto;
  min-width: 82px;
  min-height: 38px;
  padding: 8px 26px 8px 10px !important;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background-color: #f4f4f5;
  color: var(--muted);
  font-family: var(--utility-mono);
  font-size: var(--text-control);
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
  text-align-last: center;
  box-shadow: none;
}
.field select.unit-select:hover,
.unit-select.unit-green:hover,
.unit-select.unit-orange:hover { border-color: #a1a1aa; background-color: #f4f4f5; color: var(--ink); }
.field select.unit-select:focus,
.unit-select.unit-green:focus,
.unit-select.unit-orange:focus { border-color: var(--brand); background-color: #fff; color: var(--ink); box-shadow: 0 0 0 2px rgba(22,163,74,.12); }

.field select,
.toolbar-input,
.unit-select,
.set-input,
.panel select,
.modal select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%2352525b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.field input:hover, .field select:hover, .toolbar-input:hover {
  border-color: #a1a1aa;
  background-color: #f4f4f5;
}

.field input:focus,
.field select:focus,
.toolbar-input:focus,
.set-input:focus,
.panel input:focus,
.panel select:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .12);
}

.field input[readonly], .field input:disabled, .field select:disabled {
  border-style: solid;
  border-color: #e4e4e7 !important;
  background: #fafafa !important;
  color: #a1a1aa !important;
  opacity: 1;
}

.field input.input-ok { border-color: #86efac !important; background: #f0fdf4 !important; color: var(--ink) !important; box-shadow: none !important; }
.field input.input-warn { border-color: var(--border-2); background: #f4f4f5; box-shadow: none; }
.field input.hl-emph:not(.input-ok) { border-color: var(--border-2); background: #f4f4f5; box-shadow: none; }

.stepper {
  height: 38px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: #f4f4f5;
  backdrop-filter: none;
}

.stepper button {
  padding: 0 12px;
  color: var(--muted);
  font-family: var(--utility-mono);
  font-size: 16px;
}

.stepper button:hover { color: var(--brand-deep); background: #e8f7ed; }
.stepper input { font-family: var(--utility-mono); font-size: 12px; }

/* Chips and switches */
.surface-grid, .switch-grid { gap: 6px; }
.surface-grid label, .switch-chip {
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: #fafafa;
  color: var(--muted);
  font-family: var(--utility-mono);
  font-size: 11px;
  box-shadow: none;
}

.surface-grid label:hover, .switch-chip:hover {
  transform: none;
  border-color: #a1a1aa;
  box-shadow: none;
}

.surface-grid label:has(input:checked), .switch-chip:has(input:checked) {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--brand-deep);
  box-shadow: none;
}

.toggle-card { padding: 14px 16px; }
.toggle-head {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
.toggle-head::before { width: 5px; height: 5px; border-radius: 1px; background: var(--brand); }
.toggle-row { padding: 4px 6px; color: var(--muted); font-size: 12px; }
.toggle-row:hover { background: #f4f4f5; }
.toggle { width: 34px; height: 19px; }
.toggle-track { border: 1px solid #d4d4d8; border-radius: 10px; background: #e4e4e7; }
.toggle-track::after { width: 13px; height: 13px; top: 2px; left: 2px; box-shadow: none; }
.toggle input:checked + .toggle-track,
.toggle-row.t-green .toggle input:checked + .toggle-track,
.toggle-row.t-purple .toggle input:checked + .toggle-track,
.toggle-row.t-red .toggle input:checked + .toggle-track,
.toggle-row.t-orange .toggle input:checked + .toggle-track { border-color: var(--brand); background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(15px); box-shadow: none; }

/* Calm actions with one clear primary color */
.sticky-actions {
  padding: 10px 0 12px;
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.btn, .btn-copy, .btn-primary, .btn-confirm {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--brand-deep);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  box-shadow: none;
  font-family: var(--utility-mono);
  font-weight: 600;
}

.btn { padding: 12px; font-size: 13px; letter-spacing: 0; }
.btn::before { display: none; }
.btn:hover, .btn-copy:hover, .btn-primary:hover, .btn-confirm:hover {
  transform: none;
  background: var(--brand-deep);
  box-shadow: none;
}

.sticky-actions .row:first-child .btn:last-child {
  border-color: var(--border-2) !important;
  background: #f4f4f5 !important;
  color: var(--muted) !important;
}

.sticky-actions .row:first-child .btn:last-child:hover { background: #e4e4e7 !important; color: var(--ink) !important; }
.btn-secondary, .btn-cancel {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--border-2) !important;
  border-radius: 6px;
  background: #fafafa !important;
  color: var(--muted) !important;
  box-shadow: none;
  font-family: var(--utility-mono);
}
.btn-secondary:hover, .btn-cancel:hover { transform: none; border-color: #a1a1aa !important; background: #f4f4f5 !important; }

/* Results and data tables */
.result-placeholder {
  min-height: 0;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  background: #fff;
  color: var(--muted-2);
  text-align: left;
  backdrop-filter: none;
}
.result-placeholder::before { display: none; }
.result-placeholder .ph-icon { display: none; }
.result-placeholder .ph-title { display: inline; color: var(--ink); font-family: var(--utility-mono); font-size: 12px; font-weight: 600; }
.result-placeholder .ph-title::before { content: "READY  "; color: var(--brand); font-size: 10px; }
.result-placeholder .ph-sub { display: inline; margin-left: 10px; color: var(--muted-3); font-family: var(--utility-mono); font-size: 10px; }
.result-card { border-color: var(--border-2); box-shadow: none; }
.result-header {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-align: center;
}
.result-header::before, .result-header::after { display: none; }
.result-header .rh-label { color: var(--muted-2); font-family: var(--utility-mono); font-size: 9px; letter-spacing: .08em; }
.result-header .rh-total {
  margin: 4px 0 2px;
  color: var(--brand-deep);
  background: none;
  font-family: var(--utility-mono);
  font-size: 30px;
  letter-spacing: -1px;
  text-shadow: none;
  -webkit-text-fill-color: currentColor;
}
.result-header .rh-sub, .result-header .rh-tax { color: var(--muted-2); opacity: 1; font-family: var(--utility-mono); font-size: 10px; }
.cost-chain { padding: 11px 12px; border-bottom: 1px solid var(--border); background: #fafafa; backdrop-filter: none; }
.cost-chain .cc-item:hover { transform: none; }
.cost-chain .cc-label { color: var(--muted-3); font-family: var(--utility-mono); font-size: 9px; }
.cost-chain .cc-val { color: var(--ink); font-size: 12px; font-weight: 600; }
.cost-chain .cc-val.accent { color: var(--brand-deep); font-size: 12px; text-shadow: none; }
.cost-chain .cc-arrow { color: var(--border-2); font-size: 12px; }
.cost-chain .cc-val, .cost-table td.num, .stat-item .stat-num { font-family: var(--utility-mono); }
.cost-table { font-size: 11px; }
.cost-table th { padding: 8px 10px; border-bottom: 1px solid var(--border-2); background: #f4f4f5; color: var(--muted-2); font-family: var(--utility-mono); font-size: 9px; font-weight: 500; }
.cost-table td { padding: 7px 10px; border-bottom-color: var(--border); }
.cost-table tr:hover td { background: #fafafa; }
.cost-table .cat-header td,
.cost-table .cat-header.cat-material td,
.cost-table .cat-header.cat-print td,
.cost-table .cat-header.cat-process td,
.cost-table .cat-header.cat-other td,
.cost-table .cat-header.cat-outsource td {
  padding: 6px 10px;
  background: #fafafa;
  color: var(--muted-2);
  font-family: var(--utility-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .04em;
}
.cost-table .total-row { background: #f0fdf4; }
.cost-table .total-row td { padding: 9px 10px; }
.cost-table .total-row .total-val { color: var(--brand-deep); font-family: var(--utility-mono); font-size: 12px; text-shadow: none; }
.formula-toggle { padding: 9px 12px; border-top-color: var(--border); text-align: left; }
.formula-toggle span { color: var(--muted-2); font-family: var(--utility-mono); font-size: 9px; }
.formula-detail { background: #fafafa; color: var(--muted); font-family: var(--utility-mono); font-size: 10px; }
.formula-detail.open { padding: 12px; border-top-color: var(--border); }
.formula-detail .fhead { margin-top: 18px; border-bottom-color: var(--border); }
.formula-detail .fsec, .formula-detail .flabel, .formula-detail .flabel.lvl2 { color: var(--brand-deep); }
.formula-detail .fsub, .formula-detail .fval, .formula-detail .fval.lvl2,
.formula-detail .fsum .flabel, .formula-detail .fsum .fval { color: var(--muted); font-family: var(--utility-mono); }
.formula-detail .fsum.total .flabel, .formula-detail .fsum.total .fval { color: var(--brand-deep); }
.formula-detail .fpiece2 { border: 1px solid var(--border); border-radius: 3px; background: #fff; color: var(--muted); }
.stats-bar { border-color: var(--border); box-shadow: none; }
.stat-item { background: #fafafa; }
.stat-item:hover { background: #f4f4f5; }
.stat-item .stat-num, .stat-item.accent .stat-num { color: var(--ink); }

/* History behaves like a compact data browser, not a dashboard card. */
#historyCard { padding-bottom: 10px; }
#historyCard .stats-bar {
  gap: 20px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #fafafa;
}
#historyCard .stat-item {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}
#historyCard .stat-item:hover { background: transparent; }
#historyCard .stat-item .stat-num { font-size: 13px; font-weight: 650; }
#historyCard .stat-item .stat-label { margin: 0; color: var(--muted-3); font-family: var(--utility-mono); font-size: 9px; }
#historyCard .stat-item.accent .stat-num { color: var(--brand-deep); }

#historyCard .hist-filter-bar { gap: 6px !important; margin-bottom: 7px !important; }
#historyCard .toolbar-input {
  min-height: 34px;
  padding-top: 6px;
  padding-bottom: 6px;
  background-color: #fafafa;
  font-size: 11px;
  text-align: center;
  text-align-last: center;
}
#historyCard .hist-action-bar { margin-bottom: 8px !important; }
#historyCard .btn-sm {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-family: var(--utility-mono);
  font-size: 10px;
  font-weight: 500;
}
#historyCard .btn-sm:hover { transform: none; border-color: #a1a1aa; background: #f4f4f5; filter: none; }
#historyCard .btn-sm.red:hover { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
#historyCard #selectedCount { color: var(--muted-2) !important; font-family: var(--utility-mono); font-size: 10px !important; font-weight: 500 !important; }

.history-table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  overflow: hidden;
}
.history-table th {
  padding: 8px 9px;
  border-bottom: 1px solid var(--border-2);
  background: #f4f4f5;
  color: var(--muted-2);
  font-family: var(--utility-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}
.history-table td { padding: 8px 9px; border-bottom: 1px solid var(--border); }
.history-table tbody tr:hover { background: #fafafa; }
.history-table .col-num { font-family: var(--utility-mono); font-variant-numeric: tabular-nums; }
.history-table .action-btn,
.history-table .action-btn.del,
.history-table .action-btn.exp {
  padding: 4px 7px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-family: var(--utility-mono);
  font-size: 9px;
}
.history-table .action-btn:hover,
.history-table .action-btn.del:hover,
.history-table .action-btn.exp:hover { transform: none; border-color: var(--brand); background: #f0fdf4; color: var(--brand-deep); box-shadow: none; }
.no-result { padding: 20px !important; color: var(--muted-3); font-family: var(--utility-mono); font-size: 10px; }
.footer { margin-top: 12px; color: var(--muted-3); font-family: var(--utility-mono); font-size: 9px; }

/* Unified button hierarchy across settings, dialogs and generated panels. */
.btn-sm, .qb-btn, .action-btn, .tip-edit .action-btn {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  font-family: var(--utility-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}
.btn-sm:hover, .qb-btn:hover, .action-btn:hover, .tip-edit .action-btn:hover {
  transform: none;
  border-color: #a1a1aa;
  background: #f4f4f5;
  color: var(--ink);
  box-shadow: none;
  filter: none;
}
.btn-sm.green, .btn-sm.blue, .qb-btn.qb-copy {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--brand-deep);
  box-shadow: none;
}
.btn-sm.orange, .qb-btn.qb-tpl {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
  box-shadow: none;
}
.btn-sm.red, .action-btn.del {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: none;
}
.btn-sm.gray, .qb-btn.qb-close { background: #fff; color: var(--muted); }
.set-actions .btn-sm, .panel-foot .btn-sm { min-width: 92px; }
.transport-del { min-height: 28px !important; padding: 4px 8px !important; }

/* Settings/password/quote-preview overlays use the same flat utility surfaces. */
.overlay { background: rgba(24, 24, 27, .38); backdrop-filter: blur(2px); }
.panel, .pwd-panel, .quote-box {
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .16);
  backdrop-filter: none;
  animation: none;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  backdrop-filter: none;
}
.panel-head h3, .pwd-body h3, .quote-box h3 {
  color: var(--ink);
  font-family: var(--utility-mono), "Microsoft YaHei";
  font-size: 13px;
}
.panel-head .panel-close { color: var(--muted-3); }
.panel-head .panel-close:hover { background: #f4f4f5; color: var(--ink); }
.panel-body, .pwd-body { background: #fff; }
.panel-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.set-card, .set-card.wide, .set-card.danger {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-2);
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
}
.set-card.c-green, .set-card.c-blue, .set-card.wide { border-left-color: var(--brand); }
.set-card.c-orange, .set-card.c-purple, .set-card.c-amber { border-left-color: var(--border-2); }
.set-card.c-red, .set-card.danger { border-left-color: #ef4444; background: #fff; }
.set-card h4, .set-card.wide h4 { color: var(--ink); font-family: var(--utility-mono), "Microsoft YaHei"; font-size: 11px; }
.set-card h5, .press-size { color: var(--muted); font-size: 10px; }
.set-card .srow { border-bottom-color: var(--border); }
.set-card .srow label { color: var(--muted); font-size: 10px; }
.set-card .srow input, .set-input, .pwd-input, .qb-textarea {
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: #f4f4f5;
  color: var(--ink);
  box-shadow: none;
  font-family: var(--utility-mono);
  text-align: center;
}
.set-card .srow input:focus, .set-input:focus, .pwd-input:focus, .qb-textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .12);
}
.press-group { border-top-color: var(--border); }

/* 设置弹窗对齐彩盒结构（2026-09-18）：标题栏+✕ / panel-body / panel-foot / hint 说明 */
#setOverlay .panel { padding: 0; max-width: 680px; width: 94%; max-height: 90vh; }
.panel-body { padding: 14px 16px; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 10px; line-height: 1.6; }
.set-card.danger .hint { color: #B06A6A; }
body.dark .hint { color: #8B9BB0; }
body.dark .set-card.danger .hint { color: #D9A0A0; }
.qb-actions { gap: 7px; }
.qb-btn { flex: 1; }
.gtip { border: 1px solid #3f3f46; border-radius: 5px; background: #27272a; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-family: var(--utility-mono); }

/* Multi-quantity comparison follows the same neutral data-table language. */
#multiQtyTable { padding: 12px 0 0 !important; }
.mq-hint {
  margin: 0 0 8px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  color: var(--muted-2);
  font-family: var(--utility-mono);
  font-size: 9px;
  backdrop-filter: none;
}
#mqCompareTable {
  border-collapse: separate;
  border-spacing: 0;
  border-color: var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-size: 10px;
  box-shadow: none;
}
#mqCompareTable thead th {
  padding: 8px 9px;
  border: 0;
  border-bottom: 1px solid var(--border-2);
  background: #f4f4f5;
  color: var(--muted-2);
  font-family: var(--utility-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}
#mqCompareTable tbody tr,
#mqCompareTable tbody tr:nth-child(even) { background: #fff; animation: none; }
#mqCompareTable tbody tr:hover { transform: none; background: #fafafa; }
#mqCompareTable tbody tr.mq-sel { background: #f0fdf4; box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
#mqCompareTable tbody td { padding: 8px 9px; border: 0; border-bottom: 1px solid var(--border); font-family: var(--utility-mono); }
#mqCompareTable tbody td:first-child { font-family: var(--utility-mono); }
.best-badge { width: 14px; height: 14px; border-radius: 3px; background: var(--brand); box-shadow: none; font-size: 8px; }
#mqDetailPanel { margin-top: 8px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }

/* Save dialog: flat utility panel, matching the page instead of a glass card. */
.modal-mask { padding: 18px; background: rgba(24, 24, 27, .38); backdrop-filter: blur(2px); }
.modal-card {
  width: 410px;
  max-width: 100%;
  max-height: calc(100vh - 36px);
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .16);
  backdrop-filter: none;
  animation: none;
}
.modal-close { top: 9px; right: 9px; border: 1px solid transparent; color: var(--muted-3); font-family: var(--utility-mono); font-size: 13px; }
.modal-close:hover { border-color: var(--border); background: #f4f4f5; color: var(--ink); }
.modal-title { margin: 0 30px 3px 0; color: var(--ink); font-family: var(--utility-mono); font-size: 13px; font-weight: 650; }
.modal-sub { margin-bottom: 14px; color: var(--muted-3); font-size: 10px; }
.modal-form { gap: 8px; }
.modal-row { gap: 8px; }
.modal-row label { flex-basis: 68px; color: var(--muted); font-size: 10px; font-weight: 500; }
.modal-row input, .modal-row textarea,
.spec-group input, .gram-wrap, .paper-group select,
.flute-group input[type="text"], .flute-group select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: #f4f4f5;
  color: var(--ink);
  box-shadow: none;
  font-family: var(--utility-mono);
  font-size: 10px;
  text-align: center;
}
.gram-wrap { padding: 0 8px; }
.gram-wrap input { min-height: 30px; color: var(--ink); font-family: var(--utility-mono); font-size: 10px; text-align: center; }
.modal-row input:focus, .modal-row textarea:focus,
.spec-group input:focus, .paper-group select:focus,
.flute-group input[type="text"]:focus, .flute-group select:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .12);
}
.cross-label { color: var(--muted); font-family: var(--utility-mono); font-size: 9px; }
.modal-actions { gap: 7px; margin-top: 14px; }
.modal-actions button { min-height: 34px; padding: 7px 9px; border-radius: 5px; font-family: var(--utility-mono); font-size: 10px; font-weight: 600; }
#saveModal #btnModalConfirm {
  border: 1px solid var(--border-2);
  background: #fff;
  color: var(--muted);
}
#saveModal #btnModalConfirm:hover { border-color: #a1a1aa; background: #f4f4f5; color: var(--ink); }
.modal-input-err, .modal-input-err:focus,
.gram-wrap.modal-input-err { border-width: 1px !important; border-color: #ef4444 !important; background: #fef2f2 !important; box-shadow: 0 0 0 2px rgba(239, 68, 68, .1) !important; }

/* Utility buttons stay visible without floating orange blobs */
.fab-group { right: 12px; bottom: 16px; gap: 6px; }
.fab-btn, .fab-btn.fab-reset {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
  animation: none;
  font-size: 13px;
}
.fab-btn:hover, .fab-btn.fab-reset:hover { transform: none; border-color: var(--brand); background: #f0fdf4; color: var(--brand-deep); box-shadow: none; }

/* Dialogs and secondary surfaces */
.modal-content, .panel, .sub-card, .press-group {
  border-color: var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}
.formula-detail, .formula-detail.open { background: #fafafa; }
.formula-toggle span { color: var(--brand-deep); }
.hist-table th { background: #f4f4f5; color: var(--muted); font-family: var(--utility-mono); }

/* Final typography scale: no UI text below 10px. */
.mode-tab, .field input, .field select, .stepper input { font-size: var(--text-control); }
.card h2, .toggle-head { font-size: var(--text-body); }
.field label, .surface-grid label, .switch-chip, .toggle-row { font-size: var(--text-small); }
.auto-tag { font-size: var(--text-meta); }
.btn, .btn-copy { font-size: var(--text-control); }
.btn-secondary, .btn-primary, .btn-confirm, .btn-cancel { font-size: var(--text-small); }
.btn-sm, .qb-btn, .action-btn, .tip-edit .action-btn { font-size: var(--text-meta); }
.result-header .rh-label,
.result-header .rh-sub,
.result-header .rh-tax,
.cost-chain .cc-label,
.cost-table th,
.cost-table .cat-header td,
.formula-toggle span,
#historyCard .stat-item .stat-label,
.history-table th,
.history-table .action-btn,
.no-result,
.footer,
.mq-hint,
#mqCompareTable thead th,
.modal-sub,
.modal-row label,
.cross-label { font-size: var(--text-meta); }
.cost-table .cat-header td { font-size: var(--text-meta) !important; }
.cost-table, .history-table, #mqCompareTable { font-size: var(--text-small); }
.formula-detail, .modal-row input, .modal-row textarea,
.spec-group input, .paper-group select, .flute-group input[type="text"],
.flute-group select, .gram-wrap input { font-size: var(--text-small); }
.modal-title, .panel-head h3, .pwd-body h3, .quote-box h3 { font-size: 13px; }
.modal-actions button { font-size: var(--text-small); }
.best-badge { width: 16px; height: 16px; font-size: var(--text-meta); }

/* Neutral dark mode — same hierarchy, without reviving the previous gradients. */
body.dark {
  --bg-1: #09090b;
  --bg-2: #111113;
  --bg-3: #18181b;
  --border: #27272a;
  --border-2: #3f3f46;
  --border-soft: #202023;
  --ink: #f4f4f5;
  --ink-2: #fafafa;
  --muted: #a1a1aa;
  --muted-2: #a1a1aa;
  --muted-3: #71717a;
  --card-bg: #111113;
  --card-bg-solid: #111113;
  color: var(--ink);
  background: #09090b;
  background-image: none;
}
body.dark::before { display: none; }
body.dark .card,
body.dark .mode-tabs,
body.dark .panel,
body.dark .pwd-panel,
body.dark .quote-box,
body.dark .modal-card,
body.dark .panel-head,
body.dark .panel-body,
body.dark .pwd-body,
body.dark .set-card,
body.dark .set-card.wide,
body.dark .set-card.danger,
body.dark .modal-content,
body.dark .sub-card,
body.dark .press-group {
  border-color: var(--border);
  background: #111113;
  color: var(--ink);
  box-shadow: none;
  backdrop-filter: none;
}
body.dark .card:hover { border-color: var(--border-2); box-shadow: none; }
body.dark .card h2,
body.dark .toggle-head,
body.dark .panel-head h3,
body.dark .pwd-body h3,
body.dark .modal-title,
body.dark .set-card h4,
body.dark .set-card.wide h4 { color: var(--ink); border-color: var(--border); }
body.dark .mode-tab { color: var(--muted); background: transparent; }
body.dark .mode-tab:hover { color: var(--ink); background: #18181b; }
body.dark .mode-tab.active { border-color: var(--border-2); background: #18181b; color: #4ade80; }
body.dark .field label,
body.dark .modal-row label,
body.dark .set-card .srow label { color: var(--muted); }
body.dark .field input,
body.dark .field select,
body.dark .toolbar-input,
body.dark .set-input,
body.dark .set-card .srow input,
body.dark .pwd-input,
body.dark .qb-textarea,
body.dark .modal-row input,
body.dark .modal-row textarea,
body.dark .spec-group input,
body.dark .gram-wrap,
body.dark .paper-group select,
body.dark .flute-group input[type="text"],
body.dark .flute-group select {
  border-color: var(--border-2);
  background-color: #18181b;
  color: var(--ink);
  box-shadow: none;
}
body.dark .field input:focus,
body.dark .field select:focus,
body.dark .toolbar-input:focus,
body.dark .modal-row input:focus,
body.dark .modal-row textarea:focus { border-color: #22c55e; background: #18181b; box-shadow: 0 0 0 2px rgba(34,197,94,.14); }
body.dark .field input[readonly], body.dark .field input:disabled { border-color: var(--border) !important; background: #111113 !important; color: #71717a !important; }
body.dark .stepper { border-color: var(--border-2); background: #18181b; }
body.dark .stepper button, body.dark .stepper input { color: var(--ink); background: transparent; }
body.dark .surface-grid label, body.dark .switch-chip,
body.dark .btn-secondary, body.dark .btn-cancel,
body.dark .btn-sm, body.dark .qb-btn, body.dark .action-btn,
body.dark .fab-btn, body.dark .fab-btn.fab-reset {
  border-color: var(--border-2) !important;
  background: #18181b !important;
  color: var(--muted) !important;
  box-shadow: none;
}
body.dark .btn.btn-sm,
body.dark .btn-sm.green,
body.dark .btn-sm.blue,
body.dark .btn-sm.orange,
body.dark .btn-sm.red,
body.dark .btn-sm.gray {
  box-shadow: none !important;
}
body.dark .btn-sm.green, body.dark .btn-sm.blue { border-color: #166534 !important; background: #052e16 !important; color: #4ade80 !important; }
body.dark .btn-sm.orange { border-color: #78350f !important; background: #2b1607 !important; color: #fbbf24 !important; }
body.dark .btn-sm.red { border-color: #7f1d1d !important; background: #2a0d0d !important; color: #f87171 !important; }
body.dark .btn,
body.dark .btn-copy,
body.dark .btn-primary,
body.dark .btn-confirm {
  border-color: #15803d;
  background: #16a34a;
  color: #fff;
  box-shadow: none;
}
body.dark .btn:hover,
body.dark .btn-copy:hover,
body.dark .btn-primary:hover,
body.dark .btn-confirm:hover { background: #15803d; box-shadow: none; }
body.dark .sticky-actions .row:first-child .btn:last-child {
  border-color: var(--border-2) !important;
  background: #18181b !important;
  color: var(--muted) !important;
  box-shadow: none !important;
}
body.dark #saveModal #btnModalConfirm { border-color: var(--border-2); background: #18181b; color: var(--muted); }
body.dark .field input.input-ok { border-color: #166534 !important; background: #052e16 !important; color: #dcfce7 !important; }
body.dark.carton-page .btn,
body.dark.carton-page .btn-copy,
body.dark.carton-page .btn-primary,
body.dark.carton-page .btn-confirm {
  border-color: #92400e;
  background: #b45309;
}
body.dark.carton-page .btn:hover,
body.dark.carton-page .btn-copy:hover,
body.dark.carton-page .btn-primary:hover,
body.dark.carton-page .btn-confirm:hover { background: #92400e; }
body.dark.carton-page .field input.input-ok { border-color: #a16207 !important; background: #2b1607 !important; color: #fef3c7 !important; }
body.dark.carton-page .btn-sm.green,
body.dark.carton-page .btn-sm.blue { border-color: #78350f !important; background: #2b1607 !important; color: #fbbf24 !important; }
body.dark .surface-grid label:has(input:checked), body.dark .switch-chip:has(input:checked) { border-color: #22c55e; background: #052e16; color: #4ade80; }
body.dark .sticky-actions { border-top-color: var(--border); background: rgba(9,9,11,.94); backdrop-filter: blur(8px); }
body.dark .result-header, body.dark .cost-table td, body.dark #mqCompareTable tbody tr,
body.dark #mqCompareTable tbody tr:nth-child(even), body.dark .history-table td { background: #111113; color: var(--ink); }
body.dark .cost-chain, body.dark .cost-table th, body.dark .cost-table .cat-header td,
body.dark #mqCompareTable thead th, body.dark .history-table th,
body.dark #historyCard .stats-bar, body.dark .formula-detail,
body.dark .mq-hint, body.dark .panel-foot { border-color: var(--border); background: #18181b; color: var(--muted); }
body.dark .cost-table .total-row, body.dark #mqCompareTable tbody tr.mq-sel { background: #052e16; }
body.dark .result-placeholder { border-color: var(--border); border-left-color: #22c55e; background: #111113; }
body.dark .modal-mask, body.dark .overlay { background: rgba(0,0,0,.64); backdrop-filter: blur(2px); }
body.dark .footer { color: var(--muted-3); }

/* 2026-11-19 方案A门槛修正：735→759（徽章同行门槛，详见 color-box.css 同名注释）。
   <760 齐步换两列紧凑版，≥760（含 ↔ 竖屏挡位）才是宽版。 */
@media (max-width: 759px) {
  .field { min-width: calc(50% - 6px); }
}

@media (max-width: 680px) {
  body { padding: 10px 9px 28px; }
  .card { padding: 14px 12px; }
  .container { max-width: 100%; }
  .mode-tab { padding: 9px 8px; font-size: 11px; }
}

/* 2026-11-06 撤除：远程桌面 / 部分浏览器与系统「优化动画」工具会把 prefers-reduced-motion
   误报成 reduce，一旦生效会把整页动画与过渡（卡片淡入、阶梯行淡入、按钮悬停、toast 滑出）
   全部静默关掉，用户体感就是「所有动画都消失了」。本项目是内部单用户工具，动画均为装饰性，
   故恒定保留。日后若要做无障碍开关，请做成用户可选项，不要用媒体查询硬关。
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
*/

/* ===== Typography & dark palette refinement ===== */
/* Keep Chinese text soft and readable; use tabular figures instead of a monospace face. */
button, input, select, textarea { font-family: var(--ui-font); }
.cost-table td.num, .stat-item .stat-num, .history-table .col-num,
.result-header .rh-total, .cost-chain .cc-val { font-variant-numeric: tabular-nums; }
.card h2, .toggle-head { font-size: 15px; font-weight: 600; }
.field label, .surface-grid label, .switch-chip, .toggle-row { font-size: 12px; font-weight: 400; }
.field input, .field select, .stepper input, .mode-tab, .btn, .btn-copy { font-size: 13px; }
.result-header .rh-label, .cost-chain .cc-label, .cost-table th,
.formula-toggle span, #historyCard .stat-item .stat-label,
.history-table th, #mqCompareTable thead th { font-size: 11px; }
.result-header .rh-sub, .result-header .rh-tax, .formula-detail,
.modal-sub, .modal-row label, .set-card .srow label { font-size: 12px; }
.cost-table, .history-table, #mqCompareTable { font-size: 12px; line-height: 1.5; }
.modal-title, .panel-head h3, .pwd-body h3, .quote-box h3 { font-size: 15px; font-weight: 600; }
.modal-row input, .modal-row textarea, .spec-group input, .paper-group select,
.flute-group input[type="text"], .flute-group select, .gram-wrap input,
.modal-actions button { font-size: 12px; }
.result-placeholder .ph-title::before, .result-placeholder .ph-sub,
.cost-table .cat-header td, .formula-detail .fhead,
#historyCard .toolbar-input, #historyCard .toolbar-btn,
#historyCard #selectedCount, .history-table .action-btn,
.no-result, .footer, .set-card h5, .press-size,
.cross-label, .best-badge { font-size: 11px !important; }
.set-card .srow label, .set-card .srow input, .set-input,
.pwd-input, .qb-textarea, .mq-hint, .panel-foot { font-size: 12px; }

body.dark {
  --bg-1: #000000;
  --bg-2: #111111;
  --bg-3: #181818;
  --border: #222222;
  --border-2: #303034;
  --border-soft: #1a1a1a;
  --ink: #ededef;
  --ink-2: #f5f5f6;
  --muted: #8a8a97;
  --muted-2: #707079;
  --muted-3: #56565f;
  --card-bg: #111111;
  --card-bg-solid: #111111;
  background: var(--bg-1);
}
body.dark .card, body.dark .mode-tabs, body.dark .panel,
body.dark .pwd-panel, body.dark .quote-box, body.dark .modal-card,
body.dark .panel-head, body.dark .panel-body, body.dark .pwd-body,
body.dark .set-card, body.dark .set-card.wide, body.dark .set-card.danger,
body.dark .modal-content, body.dark .sub-card, body.dark .press-group,
body.dark .result-header, body.dark .cost-table td,
body.dark #mqCompareTable tbody tr, body.dark .history-table td {
  border-color: var(--border);
  background: var(--bg-2);
}
body.dark .field input, body.dark .field select, body.dark .toolbar-input,
body.dark .set-input, body.dark .set-card .srow input, body.dark .pwd-input,
body.dark .qb-textarea, body.dark .modal-row input, body.dark .modal-row textarea,
body.dark .spec-group input, body.dark .gram-wrap, body.dark .paper-group select,
body.dark .flute-group input[type="text"], body.dark .flute-group select,
body.dark .stepper { border-color: var(--border-2); background: var(--bg-3); color: var(--ink); }
body.dark .field input[readonly], body.dark .field input:disabled {
  border-color: var(--border) !important; background: var(--bg-2) !important; color: var(--muted-3) !important;
}
body.dark .field input.input-ok,
body.dark.carton-page .field input.input-ok {
  border-color: var(--brand) !important; background: var(--bg-3) !important; color: var(--ink) !important;
}
body.dark .surface-grid label, body.dark .switch-chip,
body.dark .btn-secondary, body.dark .btn-cancel, body.dark .btn-sm,
body.dark .qb-btn, body.dark .action-btn, body.dark .fab-btn,
body.dark .fab-btn.fab-reset, body.dark .btn-sm.green,
body.dark .btn-sm.blue, body.dark .btn-sm.orange,
body.dark.carton-page .btn-sm.green, body.dark.carton-page .btn-sm.blue {
  border-color: var(--border-2) !important; background: var(--bg-3) !important; color: var(--muted) !important;
}
body.dark .surface-grid label:has(input:checked),
body.dark .switch-chip:has(input:checked) {
  border-color: var(--brand); background: var(--bg-3); color: var(--ink);
}
body.dark .cost-chain, body.dark .cost-table th,
body.dark .cost-table .cat-header td, body.dark #mqCompareTable thead th,
body.dark .history-table th, body.dark #historyCard .stats-bar,
body.dark .formula-detail, body.dark .mq-hint, body.dark .panel-foot {
  border-color: var(--border); background: var(--bg-3); color: var(--muted);
}
body.dark .cost-table .total-row, body.dark #mqCompareTable tbody tr.mq-sel {
  background: var(--bg-3); box-shadow: inset 3px 0 0 var(--brand);
}
body.dark .result-placeholder { border-color: var(--border); border-left-color: var(--brand); background: var(--bg-2); }
body.dark .sticky-actions { border-top-color: var(--border); background: rgba(0,0,0,.94); }
body.dark input, body.dark select, body.dark textarea { color-scheme: dark; }
body.dark .modal-close:hover { border-color: var(--border); background: var(--bg-3); color: var(--ink); }
body.dark .modal-input-err, body.dark .modal-input-err:focus,
body.dark .gram-wrap.modal-input-err {
  border-color: #7f1d1d !important;
  background: #1c1010 !important;
  color: #fecaca !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.10) !important;
}
body.dark ::-webkit-scrollbar { width: 10px; height: 10px; }
body.dark ::-webkit-scrollbar-track { background: #000; }
body.dark ::-webkit-scrollbar-thumb { border: 2px solid #000; border-radius: 10px; background: #303034; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

/* ===== Sidebar workspace navigation ===== */
@media (min-width: 681px) {
  body { padding-left: 146px; }
  .mode-tabs { position: fixed; z-index: 120; inset: 0 auto 0 0; width: 128px; margin: 0; padding: 16px 10px; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: #fafafa; }
  .mode-tab { flex: 0 0 auto; width: 100%; min-height: 38px; padding: 0 8px; display: flex; align-items: center; gap: 8px; border: 0; text-align: left; }
  .mode-tab.active { margin: 0; border: 0; background: #fff4e8; color: var(--brand-deep); box-shadow: inset 3px 0 0 var(--brand); }
}
.side-brand { display: flex; align-items: center; gap: 8px; margin: 0 2px 13px; padding: 0 2px 14px; border-bottom: 1px solid var(--border); }
.side-brand b { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; }.side-brand span { color: var(--ink); font-size: 12px; font-weight: 600; }
.nav-icon { display: grid; flex: 0 0 auto; width: 23px; height: 23px; place-items: center; border-radius: 6px; background: #ededee; color: var(--muted); font-size: 9px; font-weight: 600; }.mode-tab.active .nav-icon { background: var(--brand); color: #fff; }
body.dark .mode-tabs { border-color: var(--border); background: var(--bg-2); } body.dark .side-brand { border-color: var(--border); } body.dark .side-brand b { background: var(--ink); color: #111; } body.dark .side-brand span { color: var(--ink); } body.dark .nav-icon { background: var(--bg-3); color: var(--muted); } body.dark .mode-tab.active { background: var(--bg-3); color: var(--brand-2); box-shadow: inset 3px 0 0 var(--brand); } body.dark .mode-tab.active .nav-icon { background: var(--brand); color: #fff; }
@media (max-width: 680px) { .side-brand { display:none; } .mode-tabs { display:flex; flex-direction:row; } .mode-tab { flex:1; justify-content:center; text-align:center; } .nav-icon { display:none; } }

/* ===== Complete component color audit ===== */
body.dark .toggle input:checked + .toggle-track,
body.dark .toggle-row.t-green .toggle input:checked + .toggle-track,
body.dark .toggle-row.t-purple .toggle input:checked + .toggle-track,
body.dark .toggle-row.t-red .toggle input:checked + .toggle-track,
body.dark .toggle-row.t-orange .toggle input:checked + .toggle-track {
  border-color: var(--brand) !important;
  background: var(--brand) !important;
  box-shadow: none !important;
}
body.dark .unit-select, body.dark .unit-select.unit-green,
body.dark .unit-select.unit-orange, body.dark .field select.unit-select {
  border-color: var(--border-2) !important;
  background-color: var(--bg-3) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}
body.dark #historyCard .stat-item::before,
body.dark #historyCard .stat-item::after { display: none !important; }
body.dark #historyCard .stat-item .stat-num { color: var(--ink) !important; }
body.dark #historyCard .stat-item.accent .stat-num { color: var(--brand-2) !important; }
body.dark .cust-tag, body.dark .cust-tag.c0, body.dark .cust-tag.c1,
body.dark .cust-tag.c2, body.dark .cust-tag.c3,
body.dark .cust-tag.c4, body.dark .cust-tag.c5 {
  border: 1px solid var(--border-2) !important;
  background: var(--bg-3) !important;
  color: var(--muted) !important;
}
body.dark .cb-check { border-color: var(--border-2) !important; background: var(--bg-3) !important; accent-color: var(--brand); }
body.dark .cb-check:checked { border-color: var(--brand) !important; background: var(--brand) !important; }
body.dark .history-table .action-btn,
body.dark .history-table .action-btn.exp {
  border-color: var(--border-2) !important;
  background: var(--bg-3) !important;
  color: var(--muted) !important;
}
body.dark .history-table .action-btn:hover,
body.dark .history-table .action-btn.exp:hover {
  border-color: var(--brand) !important;
  background: var(--bg-3) !important;
  color: var(--brand-2) !important;
}
body.dark .history-table .action-btn.del {
  border-color: #5f2525 !important;
  background: var(--bg-3) !important;
  color: #f87171 !important;
}
body.dark .foot-update, body.dark .footer { border-color: var(--border); color: var(--muted-3); }
body.dark .auto-tag, body.dark .auto-tag[data-mode="auto"],
body.dark .auto-tag[data-mode="manual"] {
  border-color: var(--border-2) !important;
  background: var(--bg-3) !important;
  color: var(--muted) !important;
}
body.dark .cost-table .cat-header.cat-material,
body.dark .cost-table .cat-header.cat-print,
body.dark .cost-table .cat-header.cat-process,
body.dark .cost-table .cat-header.cat-other,
body.dark .cost-table .cat-header.cat-outsource {
  border-color: var(--border) !important;
  background: var(--bg-3) !important;
  color: var(--muted) !important;
}
body.dark .cost-chain .cc-val.accent,
body.dark .cost-table .total-row .total-val,
body.dark .formula-detail .fsum.total .flabel,
body.dark .formula-detail .fsum.total .fval { color: var(--brand-2) !important; }

/* ===== Final navigation: separate desktop rail and mobile tabs ===== */
.desktop-nav { display: none; }
.mobile-nav { display: none; }
@media (min-width: 421px) {
  body { padding-left: 76px; }
  .desktop-nav {
    position: fixed;
    z-index: 120;
    inset: 0 auto 0 0;
    display: flex;
    width: 58px;
    padding: 16px 9px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border);
    background: #fafafa;
  }
  .desktop-brand { display: grid; width: 32px; height: 32px; margin-bottom: 8px; place-items: center; border-radius: 9px; background: #18181b; color: #fff; font-size: 12px; font-weight: 700; }
  .desktop-nav-btn { display: grid; width: 36px; height: 36px; padding: 0; flex: 0 0 36px; place-items: center; border: 1px solid transparent; border-radius: 9px; text-decoration: none; font-size: 12px; font-weight: 600; line-height: 1; }
  .desktop-nav-btn.nav-color { border-color: #bbf7d0; background: #dcfce7; color: #15803d; }
  .desktop-nav-btn.nav-carton { border-color: #fed7aa; background: #ffedd5; color: #c2410c; }
  .desktop-nav-btn.nav-record { border-color: #bfdbfe; background: #dbeafe; color: #1d4ed8; }
  .desktop-nav-btn.nav-client { border-color: #e9d5ff; background: #f3e8ff; color: #7e22ce; }
  .desktop-nav-btn.nav-color:hover, .desktop-nav-btn.nav-color.active { background: #16a34a; color: #fff; }
  .desktop-nav-btn.nav-carton:hover, .desktop-nav-btn.nav-carton.active { background: #f97316; color: #fff; }
  .desktop-nav-btn.nav-record:hover, .desktop-nav-btn.nav-record.active { background: #3b82f6; color: #fff; }
  .desktop-nav-btn.nav-client:hover, .desktop-nav-btn.nav-client.active { background: #9333ea; color: #fff; }
}
@media (max-width: 420px) {
  .mobile-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: #f4f4f5; }
  .mobile-nav a { padding: 8px 4px; border-radius: 6px; color: var(--muted); text-align: center; text-decoration: none; font-size: 11px; }
  .mobile-nav a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
}
body.dark .desktop-nav { border-color: var(--border); background: var(--bg-2); }
body.dark .desktop-brand { background: var(--ink); color: #111; }
body.dark .desktop-nav-btn.nav-color { border-color: #14532d; background: #123522; color: #86efac; }
body.dark .desktop-nav-btn.nav-carton { border-color: #7c2d12; background: #3b2617; color: #fdba74; }
body.dark .desktop-nav-btn.nav-record { border-color: #1e3a8a; background: #172b4d; color: #93c5fd; }
body.dark .desktop-nav-btn.nav-client { border-color: #581c87; background: #2E1A47; color: #d8b4fe; }
body.dark .desktop-nav-btn.nav-color:hover, body.dark .desktop-nav-btn.nav-color.active { background: #16a34a; color: #fff; }
body.dark .desktop-nav-btn.nav-carton:hover, body.dark .desktop-nav-btn.nav-carton.active { background: #ea580c; color: #fff; }
body.dark .desktop-nav-btn.nav-record:hover, body.dark .desktop-nav-btn.nav-record.active { background: #2563eb; color: #fff; }
body.dark .desktop-nav-btn.nav-client:hover, body.dark .desktop-nav-btn.nav-client.active { background: #9333ea; color: #fff; }
body.dark .mobile-nav { border-color: var(--border); background: var(--bg-2); }
body.dark .mobile-nav a.active { background: var(--bg-3); color: var(--ink); }

@media (min-width: 421px) {
  .desktop-nav-tools { display: flex; margin-top: auto; flex-direction: column; gap: 6px; }
  .desktop-nav-tools button { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--border-2); border-radius: 9px; background: #fff; color: var(--muted); box-shadow: none; cursor: pointer; font-family: var(--ui-font); font-size: 12px; line-height: 1; }
  .desktop-nav-tools button:hover { border-color: #a1a1aa; background: #f4f4f5; color: var(--ink); }
  .desktop-nav-tools .nav-tool-settings::before { content: "⚙"; font-family: "Segoe UI Symbol", "Microsoft YaHei UI", sans-serif; font-size: 16px; line-height: 1; }
  .fab-group { display: none !important; }
  .mobile-footer-action { display: none !important; }
}
body.dark .desktop-nav-tools button { border-color: var(--border-2); background: var(--bg-3); color: var(--muted); }
body.dark .desktop-nav-tools button:hover { border-color: #52525b; background: #27272a; color: var(--ink); }

/* ===== 输入校验标红 =====
   markInvalid() 加的就是这个类。瓦楞页自包含（不引 common.js 的样式注入），
   以前这里压根没有 .field-error 的样式 —— 拦下了、标红了，但屏幕上什么也看不见。
   用 inset 阴影而不是 outline：步进器容器是 overflow:hidden，outline 画在盒子外侧，
   上下两条边会被裁掉，只剩左右两道红边看着像渲染 bug。 */
/* 选择器必须比「已填写=绿框」的 .field input.input-ok 更靠后 ——
   那条规则写了 box-shadow:none!important，只写 .field-error 会被它压掉（标红看不见）。 */
body .field input.field-error,
body .stepper input.field-error,
body .field select.field-error,
body input.field-error {
  box-shadow: inset 0 0 0 2px #DC2626 !important;
  background: #FEF2F2 !important;
  border-color: #DC2626 !important;
  border-radius: 6px;
}
body.dark .field input.field-error,
body.dark .stepper input.field-error,
body.dark .field select.field-error,
body.dark input.field-error {
  box-shadow: inset 0 0 0 2px #F87171 !important;
  background: rgba(220, 38, 38, .24) !important;
  border-color: #F87171 !important;
}
