/* ============================================================
   原有基础样式
   ============================================================ */

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, '仿宋', 'FangSong', '华文仿宋', STFangsong, sans-serif;
    font-size: 17px;
}

/* 禁止页面级横向滚动/横向滑动把离屏内容（如闭合状态移动抽屉的深色面板）边缘滑进视口；
   宽表格已由各自 .mud-table-container(overflow-x:auto) 内部滚动，不受此规则影响 */
html, body {
    overflow-x: hidden;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

code {
    color: #c02d76;
}

/* ============================================================
   表格基础样式 - 全局单行截断 + 横向滚动
   ============================================================
   关键说明：
   - table-layout: fixed 是让 text-overflow: ellipsis
     在 <td>/<th> 上生效的前提条件（display:table-cell 本身
     不支持 overflow/ellipsis）。
   - 各列宽度由 MudBlazor 按内容比例分配，列数过多时
     mud-table-container（overflow-x:auto）自动出现横向滚动条。
   ============================================================ */

.mud-table-container {
    overflow-x: auto !important;
    max-width: 100%;
}

/* 编辑页表格容器：列宽总和超出视口时横向滚动（配合 MudTable min-width 使列宽严格生效） */
.table-scroll {
    overflow-x: auto !important;
}

.mud-table {
    width: 100%;
    table-layout: fixed;
}

.mud-table-cell {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.875rem !important;
}

/* 全局表头统一字重 600 + 左对齐 */
th.mud-table-cell,
.auto-table th {
    font-weight: 600 !important;
    text-align: left !important;
}

/* ============================================================
   表格内联编辑样式 - 无边框
   ============================================================ */

.mud-table .mud-input-outlined .mud-input-outlined-border {
    border-color: transparent !important;
    transition: border-color 0.2s ease;
}

.mud-table .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

.mud-table .mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: transparent !important;
}

/* 用 box-shadow 替代边框作为焦点指示，避免边框线在单元格间产生视觉延申 */
.mud-table .mud-input-outlined:focus-within {
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary) !important;
}

/* MudSelect input-slot */

/* ============================================================
   输入框字体和高度统一 - 全局生效（不限表格内）
   所有文本输入框统一 32px 高度、14px 字体
   ============================================================ */

.mud-input.mud-input-text {
    font-size: 0.875rem !important;
    font-family: inherit !important;
}

.mud-input.mud-input-text,
.mud-select,
.mud-numeric-field,
.mud-input-control.mud-input-text {
    height: 32px !important;
    min-height: 32px !important;
}

.mud-input.mud-input-text input,
.mud-select input,
.mud-numeric-field input,
.mud-input-slot {
    height: 32px !important;
    padding: 0 0 0 8px !important;
    line-height: 32px !important;
    box-sizing: border-box !important;
}

/* MudSelect 文本区域（div.mud-input-slot）也有 MudBlazor 默认 padding，导致和箭头不在同一水平线 */
.mud-select .mud-input-slot.mud-input-root-outlined {
    padding: 0 0 0 8px !important;
    line-height: 32px !important;
    height: 32px !important;
}

/* ============================================================
   隐藏数值输入框上下箭头 - 强制生效
   ============================================================ */

/* 方法1：通过 MudBlazor 类名 */
.mud-numeric-field .mud-input-adornment {
    display: none !important;
}

/* 方法2：直接作用于 input 元素 */
.mud-numeric-field input {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

.mud-numeric-field input::-webkit-outer-spin-button,
.mud-numeric-field input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

/* 方法3：全局强制隐藏所有 number 类型输入框的箭头 */
input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

/* ============================================================
   下拉选择框样式
   ============================================================ */

.mud-table .mud-select {
    min-width: 80px !important;
}

.mud-select .mud-input {
    padding-right: 24px !important;
}

.mud-select .mud-select-arrow {
    right: 4px !important;
}

.mud-select .mud-input-adornment-end {
    height: 32px !important;
    max-height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mud-select .mud-input input {
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.mud-select-item {
    white-space: normal !important;
    word-break: break-word !important;
}

/* 操作工/检验员多选下拉：表格内单元格空间有限，弹层加宽避免人员名被截断 */
.operator-select-popover {
    min-width: 260px !important;
}

/* 操作工/检验员多选下拉：选项行高压缩、勾选框（mud-list-item-icon）与姓名间距压缩，人员名更紧凑 */
.operator-select-popover .mud-list-item {
    min-height: 32px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}
.operator-select-popover .mud-list-item-icon {
    min-width: 24px !important;
    margin-right: 0 !important;
}
.operator-select-popover .mud-list-item-text {
    white-space: nowrap !important;
}

/* 员工管理多选（生产工段/工序组/靠工岗位）：表格单元格内弹层窄导致中文选项文字被截断——
   加宽弹层让选项完整可见 + 压缩勾选框（mud-list-item-icon）与文字之间的占位间距 */
.cell-multi-select-popover {
    min-width: 340px !important;
    max-width: 480px !important;
}
.cell-multi-select-popover .mud-list-item {
    min-height: 32px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}
.cell-multi-select-popover .mud-list-item-icon {
    min-width: 20px !important;
    margin-right: 0 !important;
}
.cell-multi-select-popover .mud-list-item-text {
    white-space: normal !important;
    word-break: break-word !important;
}

/* 操作工/检验员多选输入框：突破 compact-input 130px 上限，加宽让多人姓名可见；压缩姓名与边框/箭头间距 */
.operator-input.compact-input {
    max-width: 190px !important;
}
.operator-input .mud-input-slot.mud-input-root-outlined {
    padding: 0 4px 0 8px !important;
}

/* 下拉选项键盘导航高亮 - JS 侧添加 .mud-selected-item 但 MudBlazor 自身 CSS 未定义该类的可见样式 */
.mud-popover-open .mud-list-item.mud-selected-item {
    background-color: var(--mud-palette-action-default-hover) !important;
}
.mud-popover-open .mud-list-item.mud-selected-item:hover {
    background-color: var(--mud-palette-primary-hover, rgba(89, 74, 226, 0.12)) !important;
}

/* ============================================================
   复选框居中
   ============================================================ */

.mud-table .mud-checkbox {
    padding: 0 !important;
    margin: 0 !important;
}

.mud-table .mud-checkbox .mud-icon-button {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
}

/* ============================================================
   操作按钮
   ============================================================ */

.mud-table .mud-icon-button {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
}

/* ============================================================
   表单验证样式 - 红色边框和错误提示
   ============================================================ */

/* 无效输入框的红色边框 */
.mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
    border-width: 1px !important;
}

.mud-input-error.mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
    border-width: 2px !important;
}

/* 必填字段的星号标记 */
.mud-input-required .mud-input-label::after {
    content: " *";
    color: var(--mud-palette-error);
}

/* 错误提示文字样式 */
.mud-helper-text.mud-invalid {
    color: var(--mud-palette-error) !important;
    font-size: 0.7rem;
    margin-top: 2px;
}

/* ============================================================
   顶部导航栏样式
   ============================================================ */

/* MudMenu 下拉菜单按钮的文字颜色 */
.mud-menu .mud-button-text {
    color: inherit !important;
}

/* ============================================================
   下拉菜单容器样式 - 深色主题，与导航栏一致
   ============================================================ */

/* 下拉面板背景 */
.mud-menu .mud-paper {
    background-color: #1a1a2e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    margin-top: 4px !important;
    min-width: 140px !important;
    overflow: visible !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}

/* 菜单项基础样式 */
.mud-menu .mud-list-item {
    color: #ccc !important;
    font-size: 0.875rem !important;
    padding: 8px 16px !important;
    transition: all 0.15s ease !important;
    border-radius: 4px !important;
    margin: 2px 4px !important;
}

/* 菜单项悬停 */
.mud-menu .mud-list-item:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* 表格内联编辑的验证样式 */
.mud-table .mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

/* ============================================================
   紧凑表格样式 - 极小内边距，适配20+列密集表格
   ============================================================ */

.compact-table.mud-table {
    width: auto;
}

/* ⚠️ MudTable 的 Class/Style 参数作用在根 div（class 含 "mud-table compact-table"），不是 <table class="mud-table-root">！
   若在根 div 上设 min-width 会把根 div 撑破 → 宽度溢出外传到页面 body → 页面级横向滚动条覆盖菜单+内容。
   正解：CSS 变量 --table-min-width 由列表页 Style 传入，仅对带 table-min-width 标识的列表页
   把 min-width 应用到 <table> 自身 → .mud-table-container(overflow-x:auto; max-width:100%) 因表格超宽而滚动（滚动条回到表格位置）。 */
.compact-table.table-min-width .mud-table-root {
    min-width: var(--table-min-width, 100%);
}

.compact-table.mud-table .mud-table-cell {
    padding: 1px 1px !important;
}

/* 默认表格布局：列宽由 <th Style="width:xx"> 决定（偏好宽度，非强制）
   未设宽度的列由内容撑开（如操作按钮），不会消失。
   总宽超容器时 mud-table-container(overflow-x:auto) 自动滚动。 */
.compact-table .mud-table-root {
    width: 100%;
}

/* 数据值左对齐（仅数据行） */
.compact-table.mud-table tbody .mud-table-cell {
    text-align: left !important;
}

/* 数值类单元格居中（覆盖 compact-table 的 left !important，特异性更高） */
.compact-table.mud-table tbody .mud-table-cell.text-center {
    text-align: center !important;
}

/* 数值类单元格右对齐（覆盖 compact-table 的 left !important，特异性更高） */
.compact-table.mud-table tbody .mud-table-cell.text-right {
    text-align: right !important;
}

/* 输入框填满所在单元格宽度 */
.compact-table .mud-input {
    width: 100%;
}

.compact-table.mud-table .mud-input input,
.compact-table.mud-table .mud-select input {
    padding: 0 0 0 1px !important;
}

/* MudSelect 内层输入容器预留下拉图标空间 */
.compact-table.mud-table .mud-select .mud-input {
    padding-right: 16px !important;
}

/* 下拉选择框验证样式 */
.mud-select.mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

/* 数值输入框验证样式 */
.mud-numeric-field.mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

/* 日期选择器验证样式 */
.mud-datepicker.mud-input-error .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

/* 表头文字与筛选框之间的间距 */
.mud-table .mud-th {
    vertical-align: top;
    padding: 4px 6px !important;
}

/* 表头列名文字 */
.mud-table .th-label {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 1px;
}

/* 更新修改模式：原项次主号只读样式 */
.readonly-field .mud-input-input {
    background-color: #f0f0f0 !important;
    cursor: default !important;
    color: #666 !important;
}
.readonly-field .mud-input .mud-input-outlined-border {
    border-color: #e0e0e0 !important;
}

/* ============================================================
   可排序列头样式 - 简洁美观，不遮蔽字段文字
   ============================================================ */

.sortable-header {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    user-select: none;
    white-space: nowrap;
}

.sortable-header:hover {
    color: var(--mud-palette-primary);
}

.sort-arrow {
    font-size: 9px;
    line-height: 1;
    color: var(--mud-palette-primary);
    flex-shrink: 0;
}

/* ============================================================
   统一表格行高 - 查看模式与编辑模式行高一致
   编辑模式下输入框 height:32px + padding:2px*2 = 36px，设为 38px 留有余地
   查看模式下仅有文本，通过 height 拉伸至与编辑模式一致

   注意：
   - table-layout:fixed 下浏览器对 td height 解释不一致，
     因此同时设置 height + min-height + line-height:normal
     三重兜底（min-height 虽 CSS spec 不适用于 table-cell，
     但实际浏览器大多支持；line-height:normal 防止被继承）。
   ============================================================ */

.auto-table td.mud-table-cell,
.auto-table td,
.compact-table.mud-table .mud-table-cell,
.mud-table-dense .mud-table-row .mud-table-cell {
    height: 38px !important;
    min-height: 38px;
    line-height: normal;
}

/* ============================================================
   全局列表自动压缩样式 - 列多时自动压缩，不出现横向滚动条
   ============================================================ */

.auto-table {
    width: 100%;
}

/* 订单交期预估小表可点击单元格（联动筛选订单列表） */
.estimate-cell {
    transition: background-color 0.15s;
    user-select: none;
}
.estimate-cell:hover {
    background-color: #e3f2fd;
}

.auto-table td.mud-table-cell,
.auto-table th.mud-table-cell {
    padding: 2px 4px !important;
}

.auto-table .mud-input,
.auto-table .mud-select,
.auto-table .mud-numeric-field {
    margin: 0 !important;
}

.auto-table .mud-input {
    width: 100%;
    min-width: 0;
}

.auto-table th.mud-table-cell {
    white-space: nowrap !important;
    font-size: 0.875rem !important;
}

.auto-table th {
    font-size: 0.875rem !important;
}

/* 单行表单 MudSimpleTable 的 <th>/<td> 表头截断 */
.auto-table th,
.auto-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   列分组样式 - 用于多列列表页的分组视觉呈现
   ============================================================ */

/* 列表页统一工具栏（列显隐 + 记录数 + 操作按钮，置于表/分组字段上方，紧凑 28px） */
.list-toolbar {
    display: flex;
    align-items: center;
    padding: 2px 0;
    min-height: 28px;
}

/* 分组标题栏 - 独立于 MudTable 的 flex 行，由 JS 测量列宽对齐 */
.col-group-header-scroll {
    overflow: hidden;
    border-bottom: 2px solid #e0e0e0;
    background: #fff;
}

.col-group-header-bar {
    display: flex;
    height: 28px;
}

.col-group-header-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-right: 1px solid #e0e0e0;
    /* 关键：content-box 时 item 实际占位 = 设置宽 + padding + border（多出 5px/项），
       与表格列宽（th.offsetWidth / col.Width）错位累积。border-box 后占位精确 = 设置宽，
       组标题栏与列宽（屏幕 offsetWidth、打印 col.Width）逐列对齐。 */
    box-sizing: border-box;
}

.col-group-header-item:last-child {
    border-right: none;
}

/* 数据居中 */
#workorder-execution-list-table .mud-table-cell {
    text-align: center !important;
}

#workorder-execution-list-table .col-header-cell {
    justify-content: center !important;
}

/* 分组列通用 - 居左排列，不换行 */
.col-header-cell {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

/* 分组标签徽章 - 紧凑小字 */
.col-group-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0 4px;
    margin-right: 2px;
    border-radius: 2px;
    line-height: 1.6;
    white-space: nowrap;
}


/* G1: 基础数据 - 无色调 */
.col-g1 .col-group-badge { color: #455A64; background: #ECEFF1; }

/* G2: 用料计划 - 蓝色系 */
.col-g2 { background: #F5F9FF !important; }
.col-g2 .col-group-badge { color: #1565C0; background: #BBDEFB; }
.col-g2-cell { background: #F5F9FF !important; }

/* G3: 投料数据 - 绿色系 */
.col-g3 { background: #F4FAF5 !important; }
.col-g3 .col-group-badge { color: #2E7D32; background: #C8E6C9; }
.col-g3-cell { background: #F4FAF5 !important; }

/* G4: 有效数据 - 橙色系 */
.col-g4 { background: #FFF8F0 !important; }
.col-g4 .col-group-badge { color: #E65100; background: #FFE0B2; }
.col-g4-cell { background: #FFF8F0 !important; }

/* G5: 物料执行 - 紫色系 */
.col-g5 { background: #F8F4FC !important; }
.col-g5 .col-group-badge { color: #6A1B9A; background: #E1BEE7; }
.col-g5-cell { background: #F8F4FC !important; }

/* G6: 返整执行 - 青色系 */
.col-g6 { background: #E0F7FA !important; }
.col-g6 .col-group-badge { color: #00695C; background: #B2DFDB; }
.col-g6-cell { background: #E0F7FA !important; }

/* G7: 有效流转 - 石灰系 */
.col-g7 { background: #FFF3E0 !important; }
.col-g7 .col-group-badge { color: #E65100; background: #FFE0B2; }
.col-g7-cell { background: #FFF3E0 !important; }

/* G8: 过程不合格 - 红粉系 */
.col-g8 { background: #FFEBEE !important; }
.col-g8 .col-group-badge { color: #C62828; background: #FFCDD2; }
.col-g8-cell { background: #FFEBEE !important; }

/* G9: 成检不合格 - 深橙系 */
.col-g9 { background: #FFF3E0 !important; }
.col-g9 .col-group-badge { color: #E65100; background: #FFE0B2; }
.col-g9-cell { background: #FFF3E0 !important; }

/* G10: 汇总不合格 - 棕灰系 */
.col-g10 { background: #EFEBE9 !important; }
.col-g10 .col-group-badge { color: #4E342E; background: #D7CCC8; }
.col-g10-cell { background: #EFEBE9 !important; }

/* G11: 成品入库 — 青绿系 */
.col-g11 { background: #E8F5E9 !important; }
.col-g11 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
.col-g11-cell { background: #E8F5E9 !important; }

.col-g12 { background: #FFF8E1 !important; }
.col-g12 .col-group-badge { color: #F57F17; background: #FFECB3; }
.col-g12-cell { background: #FFF8E1 !important; }

/* G7: 有效流转 — 青绿系 */
.col-g7 { background: #E0F2F1 !important; }
.col-g7 .col-group-badge { color: #00695C; background: #B2DFDB; }
.col-g7-cell { background: #E0F2F1 !important; }

.col-g13 { background: #F3E5F5 !important; }
.col-g13 .col-group-badge { color: #7B1FA2; background: #E1BEE7; }
.col-g13-cell { background: #F3E5F5 !important; }

.col-g14 { background: #E0F2F1 !important; }
.col-g14 .col-group-badge { color: #00695C; background: #B2DFDB; }
.col-g14-cell { background: #E0F2F1 !important; }
.col-g15 { background: #FFF3E0 !important; }
.col-g15 .col-group-badge { color: #E65100; background: #FFCC80; }
.col-g15-cell { background: #FFF3E0 !important; }

/* G16: 荒管采购 */
.col-g16 { background: #E8EAF6 !important; }
.col-g16 .col-group-badge { color: #283593; background: #C5CAE9; }
.col-g16-cell { background: #E8EAF6 !important; }

/* G17: 成品采购 */
.col-g17 { background: #FCE4EC !important; }
.col-g17 .col-group-badge { color: #AD1457; background: #F48FB1; }
.col-g17-cell { background: #FCE4EC !important; }

/* G18: 库存使用 */
.col-g18 { background: #E0F7FA !important; }
.col-g18 .col-group-badge { color: #00695C; background: #80DEEA; }
.col-g18-cell { background: #E0F7FA !important; }

/* ============================================================
   WorkOrderExecution 分组底色统一（仅本页生效）
   - 实时关注（组 3，整体汇整）：粉色系（突出总览，置于明细之前）
   - 用料计划及执行实况（组 4~12）：绿色系（4 为 5~12 的汇整，同色）
   - 实际生产总流转（组 13~15）：琥珀色系（13 为 14~15 的汇整；14 原始投料有效流转 / 15 返整执行）
   - 次品总量（组 16）：红色系（次品/缺陷语义，与 13~15 区分）
   - 成品入库（组 17）：蓝色系
   作用域限定 #workorder-execution-list-table，不影响其他页面
   ============================================================ */
#workorder-execution-list-table .col-g3 { background: #FCE4EC !important; }
#workorder-execution-list-table .col-g3 .col-group-badge { color: #AD1457; background: #F48FB1; }
#workorder-execution-list-table .col-g3-cell { background: #FCE4EC !important; }
#workorder-execution-list-table .col-g4 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g4 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g4-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g5 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g5 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g5-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g6 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g6 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g6-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g7 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g7 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g7-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g8 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g8 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g8-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g9 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g9 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g9-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g10 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g10 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g10-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g11 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g11 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g11-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g12 { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g12 .col-group-badge { color: #1B5E20; background: #A5D6A7; }
#workorder-execution-list-table .col-g12-cell { background: #E8F5E9 !important; }
#workorder-execution-list-table .col-g13 { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g13 .col-group-badge { color: #F57F17; background: #FFECB3; }
#workorder-execution-list-table .col-g13-cell { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g14 { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g14 .col-group-badge { color: #F57F17; background: #FFECB3; }
#workorder-execution-list-table .col-g14-cell { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g15 { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g15 .col-group-badge { color: #F57F17; background: #FFECB3; }
#workorder-execution-list-table .col-g15-cell { background: #FFF8E1 !important; }
#workorder-execution-list-table .col-g16 { background: #FFEBEE !important; }
#workorder-execution-list-table .col-g16 .col-group-badge { color: #C62828; background: #EF9A9A; }
#workorder-execution-list-table .col-g16-cell { background: #FFEBEE !important; }
#workorder-execution-list-table .col-g17 { background: #E8EAF6 !important; }
#workorder-execution-list-table .col-g17 .col-group-badge { color: #283593; background: #C5CAE9; }
#workorder-execution-list-table .col-g17-cell { background: #E8EAF6 !important; }

/* G15 内联编辑控件紧凑样式 */
.compact-select {
    font-size: 0.8rem;
    padding: 0 4px;
    min-height: 28px;
    margin: 0;
}

/* 分组起始列 - 左侧竖线分隔 */
.col-group-start { border-left: 2px solid #BDBDBD !important; }
.col-group-start-cell { border-left: 2px solid #E0E0E0 !important; }

/* ========== 成检到料列表分组（G1=检验到料实体, G2=批次自动填充） ========== */
#material-checks-list-table .col-g1 { background: #F5F9FF !important; }
#material-checks-list-table .col-g1 .col-group-badge { color: #1565C0; background: #BBDEFB; }
#material-checks-list-table .col-g1-cell { background: #F5F9FF !important; }
#material-checks-list-table .col-g2 { background: #F4FAF5 !important; }
#material-checks-list-table .col-g2 .col-group-badge { color: #2E7D32; background: #C8E6C9; }
#material-checks-list-table .col-g2-cell { background: #F4FAF5 !important; }

/* 页脚汇总行样式 */
.col-footer-cell {
    border-top: 2px solid #BDBDBD !important;
    font-weight: 600 !important;
    background: #FAFAFA !important;
}
.col-footer-sum {
    color: #1565C0;
    white-space: nowrap;
    font-size: 0.8125rem;
}

/* 工单执行状况 - 全部数据居中显示 */
#workorder-execution-list-table .mud-table-cell {
    text-align: center !important;
}
#workorder-execution-list-table .col-header-cell {
    justify-content: center;
}

/* ============================================================
   批次新建页面 - 上下结构表单样式
   ============================================================ */

.batch-create-table {
    width: 100%;
}

.batch-create-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
    padding: 4px 8px 2px 8px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    white-space: nowrap;
}

.batch-create-table tbody td {
    padding: 2px 8px 6px 8px;
    vertical-align: top;
    font-size: 0.875rem;
}

.batch-create-table .mud-input-outlined .mud-input-outlined-border {
    border-color: transparent !important;
    transition: border-color 0.2s ease;
}

.batch-create-table .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

.batch-create-table .mud-input-outlined:focus-within .mud-input-outlined-border {
    border-color: transparent !important;
}

/* batch-create-table 用 box-shadow 替代边框作为焦点指示，与表格内联编辑一致 */
.batch-create-table .mud-input-outlined:focus-within {
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary) !important;
}

/* ============================================================
   状态标签（MudChip）统一字体尺寸
   所有 Size="Size.Small" 的 MudChip 统一为 0.875rem（与表格文字一致）
   ============================================================ */

.mud-chip.mud-chip-size-small {
    font-size: 0.875rem !important;
}

/* 用料计划状态"超量"：深色底白字 Chip */
.chip-dark {
    background-color: #37474f !important;
    color: #fff !important;
    font-weight: 500;
}

/* 批次表格内禁止 MudNumericField 箭头 (MudTextField 替代方案) */
.batch-create-table input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

.batch-create-table input[type="number"]::-webkit-inner-spin-button,
.batch-create-table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

/* ============================================================
   单行表单规范全局样式
   ============================================================ */

/* 输入框文字使用默认色，禁止浅色弱化 */
.auto-table input,
.auto-table .mud-input input {
    color: var(--mud-palette-text-primary) !important;
}

/* 表格行内编辑紧凑输入框 */
.compact-input {
    min-width: 0 !important;
    max-width: 130px !important;
}
.compact-input .mud-input.mud-input-text {
    font-size: 0.75rem !important;
    margin-top: 0 !important;
}
.compact-input .mud-input-outlined-border {
    border-width: 1px !important;
}

/* 必填字段红色星号标记（用于表头） */
.required-star {
    color: var(--mud-palette-error);
    font-weight: bold;
    margin-left: 1px;
}

/* 卡片标题与内容间距缩短 */
.compact-card.mud-card .mud-card-header {
    padding-bottom: 4px;
}

.compact-card.mud-card .mud-card-content {
    padding-top: 0;
}

/* 确保表头不裁剪筛选弹窗 */
.mud-table-head {
    overflow: visible;
}

/* ============================================================
   移动端响应式样式 — 叠加在桌面样式之上
   ============================================================ */
@media (max-width: 960px) {
    /* 表格横向滚动 */
    .mud-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* 触摸目标 44px 规范 */
    .mud-button-root,
    .mud-icon-button {
        min-height: 44px !important;
    }

    /* 卡片边距调整 */
    .mud-card {
        border-radius: 0 !important;
        box-shadow: none !important;
        border-bottom: 1px solid #e0e0e0;
    }

    /* 容器全宽 */
    .mud-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

@media (max-width: 600px) {
    /* 小屏表格字体缩小 */
    .mud-table .mud-table-cell {
        font-size: 0.75rem !important;
        padding: 2px 4px !important;
    }
}

/* 移动端导航分组样式 */
.mobile-nav-group .mud-expand-panel-header {
    padding: 12px 16px !important;
    border-bottom: 1px solid #333;
}

.mobile-nav-group .mud-expand-panel-content {
    background-color: #16213e;
}

/* ============================================================
   扫码摄像头全屏覆盖
   ============================================================ */
.camera-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #000;
    display: flex;
    flex-direction: column;
}

.camera-video {
    flex: 1;
    width: 100%;
    object-fit: cover;
    background: #000;
}

.camera-footer {
    padding: 16px;
    background: rgba(0, 0, 0, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========== 列表页表格横向滚动（B34）========== */
/* compact-table: width:max-content + table-layout:fixed
   - 列宽总和 ≤ 视口 → 无滚动条，列宽按设定显示
   - 列宽总和 > 视口 → mud-table-container(overflow-x:auto) 自动滚动
   未设宽度的列由内容决定宽度（如操作列按钮）。
   详见 04_开发规范.md §6.29 */

/* ========== 表头语义层级标色（主号级青色 / 订单级橙色）========== */
/* 主号级：单个表头强化——深青底 + 加粗 + 青色粗下边框（单元格不着色，避免与组色块混淆） */
th.col-level-mainno,
#workorder-execution-list-table th.col-level-mainno {
    background: #B2EBF2 !important;
    font-weight: 600 !important;
    border-bottom: 3px solid #00ACC1 !important;
}
th.col-level-order,
#workorder-execution-list-table th.col-level-order { background: #FFE0B2 !important; }

/* ========== 表头高亮（特殊多档判定列，如"到料实投一致性"）========== */
/* 琥珀底 + 加粗 + 深琥珀粗下边框，与内容 Chip（红/橙/蓝/绿/灰）呼应 */
th.col-header-consistency,
#workorder-execution-list-table th.col-header-consistency { background: #FFECB3 !important; font-weight: 700 !important; border-bottom: 3px solid #FFA000 !important; }

/* ========== 操作列整列高亮（G15 执行/预算投料日，原地编辑控件列）========== */
/* 表头靛蓝深底 + 加粗 + 靛蓝粗下边框；单元格淡靛蓝底，覆盖组色块使整列与数据列区分 */
th.col-edit-actions { background: #C5CAE9 !important; font-weight: 700 !important; border-bottom: 3px solid #3F51B5 !important; }
td.col-edit-actions { background: #E8EAF6 !important; }

/* ============================================================
   样式统一语义类（2026-08-20 前端样式统一）
   消灭内联硬编码颜色：卡片/背景/文字/表头统一走语义类
   ============================================================ */

/* 折叠汇总卡：浅底 + 细边框 + 圆角 */
.summary-card {
    background: #FAFBFC;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
}

/* 普通表单卡：细边框 + 圆角 */
.form-card {
    border: 1px solid #E0E0E0;
    border-radius: 8px;
}

/* 扫码/提示卡：蓝左边框 + 浅蓝底 */
.notice-card {
    border-left: 4px solid #1976D2;
    background: #E3F2FD;
}

/* 成功提示卡：绿左边框 + 浅绿底 */
.notice-card-success {
    border-left: 4px solid #4CAF50;
    background: #E8F5E9;
}

/* 蓝左边框卡（无底色） */
.card-accent-left {
    border-left: 4px solid #1976D2;
}

/* 浅蓝背景条 */
.bg-soft-blue {
    background-color: #F0F7FF;
}

/* 浅灰背景 */
.bg-soft-gray {
    background-color: #F5F5F5;
}

/* 极浅灰背景 */
.bg-subtle {
    background-color: #FAFAFA;
}

/* 品牌蓝文字 */
.text-brand {
    color: #1565C0;
}

/* 警示橙文字 */
.text-warning-orange {
    color: #E65100;
}

/* 辅助灰文字（统一 #757575） */
.text-hint {
    color: #757575;
}

/* 链接样文字 */
.text-link {
    color: #1976D2;
    cursor: pointer;
}

/* 小节标题深灰蓝 */
.text-title {
    color: #37474F;
}

/* ============================================================
   考勤表（月视图网格）
   ============================================================ */

.attendance-scroll {
    /* 考勤表竖向+横向滚动都发生在该容器内，sticky 表头才能相对容器锁定 */
    overflow: auto;
    max-height: calc(100vh - 200px);
}

.attendance-grid {
    border-collapse: collapse;
    min-width: max-content;
    font-size: 0.875rem;
}

.attendance-grid th,
.attendance-grid td {
    border: 1px solid #E0E0E0;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
}

.attendance-grid thead th {
    background: #E3F2FD;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}

.attendance-grid .sticky-left {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    min-width: 56px;
}

.attendance-grid .sticky-right {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 1;
    min-width: 64px;
    font-weight: 600;
}

.attendance-grid thead th.sticky-left,
.attendance-grid thead th.sticky-right {
    z-index: 3;
}

.attendance-grid .attendance-day {
    min-width: 44px;
    color: #546E7A;
}

.attendance-grid .attendance-cell-td {
    padding: 0;
}

/* 考勤格子原生输入框（替代 MudNumericField，密集网格性能优化） */
.attendance-grid .attendance-cell-input {
    width: 44px;
    min-width: 44px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 4px 0;
    box-sizing: border-box;
}

.attendance-grid .attendance-cell-input:hover {
    background: #F5F5F5;
}

.attendance-grid .attendance-cell-input:focus {
    outline: 2px solid #2196F3;
    outline-offset: -1px;
    background: #fff;
}

.attendance-grid .attendance-total-td {
    background: #F5F5F5;
}

.attendance-grid .attendance-foot td {
    background: #ECEFF1;
    font-weight: 600;
    color: #37474F;
}

/* 「津贴与处罚」月度网格：已停用员工的当月历史行灰显（仍可编辑） */
.attendance-grid tr.allowance-inactive-row {
    background-color: #FAFAFA;
}

.attendance-grid tr.allowance-inactive-row td.sticky-left {
    color: #9E9E9E;
}

/* 「月工资津贴汇总」只读汇总网格：压缩列宽整表免横向滚动
   （列宽由 thead th 行内 style 定义 + fixed 布局撑满容器；金额列表头允许多行换行） */
.attendance-grid.monthly-summary-grid {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 0.8125rem;
}
.monthly-summary-grid th,
.monthly-summary-grid td {
    padding: 2px 3px;
}
.monthly-summary-grid thead th {
    white-space: normal;
    line-height: 1.2;
    vertical-align: middle;
}
.monthly-summary-grid thead th.sticky-left {
    white-space: nowrap;
}
.monthly-summary-grid tfoot td {
    padding: 3px;
}

/* 考勤表头可点击排序（工号/姓名/岗位类别/岗位） */
.attendance-grid .sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.attendance-grid .sortable-th:hover {
    background: #E3F2FD;
}

/* 表格表头蓝底 */
.table-head-blue {
    background: #E3F2FD;
}

/* ===== 生产计件类别编辑页：维度档分区块 ===== */
.dim-block {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: #fff;
}

.dim-block-warning {
    border-color: #f44336;
    background: #fff8f8;
}

.dim-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tier-editor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.tier-editor-row:first-of-type {
    border-top: none;
}

.dim-ratio-input {
    width: 110px;
    flex: none;
}

.dim-hint {
    flex: none;
    max-width: 120px;
    line-height: 1.2;
    white-space: normal;
    word-break: break-all;
}