/* Staff master table readability hardening.
   The staff table is intentionally allowed to grow horizontally instead of
   squeezing Japanese labels/names into vertical character wrapping. */

.staff-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.staff-table th,
.staff-table td {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  vertical-align: middle;
  line-height: 1.45;
}

.staff-table th {
  padding: 10px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
}

.staff-table td {
  padding: 10px 10px;
  font-size: 12.5px;
  height: 58px;
}

.staff-table th.staff-sticky,
.staff-table td.staff-sticky {
  min-width: 92px;
  max-width: 150px;
  padding-left: 14px;
  padding-right: 14px;
  box-shadow: 1px 0 0 var(--border);
}

.staff-table td.staff-sticky strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 122px;
  font-size: 13px;
}

.staff-table .inline-select {
  width: auto;
  min-width: 82px;
  max-width: 116px;
  height: 36px;
  padding: 6px 28px 6px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.staff-table input.inline-select[type="text"] {
  min-width: 56px;
  width: 56px !important;
  max-width: 56px;
  padding: 6px 8px;
}

.staff-table .checkbox-row {
  min-width: 32px;
  margin: 0;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.staff-table .checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 15px;
}

/* Checkbox-style columns should stay compact instead of consuming the same
   width as editable select columns. :has is supported by current Safari,
   Chromium and WebKit used by the app. */
.staff-table td:has(> .checkbox-row) {
  min-width: 54px;
  width: 54px;
  padding-left: 7px;
  padding-right: 7px;
  text-align: center;
}

.staff-table td:has(> .checkbox-row .status-badge),
.staff-table td:has(> .checkbox-row .badge) {
  min-width: 82px;
  width: auto;
}

.staff-table td:last-child,
.staff-table th:last-child {
  width: 68px;
  min-width: 68px;
  text-align: center;
}

/* Keep the whole table inside its own horizontal scroller. The page itself
   must never become wider than the viewport. */
.table-wrap:has(> .staff-table) {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-wrap:has(> .staff-table)::-webkit-scrollbar {
  height: 9px;
}

.table-wrap:has(> .staff-table)::-webkit-scrollbar-thumb {
  background: #cfd5de;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.table-wrap:has(> .staff-table)::-webkit-scrollbar-track {
  background: #f4f6f8;
}

@media (max-width: 900px) {
  .staff-table th {
    padding: 9px 8px;
    font-size: 11px;
  }

  .staff-table td {
    padding: 9px 8px;
    height: 54px;
    font-size: 12px;
  }

  .staff-table th.staff-sticky,
  .staff-table td.staff-sticky {
    min-width: 88px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .staff-table td.staff-sticky strong {
    max-width: 104px;
  }

  .staff-table .inline-select {
    min-width: 78px;
    max-width: 108px;
    height: 34px;
  }
}
