/* ============================================================
   仓驭 · v8 权威终态样式层（v8.css）
   ------------------------------------------------------------
   定位：全站【最后加载】的唯一权威层，用于：
   1) 补齐 theme.css 未收口的遗留/实验变量，彻底归一配色；
   2) 统一且清晰的「选中态」（表格行/列表/菜单/单元格/勾选）；
   3) 统一弹窗尺寸（PC 宽弹窗、移动端才全屏抽屉），表单不挤；
   4) Excel 式自定义表格网格（.sheet / .sheet-cell / 公式栏）；
   5) 修正布局错乱、层级 z-index、控件尺寸与焦点环。
   只引用 tokens.css 设计令牌，不写死品牌色；深浅主题自适应。
   ============================================================ */

/* ---------- 0. 遗留/实验变量补漏收口（普通流畅模式下回归干净中性） ---------- */
body[data-perf="1"]{
  /* 旧表面/卡片别名补全 */
  --card:var(--color-surface);
  --bg-card-solid:var(--color-surface);
  --input-solid:var(--color-surface);
  --bg-mask:var(--color-mask);
  /* 历代「液态玻璃/拟物」实验变量统一为干净表面，消除残留反光/描边噪音 */
  --ng-base-card:var(--color-surface);
  --ng-base-panel:var(--color-surface);
  --ng-card-1:var(--color-surface);
  --ng-card-2:var(--color-surface);
  --ng-btn-1:var(--color-primary);
  --ng-btn-2:var(--color-primary-hover);
  --ng-btn-base:var(--color-primary);
  --ng-inner:var(--color-surface-hover);
  --ng-line-a:var(--color-border);
  --ng-line-b:var(--color-border-light);
  --ng-ring:var(--color-focus-ring);
  --ng-lo:var(--shadow-sm);
  --ng-hi:var(--color-surface);
  --ng-drop:var(--shadow-md);
  --ng-drop-2:var(--shadow-lg);
  --ng-pop-1:var(--color-surface);
  --ng-pop-2:var(--color-surface);
  --ng-pop-drop:var(--shadow-lg);
  --ng-sheen:transparent;
  --ng-tint-1:transparent;
  --ng-tint-2:transparent;
  --lg-bg:var(--color-surface);
  --lg-card:var(--color-surface);
  --lg-card-edge:var(--color-border);
  --lg-card-shadow:var(--shadow-md);
  --lg-shadow:var(--shadow-md);
  --lg-sheet-a:var(--color-surface);
  --lg-sheet-b:var(--color-surface);
  --lg-sheet-shadow:var(--shadow-lg);
  --lg-sheet-top:var(--color-border-light);
  --lg-head-line:var(--color-border-light);
  --lg-head-scroll:var(--color-border);
  --lg-ring-cool:var(--color-focus-ring);
  --lg-ring-mid:var(--color-focus-ring);
  --lg-ring-low:var(--color-focus-ring);
  --lg-ring-top:var(--color-focus-ring);
  --lg-toplight:transparent;
  --sheet-bg:var(--color-surface);
  --sheet-border:var(--color-border);
  --sheet-edge:var(--color-border);
  --sheet-inner:var(--color-border-light);
  --sheet-input:var(--color-surface);
  --sheet-shadow:var(--shadow-md);
  --sheet-sheen:transparent;
  --sheet-tint-a:transparent;
  --sheet-tint-b:transparent;
  --sheen-a:transparent; --sheen-b:transparent; --sheen-c:transparent;
  --sheen-arc:transparent; --sheen-dot:transparent; --sheen-op:0;
  --ring-strong:var(--color-selected-border);
  --ring-fade:var(--color-border-light);
  --ring-dark:var(--color-border);
}

/* ---------- 0.5 历史主色别名归一（不限性能模式，perf=0/1 都恒定石青；个性换肤 body[data-bg] 特异性更高仍可覆盖） ---------- */
:root,
body[data-perf="0"],
body[data-perf="1"]{
  --primary:var(--color-primary);
  --accent:var(--color-primary);
  --accent-2:var(--color-primary-hover);
  --blue:var(--color-primary);
  --zc:var(--color-primary);
  --brand-soft:var(--color-primary-bg);
  --brand-line:var(--color-selected-border);
  --link:var(--color-primary);
}

/* ---------- 1. 全局基底与文本选区 ---------- */
body[data-perf="1"] ::selection{ background:var(--color-highlight) !important; color:inherit; }
body[data-perf="1"] *,body[data-perf="1"] *::before,body[data-perf="1"] *::after{ -webkit-tap-highlight-color:transparent; }

/* ---------- 2. 统一选中态（清晰但不刺眼） ---------- */
/* 2.1 表格行选中：石青浅底 + 左侧指示条，压过历史 #tblView / v338 / v4 的 !important */
body[data-perf="1"] table tbody tr.row-sel td,
body[data-perf="1"] table tbody tr.selected td,
body[data-perf="1"] .list-row.selected,
body[data-perf="1"] .row.selected{
  background:var(--color-selected-strong) !important;
  box-shadow:inset 3px 0 0 var(--color-selected-border) !important;
  color:var(--color-text-primary);
}
body[data-perf="1"] #tblView tr.row-sel td,
body[data-perf="1"] #tblView tr.selected td{
  background:var(--color-selected-strong) !important; /* 覆盖 style.css 硬编码 rgba(13,148,136) */
  box-shadow:inset 3px 0 0 var(--color-selected-border) !important;
}
/* 选中行再悬停略加深 */
body[data-perf="1"] table tbody tr.row-sel:hover td,
body[data-perf="1"] table tbody tr.selected:hover td{ background:var(--color-primary-bg-strong) !important; }
/* 普通悬停：统一更轻的中性/主色浅底，且不把整行文字染成蓝色 */
body[data-perf="1"] table tbody tr:hover td{ background:var(--color-surface-hover); color:inherit; }
/* 2.2 侧栏导航选中 */
body[data-perf="1"] .nav-item.active{
  background:var(--color-primary-bg);
  color:var(--color-primary);
  box-shadow:inset 3px 0 0 var(--color-primary);
  font-weight:600;
}
/* 2.3 分段控件 / 下拉项 / 列表项 选中 */
body[data-perf="1"] .seg-item.active,
body[data-perf="1"] .seg .active,
body[data-perf="1"] .tab.active,
body[data-perf="1"] [aria-selected="true"],
body[data-perf="1"] .dropdown-item.active,
body[data-perf="1"] .menu-item.active,
body[data-perf="1"] .opt.active{
  background:var(--color-primary-bg);
  color:var(--color-primary);
  box-shadow:inset 2px 0 0 var(--color-primary);
}
/* 2.4 勾选/单选：主色描边与填充 */
body[data-perf="1"] input[type=checkbox]{
  appearance:none;-webkit-appearance:none;width:16px;height:16px;border:1.5px solid var(--color-border);
  border-radius:4px;background:var(--color-surface);display:inline-grid;place-content:center;cursor:pointer;transition:all .15s;flex:0 0 auto;
}
body[data-perf="1"] input[type=checkbox]::before{ content:"";width:9px;height:9px;clip-path:polygon(14% 44%,0 60%,45% 100%,100% 16%,86% 0,42% 72%);background:#fff;transform:scale(0);transition:transform .12s; }
body[data-perf="1"] input[type=checkbox]:checked{ background:var(--color-primary);border-color:var(--color-primary); }
body[data-perf="1"] input[type=checkbox]:checked::before{ transform:scale(1); }
body[data-perf="1"] input[type=checkbox]:indeterminate{ background:var(--color-primary);border-color:var(--color-primary); }
body[data-perf="1"] input[type=radio]{
  appearance:none;-webkit-appearance:none;width:16px;height:16px;border:1.5px solid var(--color-border);border-radius:50%;
  background:var(--color-surface);display:inline-grid;place-content:center;cursor:pointer;flex:0 0 auto;
}
body[data-perf="1"] input[type=radio]::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--color-primary);transform:scale(0);transition:transform .12s;}
body[data-perf="1"] input[type=radio]:checked{ border-color:var(--color-primary); }
body[data-perf="1"] input[type=radio]:checked::before{ transform:scale(1); }
body[data-perf="1"] input[type=checkbox]:focus-visible,
body[data-perf="1"] input[type=radio]:focus-visible{ outline:none;box-shadow:0 0 0 3px var(--color-focus-ring); }

/* ---------- 3. 弹窗 / 浮层尺寸（PC 宽、移动端才抽屉） ---------- */
body[data-perf="1"] .modal-mask,body[data-perf="1"] .pop-mask{
  position:fixed;inset:0;z-index:1200;display:none;align-items:center;justify-content:center;
  background:var(--color-mask);padding:20px;
}
body[data-perf="1"] .modal-mask.show,body[data-perf="1"] .pop-mask.show{display:flex;}
body[data-perf="1"] .modal{
  width:min(94vw,760px);max-width:94vw;max-height:90vh;margin:0;
  border-radius:var(--radius-lg);border:1px solid var(--color-border-light);
  box-shadow:var(--shadow-lg);background:var(--color-surface);
  display:flex;flex-direction:column;overflow:hidden;
}
body[data-perf="1"] .modal.wide,body[data-perf="1"] .modal.xl{ width:min(96vw,1120px); }
body[data-perf="1"] .modal.sheet-xl{ width:min(97vw,1280px); }
body[data-perf="1"] .pop-sheet{
  width:min(94vw,680px);max-width:94vw;max-height:88vh;margin:0;
  border-radius:var(--radius-lg);border:1px solid var(--color-border-light);
  box-shadow:var(--shadow-lg);background:var(--color-surface);
  display:flex;flex-direction:column;overflow:hidden;
}
body[data-perf="1"] .modal-head,body[data-perf="1"] .pop-head{
  display:flex;align-items:center;gap:10px;padding:16px 20px;border-bottom:1px solid var(--color-border-light);flex:0 0 auto;
}
body[data-perf="1"] .modal-head h3,body[data-perf="1"] .pop-head h3{margin:0;font-size:16px;font-weight:700;flex:1;min-width:0;}
body[data-perf="1"] .modal-body,body[data-perf="1"] .pop-body{ padding:18px 20px;overflow-y:auto;flex:1 1 auto;min-height:0; }
body[data-perf="1"] .modal-foot,body[data-perf="1"] .pop-foot{
  display:flex;justify-content:flex-end;gap:10px;padding:14px 20px;border-top:1px solid var(--color-border-light);flex:0 0 auto;flex-wrap:wrap;
}
/* 弹窗内表单：双列网格自动排布，窄屏回落单列，编辑框不再被挤 */
body[data-perf="1"] .modal-body .fld{ display:flex;flex-direction:column;gap:6px;margin-bottom:14px;min-width:0; }
body[data-perf="1"] .modal-body .fld>span{ font-size:13px;color:var(--color-text-secondary);font-weight:600; }
@media(min-width:721px){
  body[data-perf="1"] .modal-body .form-grid,
  body[data-perf="1"] .modal-body .grid-form{ display:grid;grid-template-columns:1fr 1fr;gap:0 16px; }
  body[data-perf="1"] .modal-body .form-grid .fld.full,
  body[data-perf="1"] .modal-body .grid-form .fld.full{ grid-column:1/-1; }
}
/* 抵消 v323 在 PC 上把弹窗变成底部抽屉的问题（仅 ≤720px 允许贴边全屏） */
@media(min-width:721px){
  body[data-perf="1"] .modal,body[data-perf="1"] .pop-sheet{ border-radius:var(--radius-lg) !important; }
}
@media(max-width:720px){
  body[data-perf="1"] .modal-mask,body[data-perf="1"] .pop-mask{padding:0;align-items:flex-end;}
  body[data-perf="1"] .modal,body[data-perf="1"] .pop-sheet{width:100%;max-width:100%;max-height:94vh;border-radius:18px 18px 0 0;}
}

/* ---------- 4. 控件尺寸 / 输入 / 按钮统一 ---------- */
body[data-perf="1"] input[type=text],body[data-perf="1"] input[type=number],body[data-perf="1"] input[type=date],
body[data-perf="1"] input[type=search],body[data-perf="1"] input[type=email],body[data-perf="1"] input[type=password],
body[data-perf="1"] input:not([type]),body[data-perf="1"] select,body[data-perf="1"] textarea{
  background:var(--color-surface);border:1px solid var(--color-border);border-radius:var(--radius-md);
  color:var(--color-text-primary);padding:8px 11px;font-size:14px;min-height:38px;width:100%;max-width:100%;
  transition:border-color .15s,box-shadow .15s;
}
body[data-perf="1"] textarea{min-height:auto;line-height:1.5;}
body[data-perf="1"] input:focus,body[data-perf="1"] select:focus,body[data-perf="1"] textarea:focus{
  outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px var(--color-focus-ring);
}
body[data-perf="1"] input::placeholder,body[data-perf="1"] textarea::placeholder{color:var(--color-text-muted);}
body[data-perf="1"] .btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:var(--radius-md);
  min-height:38px;padding:8px 15px;font-size:14px;font-weight:600;cursor:pointer;border:1px solid transparent;
  white-space:nowrap;transition:all .15s;
}
body[data-perf="1"] .btn-sm{min-height:32px;padding:5px 11px;font-size:13px;}
body[data-perf="1"] .btn-primary{background:var(--color-primary);color:var(--color-primary-text);}
body[data-perf="1"] .btn-primary:hover{background:var(--color-primary-hover);}
body[data-perf="1"] .btn-ghost{background:var(--color-surface);border-color:var(--color-border);color:var(--color-text-secondary);}
body[data-perf="1"] .btn-ghost:hover{background:var(--color-surface-hover);color:var(--color-primary);border-color:var(--color-selected-border);}
body[data-perf="1"] .btn:disabled{opacity:.5;cursor:not-allowed;}

/* ---------- 5. 工具栏 / 卡片 / 表格通用布局修正 ---------- */
body[data-perf="1"] .toolbar{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px;
}
body[data-perf="1"] .toolbar .spacer{flex:1 1 auto;}
body[data-perf="1"] .toolbar .search,body[data-perf="1"] .toolbar select{width:auto;min-width:160px;}
body[data-perf="1"] .card{
  background:var(--color-surface);border:1px solid var(--color-border-light);
  border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);
}
body[data-perf="1"] .table-wrap{
  background:var(--color-surface);border:1px solid var(--color-border-light);border-radius:var(--radius-lg);
  overflow:auto;box-shadow:var(--shadow-sm);
}
body[data-perf="1"] table{border-collapse:separate;border-spacing:0;width:100%;}
body[data-perf="1"] table thead th{
  position:sticky;top:0;z-index:2;background:var(--color-surface-hover);color:var(--color-text-secondary);
  font-size:13px;font-weight:600;text-align:left;padding:10px 12px;border-bottom:1px solid var(--color-border);white-space:nowrap;
}
body[data-perf="1"] table tbody td{padding:9px 12px;border-bottom:1px solid var(--color-border-light);vertical-align:middle;}
body[data-perf="1"] table tbody tr:last-child td{border-bottom:none;}
body[data-perf="1"] td.num,body[data-perf="1"] .cell-num,body[data-perf="1"] .td-num{font-variant-numeric:tabular-nums;text-align:right;}

/* ---------- 6. Excel 式自定义表格网格 ---------- */
.sheet-fxbar{
  display:flex;align-items:center;gap:8px;background:var(--color-surface);border:1px solid var(--color-border-light);
  border-radius:var(--radius-md);padding:6px 10px;margin-bottom:8px;position:sticky;top:0;z-index:5;
}
.sheet-addr{
  flex:0 0 auto;min-width:56px;text-align:center;font-weight:700;font-size:13px;color:var(--color-primary);
  background:var(--color-primary-bg);border-radius:var(--radius-sm);padding:4px 8px;font-variant-numeric:tabular-nums;
}
.sheet-fx{color:var(--color-text-muted);font-style:italic;font-weight:700;}
.sheet-fxbar input{flex:1 1 auto;min-width:0;border:none!important;background:transparent!important;box-shadow:none!important;min-height:32px!important;padding:4px 6px!important;}
.sheet-fxbar input:focus{box-shadow:none!important;}
.sheet-quick{flex:0 0 auto;color:var(--color-primary);font-size:13px;font-weight:700;font-variant-numeric:tabular-nums;}
.sheet-scroll{
  overflow:auto;max-height:calc(100vh - 230px);border:1px solid var(--color-border);border-radius:var(--radius-md);background:var(--color-surface);
}
table.sheet{border-collapse:separate;border-spacing:0;font-size:13px;}
table.sheet thead th{
  position:sticky;top:0;z-index:4;padding:0;background:var(--color-surface-3);border-right:1px solid var(--color-border);
  border-bottom:1px solid var(--color-border);font-weight:600;color:var(--color-text-secondary);height:30px;vertical-align:middle;
}
.sheet-corner{position:sticky;left:0;z-index:6;min-width:42px;width:42px;background:var(--color-surface-3)!important;}
.sheet-colh{min-width:118px;cursor:pointer;user-select:none;text-align:center!important;}
.sheet-colh .col-letter{display:inline-block;font-weight:800;color:var(--color-primary);margin-right:5px;font-variant-numeric:tabular-nums;}
.sheet-colh .col-name{color:var(--color-text-secondary);font-weight:600;}
.sheet-colh:hover{background:var(--color-surface-hover)!important;}
.sheet-rowh{
  position:sticky;left:0;z-index:3;background:var(--color-surface-3);color:var(--color-text-muted);text-align:center;
  width:42px;min-width:42px;font-size:12px;font-variant-numeric:tabular-nums;cursor:pointer;user-select:none;
  border-right:1px solid var(--color-border);border-bottom:1px solid var(--color-border-light);padding:0!important;
}
.sheet-rowh.rowh-active{background:var(--color-primary-bg)!important;color:var(--color-primary);font-weight:700;}
.sheet-cell{
  min-width:118px;height:32px;padding:0 8px!important;border-right:1px solid var(--color-border-light);
  border-bottom:1px solid var(--color-border-light);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  cursor:cell;user-select:none;vertical-align:middle;font-variant-numeric:tabular-nums;background:var(--color-surface);position:relative;
}
.sheet-cell.in-sel{background:var(--color-selected)!important;}
.sheet-cell.active{
  background:var(--color-primary-bg-strong)!important;
  box-shadow:inset 0 0 0 2px var(--color-primary)!important;z-index:1;font-weight:600;
}
.sheet-cell.is-formula{color:var(--color-primary);}
.sheet-cell.is-formula::before{content:"";position:absolute;left:0;top:0;width:0;height:0;border-top:5px solid var(--color-primary);border-right:5px solid transparent;opacity:.55;}
.sheet-cell.cell-err{color:var(--color-danger);font-style:italic;}
.sheet-cell.kw-hit{background:var(--color-highlight)!important;}
.sheet-cell.editing{padding:0!important;overflow:visible;box-shadow:inset 0 0 0 2px var(--color-primary)!important;background:var(--color-surface)!important;}
.sheet-editor{
  width:100%;height:100%;min-height:30px!important;border:none!important;border-radius:0!important;background:var(--color-surface)!important;
  padding:0 8px!important;font-size:13px;box-shadow:none!important;
}
.sheet-editor:focus{box-shadow:none!important;}
.sheet-imgtag{color:var(--color-secondary);font-size:12px;}
.sheet-status{
  margin-top:8px;font-size:12px;color:var(--color-text-secondary);display:flex;gap:14px;flex-wrap:wrap;
}
.sheet-status b{color:var(--color-primary);font-variant-numeric:tabular-nums;}

/* ---------- 7. 层级 z-index 归一（避免互相遮挡 / 顶乱） ---------- */
body[data-perf="1"] .user-menu{z-index:900;}
body[data-perf="1"] #icDock{z-index:850;}
body[data-perf="1"] .toast{z-index:1500;}
body[data-perf="1"] #globalLoader{z-index:1600;}
body[data-perf="1"] .emoji-panel,body[data-perf="1"] .pop-panel{z-index:1150;}

/* ---------- 8. 帮助文档排版 ---------- */
.help-doc{font-size:13.5px;line-height:1.7;color:var(--color-text-secondary);max-height:62vh;overflow:auto;}
.help-doc p{margin:0 0 10px;}
.help-doc b{color:var(--color-text-primary);}
.help-doc code{background:var(--color-surface-3);padding:1px 6px;border-radius:5px;font-size:12.5px;color:var(--color-primary);}
.help-doc ul{margin:4px 0 10px;padding-left:20px;}
.help-doc li{margin-bottom:5px;}

/* ---------- 9. 深色主题微调（变量已自适应，这里补网格对比） ---------- */
[data-theme="dark"] .sheet-cell{border-right-color:var(--color-border-light);border-bottom-color:var(--color-border-light);}

/* ============ v8 可访问性 ============ */
.skip-link{
  position:fixed;top:-100px;left:16px;z-index:9999;
  background:var(--color-primary,#0D9488);color:#fff;
  padding:10px 18px;border-radius:0 0 10px 10px;
  font-weight:600;font-size:14px;text-decoration:none;
  transition:top .2s ease;
}
.skip-link:focus{top:0;outline:2px solid #fff;outline-offset:2px;}

/* 焦点可见性统一（覆盖历史样式） */
body[data-perf="1"] a:focus-visible,
body[data-perf="1"] button:focus-visible,
body[data-perf="1"] input:focus-visible,
body[data-perf="1"] select:focus-visible,
body[data-perf="1"] textarea:focus-visible,
body[data-perf="1"] [tabindex]:focus-visible{
  outline:2px solid var(--color-primary,#0D9488) !important;
  outline-offset:2px !important;
}

/* 减少动效偏好 */
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important;}
}

/* ============ v8 删除/确认弹窗（危险样式 + 输入确认） ============ */
.dlg-msg{display:flex;gap:14px;align-items:flex-start;font-size:14px;line-height:1.6;color:var(--color-text-primary);}
.dlg-msg .dlg-ico{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;background:var(--color-info-bg);color:var(--color-info);}
.dlg-msg.dlg-danger .dlg-ico{background:var(--color-danger-bg);color:var(--color-danger);}
.dlg-msg.dlg-danger{font-weight:500;}
.dlg-sub{margin-top:6px;font-size:12.5px;color:var(--color-text-muted);}
.dlg-confirm-input{width:100%;margin-top:12px;border:1px solid var(--color-danger-border)!important;}
.dlg-foot{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;}

/* ============ v8 登录页入口切换（仓储系统 / 平台管理） ============ */
.login-portal-seg{display:flex;border:1px solid var(--color-border);border-radius:var(--radius-md);padding:3px;background:var(--color-surface-3);}
.login-portal-seg button{flex:1;border:1px solid transparent!important;background:transparent!important;}
.login-portal-seg button.on{background:var(--color-primary-bg)!important;color:var(--color-primary)!important;border-color:var(--color-selected-border)!important;}

/* ============================================================
   CY 终态全局修复层（cy260916，不限 data-perf，作为最终兜底）
   目标：选中可点且明显、文本可框选、弹窗不挤控件、顶部不错乱、选区统一
   ============================================================ */
/* 1) 选区文本配色统一石青 */
::selection{background:var(--color-highlight,rgba(13,148,136,.18));color:inherit;}
/* 2) 默认可选文本；仅交互控件禁选，避免“想复制却选不中 / 点按钮误选一片” */
table td,.modal-body,.pop-body,.help-doc,.cell-text,.note,pre,code{user-select:text;-webkit-user-select:text;}
button,.btn,.seg button,.tab,.chip,.nav-item,.pager button,th[data-sort],.col-drag,label.switch,.switch{user-select:none;-webkit-user-select:none;}
/* 3) 点击选中态：覆盖历史各类名，统一明显的石青选中（浅底 + 左侧主色条 + 主色文字） */
table tbody tr.selected>td,
table tbody tr[aria-selected="true"]>td,
.list-row.selected,.list-row[aria-selected="true"],
.list-item.selected,.pick-item.selected,.pick-row.selected,.menu-item.selected,.row.selected{
  background:var(--color-primary-bg)!important;
  color:var(--color-primary)!important;
  box-shadow:inset 3px 0 0 var(--color-primary);
}
table tbody tr.selected:hover>td,.list-row.selected:hover,.list-item.selected:hover{background:var(--color-primary-bg-strong)!important;}
/* 分段/标签/页签选中 */
.seg button.on,.seg .on,button.tab.on,.tablist .on{
  background:var(--color-primary)!important;color:#fff!important;border-color:var(--color-primary)!important;
}
/* 4) 弹窗宽度阶梯 + 表单控件不被挤 */
.modal.xl,.modal.sheet-xl{width:min(97vw,1280px);}
.modal.wide{width:min(96vw,1120px);}
.modal-body,.pop-body{min-width:0;overflow-x:auto;}
.modal-body .fld,.pop-body .fld{min-width:0;}
.modal-body input,.modal-body textarea,.modal-body select,.pop-body input,.pop-body textarea,.pop-body select{
  width:100%;max-width:100%;min-width:0;box-sizing:border-box;
}
.modal-body .form-row,.modal-body .form-inline{display:flex;flex-wrap:wrap;gap:10px;min-width:0;}
.modal-body .form-row>*{min-width:0;}
@media(max-width:680px){
  .modal-body .form-grid,.modal-body .grid-form,.pop-body .form-grid,.pop-body .grid-form{grid-template-columns:1fr!important;}
}
/* 5) 顶部栏布局稳定：不换行错位、标题超长省略、控件不被压扁 */
.topbar,#topbar,.app-topbar,header.app-header{display:flex;flex-wrap:nowrap;align-items:center;gap:12px;min-width:0;}
.topbar>*,#topbar>*,.app-topbar>*,header.app-header>*{min-width:0;flex-shrink:1;}
.topbar .top-title,.topbar h1,#topbar h1,.app-topbar h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;}
.topbar .spacer,#topbar .spacer{flex:1 1 auto;min-width:0;}
/* 6) 列表/表格行可点击反馈，命中区域不留死区 */
table tbody tr[role="button"],.list-row[role="button"],.clickable{cursor:pointer;}
