/* 工艺软件系统 · 复刻「东庚数据库」蓝白主题 */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root{
  --blue:#1a73e8; --blue-dark:#1967d2; --blue-bg:#e8f0fe;
  --line:#e6e8eb; --line-soft:#f1f3f4;
  --text:#202124; --muted:#5f6368; --faint:#9aa0a6;
  --bg:#fff; --panel:#fff;
  --ok:#188038; --ok-soft:#e6f4ea; --warn:#b06000; --danger:#c5221f; --danger-soft:#fce8e6;
  /* 兼容旧类名的别名 */
  --ink:#202124; --accent:#1a73e8; --accent-2:#1a73e8; --accent-soft:#e8f0fe;
  --radius:10px; --shadow:0 1px 2px rgba(0,0,0,.04),0 2px 10px rgba(0,0,0,.05);
}
body{
  font-family:-apple-system,"Segoe UI","Microsoft YaHei",Roboto,sans-serif;
  color:var(--text); background:#fff; height:100vh; display:flex; flex-direction:column;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--blue); text-decoration:none;} a:hover{text-decoration:underline;}
.ic{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}

/* ---------- 顶栏 ---------- */
.topbar{
  height:56px; flex-shrink:0; display:flex; align-items:center; justify-content:space-between;
  padding:0 20px; border-bottom:1px solid var(--line); box-shadow:0 1px 2px rgba(0,0,0,.03); background:#fff;
}
.brand{display:flex; align-items:center; gap:10px; font-size:18px; font-weight:600; color:var(--text);}
.brand .ic{color:var(--blue); width:24px; height:24px;}
.brand .mk{width:8px;height:20px;background:var(--blue);border-radius:2px;}
.brand small{font-weight:400; color:var(--faint); font-size:12px; letter-spacing:1px; margin-left:2px;}
/* 侧栏收起按钮（在"工艺软件包"标题行右侧） */
.side-toggle{width:26px; height:26px; border:none; background:transparent; color:var(--muted); cursor:pointer; border-radius:6px; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.side-toggle:hover{background:var(--line-soft); color:var(--text);}
.side-toggle svg{width:18px; height:18px; transition:transform .16s ease;}
.layout.collapsed .side-toggle svg{transform:rotate(180deg);}
/* 侧栏收起为只剩图标的窄条 */
.sidebar{transition:width .16s ease, padding .16s ease;}
.layout.collapsed .sidebar{width:58px !important; min-width:58px; padding:14px 7px;}
.layout.collapsed .sidebar-title{justify-content:center; margin:0 0 8px;}
.layout.collapsed .sidebar-title .st-label,.layout.collapsed .sidebar-title .cnt{display:none;}
.layout.collapsed .cat-head{display:none;}
.layout.collapsed .trow .label,.layout.collapsed .trow .via{display:none;}
.layout.collapsed .trow{justify-content:center; padding:10px 0; gap:0;}
.layout.collapsed .toollist{gap:4px;}
.layout.collapsed .sidebar-empty{display:none;}
.breadcrumb .ficon{width:18px; height:18px; flex-shrink:0;}
.topbar .right{display:flex; align-items:center; gap:14px;}
.lnk{display:flex; align-items:center; gap:6px; background:#fff; border:1px solid var(--line); border-radius:10px;
  padding:6px 12px; font-size:13px; cursor:pointer; color:var(--text);}
.lnk:hover{background:#f8f9fa; text-decoration:none;}
.lnk .ic{width:16px;height:16px;}
.role-badge{background:var(--blue-bg); color:var(--blue-dark); padding:5px 12px; border-radius:14px; font-size:13px; font-weight:500; white-space:nowrap;}
.who{display:flex; align-items:center; gap:10px; position:relative; cursor:pointer;}
.who .avatar,.avatar{
  width:34px;height:34px;border-radius:50%; background:var(--blue-bg); color:var(--blue-dark);
  display:flex; align-items:center; justify-content:center; font-size:15px; font-weight:600; flex-shrink:0;
}
.who .meta{line-height:1.25;}
.who .meta b{color:var(--text); font-weight:600; font-size:13px;}
.who .meta span{display:block; color:var(--muted); font-size:11.5px;}
/* 用户下拉菜单 */
.user-menu{position:absolute; top:46px; right:0; background:#fff; border:1px solid var(--line);
  border-radius:10px; box-shadow:0 6px 24px rgba(0,0,0,.12); padding:6px; min-width:200px; display:none; z-index:40;}
.user-menu.open{display:block;}
.user-menu .hd{padding:8px 12px; font-size:12px; color:var(--faint); border-bottom:1px solid var(--line-soft); margin-bottom:4px;}
.user-menu .hd b{display:block; color:var(--text); font-size:14px; font-weight:600; margin-bottom:2px;}
.user-menu .item{padding:9px 12px; border-radius:8px; cursor:pointer; font-size:13.5px;}
.user-menu .item:hover{background:var(--line-soft);}
.user-menu .item.danger{color:var(--danger);}
.user-menu .item.danger:hover{background:var(--danger-soft);}

/* ---------- 两栏布局 ---------- */
.layout{flex:1; display:flex; overflow:hidden;}
.sidebar{width:290px; flex-shrink:0; border-right:1px solid var(--line); padding:16px 12px; overflow:auto; display:flex; flex-direction:column;}
.sidebar-title{font-size:13px; color:var(--muted); margin:2px 6px 12px; display:flex; align-items:center; gap:6px;}
.sidebar-title .cnt{color:var(--faint); font-weight:400; margin-left:auto;}
.cat-head{font-size:11px; font-weight:700; color:var(--faint); letter-spacing:.6px; margin:14px 8px 6px;}
.cat-head:first-of-type{margin-top:2px;}
.toollist{display:flex; flex-direction:column; gap:2px;}
.trow{display:flex; align-items:center; gap:9px; padding:9px 10px; border-radius:9px; cursor:pointer; font-size:14px; position:relative;}
.trow:hover{background:var(--line-soft);}
.trow.selected{background:var(--blue-bg); color:var(--blue-dark); font-weight:500;}
.trow .ficon{width:20px; height:20px; flex-shrink:0; color:var(--muted); stroke-width:1.7;}
.trow.selected .ficon{color:var(--blue-dark);}
.trow .label{flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.trow .via{font-size:10.5px; padding:1px 7px; border-radius:10px; flex-shrink:0; font-weight:600;}
.via.user{background:var(--blue-bg); color:var(--blue-dark);}
.via.dept{background:var(--ok-soft); color:var(--ok);}
.via.admin{background:#f3e8fd; color:#8430c7;}
.sidebar-empty{color:var(--faint); font-size:13px; padding:20px 10px; line-height:1.7;}

/* ---------- 个人计算历史 ---------- */
.sidebar{overflow:hidden;}
#list{flex:1; min-height:0; overflow:auto; scrollbar-gutter:stable;}
.sidebar-footer{flex-shrink:0; margin-top:12px; padding-top:10px; border-top:1px solid var(--line-soft);}
.history-trigger{width:100%; min-height:42px; display:flex; align-items:center; gap:9px; padding:9px 10px;
  border:1px solid transparent; border-radius:9px; background:#fff; color:var(--muted); font:500 14px/1.2 inherit; cursor:pointer; text-align:left;
  transition:background .16s ease,border-color .16s ease,color .16s ease;}
.history-trigger:hover{background:var(--line-soft); color:var(--text);}
.history-trigger:focus-visible,.history-close:focus-visible,.history-filter:focus-visible,.history-item-main:focus-visible,
.history-delete:focus-visible,.history-more:focus-visible,.history-error button:focus-visible{outline:3px solid rgba(26,115,232,.24); outline-offset:1px;}
.history-trigger svg{width:20px; height:20px; flex-shrink:0; color:var(--blue-dark);}
.history-trigger-label{flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.history-count{min-width:21px; height:20px; padding:0 6px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:10px; background:var(--blue-bg); color:var(--blue-dark); font-size:10.5px; font-weight:700; font-variant-numeric:tabular-nums;}
.layout.collapsed .sidebar-footer{margin-top:8px; padding-top:8px;}
.layout.collapsed .history-trigger{justify-content:center; padding:9px 0;}
.layout.collapsed .history-trigger-label,.layout.collapsed .history-count{display:none;}

.history-scrim{position:fixed; inset:56px 0 0; z-index:118; background:rgba(32,33,36,.26);}
.history-drawer{position:fixed; z-index:120; top:56px; bottom:0; left:0; width:min(380px,calc(100vw - 28px));
  display:flex; flex-direction:column; background:#fff; border-right:1px solid var(--line); box-shadow:14px 0 34px rgba(32,33,36,.14);
  transform:translateX(-102%); visibility:hidden; transition:transform .2s ease,visibility .2s step-end;}
.history-drawer.open{transform:translateX(0); visibility:visible; transition:transform .2s ease,visibility 0s;}
.history-head{display:flex; align-items:center; justify-content:space-between; gap:16px; padding:19px 18px 14px; border-bottom:1px solid var(--line-soft);}
.history-eyebrow{margin-bottom:3px; color:var(--faint); font-size:10.5px; font-weight:700; letter-spacing:.08em;}
.history-head h2{font-size:18px; line-height:1.3; font-weight:650;}
.history-close{width:36px; height:36px; flex-shrink:0; display:flex; align-items:center; justify-content:center; border:0; border-radius:9px;
  background:#fff; color:var(--muted); cursor:pointer;}
.history-close:hover{background:var(--line-soft); color:var(--text);}
.history-close svg{width:20px; height:20px;}
.history-filters{display:flex; gap:6px; padding:11px 18px; border-bottom:1px solid var(--line-soft);}
.history-filter{min-height:32px; padding:6px 11px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--muted);
  font:500 12px/1.2 inherit; cursor:pointer;}
.history-filter:hover:not(:disabled){border-color:#c8d8ef; color:var(--blue-dark);}
.history-filter.active{border-color:#c7dafb; background:var(--blue-bg); color:var(--blue-dark);}
.history-filter:disabled{opacity:.45; cursor:not-allowed;}
.history-body{flex:1; min-height:0; overflow:auto; padding:10px 12px 16px;}
.history-list{display:flex; flex-direction:column; gap:7px;}
.history-item{display:grid; grid-template-columns:minmax(0,1fr) 40px; align-items:stretch; border:1px solid var(--line); border-radius:10px; background:#fff;
  transition:border-color .16s ease,background .16s ease; overflow:hidden;}
.history-item:hover{border-color:#ccd8e8; background:#fbfcfe;}
.history-item-main{min-width:0; padding:11px 10px 11px 12px; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; font:inherit;}
.history-item-meta{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:7px;}
.history-tool{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:11.5px; font-weight:600;}
.history-item time{flex-shrink:0; color:var(--faint); font-size:10.5px; font-variant-numeric:tabular-nums;}
.history-result{display:flex; align-items:baseline; justify-content:space-between; gap:10px;}
.history-result span{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); font-size:13px;}
.history-result strong{flex-shrink:0; max-width:58%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--blue-dark); font-size:13.5px;
  font-variant-numeric:tabular-nums;}
.history-detail{margin-top:5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--faint); font-size:10.5px;}
.history-delete{align-self:center; width:36px; height:36px; display:flex; align-items:center; justify-content:center; margin-right:4px;
  border:0; border-radius:8px; background:transparent; color:var(--faint); cursor:pointer;}
.history-delete:hover{background:var(--danger-soft); color:var(--danger);}
.history-delete svg{width:18px; height:18px;}
.history-empty,.history-error{min-height:230px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:28px;
  color:var(--faint); text-align:center;}
.history-empty svg{width:34px; height:34px; margin-bottom:3px; color:#a9bedc;}
.history-empty b,.history-error b{color:var(--muted); font-size:13.5px;}
.history-empty span,.history-error span{max-width:240px; font-size:11.5px; line-height:1.6; text-wrap:pretty;}
.history-error button{margin-top:5px; padding:7px 12px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--blue-dark); cursor:pointer;}
.history-skeleton{height:86px; margin-bottom:7px; padding:13px 12px; border:1px solid var(--line-soft); border-radius:10px; overflow:hidden;}
.history-skeleton span{display:block; height:9px; margin-bottom:9px; border-radius:5px; background:linear-gradient(90deg,#f1f3f4 25%,#f8f9fa 50%,#f1f3f4 75%);
  background-size:200% 100%; animation:history-shimmer 1.1s linear infinite;}
.history-skeleton span:nth-child(1){width:54%;}.history-skeleton span:nth-child(2){width:82%;}.history-skeleton span:nth-child(3){width:38%;}
@keyframes history-shimmer{to{background-position:-200% 0;}}
.history-foot{flex-shrink:0; padding:10px 18px 14px; border-top:1px solid var(--line-soft); background:#fff;}
.history-more{width:100%; min-height:38px; border:1px solid var(--line); border-radius:9px; background:#fff; color:var(--blue-dark); font:500 12.5px/1 inherit; cursor:pointer;}
.history-more:hover:not(:disabled){background:var(--blue-bg); border-color:#c7dafb;}
.history-more:disabled{opacity:.65; cursor:default;}
.history-confirm .bd p{color:var(--muted); font-size:13px; line-height:1.65; text-wrap:pretty;}

/* ---------- 右侧内容 / 内嵌工具 ---------- */
.content{flex:1; display:flex; flex-direction:column; overflow:hidden; position:relative;}
.content-head{height:52px; flex-shrink:0; display:flex; align-items:center; gap:12px; padding:0 20px; border-bottom:1px solid var(--line-soft);}
.breadcrumb{flex:1; font-size:15px; font-weight:500; color:var(--text); display:flex; align-items:center; gap:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.breadcrumb .ic{width:18px;height:18px;color:var(--blue); flex-shrink:0;}
.breadcrumb .desc{font-size:12.5px; color:var(--faint); font-weight:400;}
.chead-tools{display:flex; align-items:center; gap:8px; flex-shrink:0;}
.chead-tools .btn{padding:6px 12px; font-size:12.5px;}
.frame{flex:1; border:none; width:100%; background:#fff;}
.frame-empty{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; color:var(--faint); background:#fbfcfd;}
.frame-empty .big{width:56px;height:56px;color:#c7ccd1;}
.frame-empty b{color:var(--muted); font-size:16px; font-weight:600;}
.frame-empty span{font-size:13px;}

/* ---------- 通用按钮 / 表单 ---------- */
.btn{display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:500; padding:8px 14px;
  border-radius:9px; border:1px solid var(--line); background:#fff; color:var(--text); cursor:pointer; transition:.12s;}
.btn:hover{background:#f8f9fa;}
.btn.primary{background:var(--blue); border-color:var(--blue); color:#fff;}
.btn.primary:hover{background:var(--blue-dark);}
.btn.sm{padding:5px 11px; font-size:12.5px; border-radius:8px;}
.btn.danger{color:var(--danger); border-color:#f3c9c6;}
.btn.danger:hover{background:var(--danger-soft);}
input,select{font-family:inherit; font-size:13px; color:var(--text); background:#fff;
  border:1px solid var(--line); border-radius:8px; padding:8px 11px; outline:none; width:100%;}
input:focus,select:focus{border-color:var(--blue); box-shadow:0 1px 4px rgba(26,115,232,.12);}
label.fld{display:block; font-size:12px; color:var(--muted); margin:0 0 5px; font-weight:500;}

/* ---------- 面板 / 表格（后台用） ---------- */
.wrap{max-width:1180px; margin:0 auto; padding:22px 22px 60px; width:100%; overflow-y:auto;}
.page-head{display:flex; align-items:baseline; justify-content:space-between; margin-bottom:16px;}
.page-head h1{font-size:19px; font-weight:600;}
.panel{background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow);}
.panel .hd{padding:13px 18px; border-bottom:1px solid var(--line-soft); font-weight:600; font-size:14px; display:flex; align-items:center; justify-content:space-between;}
.panel .bd{padding:16px 18px;}
table.tbl{width:100%; border-collapse:collapse; font-size:13px;}
table.tbl th{text-align:left; color:var(--muted); font-weight:500; font-size:12px; padding:9px 12px; border-bottom:1px solid var(--line);}
table.tbl td{padding:9px 12px; border-bottom:1px solid var(--line-soft); vertical-align:middle;}
table.tbl tr:hover td{background:#f8fafd;}
.pill{font-size:11px; font-weight:600; padding:2px 9px; border-radius:12px;}
.pill.on{background:var(--ok-soft); color:var(--ok);}
.pill.off{background:#f1f3f4; color:var(--faint);}
.tag{font-size:11px; padding:2px 8px; border-radius:12px; font-weight:600;}
.tag.user{background:var(--blue-bg); color:var(--blue-dark);}
.tag.dept{background:var(--ok-soft); color:var(--ok);}
.tag.admin{background:#f3e8fd; color:#8430c7;}

/* ---------- 提示 / 模态 ---------- */
.toast{position:fixed; right:20px; bottom:20px; z-index:200; display:flex; flex-direction:column; gap:8px;}
.toast .msg{background:#2b2b2b; color:#fff; padding:10px 16px; border-radius:9px; box-shadow:0 6px 22px rgba(0,0,0,.24); font-size:13px;}
.toast .msg.ok{background:#188038;} .toast .msg.err{background:#c5221f;}
.mask{position:fixed; inset:0; background:rgba(32,33,36,.42); display:flex; align-items:center; justify-content:center; z-index:150;}
.modal{background:#fff; border-radius:14px; width:min(460px,92vw); box-shadow:0 20px 60px rgba(0,0,0,.28); overflow:hidden;}
.modal .hd{padding:15px 20px; font-weight:600; font-size:15px; border-bottom:1px solid var(--line-soft);}
.modal .bd{padding:18px 20px; display:flex; flex-direction:column; gap:13px;}
.modal .ft{padding:14px 20px; background:#f8f9fa; display:flex; justify-content:flex-end; gap:10px;}

/* ---------- 登录页 ---------- */
.login-wrap{flex:1; display:flex; align-items:center; justify-content:center; background:#f6f8fc;}
.login-card{width:min(380px,92vw); background:#fff; border:1px solid var(--line); border-radius:16px;
  box-shadow:0 12px 40px rgba(26,115,232,.10); padding:30px 30px 26px; display:flex; flex-direction:column;}
.login-brand{display:flex; align-items:center; gap:10px; font-size:21px; font-weight:600; justify-content:center;}
.login-brand .ic{color:var(--blue); width:28px; height:28px;}
.login-sub{color:var(--muted); font-size:13px; text-align:center; margin:10px 0 22px;}
.login-card input{margin-bottom:13px; padding:11px 13px;}
.login-btn{background:var(--blue); color:#fff; border:none; border-radius:9px; padding:12px; font-size:15px; font-weight:500; cursor:pointer; margin-top:4px;}
.login-btn:hover{background:var(--blue-dark);}
.login-btn:disabled{opacity:.7; cursor:default;}
.login-err{color:var(--danger); font-size:12.5px; text-align:center; margin-top:12px; min-height:16px;}
.login-hint{color:var(--faint); font-size:11.5px; text-align:center; margin-top:16px; line-height:1.7;}

/* ============================================================
   工具视图共享样式（所有工艺软件包模块统一用这套类，保证观感一致）
   ============================================================ */
.twrap{display:flex; flex-direction:column; height:100%; overflow:hidden;}
.tbar{display:flex; align-items:center; gap:8px; padding:9px 16px; border-bottom:1px solid var(--line-soft); flex-shrink:0; background:#fff;}
.tbar .sp{flex:1;}
.tbody{flex:1; display:flex; overflow:hidden; min-height:0;}
.tin{width:400px; flex-shrink:0; overflow:auto; padding:14px 16px; border-right:1px solid var(--line);}
.tin.wide{width:460px;}
.tout{flex:1; overflow:auto; padding:16px 20px; background:#fbfcfe; min-width:0;}
.tout.full{padding:16px 20px;}

/* 输入区 */
.tcard{background:#fff; border:1px solid var(--line); border-radius:8px; padding:11px 13px 8px; margin-bottom:10px;}
.tsec{display:flex; align-items:center; gap:8px; font-size:13px; font-weight:600; color:var(--ink); margin:6px 0 7px;}
.tsec:first-child{margin-top:0;}
.tsec::before{content:""; width:3px; height:15px; background:var(--blue); border-radius:2px; flex-shrink:0;}
.tfrow{display:flex; align-items:center; gap:8px; margin-bottom:7px;}
.tfrow label{font-size:12.5px; color:var(--muted); width:118px; text-align:right; flex-shrink:0;}
.tfrow input,.tfrow select{flex:1; min-width:0; padding:5px 9px;}
.tfrow .u{font-size:11px; color:var(--faint); flex-shrink:0; width:36px;}
.tgrid{display:grid; grid-template-columns:auto 1fr; gap:7px 10px; align-items:center;}
.tgrid.two{grid-template-columns:auto 1fr auto 1fr;}
.tgrid label{font-size:12.5px; color:var(--muted); text-align:right;}
.tgrid input,.tgrid select{padding:5px 9px; min-width:0;}
/* 值单元格里 输入框 + 单位 同行（单位不再换行到下面） */
.tgrid > span{display:flex; align-items:center; gap:6px; min-width:0;}
.tgrid > span input,.tgrid > span select{flex:1; width:auto; min-width:0; padding:5px 9px;}
.tgrid > span .u{flex-shrink:0; width:auto;}
.u{font-size:11.5px; color:var(--faint);}
/* 物料检索块：标签左对齐 */
.matbox .tfrow label, .matbox .tgrid label{text-align:left;}
.tchk{display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--text); margin-bottom:6px;}
.tchk input{width:auto; flex:none;}

/* 输入表格（如物流数据 N1/N2） */
.titbl{width:100%; border-collapse:collapse; margin-top:6px;}
.titbl th{background:#eef2f7; color:var(--muted); font-size:11px; font-weight:600; padding:5px 6px; text-align:center; border-bottom:1px solid var(--line);}
.titbl td{padding:3px 5px; border-bottom:1px solid var(--line-soft); font-size:12.5px; text-align:center;}
.titbl td.lbl{text-align:left; color:var(--text); white-space:nowrap;}
.titbl td.u{color:var(--faint); font-size:11px;}
.titbl td input{width:100%; text-align:right; padding:3px 6px;}
.titbl td select{width:100%; padding:3px 4px;}
.titbl .dn{font-weight:600; background:#f1f5f9; border-radius:4px; padding:3px 6px; display:inline-block; width:100%;}

/* 结果区 */
.rsec{display:flex; align-items:center; gap:8px; font-size:13.5px; font-weight:600; color:var(--ink); margin:16px 0 7px;}
.rsec:first-child{margin-top:0;}
.rsec::before{content:""; width:4px; height:16px; background:var(--blue); border-radius:2px; flex-shrink:0;}
.rsec.ok::before{background:var(--ok);}
.rsec.warn::before{background:var(--danger);}
.rsec .en{font-size:11px; color:var(--faint); font-weight:400;}
.rtbl{width:100%; border-collapse:collapse; font-size:13px; margin-bottom:4px;}
.rtbl th{background:#334155; color:#fff; font-size:12px; font-weight:600; padding:6px 8px; text-align:left;}
.rtbl th.c{text-align:center;} .rtbl th:first-child{text-align:left;}
.rtbl td{padding:5px 8px; font-size:13px; border-bottom:1px solid var(--line-soft);}
.rtbl tr:nth-child(even) td{background:#f4f7fa;}
.rtbl td.val{text-align:right; font-variant-numeric:tabular-nums;}
.rtbl td.c{text-align:center;}
.rtbl td.unit,.rtbl td.note{color:var(--faint); font-size:11px;}
.rtbl td.ok{color:var(--ok); font-weight:600;}
.rtbl td.warn{color:var(--danger); font-weight:600;}
.rtbl.sum tr:last-child td{font-weight:700; background:#eaf2fb; color:var(--blue-dark); border-top:2px solid var(--blue);}
.rmoney{font-variant-numeric:tabular-nums;}
.rtotal{font-size:15px; font-weight:700; color:var(--blue-dark);}
.tplace{color:var(--faint); text-align:center; padding:56px 20px;}
.tplace .ic{font-size:34px; opacity:.5; margin-bottom:12px;}
.tnote{font-size:12.5px; color:var(--muted); padding:4px 2px;}
.talert{border-radius:7px; padding:9px 12px; font-size:12.5px; margin-bottom:12px;}
.talert.ok{background:var(--ok-soft); color:var(--ok);}
.talert.warn{background:var(--danger-soft); color:var(--danger); white-space:pre-line;}
.tdiag{background:#fff; border:1px solid var(--line); border-radius:8px; padding:10px; margin:8px 0 14px; overflow:auto;}
/* 工具内子标签（材料单价表/壁厚表等参照页） */
.tsub{display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:12px;}
.tsub .t{padding:7px 13px; font-size:12.5px; font-weight:600; color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px;}
.tsub .t.on{color:var(--blue); border-bottom-color:var(--blue);}

/* ---------- Mobile layout ---------- */
@media (max-width: 760px){
  html,body{width:100%; height:100dvh; overflow:hidden;}
  body{min-width:0;}

  .topbar{
    height:auto; min-height:54px; padding:8px 10px; gap:8px;
    align-items:center;
  }
  .brand{min-width:0; gap:7px; font-size:16px;}
  .brand .ic{width:21px; height:21px;}
  .brand small{display:none;}
  .topbar .right{gap:8px; min-width:0;}
  .lnk{padding:6px 9px; font-size:12px; border-radius:8px;}
  .lnk .ic{width:15px; height:15px;}
  .role-badge{display:none;}
  .who .avatar,.avatar{width:32px; height:32px; font-size:14px;}
  .user-menu{position:fixed; top:54px; right:10px; max-width:calc(100vw - 20px);}

  .layout{flex-direction:column; min-height:0; overflow:hidden;}
  .sidebar,
  .layout.collapsed .sidebar{
    width:100% !important; min-width:0; max-width:100%;
    max-height:33dvh; padding:9px 10px 8px; border-right:none; border-bottom:1px solid var(--line);
    overflow:hidden; display:block; flex-shrink:0;
  }
  .sidebar-title,
  .layout.collapsed .sidebar-title{
    justify-content:flex-start; margin:0 2px 7px; gap:6px;
  }
  .layout.collapsed .sidebar-title .st-label,
  .layout.collapsed .sidebar-title .cnt{display:inline;}
  .sidebar-title .cnt{margin-left:0;}
  .side-toggle{display:none;}
  #list{display:flex; gap:10px; overflow-x:auto; overflow-y:hidden; padding:0 0 4px; -webkit-overflow-scrolling:touch;}
  .cat-head,.layout.collapsed .cat-head{display:none;}
  .toollist,.layout.collapsed .toollist{
    display:flex; flex-direction:row; gap:8px; min-width:max-content;
  }
  .trow,.layout.collapsed .trow{
    min-width:148px; max-width:190px; justify-content:flex-start; gap:8px;
    padding:8px 9px; border:1px solid var(--line); border-radius:10px; background:#fff;
  }
  .trow.selected{border-color:#c7dafb;}
  .trow .label,.layout.collapsed .trow .label{
    display:block; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .trow .via,.layout.collapsed .trow .via{display:none;}
  .sidebar-empty{padding:8px 2px 12px;}
  .sidebar-footer{margin-top:6px; padding-top:6px;}
  .history-trigger,.layout.collapsed .history-trigger{width:auto; min-height:36px; justify-content:flex-start; padding:7px 10px; border-color:var(--line);}
  .layout.collapsed .history-trigger-label,.layout.collapsed .history-count{display:inline-flex;}
  .history-trigger-label{display:inline;}
  .history-drawer{top:54px; width:100%; border-right:0;}
  .history-scrim{inset:54px 0 0;}
  .history-head{padding:16px 14px 12px;}
  .history-filters{padding:10px 14px;}
  .history-filter{min-height:44px; flex:1;}
  .history-body{padding:9px 10px 14px;}
  .history-item{grid-template-columns:minmax(0,1fr) 48px;}
  .history-delete{width:44px; height:44px;}

  .content{min-height:0; flex:1;}
  .content-head{
    height:auto; min-height:47px; padding:7px 10px; gap:8px; flex-wrap:wrap;
  }
  .breadcrumb{font-size:14px; min-width:0; white-space:nowrap;}
  .breadcrumb .desc{display:none;}
  .chead-tools{
    width:100%; gap:7px; overflow-x:auto; padding-bottom:2px; -webkit-overflow-scrolling:touch;
  }
  .chead-tools:empty{display:none;}
  .chead-tools .btn{white-space:nowrap; flex-shrink:0;}
  #stage{overflow:auto !important; -webkit-overflow-scrolling:touch;}
  .frame-empty{min-height:320px; padding:28px 16px; text-align:center;}

  .twrap{height:auto; min-height:100%; overflow:visible;}
  .tbody{display:flex; flex-direction:column; overflow:visible; min-height:0;}
  .tin,.tin.wide{
    width:100%; padding:11px 12px; border-right:none; border-bottom:1px solid var(--line);
    overflow:visible; flex-shrink:0;
  }
  .tout,.tout.full{
    width:100%; min-height:0; padding:12px; overflow:auto;
  }
  .tbar{padding:8px 10px; overflow-x:auto;}
  .tcard{padding:10px 11px 8px; margin-bottom:9px;}
  .tfrow{align-items:flex-start; flex-wrap:wrap; gap:6px;}
  .tfrow label{width:100%; text-align:left;}
  .tfrow input,.tfrow select{min-width:0;}
  .tfrow .u{width:auto;}
  .tgrid,.tgrid.two{grid-template-columns:1fr; gap:5px;}
  .tgrid label{text-align:left;}
  .tgrid > span{width:100%;}
  .tsub{overflow-x:auto; -webkit-overflow-scrolling:touch;}
  .tsub .t{white-space:nowrap;}
  .rtbl,.titbl,.pm,table.tbl,.kw-table{min-width:620px;}
  .rtbl th,.rtbl td{padding:6px 7px;}
  .tplace{padding:36px 14px;}

  .wrap{max-width:none; height:calc(100dvh - 54px); padding:14px 10px 36px; overflow:auto;}
  .page-head{display:flex; flex-direction:column; align-items:flex-start; gap:8px;}
  .panel{border-radius:10px;}
  .panel .bd{padding:13px 12px; overflow-x:auto;}
  .tabs{overflow-x:auto; white-space:nowrap; -webkit-overflow-scrolling:touch;}
  .tab{padding:9px 12px;}
  .usr-bar{flex-wrap:wrap; align-items:stretch;}
  .usr-search{max-width:none; width:100%; flex-basis:100%;}
  .usr-count{margin-left:0;}
  .legend{gap:8px; padding:9px 10px;}
  .select-bar{flex-wrap:wrap; gap:8px;}
  .select-bar .sel-count{flex-basis:100%;}

  .toast{left:10px; right:10px; bottom:12px;}
  .toast .msg{width:100%; text-align:center;}
  .mask{align-items:flex-end; padding:10px;}
  .modal{width:100%; max-height:88dvh; border-radius:14px; display:flex; flex-direction:column;}
  .modal .bd{overflow:auto;}
  .modal .ft{flex-wrap:wrap;}
  .modal .ft .btn{flex:1; justify-content:center;}

  .login-wrap{padding:16px; align-items:center;}
  .login-card{width:100%; max-width:420px; padding:24px 18px 22px; border-radius:14px;}
  .login-brand{font-size:19px;}
  .login-sub{margin:8px 0 18px;}
  .login-btn{padding:12px;}
}

@media (prefers-reduced-motion:reduce){
  .history-drawer{transition:none;}
  .history-skeleton span{animation:none;}
}

@media (max-width: 420px){
  .topbar{padding:7px 8px;}
  .brand span{max-width:9em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
  .lnk{padding:6px 8px;}
  .sidebar,.layout.collapsed .sidebar{max-height:36dvh; padding-left:8px; padding-right:8px;}
  .trow,.layout.collapsed .trow{min-width:136px; max-width:168px;}
  .content-head{padding-left:8px; padding-right:8px;}
  .tin,.tin.wide,.tout,.tout.full{padding:10px 9px;}
  .rtbl,.titbl,.pm,table.tbl,.kw-table{min-width:560px;}
}
