.ams-report-page {
  --ams-report-primary: #F97316;
  --ams-report-primary-dark: #EA580C;
  --ams-report-secondary: #FE9F43;
  --ams-report-bg: #FFF8F1;
  --ams-report-card: #FFFFFF;
  --ams-report-input: #FFFDFB;
  --ams-report-text: #1F2937;
  --ams-report-muted: #6B7280;
  --ams-report-border: #F5D7BE;
  --ams-report-soft-border: #FEE4CC;
  max-width: 100%;
  padding: clamp(12px, 1.8vw, 22px) clamp(8px, 1.4vw, 16px) 32px;
  color: var(--ams-report-text);
}

.ams-report-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 2px solid #FEEAD8;
}

.ams-report-header-icon {
  width: clamp(46px, 8vw, 56px);
  height: clamp(46px, 8vw, 56px);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--ams-report-primary), var(--ams-report-secondary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: clamp(20px, 4vw, 26px);
  box-shadow: 0 8px 20px rgba(249, 115, 22, .24);
  flex: 0 0 auto;
}

.ams-report-title h2 {
  font-size: clamp(21px, 3vw, 28px);
  line-height: 1.15;
  font-weight: 700;
  color: var(--ams-report-text);
  margin: 0 0 5px;
}

.ams-report-title p {
  color: var(--ams-report-muted);
  font-size: clamp(13px, 2vw, 14px);
  margin: 0;
}

.ams-report-card {
  background: var(--ams-report-card);
  border: 1px solid var(--ams-report-border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(249, 115, 22, .08);
  overflow: hidden;
}

.ams-report-card + .ams-report-card {
  margin-top: 16px;
}

.ams-report-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(12px, 1.8vw, 18px);
  border-bottom: 1px solid var(--ams-report-soft-border);
  background: linear-gradient(to right, rgba(255, 251, 246, .9), rgba(255, 248, 241, .45));
}

.ams-report-card-head i {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ams-report-primary), var(--ams-report-secondary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex: 0 0 auto;
}

.ams-report-card-head h3 {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ams-report-text);
  margin: 0;
}

.ams-report-card-body {
  padding: clamp(12px, 1.8vw, 18px);
}

.ams-report-filter-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.ams-report-filter-grid.has-pay-type {
  grid-template-columns: repeat(14, minmax(0, 1fr));
}

.ams-report-filter-field {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ams-report-filter-field.is-wide {
  grid-column: span 4;
}

.ams-report-filter-field.is-compact {
  grid-column: span 2;
}

.ams-report-filter-actions {
  grid-column: span 2;
}

.ams-report-filter-field label {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
}

.ams-report-filter-field .form-control,
.ams-report-filter-field .form-select {
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--ams-report-border);
  background: var(--ams-report-input);
  color: var(--ams-report-text);
  font-size: 14px;
  padding: 10px 13px;
  box-shadow: none;
  transition: .22s ease;
}

.ams-report-filter-field .form-control:focus,
.ams-report-filter-field .form-select:focus {
  border-color: var(--ams-report-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, .10);
}

.ams-report-btn {
  min-height: 44px;
  width: 100%;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ams-report-primary), var(--ams-report-secondary));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(249, 115, 22, .22);
  transition: .22s ease;
}

.ams-report-btn:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(249, 115, 22, .28);
}

.ams-report-table-wrap {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.ams-report-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.ams-report-meta h5 {
  font-size: 18px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 4px;
}

.ams-report-meta p,
.ams-report-generated {
  color: var(--ams-report-muted);
  font-size: 13px;
  margin: 0;
}

.ams-report-generated {
  text-align: right;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 12px;
  padding: 8px 10px;
}

.ams-report-table-wrap .table-wrap-x {
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.ams-report-table-wrap .main_table {
  margin: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  width: max-content !important;
  max-width: none;
  table-layout: auto;
  transform-origin: top left;
}

.ams-report-table-wrap #employee-detail-table {
  min-width: 1600px;
}

.ams-report-table-wrap #branch-summary-table {
  min-width: 1420px;
}

.ams-report-table-wrap .main_table thead th {
  background: #FFF7ED;
  color: #7C2D12;
  border-bottom: 1px solid #FED7AA;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1.2;
  padding: 10px 9px;
}

.ams-report-table-wrap .dataTables_wrapper {
  overflow: hidden;
}

.ams-report-table-wrap .dataTables_wrapper .dataTables_scroll,
.ams-report-table-wrap .dataTables_wrapper .dataTables_scrollBody {
  overflow: visible !important;
}

.ams-report-table-wrap .main_table tbody td,
.ams-report-table-wrap .main_table tfoot th {
  color: #374151;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  padding: 11px 9px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.ams-report-table-wrap .main_table tbody tr:hover td {
  background: #FFF9F2;
}

.ams-report-table-wrap .main_table tfoot th {
  background: #FFFBF6;
  color: #7C2D12;
  font-weight: 700;
}

.ams-report-table-wrap .js-view-photo,
.ams-report-table-wrap .js-branch-employee-report {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ams-report-table-wrap .js-view-photo:hover,
.ams-report-table-wrap .js-branch-employee-report:hover {
  background: #FFEDD5;
  border-color: #FDBA74;
}

.ams-report-table-wrap .dataTables_wrapper {
  width: 100%;
}

.ams-report-table-wrap .dataTables_wrapper .row {
  --bs-gutter-x: .5rem;
}

.ams-report-table-wrap .dataTables_wrapper .dt-buttons,
.ams-report-table-wrap .dataTables_wrapper .dataTables_length,
.ams-report-table-wrap .dataTables_wrapper .dataTables_filter {
  float: none;
  margin-bottom: 10px;
  font-size: 12px;
}

.ams-report-table-wrap .dataTables_wrapper .dataTables_filter {
  text-align: right;
}

.ams-report-table-wrap .dataTables_wrapper .dt-buttons .btn,
.ams-report-table-wrap .dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 10px !important;
}

.ams-report-table-wrap .dt-button-collection {
  border: 1px solid #FED7AA;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(31, 41, 55, .14);
  padding: 8px;
}

.ams-report-table-wrap .dataTables_filter input,
.ams-report-table-wrap .dataTables_length select {
  border-radius: 8px;
  border: 1.5px solid var(--ams-report-border);
  background: var(--ams-report-input);
  min-height: 34px;
  font-size: 12px;
  padding: 5px 8px;
}

.ams-report-table-wrap .dt-buttons .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 11px;
}

@media (max-width: 1366px) and (min-width: 768px) {
  .ams-report-table-wrap .main_table thead th {
    font-size: 10px;
    padding: 9px 7px;
  }

  .ams-report-table-wrap .main_table tbody td,
  .ams-report-table-wrap .main_table tfoot th {
    font-size: 11px;
    padding: 10px 7px;
  }

  .ams-report-generated,
  .ams-report-meta p {
    font-size: 11px;
  }
}

.ams-report-empty {
  color: var(--ams-report-muted);
  margin: 0;
}

.ams-payroll-summary-grid,
.ams-payroll-custom-deductions {
  --ams-payroll-font: clamp(11px, .72vw, 12px);
  --ams-payroll-head-font: clamp(11px, .76vw, 12px);
}

.ams-payroll-card {
  border-color: #E5E7EB !important;
  border-radius: 8px !important;
  box-shadow: none;
  height: auto;
}

.ams-payroll-card h6 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px !important;
}

.ams-payroll-table-wrap {
  overflow-x: hidden;
}

.ams-payroll-table,
.ams-rate-table,
.ams-payout-table {
  width: 100%;
  table-layout: fixed;
  font-size: var(--ams-payroll-font);
}

.ams-payroll-table th,
.ams-payroll-table td,
.ams-rate-table td,
.ams-payout-table th,
.ams-payout-table td {
  padding: 6px 6px !important;
  line-height: 1.2;
  vertical-align: middle;
  border-color: #E5E7EB !important;
}

.ams-payout-table thead th,
.ams-payroll-table thead th {
  font-size: var(--ams-payroll-head-font);
  white-space: nowrap;
}

.ams-rate-table td:first-child {
  width: 58%;
}

.ams-rate-table td:last-child {
  width: 42%;
}

.ams-payroll-table td,
.ams-payroll-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ams-payout-table td,
.ams-payout-table th {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.ams-payout-table td:first-child,
.ams-payroll-table td:first-child {
  text-align: left;
}

.ams-payout-table tbody td:nth-child(2),
.ams-payout-table tbody td:nth-child(3),
.ams-payout-table tbody td:nth-child(4),
.ams-payout-table thead th:nth-child(2),
.ams-payout-table thead th:nth-child(3),
.ams-payout-table thead th:nth-child(4) {
  text-align: right;
}

.ams-payout-table tfoot th,
.ams-payout-table tfoot td {
  font-size: var(--ams-payroll-font);
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.ams-payout-table tfoot th[colspan="3"] {
  padding-right: 14px !important;
}

.ams-payout-table tfoot tr:last-child td {
  white-space: normal;
  line-height: 1.25;
  font-size: 10px;
  text-align: right;
}

.ams-payout-head {
  gap: 10px;
}

.ams-payout-head .text-muted.small {
  font-size: 11px;
  white-space: nowrap;
}

.ams-payout-head .btn {
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

@media (max-width: 1366px) and (min-width: 768px) {
  .ams-payroll-card {
    padding: 12px !important;
  }

  .ams-payroll-table th,
  .ams-payroll-table td,
  .ams-rate-table td,
  .ams-payout-table th,
  .ams-payout-table td {
    padding: 5px 5px !important;
  }
}

@media (max-width: 1100px) {
  .ams-report-filter-field,
  .ams-report-filter-field.is-wide,
  .ams-report-filter-field.is-compact,
  .ams-report-filter-actions {
    grid-column: span 6;
  }
}

@media (max-width: 767px) {
  .ams-report-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .ams-report-header {
    align-items: flex-start;
  }

  .ams-report-filter-field,
  .ams-report-filter-field.is-wide,
  .ams-report-filter-field.is-compact,
  .ams-report-filter-actions {
    grid-column: 1 / -1;
  }

  .ams-report-card {
    border-radius: 16px;
  }

  .ams-report-meta {
    grid-template-columns: 1fr;
  }

  .ams-report-generated {
    text-align: left;
  }

  .ams-report-table-wrap {
    overflow-x: visible;
  }

  .ams-report-table-wrap .dataTables_wrapper .dt-buttons,
  .ams-report-table-wrap .dataTables_wrapper .dataTables_length,
  .ams-report-table-wrap .dataTables_wrapper .dataTables_filter,
  .ams-report-table-wrap .dataTables_wrapper .dataTables_info,
  .ams-report-table-wrap .dataTables_wrapper .dataTables_paginate {
    width: 100%;
    max-width: 100%;
    float: none;
    text-align: left;
  }

  .ams-report-table-wrap .dataTables_wrapper,
  .ams-report-table-wrap .dataTables_scroll,
  .ams-report-table-wrap .dataTables_scrollBody,
  .ams-report-table-wrap .dataTables_scrollHead,
  .ams-report-table-wrap .dataTables_scrollHeadInner {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .ams-report-table-wrap .dataTables_wrapper .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }

  .ams-report-table-wrap .dataTables_wrapper .dt-buttons .btn {
    flex: 1 1 100%;
    min-height: 38px;
    margin: 0;
  }

  .ams-report-table-wrap .dataTables_filter label,
  .ams-report-table-wrap .dataTables_filter input {
    width: 100%;
    margin-left: 0;
  }

  .ams-report-table-wrap table.main_table,
  .ams-report-table-wrap table.main_table thead,
  .ams-report-table-wrap table.main_table tbody,
  .ams-report-table-wrap table.main_table th,
  .ams-report-table-wrap table.main_table td,
  .ams-report-table-wrap table.main_table tr {
    display: block;
    width: 100% !important;
    min-width: 0;
  }

  .ams-report-table-wrap table.main_table thead {
    position: absolute;
    width: 1px !important;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .ams-report-table-wrap table.main_table tbody tr {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 14px;
    border: 1px solid var(--ams-report-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(249, 115, 22, .08);
    overflow: hidden;
  }

  .ams-report-table-wrap table.main_table tbody tr.child,
  .ams-report-table-wrap table.main_table tbody tr.child td {
    display: none !important;
  }

  .ams-report-table-wrap table.main_table tbody td {
    display: grid !important;
    grid-template-columns: 1fr;
    max-width: none !important;
    gap: 5px;
    align-items: start;
    border-bottom: 1px solid #F8E7D7;
    padding: 12px 13px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  .ams-report-table-wrap table.main_table tbody td.dtr-control::before,
  .ams-report-table-wrap table.main_table tbody th.dtr-control::before {
    display: none !important;
  }

  .ams-report-table-wrap table.main_table tbody td::before {
    content: attr(data-label);
    color: #7C2D12;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .02em;
    line-height: 1.2;
  }

  .ams-report-table-wrap table.main_table tbody td:first-child {
    background: #FFF7ED;
    text-align: left;
  }

  .ams-report-table-wrap table.main_table tbody td:first-child::before,
  .ams-report-table-wrap table.main_table tbody td[colspan]::before {
    display: none;
  }

  .ams-report-table-wrap table.main_table tbody td:last-child {
    border-bottom: 0;
  }

  .ams-report-table-wrap .main_table colgroup {
    display: none;
  }
}
