:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --line: #d8dee9;
  --line-strong: #9aa7b8;
  --text: #1f2937;
  --muted: #667085;
  --accent: #2563eb;
  --danger: #dc2626;
  --shift-bg: #eef4ff;
  --empty-bg: #f3f4f6;
  --sticky-bg: #ffffff;
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, select {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}

button:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #64748b;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

select {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 10px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
  border-bottom: 1px solid var(--line);
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: .02em;
}

.app-header h1 span {
  font-size: 13px;
  color: var(--muted);
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  white-space: nowrap;
}

.app-shell {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 8px;
  gap: 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-break {
  flex-basis: 100%;
  width: 0;
  height: 0;
}

.workflow-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
}

.workflow-group {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid #d3d9e4;
  border-radius: 8px;
  background: #f7f9fc;
}

.workflow-step {
  color: #536174;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-btn {
  width: 86px;
  line-height: 1.15;
  padding: 7px 8px;
}

.history-btn small {
  color: var(--muted);
}

.day-nav select {
  min-width: 76px;
  text-align: center;
}

.view-label {
  color: var(--muted);
  font-size: 13px;
}

button.danger {
  color: var(--danger);
  border-color: #f2aaaa;
}

.toolbar-note {
  flex: 1;
  min-width: 260px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.editor-area {
  min-height: 0;
  flex: 1;
  display: flex;
  gap: 10px;
}

.work-panel {
  width: 168px;
  flex: 0 0 168px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-height: 0;
}

.work-panel h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.selected-work {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.3;
}

.work-palette {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.work-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
}

.work-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(0,0,0,.28);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.work-item.selected .work-chip {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.work-shortcut {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.grid-section {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.grid-meta {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.grid-wrap {
  min-height: 0;
  flex: 1;
  overflow: auto;
  position: relative;
}

.schedule-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 12px;
  user-select: none;
}

.schedule-grid th,
.schedule-grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  height: 28px;
  min-width: 34px;
  text-align: center;
  vertical-align: middle;
  padding: 0;
}

.schedule-grid thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  color: #475467;
  font-weight: 700;
}

.schedule-grid .staff-head,
.schedule-grid .staff-name {
  position: sticky;
  left: 0;
  z-index: 6;
  min-width: 136px;
  width: 136px;
  max-width: 136px;
  background: var(--sticky-bg);
  border-right: 2px solid var(--line-strong);
  text-align: left;
  padding: 0 8px;
}

.schedule-grid thead .staff-head {
  z-index: 8;
  background: #f8fafc;
}

.schedule-grid .time-head.hour-start {
  border-left: 2px solid var(--line-strong);
}

.schedule-grid td.hour-start {
  border-left: 2px solid var(--line-strong);
}

.staff-no {
  display: inline-block;
  min-width: 24px;
  color: var(--muted);
  font-size: 11px;
}

.cell {
  background: var(--empty-bg);
  cursor: not-allowed;
  color: transparent;
}

.cell.shift {
  background: var(--shift-bg);
  cursor: crosshair;
  color: var(--text);
}

.cell.worked {
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px rgba(255,255,255,.35);
}

.cell.painting {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.status-bar {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .editor-area { flex-direction: column; }
  .work-panel { width: 100%; flex: 0 0 auto; max-height: 190px; }
  .work-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
  .work-item { margin-bottom: 0; }
  .toolbar-note { text-align: left; }
}

.import-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.import-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  white-space: nowrap;
  cursor: pointer;
}

.file-label span {
  font-weight: 700;
  color: var(--accent);
}

.file-label input {
  max-width: 250px;
}

.import-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.import-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .import-panel,
  .import-left {
    align-items: stretch;
    flex-direction: column;
  }
  .import-actions {
    flex-wrap: wrap;
  }
  .file-label {
    justify-content: space-between;
  }
}

/* v0.4: EXE版に寄せた 1スタッフ2行表示 */
.two-line-grid .sticky-col {
  position: sticky;
  z-index: 6;
  background: var(--sticky-bg);
}

.two-line-grid thead .sticky-col {
  z-index: 9;
  background: #f8fafc;
}

.two-line-grid .staff-col {
  left: 0;
  min-width: 120px;
  width: 120px;
  max-width: 120px;
  border-right: 1px solid var(--line-strong);
}

.two-line-grid .type-col {
  left: 120px;
  min-width: 54px;
  width: 54px;
  max-width: 54px;
  text-align: center;
  padding: 0 4px;
  border-right: 1px solid var(--line);
}

.two-line-grid .info-col {
  left: 174px;
  min-width: 150px;
  width: 150px;
  max-width: 150px;
  text-align: left;
  padding: 0 8px;
  border-right: 2px solid var(--line-strong);
  white-space: nowrap;
}

.two-line-grid .staff-name {
  vertical-align: middle;
  font-weight: 700;
}

.two-line-grid .staff-work-row th,
.two-line-grid .staff-work-row td {
  border-bottom: 2px solid var(--line-strong);
}

.two-line-grid .row-type {
  font-size: 11px;
  color: #334155;
  font-weight: 700;
}

.two-line-grid .row-info {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}

.two-line-grid .remaining-text {
  color: #dc2626;
  font-weight: 800;
}

.two-line-grid .cell {
  min-width: 24px;
  width: 24px;
  height: 24px;
  background: #f8fafc;
  cursor: crosshair;
  position: relative;
  overflow: visible;
}

.two-line-grid .shift-line-cell.shift-band {
  background: #c9c9c9;
}

.two-line-grid .work-line-cell {
  background: #ffffff;
}

.two-line-grid .work-line-cell.shift.work-empty {
  background: #e8f7ff;
}

.two-line-grid .work-line-cell.worked {
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
}

.two-line-grid .shift-line-cell,
.two-line-grid .work-line-cell.shift {
  cursor: crosshair;
}

.two-line-grid .work-line-cell:not(.shift) {
  cursor: not-allowed;
}

.two-line-grid .time-head {
  min-width: 24px;
  width: 24px;
  font-size: 10px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  height: 58px;
}

/* v0.5: EXE版にさらに寄せたコンパクト表示 */
:root {
  --bg: #eeeeee;
  --panel: #eeeeee;
  --line: #d6d6d6;
  --line-strong: #8c8c8c;
  --text: #111111;
  --muted: #444444;
  --accent: #1f5fd1;
  --shadow: none;
  --sticky-bg: #eeeeee;
}

html, body {
  background: #eeeeee;
  font-family: "Yu Gothic UI", "Meiryo", "Segoe UI", sans-serif;
  font-size: 12px;
}

button,
select {
  border-radius: 0;
  padding: 4px 10px;
  min-height: 26px;
  background: #f5f5f5;
  border: 1px solid #9a9a9a;
  box-shadow: none;
  font-size: 12px;
}

button:hover:not(:disabled) {
  background: #ffffff;
  border-color: #555555;
}

.app-header {
  padding: 6px 14px 4px;
  background: #eeeeee;
  border-bottom: 1px solid #d0d0d0;
}

.app-header h1 {
  font-size: 14px;
  font-weight: 700;
}

.app-header h1 span,
.app-header p {
  font-size: 11px;
}

.app-shell {
  padding: 6px 8px 4px;
  gap: 5px;
}

.import-panel,
.toolbar,
.work-panel,
.grid-section {
  border-radius: 0;
  box-shadow: none;
  background: #eeeeee;
  border-color: #c9c9c9;
}

.import-panel {
  padding: 4px 6px;
}

.import-note,
.toolbar-note,
.grid-meta,
.status-bar {
  font-size: 11px;
}

.toolbar {
  padding: 4px 6px;
  gap: 6px;
}

.toolbar-group {
  gap: 5px;
}

.history-btn {
  width: 78px;
  height: 38px;
  line-height: 1.05;
  padding: 2px 4px;
}

.day-nav select,
#viewModeSelect,
#editModeSelect {
  min-width: 70px;
  height: 28px;
  padding: 2px 6px;
}

.editor-area {
  gap: 6px;
}

.work-panel {
  width: 42px;
  flex-basis: 42px;
  padding: 4px 3px;
}

.work-panel h2 {
  margin: 0 0 3px;
  font-size: 12px;
}

.selected-work {
  display: none;
}

.work-item {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
}

.work-chip {
  width: 32px;
  min-height: 22px;
  border-radius: 0;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.work-item.selected .work-chip {
  outline: 2px solid #0078d7;
  outline-offset: 0;
}

.work-shortcut {
  font-size: 10px;
  width: 8px;
  overflow: hidden;
}

.grid-section {
  background: #ffffff;
}

.grid-meta {
  padding: 4px 8px;
  background: #f8f8f8;
}

.grid-wrap {
  background: #ffffff;
}

.schedule-grid {
  font-size: 11px;
  table-layout: fixed;
}

.schedule-grid th,
.schedule-grid td {
  height: 24px;
  min-width: 22px;
  width: 22px;
  border-right: 1px solid #dedede;
  border-bottom: 1px solid #c8c8c8;
}

.schedule-grid thead th {
  height: 28px;
  background: #eeeeee;
  color: #000000;
  font-size: 12px;
}

.two-line-grid thead .sticky-col,
.schedule-grid thead .staff-head {
  background: #eeeeee;
}

.two-line-grid .staff-col {
  left: 0;
  min-width: 158px;
  width: 158px;
  max-width: 158px;
  background: #ffffff;
}

.two-line-grid .type-col {
  left: 158px;
  min-width: 36px;
  width: 36px;
  max-width: 36px;
  background: #ffffff;
  border-right: 0;
  text-align: right;
  padding: 0 4px 0 0;
}

.two-line-grid .info-col {
  left: 194px;
  min-width: 160px;
  width: 160px;
  max-width: 160px;
  background: #ffffff;
  border-right: 2px solid #8c8c8c;
  padding: 0 4px 0 2px;
}

.two-line-grid .staff-name {
  background: #ffffff;
  text-align: left;
  padding: 0 6px;
  font-size: 12px;
  border-bottom: 1px solid #c8c8c8;
}

.two-line-grid .staff-name-text {
  font-weight: 700;
}

.two-line-grid .staff-name-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.two-line-grid .staff-name-main {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.two-line-grid .staff-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.staff-type-badge {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  font-weight: 700;
}

.staff-no {
  min-width: 24px;
  color: #333333;
  font-size: 11px;
  margin-right: 2px;
}

.two-line-grid .row-type {
  font-size: 10px;
  font-weight: 400;
  color: #333333;
}

.two-line-grid .row-info {
  font-size: 11px;
  font-weight: 600;
  color: #000000;
}

.two-line-grid .staff-shift-row th,
.two-line-grid .staff-shift-row td,
.two-line-grid .staff-work-row th,
.two-line-grid .staff-work-row td {
  height: 24px;
}

.two-line-grid .staff-work-row th,
.two-line-grid .staff-work-row td {
  border-bottom: 1px solid #a9a9a9;
}

.two-line-grid .remaining-text {
  color: #ff0000;
  font-weight: 700;
}

.two-line-grid .cell {
  min-width: 22px;
  width: 22px;
  height: 24px;
  background: #ffffff;
  position: relative;
  overflow: visible;
}

.two-line-grid .time-head {
  min-width: 22px;
  width: 22px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  vertical-align: top;
  padding-top: 7px;
  overflow: visible;
  white-space: nowrap;
}

.two-line-grid .time-head.hour-start {
  border-left: 2px solid #7d7d7d;
  text-align: left;
  padding-left: 1px;
}

.schedule-grid td.hour-start {
  border-left: 2px solid #8c8c8c;
}

.two-line-grid .shift-line-cell.shift-band {
  background: #c9c9c9;
}

.two-line-grid .work-line-cell.shift.work-empty {
  background: #bdefff;
}

.two-line-grid .work-line-cell.worked {
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.cell.painting {
  outline: 2px solid #0078d7;
  outline-offset: -2px;
}

.status-bar {
  padding: 4px 8px;
  background: #eeeeee;
}

/* v0.7: 作業帯も連結表示 */
.work-panel {
  width: 54px;
  flex-basis: 54px;
  padding: 4px 3px;
}

.work-item {
  display: grid;
  grid-template-columns: 34px 10px;
  align-items: center;
  gap: 2px;
  width: 46px;
}

.work-chip {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  min-height: 22px;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  word-break: keep-all;
  line-height: 22px;
  display: block;
  text-align: center;
  font-size: 12px;
}

.work-shortcut {
  width: 10px;
  min-width: 10px;
  text-align: left;
}

.schedule-grid th,
.schedule-grid td,
.two-line-grid .cell,
.two-line-grid .time-head {
  min-width: var(--slot-width, 17px);
  width: var(--slot-width, 17px);
  max-width: var(--slot-width, 17px);
}

.two-line-grid .cell {
  height: 22px;
}

.two-line-grid .staff-shift-row th,
.two-line-grid .staff-shift-row td,
.two-line-grid .staff-work-row th,
.two-line-grid .staff-work-row td {
  height: 22px;
}

.two-line-grid .time-head {
  position: sticky;
  top: 0;
  height: 28px;
  overflow: visible;
  padding: 0;
  vertical-align: top;
  z-index: 5;
}

.two-line-grid .time-head .time-label {
  position: absolute;
  top: 6px;
  left: 2px;
  display: block;
  width: 48px;
  text-align: left;
  white-space: nowrap;
  pointer-events: none;
  font-size: 12px;
  font-weight: 700;
  color: #000;
  z-index: 7;
}

.two-line-grid .time-head.hour-start {
  padding-left: 0;
}

.two-line-grid .shift-line-cell.shift-band {
  position: relative;
  background: #c9c9c9;
}

.two-line-grid .shift-line-cell.shift-band.band-start,
.two-line-grid .shift-line-cell.shift-band.band-middle {
  border-right-color: #c9c9c9;
}

.two-line-grid .shift-line-cell.shift-band.band-end {
  border-right-color: #dedede;
}

.two-line-grid .shift-line-cell.hour-start.shift-band {
  border-left: 2px solid #8c8c8c;
}

.shift-band-label {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.two-line-grid .work-line-cell.worked {
  font-size: 10px;
  letter-spacing: -0.5px;
}


/* v0.8: 作業行も同じ作業が続く範囲を1本の帯として見せる */
.two-line-grid .work-line-cell.worked {
  position: relative;
  overflow: visible;
  font-size: 10px;
  letter-spacing: 0;
}

/* v0.8: 作業帯の15分単位線は薄いグレーにして目立たせない */
.two-line-grid .work-line-cell.worked.work-band-start,
.two-line-grid .work-line-cell.worked.work-band-middle {
  border-right-color: rgba(0, 0, 0, 0.10);
}

.two-line-grid .work-line-cell.worked.work-band-end {
  border-right-color: rgba(0, 0, 0, 0.12);
}

.two-line-grid .work-line-cell.hour-start.worked {
  border-left: 2px solid #8c8c8c;
}

.work-band-label {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: inherit;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

/* v0.9: 作業マスタ編集モーダル */
button.primary {
  background: #e8f0fe;
  border-color: #4f79d9;
  font-weight: 700;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-dialog {
  width: min(980px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #eeeeee;
  border: 1px solid #777777;
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #c0c0c0;
}

.modal-footer {
  border-top: 1px solid #c0c0c0;
  border-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 14px;
  flex: 1;
}

.modal-close {
  min-width: 30px;
  padding: 2px 8px;
  font-size: 16px;
  line-height: 1;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 8px 10px;
  background: #f5f5f5;
}

.modal-note {
  margin: 0 0 8px;
  color: #444;
  font-size: 12px;
}

.modal-spacer {
  flex: 1;
}

.work-master-table-wrap {
  overflow: auto;
  border: 1px solid #b6b6b6;
  background: #fff;
}

.work-master-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 12px;
}

.work-master-table th,
.work-master-table td {
  border-right: 1px solid #d0d0d0;
  border-bottom: 1px solid #d0d0d0;
  padding: 4px;
  text-align: left;
  height: 30px;
}

.work-master-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e6e6e6;
  font-weight: 700;
}

.work-master-table .wm-order {
  width: 58px;
  text-align: center;
  white-space: nowrap;
}

.work-master-table .wm-id {
  width: 44px;
  text-align: right;
  color: #444;
  padding-right: 8px;
}

.work-master-table input[type="text"] {
  width: 100%;
  height: 24px;
  border: 1px solid #999;
  padding: 2px 4px;
  font: inherit;
}

.work-master-table input[type="color"] {
  width: 48px;
  height: 24px;
  padding: 0;
  border: 1px solid #999;
  background: #fff;
}

.wm-name { min-width: 180px; }
.wm-short { min-width: 70px; }
.wm-shortcut { width: 42px !important; text-align: center; }

.wm-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 22px;
  border: 1px solid rgba(0,0,0,.35);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}

.wm-move {
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  margin-right: 2px;
  line-height: 1;
}

.wm-move:disabled {
  color: #aaa;
  border-color: #ccc;
  background: #f3f3f3;
}

.wm-delete {
  color: #dc2626;
  border-color: #d79a9a;
  padding: 2px 8px;
}

/* v0.16: 出勤行内の休憩帯 */
.two-line-grid .shift-line-cell.shift-break {
  position: relative;
  background: #eeeeee;
}

.two-line-grid .shift-line-cell.shift-break.band-start,
.two-line-grid .shift-line-cell.shift-break.band-middle {
  border-right-color: #eeeeee;
}

.two-line-grid .shift-line-cell.shift-break.band-end {
  border-right-color: #dedede;
}

.two-line-grid .shift-line-cell.hour-start.shift-break {
  border-left: 2px solid #8c8c8c;
}

.shift-break-label {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #333;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.two-line-grid .work-line-cell.work-break {
  background: #f4f4f4;
  border-right-color: rgba(0, 0, 0, 0.08);
}

/* v0.16 add-on: 出勤行の8時間超過部分を残業として赤表示 */
.two-line-grid .shift-line-cell.shift-overtime {
  position: relative;
  background: #ff8a8a;
}

.two-line-grid .shift-line-cell.shift-overtime.band-start,
.two-line-grid .shift-line-cell.shift-overtime.band-middle {
  border-right-color: #ff8a8a;
}

.two-line-grid .shift-line-cell.shift-overtime.band-end {
  border-right-color: #dedede;
}

.two-line-grid .shift-line-cell.hour-start.shift-overtime {
  border-left: 2px solid #8c8c8c;
}

.shift-overtime-label {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #000;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.range-controls select {
  padding: 7px 8px;
  min-width: 76px;
}

.range-controls #rangeModeSelect {
  min-width: 70px;
}

.range-separator {
  color: var(--muted);
  font-weight: 700;
}

/* v0.20: 年月入力 */
.month-control input[type="month"] {
  height: 28px;
  padding: 2px 6px;
  min-width: 118px;
  border: 1px solid #aeb9cc;
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

/* v0.30: 自動作成準備用の設定管理 */
.auto-settings-dialog {
  width: min(1180px, calc(100vw - 36px));
}

.auto-settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section {
  border: 1px solid #b6b6b6;
  background: #ffffff;
}

.settings-section-title {
  padding: 6px 8px;
  background: #e6e6e6;
  border-bottom: 1px solid #c8c8c8;
  font-weight: 700;
  font-size: 13px;
}

.settings-help {
  padding: 6px 8px 0;
  color: #555;
  font-size: 12px;
}

.special-condition-layout {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.special-condition-card {
  border: 1px solid #c9d1dc;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.special-condition-head,
.special-condition-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.special-condition-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.special-condition-head h3,
.special-condition-head p {
  margin: 0;
}

.special-condition-head p {
  margin-top: 3px;
  color: #5d6673;
  font-size: 12px;
}

.special-condition-rows {
  display: grid;
  gap: 7px;
}

.special-condition-row {
  flex-wrap: wrap;
  border-top: 1px solid #dde3ea;
  padding-top: 7px;
  font-size: 12px;
}

.coverage-group-name {
  width: 190px;
  min-height: 28px;
}

.coverage-group-members {
  display: flex;
  flex: 1 1 420px;
  flex-wrap: wrap;
  gap: 5px 12px;
}

.coverage-group-members label {
  white-space: nowrap;
}

.same-work-ng-pair-row select {
  min-width: 150px;
  min-height: 28px;
}

@media (max-width: 760px) {
  .special-condition-head { align-items: flex-start; }
  .same-work-ng-pair-row { align-items: flex-start; }
}

.settings-table-wrap {
  overflow: auto;
  max-height: 36vh;
  padding: 8px;
}

.settings-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.settings-table th,
.settings-table td {
  border-right: 1px solid #d0d0d0;
  border-bottom: 1px solid #d0d0d0;
  padding: 4px;
  height: 30px;
  background: #fff;
}

.settings-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eeeeee;
  font-weight: 700;
  text-align: left;
}

.settings-table select,
.settings-table input[type="text"],
.settings-table input[type="number"] {
  width: 100%;
  height: 24px;
  border: 1px solid #999;
  padding: 2px 4px;
  font: inherit;
  background: #fff;
  box-sizing: border-box;
}

.settings-table input[type="number"] {
  width: 72px;
  text-align: right;
}

.setting-no {
  width: 46px;
  text-align: right;
  color: #555;
}

.setting-name {
  min-width: 120px;
  font-weight: 700;
  white-space: nowrap;
}

.setting-work-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
  white-space: nowrap;
}

.work-rule-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  border: 1px solid rgba(0,0,0,.35);
  font-weight: 700;
  padding: 0 3px;
  box-sizing: border-box;
}

/* v0.30.1: 設定管理UI整理 */
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #b6b6b6;
  margin-bottom: 8px;
}

.settings-tab {
  appearance: none;
  border: 1px solid #b6b6b6;
  border-bottom: none;
  background: #eeeeee;
  padding: 7px 14px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

.settings-tab.active {
  background: #ffffff;
  color: #0b57d0;
  position: relative;
  top: 1px;
}

.settings-panel[hidden] {
  display: none !important;
}

.compact-settings-table {
  min-width: 900px;
}

.staff-settings-table.compact-settings-table {
  min-width: 760px;
}

.time-pair {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) auto minmax(86px, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 190px;
}

.time-pair span {
  color: #555;
  font-weight: 700;
}

.eligible-picker {
  min-width: 260px;
}

.eligible-picker-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.mini-btn {
  border: 1px solid #9ca8ba;
  background: #f7f9fc;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.eligible-summary {
  margin-left: auto;
  color: #555;
  font-size: 11px;
  font-weight: 700;
}

.eligible-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 3px 6px;
  max-height: 92px;
  overflow: auto;
  padding: 4px;
  border: 1px solid #d6dbe5;
  background: #fafafa;
}

.eligible-check-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  font-size: 11px;
}

.eligible-check-label input {
  margin: 0;
}

.rule-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 10px;
}

.rule-summary-card {
  border: 1px solid #cbd3df;
  background: #fbfcff;
  border-radius: 6px;
  padding: 10px;
}

.rule-summary-title {
  font-size: 12px;
  color: #555;
  font-weight: 700;
}

.rule-summary-value {
  margin-top: 4px;
  font-weight: 800;
  font-size: 15px;
}

.rule-summary-card p {
  margin: 6px 0 0;
  color: #555;
  font-size: 12px;
  line-height: 1.45;
}

/* v0.30.3: 選択反映UI */
.bulk-panel {
  margin: 8px 8px 0;
  padding: 8px;
  border: 1px solid #c4ccd8;
  background: #f8fbff;
  display: grid;
  gap: 7px;
}

.bulk-title {
  font-weight: 800;
  color: #222;
}

.bulk-row,
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bulk-row label {
  min-width: 92px;
  font-weight: 700;
  color: #333;
}

.bulk-row select {
  min-width: 92px;
  height: 26px;
}

.bulk-row input[type="number"] {
  width: 72px;
  height: 26px;
  border: 1px solid #999;
  padding: 2px 4px;
  font: inherit;
  text-align: right;
  box-sizing: border-box;
}

.selection-summary {
  margin-left: 4px;
  color: #555;
  font-weight: 700;
}

.setting-select {
  width: 34px;
  text-align: center;
}

.setting-select input {
  width: 16px;
  height: 16px;
}

/* v0.30.3: 設定管理を左右分割レイアウトに調整 */
.settings-split-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  align-items: start;
}

.settings-split-layout .settings-table-wrap {
  padding: 0;
  max-height: 58vh;
  border: 1px solid #d0d0d0;
  background: #ffffff;
}

.bulk-side-panel {
  margin: 0;
  min-height: 420px;
  align-self: stretch;
  align-content: start;
  grid-auto-rows: max-content;
}

.bulk-field {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid #d9e1ec;
  background: #ffffff;
  border-radius: 6px;
}

.bulk-field label {
  font-weight: 800;
  color: #333333;
}

.bulk-time-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.bulk-time-line span {
  font-weight: 800;
  color: #555555;
}

.bulk-field select,
.bulk-field input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid #999999;
  border-radius: 4px;
  padding: 2px 5px;
  font: inherit;
  background: #ffffff;
  box-sizing: border-box;
}

.bulk-field input[type="number"] {
  text-align: right;
}

.bulk-field button,
.bulk-actions-vertical button {
  width: 100%;
  min-height: 28px;
}

.bulk-actions-vertical {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: center;
}

.bulk-actions-vertical .selection-summary {
  grid-column: 1 / -1;
  margin-left: 0;
  text-align: center;
  padding: 5px 6px;
  background: #eef3fb;
  border: 1px solid #d3dce9;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .settings-split-layout {
    grid-template-columns: 1fr;
  }

  .bulk-side-panel {
    min-height: 0;
  }
}


/* v0.30.4: 設定管理モーダルの縦スクロール抑制 */
.auto-settings-dialog {
  height: min(760px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
}

.auto-settings-dialog .modal-header {
  flex-shrink: 0;
  padding: 6px 10px;
}

.modal-title-line {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.modal-title-line h2 {
  flex: 0 0 auto;
  margin: 0;
}

.modal-title-note {
  color: #555555;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auto-settings-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 6px;
  padding: 6px 8px;
}

.auto-settings-body .settings-tabs {
  flex: 0 0 auto;
}

.auto-settings-body .settings-panel.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auto-settings-body .settings-panel[hidden] {
  display: none !important;
}

.auto-settings-body .settings-section-title {
  flex: 0 0 auto;
  padding: 5px 8px;
}

.auto-settings-body .settings-help {
  flex: 0 0 auto;
  padding: 4px 8px 0;
  line-height: 1.25;
}

.auto-settings-body .settings-split-layout {
  flex: 1;
  min-height: 0;
  padding: 6px;
  gap: 8px;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
}

.auto-settings-body .bulk-side-panel {
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.auto-settings-body .bulk-field {
  padding: 6px;
  gap: 4px;
}

.auto-settings-body .settings-split-layout .settings-table-wrap {
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.auto-settings-body .settings-table th,
.auto-settings-body .settings-table td {
  height: 26px;
  padding: 3px 4px;
}

.auto-settings-body .rule-summary-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

@media (max-width: 900px) {
  .auto-settings-dialog {
    height: calc(100vh - 24px);
  }

  .modal-title-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .modal-title-note {
    white-space: normal;
  }

  .auto-settings-body {
    overflow: auto;
  }

  .auto-settings-body .settings-split-layout {
    overflow: visible;
  }
}


/* v0.30.6: 作業設定テーブルの見出し・罫線・列幅を整理 */
.work-rule-table.compact-settings-table {
  min-width: 860px;
  table-layout: fixed;
  border-left: 1px solid #d0d0d0;
  border-top: 1px solid #d0d0d0;
}

.work-rule-table th:nth-child(1) { width: 36px; }
.work-rule-table th:nth-child(2) { width: 165px; }
.work-rule-table th:nth-child(3) { width: 105px; }
.work-rule-table th:nth-child(4) { width: 300px; }
.work-rule-table th:nth-child(5) { width: 140px; }

.work-rule-layout-row td {
  vertical-align: top;
  height: auto !important;
  padding: 4px 5px !important;
}

.work-rule-main-cell {
  min-width: 150px;
  white-space: normal;
  vertical-align: top;
}

.work-rule-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  font-weight: 700;
  white-space: nowrap;
}

.work-rule-head-block {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #d7d7d7;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.work-rule-head-block label {
  font-weight: 700;
  font-size: 11px;
}

.work-rule-head-block input.work-rule-head {
  width: 72px;
  height: 24px;
  text-align: center;
}

.work-rule-time-cell {
  min-width: 100px;
}

.work-time-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  align-items: center;
  justify-items: stretch;
}

.work-time-stack select {
  width: 86px;
  height: 26px;
}

.work-time-brace {
  display: block;
  text-align: center;
  color: #111;
  font-weight: 700;
  line-height: 1;
  transform: scaleX(1.6);
}

.work-rule-eligible-cell .eligible-picker {
  min-width: 280px;
}

.work-rule-eligible-cell .eligible-picker-actions {
  margin-bottom: 3px;
}

.work-rule-eligible-cell .eligible-checks {
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  max-height: 86px;
}

.work-rule-memo-cell input.work-rule-memo {
  min-width: 110px;
}

@media (max-width: 980px) {
  .work-rule-table.compact-settings-table {
    min-width: 760px;
  }
  .work-rule-eligible-cell .eligible-checks {
    grid-template-columns: repeat(2, minmax(64px, 1fr));
  }
}


/* v0.30.6 fixes: table cells must remain table-cells, not flex/block, so borders stay continuous. */
.work-rule-table th,
.work-rule-table td {
  border: 1px solid #d0d0d0;
  box-sizing: border-box;
}

.work-rule-table .work-rule-main-cell,
.work-rule-table .work-rule-time-cell,
.work-rule-table .work-rule-eligible-cell,
.work-rule-table .work-rule-memo-cell {
  display: table-cell;
}

.work-rule-head-block {
  background: #fafafa;
}

.work-rule-memo-cell input.work-rule-memo {
  width: 100%;
  min-width: 0;
}

/* v0.30.8: 作業者増減UI */
.staff-edit-actions small {
  line-height: 1.4;
  color: #667085;
}

.danger-lite {
  color: #b00020;
  border-color: #f2aaaa !important;
  background: #fffafa !important;
}

.settings-table .staff-no-input {
  width: 54px;
  text-align: right;
}

.settings-table .staff-name-input {
  min-width: 120px;
}

.staff-settings-table.compact-settings-table {
  min-width: 860px;
}

/* v0.30.11: 曜日別設定 試作UI */
.auto-settings-body .settings-split-layout.settings-weekly-layout {
  grid-template-columns: 245px minmax(360px, 1fr) 390px;
}

.weekday-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.weekday-check-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 4px;
  border: 1px solid #d5dce8;
  background: #f7f9fc;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.weekday-check-label input {
  margin: 0;
}

.weekday-detail-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid #cfd7e3;
  background: #ffffff;
  padding: 8px;
  box-sizing: border-box;
}

.weekday-empty {
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  background: #f8fbff;
  border: 1px dashed #c8d4e3;
  border-radius: 6px;
}

.weekday-panel-title {
  font-size: 16px;
  font-weight: 900;
  color: #222;
  margin-bottom: 3px;
}

.weekday-panel-sub {
  font-size: 12px;
  color: #555;
  padding-bottom: 7px;
  border-bottom: 1px solid #e0e5ee;
  margin-bottom: 7px;
}

.weekday-grid {
  display: grid;
  gap: 6px;
}

.weekday-row {
  display: grid;
  grid-template-columns: 26px 84px minmax(0, 1fr) 44px;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid #d7deea;
  border-radius: 6px;
  background: #fbfcff;
}

.weekday-label {
  font-weight: 900;
  text-align: center;
  color: #222;
}

.weekday-mode,
.weekday-row select,
.weekday-row input {
  width: 100%;
  min-width: 0;
  height: 25px;
  border: 1px solid #999;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  box-sizing: border-box;
}

.weekday-time-block {
  display: grid;
  gap: 3px;
}

.weekday-time-block label {
  font-size: 11px;
  font-weight: 800;
  color: #555;
}

.weekday-time-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.weekday-time-pair span {
  font-weight: 900;
  color: #555;
}

.weekday-work-head {
  text-align: right;
  padding: 2px 5px;
}

.weekday-status-pill {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 24px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #eef3fb;
  border: 1px solid #d3dce9;
  color: #39485c;
  font-size: 11px;
  font-weight: 800;
}

.selected-setting-row > td {
  background: #fff9df !important;
  outline: 1px solid #e6be4b;
}

@media (max-width: 1200px) {
  .auto-settings-body .settings-split-layout.settings-weekly-layout {
    grid-template-columns: 230px minmax(320px, 1fr);
  }
  .weekday-detail-panel {
    grid-column: 1 / -1;
    max-height: 320px;
  }
}

@media (max-width: 900px) {
  .auto-settings-body .settings-split-layout.settings-weekly-layout {
    grid-template-columns: 1fr;
  }
}

/* v0.30.12: 反映パネル固定＋右側を一覧/曜日別設定のタブ切替に変更 */
.auto-settings-body .settings-split-layout.settings-weekly-layout.settings-tabbed-layout {
  grid-template-columns: 250px minmax(0, 1fr);
}

.settings-right-area {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #cfd7e3;
  background: #ffffff;
}

.settings-inner-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #cfd7e3;
  background: #eef3fb;
  padding: 4px 4px 0;
  flex: 0 0 auto;
}

.settings-inner-tab {
  min-width: 118px;
  height: 30px;
  border: 1px solid #cfd7e3;
  border-bottom: none;
  background: #f7f9fc;
  border-radius: 6px 6px 0 0;
  font-weight: 800;
  cursor: pointer;
}

.settings-inner-tab + .settings-inner-tab {
  margin-left: 4px;
}

.settings-inner-tab.active {
  background: #ffffff;
  color: #111827;
  position: relative;
  top: 1px;
}

.settings-inner-panel {
  min-height: 0;
  overflow: hidden;
  display: none;
}

.settings-inner-panel.active {
  display: block;
  height: 100%;
}

.settings-inner-panel .settings-table-wrap,
.settings-inner-panel .weekday-detail-panel {
  height: 100%;
  max-height: none;
  border: none;
  overflow: auto;
}

.settings-inner-panel .weekday-detail-panel {
  padding: 10px;
}

/* 右側をタブ化したので、一覧表は無理に横スクロールしない幅へ圧縮 */
.staff-settings-table.compact-settings-table {
  min-width: 700px;
}

.work-rule-table.compact-settings-table {
  min-width: 740px;
}

.work-rule-table th:nth-child(1) { width: 34px; }
.work-rule-table th:nth-child(2) { width: 150px; }
.work-rule-table th:nth-child(3) { width: 96px; }
.work-rule-table th:nth-child(4) { width: 300px; }
.work-rule-table th:nth-child(5) { width: 120px; }

.weekday-row {
  grid-template-columns: 32px 110px minmax(0, 1fr) 70px;
}

@media (max-width: 900px) {
  .auto-settings-body .settings-split-layout.settings-weekly-layout.settings-tabbed-layout {
    grid-template-columns: 1fr;
  }

  .settings-right-area {
    min-height: 420px;
  }
}

/* v0.30.13: 曜日別設定を1行表示に整理 */
.settings-inner-panel .weekday-detail-panel {
  overflow-x: hidden;
}

.weekday-row.weekday-row-compact {
  grid-template-columns: 34px 112px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 7px;
  min-height: 38px;
}

.weekday-row-compact .weekday-mode {
  width: 108px;
  height: 26px;
}

.weekday-inline-fields {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.weekday-field-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
  color: #3f4b5f;
}

.compact-time-pair {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: 64px auto 64px;
  align-items: center;
  gap: 4px;
}

.compact-time-pair select,
.weekday-row-compact .weekday-row select,
.weekday-row-compact select {
  min-width: 0;
}

.weekday-row-compact .weekday-time-pair select {
  width: 64px;
  height: 26px;
  padding: 1px 3px;
  font-size: 12px;
}

.compact-head-input {
  width: 58px !important;
  height: 26px;
  text-align: right;
}

.weekday-status-pill {
  display: none;
}

@media (max-width: 1080px) {
  .weekday-row.weekday-row-compact {
    grid-template-columns: 34px 104px minmax(0, 1fr);
  }
  .weekday-inline-fields {
    flex-wrap: wrap;
    row-gap: 4px;
  }
}


/* v0.30.15: 作業者の曜日別設定をモード別に判別しやすく色分け */
.staff-weekday-row.mode-default {
  background: #d7efff;
  border-color: #6db8e6;
}

.staff-weekday-row.mode-override {
  background: #fff0b8;
  border-color: #e1b33a;
}

.staff-weekday-row.mode-off {
  background: #dddddd;
  border-color: #a9a9a9;
}

.staff-weekday-row.mode-default .weekday-label,
.staff-weekday-row.mode-override .weekday-label,
.staff-weekday-row.mode-off .weekday-label {
  font-weight: 700;
}

.staff-weekday-row.mode-off .weekday-inline-fields {
  opacity: 0.55;
}

/* v0.30.16: 作業者曜日別設定の表示切替を整理 */
.weekday-static-fields {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.weekday-static-value {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 4px 8px;
  border: 1px solid rgba(70, 98, 120, 0.35);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  color: #2d3a45;
}

.weekday-off-text {
  font-weight: 900;
  color: #666;
  justify-content: flex-start;
}

.staff-weekday-row.mode-off .weekday-static-fields {
  opacity: 1;
}


/* v0.30.18: 作業の曜日別設定タブを廃止し、作業一覧内に発生曜日チェックを集約 */
.work-row-weekday-checks {
  display: grid;
  grid-template-columns: repeat(7, minmax(28px, 1fr));
  gap: 3px;
  margin-top: 6px;
  max-width: 260px;
}
.work-row-weekday-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 3px;
  border: 1px solid #d5dbe7;
  border-radius: 4px;
  background: #f8fafc;
  font-size: 11px;
  white-space: nowrap;
}
.work-row-weekday-label input {
  margin: 0;
}
.work-rule-time-cell {
  min-width: 230px;
}


/* v0.30.18: 作業設定の時間/曜日列レイアウト崩れ修正 */
.work-rule-table.compact-settings-table {
  min-width: 860px;
  table-layout: fixed;
  border-collapse: collapse;
}

.work-rule-table th:nth-child(1) { width: 34px; }
.work-rule-table th:nth-child(2) { width: 185px; }
.work-rule-table th:nth-child(3) { width: 160px; }
.work-rule-table th:nth-child(4) { width: 365px; }
.work-rule-table th:nth-child(5) { width: 145px; }

.work-rule-layout-row td {
  vertical-align: top;
  overflow: visible;
}

.work-rule-time-cell {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  box-sizing: border-box;
}

.work-rule-time-cell .work-time-stack {
  width: 98px;
  margin: 0 0 5px 0;
}

.work-rule-time-cell .work-time-stack select {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
}

.work-row-weekday-checks {
  display: grid;
  grid-template-columns: repeat(7, 20px);
  gap: 2px;
  width: 152px;
  max-width: 152px;
  margin-top: 4px;
  align-items: center;
  overflow: visible;
}

.work-row-weekday-label {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  gap: 0;
  justify-content: center;
  border-color: #cfd7e3;
  font-size: 10px;
  line-height: 1;
  box-sizing: border-box;
}

.work-row-weekday-label input {
  width: 11px;
  height: 11px;
  margin: 0 1px 0 0;
  flex: 0 0 auto;
}

.work-rule-eligible-cell .eligible-picker {
  min-width: 330px;
}

.work-rule-eligible-cell .eligible-checks {
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  max-height: 96px;
}

.work-rule-memo-cell input.work-rule-memo {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

@media (max-width: 980px) {
  .work-rule-table.compact-settings-table {
    min-width: 820px;
  }
  .work-rule-table th:nth-child(4) { width: 330px; }
  .work-rule-eligible-cell .eligible-picker { min-width: 300px; }
  .work-rule-eligible-cell .eligible-checks { grid-template-columns: repeat(3, minmax(68px, 1fr)); }
}


/* v0.30.19: 作業一覧をさらにコンパクト化。曜日を上、時間を下へ */
.work-rule-table.compact-settings-table {
  min-width: 820px;
  table-layout: fixed;
}
.work-rule-table th:nth-child(1) { width: 32px; }
.work-rule-table th:nth-child(2) { width: 170px; }
.work-rule-table th:nth-child(3) { width: 190px; }
.work-rule-table th:nth-child(4) { width: 320px; }
.work-rule-table th:nth-child(5) { width: 115px; }
.work-rule-layout-row td {
  padding: 3px 5px;
  vertical-align: top;
}
.work-rule-main-cell {
  padding-top: 3px;
  padding-bottom: 3px;
}
.work-rule-name-line {
  margin-bottom: 4px;
  line-height: 1.1;
}
.work-rule-head-block {
  display: grid;
  grid-template-columns: auto 58px;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}
.work-rule-head-block label {
  margin: 0;
  font-size: 11px;
}
.work-rule-head-block input.work-rule-head {
  height: 24px;
  width: 54px;
  padding: 2px 4px;
}
.work-rule-time-cell {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  padding-top: 3px;
}
.work-rule-weekday-top {
  margin-bottom: 4px;
}
.work-rule-weekday-top .work-row-weekday-checks {
  display: grid;
  grid-template-columns: repeat(7, 22px);
  gap: 2px;
  width: 166px;
  max-width: 166px;
  margin: 0;
}
.work-rule-weekday-top .work-row-weekday-label {
  width: 22px;
  min-width: 22px;
  height: 20px;
  padding: 0;
  font-size: 10px;
}
.work-rule-weekday-top .work-row-weekday-label input {
  width: 10px;
  height: 10px;
}
.work-time-inline {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 176px;
}
.work-time-inline select {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  height: 24px;
  padding: 2px 4px;
  font-size: 12px;
}
.work-time-inline .work-time-brace {
  width: 10px;
  text-align: center;
  line-height: 1;
}
.work-rule-time-cell .work-time-stack {
  display: none;
}
.work-rule-eligible-cell .eligible-picker {
  min-width: 300px;
}
.work-rule-eligible-cell .eligible-picker-actions {
  margin-bottom: 2px;
}
.work-rule-eligible-cell .eligible-picker-actions button {
  padding: 2px 7px;
}
.work-rule-eligible-cell .eligible-checks {
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 1px 8px;
  max-height: 74px;
  padding: 4px 6px;
}
.work-rule-eligible-cell .eligible-checks label {
  line-height: 1.1;
  font-size: 12px;
}
.work-rule-memo-cell input.work-rule-memo {
  height: 24px;
  padding: 2px 4px;
}
@media (max-width: 980px) {
  .work-rule-table.compact-settings-table { min-width: 790px; }
  .work-rule-table th:nth-child(4) { width: 285px; }
  .work-rule-eligible-cell .eligible-picker { min-width: 270px; }
  .work-rule-eligible-cell .eligible-checks { grid-template-columns: repeat(3, minmax(56px, 1fr)); }
}

/* v0.30.20: 作業一覧は3件ずつのページ切替式 */
.work-rule-page-wrap {
  overflow-x: hidden;
  overflow-y: hidden;
}
.work-rule-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 7px 8px 4px;
  border: 1px solid #c7d0dc;
  border-top: 0;
  background: #f8fbff;
  font-size: 12px;
}
.work-rule-pager button {
  min-width: 96px;
  padding: 5px 10px;
}
.work-rule-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#workRulePageInfo {
  min-width: 150px;
  text-align: center;
  font-weight: 700;
  color: #31435a;
}


/* v0.30.21: 作業一覧ページャーを表の上に固定配置 */
.work-rule-pager-top {
  border-top: 1px solid #c7d0dc;
  border-bottom: 1px solid #c7d0dc;
  margin-bottom: 4px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.work-rule-page-wrap {
  border-top: 1px solid #c7d0dc;
}


/* v0.30.22: 作業一覧の3件表示で各行の高さを揃える */
.work-rule-table.compact-settings-table tbody tr.work-rule-layout-row {
  height: 100px;
}
.work-rule-table.compact-settings-table tbody tr.work-rule-layout-row > td {
  height: 100px;
  box-sizing: border-box;
}
.work-rule-table.compact-settings-table .work-rule-main-cell,
.work-rule-table.compact-settings-table .work-rule-time-cell,
.work-rule-table.compact-settings-table .work-rule-eligible-cell,
.work-rule-table.compact-settings-table .work-rule-memo-cell {
  height: 100px;
}
.work-rule-eligible-cell .eligible-picker {
  min-height: 84px;
  box-sizing: border-box;
}
.work-rule-eligible-cell .eligible-checks {
  height: 64px;
  max-height: 64px;
  overflow: hidden;
  align-content: start;
  box-sizing: border-box;
}
.work-rule-memo-cell input.work-rule-memo {
  width: 100%;
}


/* v0.30.23: 担当可能者欄が多人数で溢れた時、欄内だけスクロール可能にする */
.work-rule-eligible-cell .eligible-checks {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 8px;
}

.work-rule-eligible-cell .eligible-checks::-webkit-scrollbar {
  width: 8px;
}

.work-rule-eligible-cell .eligible-checks::-webkit-scrollbar-thumb {
  background: #b8c2d2;
  border-radius: 999px;
}

.work-rule-eligible-cell .eligible-checks::-webkit-scrollbar-track {
  background: #eef2f7;
}

/* v0.30.24: 設定管理モーダルをできるだけ画面いっぱいにして、作業一覧3件表示の見切れを抑制 */
.auto-settings-dialog {
  height: calc(100vh - 4px) !important;
  max-height: calc(100vh - 4px) !important;
  width: min(1180px, calc(100vw - 8px));
}

.auto-settings-dialog .modal-header {
  padding: 4px 8px !important;
}

.auto-settings-dialog .modal-footer {
  padding: 4px 8px !important;
}

.auto-settings-body {
  padding: 4px 6px !important;
  gap: 4px !important;
}

.auto-settings-body .settings-tabs {
  padding: 3px 4px 0 !important;
}

.auto-settings-body .settings-tab {
  height: 28px !important;
  padding: 4px 12px !important;
}

.auto-settings-body .settings-section-title {
  padding: 4px 7px !important;
}

.auto-settings-body .settings-help {
  padding: 3px 7px 0 !important;
  line-height: 1.15 !important;
}

.auto-settings-body .settings-split-layout {
  padding: 4px !important;
  gap: 6px !important;
}

.settings-inner-tabs {
  padding: 3px 4px 0 !important;
}

.settings-inner-tab {
  height: 28px !important;
}

.work-rule-pager {
  padding: 4px 8px 3px !important;
}

/* 3件ページ表示時は、各行に必要な高さを確保しつつ、モーダル拡大分で3行収める */
.work-rule-table.compact-settings-table tbody tr.work-rule-layout-row {
  height: 106px !important;
}

.work-rule-table.compact-settings-table tbody tr.work-rule-layout-row > td,
.work-rule-table.compact-settings-table .work-rule-main-cell,
.work-rule-table.compact-settings-table .work-rule-time-cell,
.work-rule-table.compact-settings-table .work-rule-eligible-cell,
.work-rule-table.compact-settings-table .work-rule-memo-cell {
  height: 106px !important;
  min-height: 106px !important;
  box-sizing: border-box;
}

.work-rule-eligible-cell .eligible-picker {
  min-height: 90px !important;
}

.work-rule-eligible-cell .eligible-checks {
  height: 70px !important;
  max-height: 70px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.work-rule-page-wrap {
  height: auto !important;
  overflow: hidden !important;
}


/* v0.30.25 settings check */
.settings-check-panel {
  border: 1px solid #b8c7dc;
  background: #f8fbff;
  padding: 10px;
  margin: 8px 0 12px;
}
.settings-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-check-head p {
  margin: 4px 0 0;
  color: #546176;
  font-size: 12px;
}
.settings-check-result {
  margin-top: 8px;
  border: 1px solid #d5dce8;
  background: #fff;
  min-height: 44px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  font-size: 13px;
}
.settings-check-result.empty {
  color: #6b7280;
  display: flex;
  align-items: center;
}
.settings-check-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.settings-check-summary.ok { background: #e8f8ee; border: 1px solid #9fd4ae; }
.settings-check-summary.warn { background: #fff6db; border: 1px solid #e6c564; }
.settings-check-summary.error { background: #ffe7e7; border: 1px solid #e08989; }
.settings-check-summary span { color: #445066; font-size: 12px; }
.settings-check-group {
  margin-top: 8px;
  border-top: 1px solid #e0e5ee;
  padding-top: 6px;
}
.settings-check-group-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.settings-check-group.error .settings-check-group-title { color: #b42318; }
.settings-check-group.warn .settings-check-group-title { color: #9a6700; }
.settings-check-group.ok .settings-check-group-title { color: #157347; }
.settings-check-group ul {
  margin: 0;
  padding-left: 20px;
}
.settings-check-group li {
  margin: 3px 0;
}
.settings-check-group li small {
  display: block;
  color: #667085;
  margin-top: 1px;
}


/* v0.35.2: 自動作成ルール設定 */
.auto-rule-form {
  border: 1px solid #cfd8e3;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.auto-rule-form-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: #1f2937;
}
.auto-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}
.auto-rule-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
}
.auto-rule-field > span {
  font-weight: 700;
  color: #334155;
}
.auto-rule-field select,
.auto-rule-field input[type="number"] {
  width: 100%;
  max-width: 180px;
  padding: 5px 6px;
  border: 1px solid #b6c2d2;
  border-radius: 6px;
  background: #fff;
}
.auto-rule-field small {
  color: #64748b;
  line-height: 1.35;
}
.auto-rule-check-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
@media (max-width: 980px) {
  .auto-rule-grid { grid-template-columns: 1fr; }
}

.month-log-dialog {
  width: min(920px, calc(100vw - 40px));
}

.month-log-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.month-log-summary {
  border: 1px solid #c9c9c9;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.6;
}

.month-log-body {
  width: 100%;
  min-height: 360px;
  max-height: calc(100vh - 260px);
  resize: vertical;
  overflow: auto;
  border: 1px solid #999999;
  background: #ffffff;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

/* v0.35.13: 自動作成ルールタブは設定チェック結果が長くなるため、パネル全体をスクロール可能にする */
.auto-settings-body .settings-panel[data-settings-panel="rules"].active {
  overflow: auto;
  padding-right: 4px;
}

.auto-settings-body .settings-panel[data-settings-panel="rules"] .settings-check-result {
  max-height: none;
}

/* v0.36.8: 作業者区分の幅と区分別出勤形態設定 */
.staff-settings-table .staff-type-cell {
  width: 74px;
  min-width: 74px;
}

.staff-settings-table .staff-type-select {
  min-width: 64px;
  text-align: center;
}

.staff-type-policy-form {
  margin-top: 10px;
}

.staff-type-policy-wrap {
  overflow: auto;
  padding: 8px;
}

.staff-type-policy-table {
  min-width: 620px;
}

.staff-type-policy-table input[type="number"] {
  width: 84px;
}

.inline-help {
  padding-top: 0;
}


/* v0.36.8: 区分別出勤形態テーブルを編集しやすくする */
.staff-type-policy-table th:first-child,
.staff-type-policy-table td:first-child {
  width: 150px;
  min-width: 150px;
}

.staff-type-policy-table td:first-child small {
  display: block;
  margin-top: 2px;
  color: #666666;
  font-size: 11px;
  line-height: 1.25;
}

.staff-type-policy-table td:not(:first-child) {
  white-space: nowrap;
}

.staff-type-policy-table td span {
  margin-left: 4px;
  color: #555555;
  font-size: 12px;
}


/* v0.36.8: 単日自動配置ログをモーダル内で確実にスクロール・コピーできるよう調整 */
.month-log-dialog {
  height: min(820px, calc(100vh - 40px));
}
.month-log-content {
  flex: 1 1 auto;
  overflow: hidden;
}
.month-log-body {
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  overflow: auto;
  box-sizing: border-box;
}


/* v0.37.21: 作業一覧を1.5倍幅へ。作業設定に配置方式/許可範囲を追加。 */
.work-rule-mode-block {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}
.work-rule-mode-block label,
.work-time-mini-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.work-rule-mode {
  width: 100%;
  min-height: 28px;
}
.work-flex-time-inline {
  margin-top: 4px;
}
.work-time-mini-label {
  min-width: 28px;
}


/* v0.37.21: 左端パレットの外枠だけ広げ、チップ/ショートカット幅は元に戻す */
.editor-area > .work-panel {
  width: 81px !important;
  flex: 0 0 81px !important;
  flex-basis: 81px !important;
  padding: 4px 5px !important;
}

.editor-area > .work-panel .work-palette {
  padding-right: 2px;
}

.editor-area > .work-panel .work-item {
  grid-template-columns: 34px 10px !important;
  gap: 2px !important;
  width: 46px !important;
}

.editor-area > .work-panel .work-chip {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
}

.editor-area > .work-panel .work-shortcut {
  width: 10px !important;
  min-width: 10px !important;
  text-align: left !important;
}

/* v0.37.21: 作業×時間ビュー */
.work-time-grid .sticky-col {
  position: sticky;
  z-index: 6;
  background: #ffffff;
}

.work-time-grid thead .sticky-col {
  z-index: 9;
  background: #eeeeee;
}

.work-time-grid .work-view-work-col {
  left: 0;
  min-width: 132px;
  width: 132px;
  max-width: 132px;
  border-right: 1px solid #c8c8c8;
}

.work-time-grid .work-view-info-col {
  left: 132px;
  min-width: 220px;
  width: 220px;
  max-width: 220px;
  border-right: 2px solid #8c8c8c;
}

.work-time-grid .work-view-name,
.work-time-grid .work-view-info {
  text-align: left;
  padding: 0 4px;
  background: #ffffff;
  white-space: nowrap;
  overflow: hidden;
}

.work-time-grid .work-view-name-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.work-time-grid .work-view-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  min-height: 20px;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.work-time-grid .work-view-full-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-time-grid .work-view-info-main,
.work-time-grid .work-view-info-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-time-grid .work-view-info-main {
  font-weight: 700;
}

.work-time-grid .work-view-info-sub {
  color: #555555;
  font-size: 10px;
}

.work-time-grid .work-view-cell {
  background: #ffffff;
  overflow: hidden;
  padding: 0;
  cursor: default;
}

.work-time-grid .work-view-cell.required:not(.assigned) {
  background: #eef6ff;
}

.work-time-grid .work-view-cell.assigned {
  background: #dff3ff;
}

.work-time-grid .work-view-cell.shortage {
  background: #ffe4e6;
}

.work-time-grid .work-view-staff-label,
.work-time-grid .work-view-needed-label {
  display: block;
  font-size: 9px;
  line-height: 24px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.work-time-grid .work-view-needed-label {
  color: #b91c1c;
  font-weight: 700;
}


/* v0.37.21: 作業×時間ビューの色を少し濃くして視認性を改善 */
.work-time-grid .work-view-cell {
  border-color: #c5cbd3;
}

.work-time-grid .work-view-cell.required:not(.assigned) {
  background: #d7e8fb;
}

.work-time-grid .work-view-cell.assigned {
  background: #a9d9f1;
  color: #102a43;
  font-weight: 700;
}

.work-time-grid .work-view-cell.shortage {
  background: #ffb8c0;
  color: #7f1d1d;
  font-weight: 800;
}

.work-time-grid .work-view-staff-label {
  color: #102a43;
  font-weight: 700;
}

.work-time-grid .work-view-needed-label {
  color: #7f1d1d;
  font-weight: 800;
}

.work-time-grid .work-view-info-sub {
  color: #374151;
}


/* v0.37.21: 作業×時間ビューはセル内に作業者名を出さず、ホバー表示へ寄せる */
.work-time-grid .work-view-cell.assigned {
  color: transparent;
}

.work-time-grid .work-view-cell.assigned.education-pair {
  background: #d8c7f3;
  box-shadow: inset 0 0 0 1px #8b5fbf;
}

.work-time-grid .work-view-staff-label {
  display: none;
}

.work-time-grid .work-view-needed-label {
  display: block;
  font-size: 10px;
  line-height: 24px;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

/* v0.37.21: 合計時間型を常時人数作業より後に配置する調整。 */

/* v0.37.21 希望休/希望勤務 */
.staff-request-panel {
  min-width: 0;
}
.staff-request-help,
.staff-request-legend {
  font-size: 12px;
  color: #374151;
  margin: 0 0 8px;
}
.staff-request-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.request-chip {
  display: inline-flex;
  min-width: 28px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,.12);
}
.request-chip.off, .request-chip.public { background: #fee2e2; color: #991b1b; }
.request-chip.paid { background: #e0e7ff; color: #3730a3; }
.request-chip.work { background: #dcfce7; color: #166534; }
.request-chip.blank { background: #f3f4f6; color: #4b5563; }
.staff-request-table-wrap {
  overflow: auto;
  max-height: 58vh;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
}
.staff-request-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.staff-request-table th,
.staff-request-table td {
  white-space: nowrap;
  text-align: center;
  padding: 4px;
}
.staff-request-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}
.staff-request-table .request-staff-head {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 130px;
  text-align: left;
  background: #f8fafc;
}
.staff-request-table tbody .request-staff-head {
  background: #ffffff;
}
.request-staff-head span,
.request-day-head span {
  display: block;
  font-weight: 700;
}
.request-staff-head small,
.request-day-head small {
  display: block;
  font-size: 10px;
  color: #64748b;
}
.staff-request-select {
  width: 46px;
  min-width: 46px;
  font-size: 12px;
  padding: 2px 4px;
}
.staff-request-select option[value="off_public"] { background: #fee2e2; color: #991b1b; }
.staff-request-select option[value="paid"] { background: #e0e7ff; color: #3730a3; }
.staff-request-select option[value="work"] { background: #dcfce7; color: #166534; }


/* v0.37.21: 作業者の曜日別設定を、左の名前一覧から直接切り替える */
.staff-weekday-editor {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.weekday-staff-list {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid #d6deea;
  padding-right: 8px;
}

.weekday-staff-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  margin-bottom: 4px;
  border: 1px solid #d7e0ec;
  border-radius: 7px;
  background: #f8fbff;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.weekday-staff-list-item:hover {
  background: #eef6ff;
  border-color: #9fc5ea;
}

.weekday-staff-list-item.active {
  background: #dbeafe;
  border-color: #2563eb;
  color: #0f172a;
  box-shadow: inset 3px 0 0 #2563eb;
}

.weekday-staff-list-no {
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.weekday-staff-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekday-staff-list-type {
  justify-self: end;
  color: #475569;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 1px 5px;
  background: #ffffff;
}

.weekday-staff-list-empty {
  padding: 10px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.staff-weekday-detail-body {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

@media (max-width: 900px) {
  .staff-weekday-editor {
    grid-template-columns: 1fr;
  }

  .weekday-staff-list {
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid #d6deea;
    padding-right: 0;
    padding-bottom: 8px;
  }
}

/* v0.37.21 希望休/勤務内の作業不可時間 */
.staff-work-block-editor {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border-soft, #d7dde8);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
}
.staff-work-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}
.staff-work-block-head h4 {
  margin: 0 0 2px;
  font-size: 14px;
}
.staff-work-block-head small {
  color: var(--text-muted, #667085);
}
.staff-work-block-table-wrap {
  overflow-x: auto;
}
.staff-work-block-table th,
.staff-work-block-table td {
  white-space: nowrap;
}
.staff-work-block-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.staff-work-block-memo {
  min-width: 150px;
}

/* v0.37.21: 希望休/勤務画面で作業不可時間が下に隠れないよう、上部固定＋一覧スクロールに変更 */
.staff-request-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.staff-request-main-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}
.staff-request-panel .staff-request-table-wrap {
  min-height: 0;
  max-height: none;
}
.staff-request-panel .staff-work-block-editor {
  flex: 0 0 auto;
  margin-top: 0;
}
.staff-work-block-table-wrap {
  max-height: 150px;
  overflow: auto;
}
.staff-work-block-table {
  min-width: 680px;
}
@media (max-height: 720px) {
  .staff-work-block-table-wrap {
    max-height: 110px;
  }
}

/* v0.37.21: 作業不可設定を独立タブ化し、ワースケへ表示 */
.staff-work-block-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
}

.staff-work-block-editor-standalone {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.work-line-cell.work-unavailable-band,
.cell.work-unavailable-band {
  background: #f4b183 !important;
  color: #111827 !important;
}

.work-unavailable-label {
  color: #111827 !important;
  font-weight: 900;
}

/* v0.37.21: 作業不可ラベルは該当セルを基準に配置する */
.two-line-grid .work-line-cell {
  position: relative;
  overflow: visible;
}

.two-line-grid .work-line-cell .work-band-label {
  top: 0;
  bottom: auto;
  height: 100%;
  line-height: 1;
}


/* v0.37.21: 担当可能者を ×/○/◎ の3段階へ拡張 */
.eligible-levels {
  grid-template-columns: repeat(2, minmax(118px, 1fr));
}
.eligible-level-label {
  justify-content: space-between;
  gap: 6px;
}
.eligible-staff-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eligible-level-select {
  width: 42px;
  height: 22px;
  padding: 0 2px;
  font-size: 12px;
}
.work-rule-eligible-cell .eligible-checks.eligible-levels {
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  max-height: 84px;
}
@media (max-width: 980px) {
  .work-rule-eligible-cell .eligible-checks.eligible-levels {
    grid-template-columns: repeat(2, minmax(104px, 1fr));
  }
}


/* v0.37.21: 作業設定の曜日/時間欄と担当可能者3段階UIを微調整 */
.work-rule-table.compact-settings-table th:nth-child(3) {
  width: 176px !important;
}
.work-rule-time-cell {
  width: 176px !important;
  min-width: 176px !important;
  max-width: 176px !important;
  overflow: hidden !important;
}
.work-rule-weekday-top .work-row-weekday-checks {
  grid-template-columns: repeat(7, 20px) !important;
  width: 152px !important;
  max-width: 152px !important;
  gap: 2px !important;
}
.work-rule-weekday-top .work-row-weekday-label {
  width: 20px !important;
  min-width: 20px !important;
}
.work-time-inline {
  display: grid !important;
  grid-template-columns: 26px 58px 9px 58px !important;
  gap: 2px !important;
  width: 156px !important;
  max-width: 156px !important;
  align-items: center !important;
}
.work-time-mini-label {
  min-width: 0 !important;
  width: 26px !important;
  font-size: 10px !important;
}
.work-time-inline select {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  height: 23px !important;
  padding: 1px 2px !important;
  font-size: 11px !important;
}
.work-time-inline .work-time-brace {
  width: 9px !important;
  min-width: 9px !important;
  transform: none !important;
}
.work-rule-table.compact-settings-table th:nth-child(4) {
  width: 384px !important;
}
.work-rule-eligible-cell .eligible-picker {
  min-width: 360px !important;
}
.work-rule-eligible-cell .eligible-checks.eligible-levels,
.eligible-levels {
  grid-template-columns: repeat(2, minmax(160px, 1fr)) !important;
  gap: 1px 10px !important;
}
.eligible-level-label {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 28px !important;
  gap: 4px !important;
  align-items: center !important;
}
.eligible-staff-name {
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
.eligible-level-select {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 21px !important;
  padding: 0 !important;
  font-size: 12px !important;
  text-align: center !important;
}

/* v0.37.21 education schedule editor */
.staff-education-panel .staff-work-block-table-wrap,
.staff-education-editor-standalone .staff-work-block-table-wrap {
  max-height: 520px;
  overflow: auto;
}
.staff-education-table th,
.staff-education-table td {
  white-space: nowrap;
}
.staff-education-table .staff-education-staff,
.staff-education-table .staff-education-work,
.staff-education-table .staff-education-teacher {
  max-width: 180px;
}
.staff-education-table .staff-education-memo {
  width: 140px;
}
