/* Shared compact data-table system */
.scrollable-data-table {
  min-width: 0;
}

.table-scroll-top {
  height: 8px;
  margin-bottom: 5px;
  border: 0;
  border-radius: 999px;
  background: #edf4fa;
}

.table-scroll-top::-webkit-scrollbar,
.csn-table-wrap::-webkit-scrollbar {
  height: 7px;
}

.table-wrap,
.csn-table-wrap {
  border: 1px solid #d4e2ed;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(10, 37, 64, .035);
}

table.csn-data-table {
  min-width: 780px;
  color: #0a2540;
  font-size: 12px;
  table-layout: auto;
}

.csn-data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0;
  color: #143250;
  background: #edf6ff;
  border-bottom: 1px solid #cbddea;
  font-size: 11px;
  font-weight: 600;
}

.csn-data-table th:first-child {
  border-top-left-radius: 7px;
}

.csn-data-table th:last-child {
  border-top-right-radius: 7px;
}

.sortable-header,
.table-static-header {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.15;
  text-align: left;
}

.sortable-header {
  justify-content: space-between;
}

.table-static-header {
  justify-content: flex-start;
}

.sortable-header:hover,
.sortable-header:focus-visible {
  color: #0f6fca;
  background: #e4f1fc;
}

.sortable-header .table-head-icon {
  position: relative;
  inset: auto;
  width: 8px;
  min-width: 8px;
  height: 12px;
  transform: none;
  opacity: .58;
}

.sortable-header .table-head-icon::before,
.sortable-header .table-head-icon::after {
  left: 1px;
  border-right-width: 3px;
  border-left-width: 3px;
}

.sortable-header .table-head-icon::before {
  border-bottom: 4px solid #315c7c;
}

.sortable-header .table-head-icon::after {
  border-top: 4px solid #315c7c;
}

.csn-data-table td {
  height: 37px;
  padding: 6px 9px;
  border-bottom: 1px solid #e1eaf1;
  color: #183753;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}

.csn-data-table tbody tr:nth-child(even) td {
  background: #f9fcff;
}

.csn-data-table tbody tr:hover td {
  background: #eef7ff;
}

.csn-data-table .text-link,
.csn-data-table .link-photo {
  font-size: 12px;
  font-weight: 500;
}

.csn-data-table .strong-link {
  color: #143b62;
  font-weight: 600;
}

.csn-data-table .row-actions {
  gap: 4px;
}

.csn-data-table .row-actions button,
.csn-data-table td > button:not(.text-link):not(.link-photo) {
  min-height: 26px;
  padding-inline: 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.data-table-footer {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px 0;
  color: #53677b;
  font-size: 11px;
}

.data-table-footer label,
.data-table-footer > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.data-table-footer select,
.data-table-footer button,
.data-table-footer > div > strong {
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #cfe0ed;
  border-radius: 7px;
  color: #244865;
  background: #fff;
  font-size: 11px;
}

.data-table-footer select {
  padding: 0 5px;
}

.data-table-footer button:hover:not(:disabled) {
  border-color: #1783e6;
  color: #1783e6;
  background: #eef7ff;
}

.data-table-footer button:disabled {
  opacity: .42;
}

.data-table-footer > div > strong {
  border-color: #1783e6;
  color: #fff;
  background: #1783e6;
}

/* Receipts page */
.receipts-page {
  display: grid;
  gap: 12px;
}

.receipts-page > .page-heading {
  align-items: center;
  margin-bottom: 0;
}

.receipts-page .page-title-block {
  align-items: center;
}

.receipts-heading-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #cce5f8;
  border-radius: 8px;
  color: #1783e6;
  background: #eef7ff;
}

.receipts-heading-icon svg {
  width: 22px;
  height: 22px;
}

.receipts-page .page-heading h2 {
  margin: 0 0 2px;
  font-size: 27px;
}

.receipts-page .page-heading p {
  margin: 0;
  font-size: 12px;
}

.receipts-page .page-heading small {
  display: block;
  margin-top: 3px;
  color: #718398;
  font-size: 10px;
}

.receipts-page .heading-actions {
  display: flex;
  gap: 7px;
  flex-wrap: nowrap;
}

.receipts-page .heading-actions button {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 11px;
  white-space: nowrap;
}

.receipt-filter-panel,
.receipts-table-panel {
  border: 1px solid #d6e6f5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(10, 37, 64, .04);
}

.receipt-filter-panel {
  display: grid;
  gap: 9px;
  padding: 11px;
}

.receipt-filter-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) minmax(135px, .7fr) minmax(150px, .8fr) auto auto auto;
  gap: 8px;
  align-items: end;
}

.receipt-filter-row label,
.receipt-advanced-filters label {
  display: grid;
  gap: 4px;
  color: #53677b;
  font-size: 10px;
  font-weight: 600;
}

.receipt-filter-row select,
.receipt-filter-row input,
.receipt-advanced-filters select,
.receipt-advanced-filters input {
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #c9dce9;
  border-radius: 7px;
  color: #183753;
  background: #fff;
  font-size: 11px;
  outline: none;
}

.receipt-search-field > div {
  position: relative;
}

.receipt-search-field > div svg {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  margin: 0;
  color: #6f8497;
  transform: translateY(-50%);
}

.receipt-search-field input {
  padding-left: 34px;
}

.receipt-filter-row > button {
  min-height: 36px;
  padding-inline: 10px;
  font-size: 10px;
  white-space: nowrap;
}

.receipt-filter-row .outline-action.active {
  border-color: #1783e6;
  color: #1783e6;
  background: #eef7ff;
}

.receipt-advanced-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid #e1ebf3;
}

.receipt-advanced-filters[hidden] {
  display: none;
}

.receipts-table-panel {
  min-width: 0;
  padding: 10px;
}

table.csn-data-table.receipts-data-table {
  width: 100%;
  min-width: 920px;
  table-layout: fixed;
}

.receipts-data-table th:nth-child(1),
.receipts-data-table td:nth-child(1) {
  width: 112px;
}

.receipts-data-table th:nth-child(2),
.receipts-data-table td:nth-child(2) {
  width: 90px;
}

.receipts-data-table th:nth-child(3),
.receipts-data-table td:nth-child(3) {
  width: 155px;
}

.receipts-data-table th:nth-child(4),
.receipts-data-table td:nth-child(4) {
  width: 122px;
}

.receipts-data-table th:nth-child(5),
.receipts-data-table td:nth-child(5) {
  width: 136px;
}

.receipts-data-table th:nth-child(6),
.receipts-data-table td:nth-child(6) {
  width: 120px;
}

.receipts-data-table th:nth-child(7),
.receipts-data-table td:nth-child(7) {
  width: 98px;
  text-align: right;
}

.receipts-data-table th:nth-child(8),
.receipts-data-table td:nth-child(8) {
  width: 54px;
}

.receipts-data-table th:nth-child(9),
.receipts-data-table td:nth-child(9) {
  width: 48px;
  text-align: center;
}

.receipts-data-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipts-data-table td .text-link {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.receipt-action-menu {
  position: relative;
  display: inline-block;
}

.receipt-action-menu summary {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #315a78;
  cursor: pointer;
  list-style: none;
  letter-spacing: 1px;
}

.receipt-action-menu summary::-webkit-details-marker {
  display: none;
}

.receipt-action-menu summary:hover {
  border-color: #cce2f1;
  background: #eef7ff;
}

.receipt-action-menu > div {
  position: absolute;
  top: 31px;
  right: 0;
  z-index: 25;
  width: 168px;
  display: grid;
  padding: 5px;
  border: 1px solid #d1e2ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 15px 34px rgba(10, 37, 64, .16);
}

.receipt-action-menu > div button {
  min-height: 30px;
  border: 0 !important;
  border-radius: 5px !important;
  padding: 0 8px !important;
  color: #183753 !important;
  background: #fff !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  text-align: left;
}

.receipt-action-menu > div button:hover {
  color: #0f6fca !important;
  background: #eef7ff !important;
}

.receipts-data-table tbody tr:nth-last-child(-n + 4) .receipt-action-menu > div {
  top: auto;
  bottom: 31px;
}

.receipt-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
}

.receipt-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 37, 64, .5);
  backdrop-filter: blur(3px);
}

.receipt-modal-card {
  position: relative;
  z-index: 1;
  width: min(690px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid #cde0ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(10, 37, 64, .25);
  overflow: hidden;
}

.receipt-modal-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 17px;
  border-bottom: 1px solid #dce8f1;
}

.receipt-modal-card header span {
  color: #1783e6;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.receipt-modal-card h2 {
  margin: 2px 0 0;
  color: #0a2540;
  font-size: 20px;
}

.receipt-modal-card header p {
  margin: 2px 0 0;
  color: #64778a;
  font-size: 11px;
}

.receipt-modal-card header > button {
  width: 32px;
  height: 32px;
  border: 1px solid #d5e3ed;
  border-radius: 7px;
  color: #31536d;
  background: #fff;
  font-size: 20px;
}

.receipt-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 17px;
  overflow-y: auto;
}

.receipt-form-grid label {
  display: grid;
  gap: 5px;
  color: #435b70;
  font-size: 11px;
  font-weight: 600;
}

.receipt-form-grid input,
.receipt-form-grid select,
.receipt-form-grid textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #c8dce9;
  border-radius: 7px;
  color: #163650;
  background: #fff;
  font-size: 12px;
  outline: none;
}

.receipt-form-grid input:focus,
.receipt-form-grid select:focus,
.receipt-form-grid textarea:focus {
  border-color: #1783e6;
  box-shadow: 0 0 0 3px rgba(23, 131, 230, .12);
}

.receipt-form-grid textarea {
  resize: vertical;
}

.receipt-form-grid .span-two {
  grid-column: 1 / -1;
}

.receipt-form-context {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #cde7f7;
  border-radius: 7px;
  color: #476279;
  background: #f2f9ff;
  font-size: 10px;
}

.receipt-modal-card > footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding: 11px 17px;
  border-top: 1px solid #dce8f1;
}

.receipt-modal-card > footer button {
  min-height: 36px;
  font-size: 11px;
}

.receipt-success-card {
  width: min(500px, 100%);
}

.receipt-success-body {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px 20px;
  text-align: center;
}

.receipt-success-body svg {
  width: 50px;
  height: 50px;
  padding: 12px;
  border-radius: 50%;
  color: #159447;
  background: #e8f8ef;
}

.receipt-success-body strong {
  color: #0a2540;
  font-size: 18px;
}

.receipt-success-body p {
  margin: 0;
  color: #64778a;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .receipt-filter-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .receipt-advanced-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .data-table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .data-table-footer > div {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .data-table-footer > div > span {
    flex-basis: 100%;
    text-align: right;
  }

  .receipts-page > .page-heading {
    display: grid;
  }

  .receipts-page .heading-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .receipts-page .heading-actions button {
    min-width: 0;
    padding-inline: 7px;
  }

  .receipts-page .heading-actions button:last-child {
    grid-column: 1 / -1;
  }

  .receipt-filter-row,
  .receipt-advanced-filters {
    grid-template-columns: 1fr;
  }

  .receipt-modal {
    padding: 8px;
  }

  .receipt-modal-card {
    max-height: calc(100vh - 16px);
  }

  .receipt-form-grid {
    grid-template-columns: 1fr;
    padding: 13px;
  }

  .receipt-form-grid .span-two {
    grid-column: auto;
  }

  .receipt-modal-card > footer {
    flex-wrap: wrap;
  }

  .receipt-modal-card > footer button {
    flex: 1 1 100%;
  }
}

@media print {
  .data-table-footer,
  .receipt-filter-panel,
  .receipt-modal,
  .receipt-action-menu,
  .table-scroll-top {
    display: none !important;
  }

  .csn-data-table th {
    color: #0a2540 !important;
    background: #eaf5ff !important;
  }

  .csn-data-table td {
    padding: 5px 6px !important;
    font-size: 8pt !important;
  }
}
