/* ===== Excel 化表格 ===== */
.grid-wrap {
  position: relative; overflow: auto; max-height: calc(100vh - 190px); min-height: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); outline: none;
}
.grid-wrap:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; font-size: 13px; }
table.grid th, table.grid td {
  height: 28px; padding: 0 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface);
}
table.grid thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 600; color: var(--muted);
  text-align: center; height: 22px; font-size: 12px;
}
table.grid thead tr:nth-child(2) th { top: 22px; font-weight: 400; }
table.grid thead tr:nth-child(3) th { top: 44px; font-weight: 400; color: var(--faint); }
table.grid thead th.corner { z-index: 4; left: 0; vertical-align: bottom; padding-bottom: 6px; color: var(--text); }
table.grid thead th.dayh.weekend { color: var(--warn); }
table.grid td.sticky { position: sticky; z-index: 1; background: var(--surface); }
table.grid .edge { border-right: 2px solid var(--border-strong); }
table.grid td.day { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.day.weekend { background: var(--weekend-bg); }
table.grid td.auto { background: var(--auto-bg); color: var(--muted); }
table.grid thead th.dayh.date-target { background: var(--accent); color: var(--accent-text); }
table.grid td.day.date-target { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
table.grid td.day.date-locked { background: #f1f3f6; color: var(--faint); cursor: not-allowed; }
table.grid td.required-hint::after { content: '*'; position: absolute; right: 3px; top: 0; color: var(--danger); font-weight: 700; }
table.grid tr.auto-row td.left { color: var(--muted); }
table.grid tr.blank td { height: 10px; background: var(--surface-2); }
table.grid tr.section td { color: var(--faint); font-style: italic; }
table.grid.readonly td.editable { cursor: default; }
table.grid td.editable { cursor: cell; }
table.grid td.sel { background-image: linear-gradient(var(--sel-bg), var(--sel-bg)); }
table.grid td.focus { box-shadow: inset 0 0 0 2px var(--accent); }
table.grid td.conflict { box-shadow: inset 0 0 0 2px var(--danger); }
table.grid td.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--accent); }
table.grid .cell-input {
  width: 100%; height: 100%; border: 0; padding: 0 6px; background: var(--surface); outline: none; text-align: inherit;
}
table.grid td.action { padding: 0; text-align: center; }
table.grid .row-del {
  width: 22px; height: 22px; border: 0; border-radius: 4px; background: transparent; color: var(--faint); cursor: pointer;
  visibility: hidden;
}
table.grid tr:hover .row-del, table.grid .row-del:focus-visible { visibility: visible; }
table.grid .row-del:hover { background: var(--danger-soft); color: var(--danger); }

/* 报表页工具栏 */
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 6px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a.summary { color: var(--faint); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.date-target-control { display: inline-flex; align-items: center; gap: 6px; }
.date-target-info { min-width: 210px; }
.save-state { font-size: 13px; color: var(--muted); min-width: 90px; }
.save-state.error, .save-state.conflict { color: var(--danger); }
.save-state.saved { color: var(--ok); }
.note { padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.selinfo { font-size: 12px; color: var(--faint); margin-top: 6px; min-height: 18px; }
.part-list { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.part-list label { display: flex; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.part-list label:hover { background: var(--surface-2); }
.part-list .no { color: var(--muted); font-family: var(--mono); font-size: 12px; min-width: 130px; }

/* 窄屏：只冻结关键列（项目名 / 姓名 / 零件号），其余行头随表格滚动 */
@media (max-width: 1400px) {
  table.grid.attendance td.sticky:not(.key-col) { position: static; }
  table.grid.attendance thead th.corner:not(.key-col) { left: auto !important; }
  table.grid.attendance td.key-col, table.grid.attendance thead th.corner.key-col { left: 0 !important; }
}
@media (max-width: 760px) {
  table.grid td.sticky:not(.key-col), table.grid thead th.corner:not(.key-col) { position: static; }
  table.grid td.key-col, table.grid thead th.corner.key-col { position: sticky; left: 0 !important; }
  table.grid thead th.corner:not(.key-col) { position: sticky; left: auto !important; }
  .grid-wrap { max-height: calc(100vh - 230px); }
  .date-target-input { min-width: 145px; }
}
