/* Every HRMS table keeps its columns, sorting, selection and action slots.
   Wide data scrolls within the table, while the page stays within the viewport. */
.v-application .hrms-responsive-table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--hrms-muted) var(--hrms-surface-muted);
}

.v-application .hrms-responsive-table > .v-data-table__wrapper:focus-visible {
  outline: 2px solid var(--hrms-primary);
  outline-offset: -2px;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper::-webkit-scrollbar-track {
  background: var(--hrms-surface-muted);
}

.v-application .hrms-responsive-table > .v-data-table__wrapper::-webkit-scrollbar-thumb {
  background: var(--hrms-muted);
  border: 2px solid var(--hrms-surface-muted);
  border-radius: 8px;
}

.v-application .hrms-table-scroll-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hrms-border);
  background: var(--hrms-surface-muted);
  color: var(--hrms-muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.v-application .hrms-table-scroll-hint::before {
  content: '\2194';
  flex-shrink: 0;
  color: var(--hrms-primary);
  font-size: 18px;
  line-height: 1;
}

.v-application .hrms-table-scroll-hint[hidden] {
  display: none;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper > table {
  width: 100%;
  /* Legacy pages hard-coded table widths between 1080px and 1560px. Let
     the visible column headers and content determine the required width. */
  min-width: 100% !important;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper > table th {
  white-space: nowrap;
}

.v-application .hrms-responsive-table > .v-data-table__wrapper > table td {
  overflow-wrap: anywhere;
}

.v-application .hrms-responsive-table :is(
  .purpose-text, .all-travel-purpose, .travel-leg-project, .travel-leg-activity,
  .attachment-file-link, .rop-expense-remarks, .rop-checklist-attachment-name,
  .purchase-item-description, .purchase-item-remarks, .project-activity-project,
  .missing-attendance-remarks, .employee-attendance-remarks,
  .my-leave-truncated, .leave-ellipsis, .lookup-description, .lookup-types-description
),
.v-application .hrms-responsive-table :is(.rop-purpose, .purchase-purpose) .table-primary-text {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
}

.v-application .hrms-responsive-table :is(.table-actions, .all-travel-actions, .vms-approval-actions) {
  flex-wrap: wrap;
  gap: 6px;
}

/* Rows and controls keep their native markup. Only the surrounding controls wrap. */
.v-application .hrms-responsive-table .v-data-footer {
  max-width: 100%;
  margin: 0;
  padding: 8px 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.v-application .hrms-responsive-table .v-data-footer__select,
.v-application .hrms-responsive-table .v-data-footer__pagination {
  margin: 0;
}

.v-application :is(
  .users-pagination, .attendance-management-pagination, .leave-management-pagination,
  .my-leave-pagination, .users-table-actions, .attendance-management-actions,
  .table-toolbar, .leave-table-toolbar, .leave-ledger-results-header
) {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.v-application :is(
  .users-pagination, .attendance-management-pagination, .leave-management-pagination,
  .my-leave-pagination, .users-table-actions, .attendance-management-actions
) > .d-flex {
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 599px) {
  .v-application .hrms-responsive-table > .v-data-table__wrapper > table :is(th, td) {
    padding-left: 12px;
    padding-right: 12px;
  }

  .v-application .hrms-responsive-table .v-data-footer {
    justify-content: center;
    padding: 8px;
  }

  .v-application .hrms-responsive-table .v-data-footer__select {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .v-application .hrms-responsive-table .v-data-footer__select .v-select {
    margin: 0;
  }

  .v-application :is(
    .users-pagination, .attendance-management-pagination,
    .leave-management-pagination, .my-leave-pagination
  ) > .v-pagination {
    flex: 1 1 100%;
  }

  /* The ledger's grouped headers use the same inner scroll region as reports. */
  .v-application .ledger-table {
    overflow: visible;
  }

  .v-application .leave-ledger-table .employee-summary .v-chip {
    height: auto;
    min-height: 32px;
    max-width: 100%;
  }

  .v-application .leave-ledger-table .employee-summary .v-chip__content {
    height: auto;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
