/* Shared table system. Page-specific styles should only extend these classes. */
.data-page {
  width: calc(100% + 48px);
  max-width: none;
  margin-right: -24px;
  margin-left: -24px;
  box-sizing: border-box;
}

.data-table-wrap,
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f3f8;
  font-weight: 600;
  white-space: nowrap;
}

.data-table {
  min-width: 720px;
}

table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:not(.deleted-record-row):hover,
table[data-table-enhanced="true"] tbody tr:not(.deleted-record-row):not(.deposit-row-in):not(.deposit-row-out):hover {
  background: #f3f7ff;
}

.sort-link,
.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sort-link:hover,
.sort-link:focus-visible,
.table-sort-button:hover,
.table-sort-button:focus-visible {
  color: var(--accent);
  outline: none;
}

.sort-indicator {
  display: inline-flex;
  min-width: 12px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  opacity: 0.55;
}

.sort-indicator-pair {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  font-size: 7px;
  line-height: 0.72;
}

.sort-indicator.active {
  color: #111;
  font-size: 12px;
  opacity: 1;
}

.data-table .table-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.table-edit-link {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
}

.table-edit-link:hover {
  border-color: var(--accent);
  background: #f8fafc;
}

a.table-edit-link {
  border-color: transparent;
  background: transparent;
}

a.table-edit-link:hover {
  border-color: transparent;
}

.table-edit-link img {
  width: 14px;
  height: 14px;
}

.tourists-table tbody td {
  padding-top: 6px;
  padding-bottom: 6px;
  vertical-align: top;
}

.tourists-table .tourist-name-primary {
  font-weight: 650;
}

.tourists-table .tourist-card-link,
.tourists-table .tourist-card-link:visited {
  color: var(--text);
  text-decoration: none;
}

.tourists-table .tourist-card-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tourists-table .tourist-name-secondary,
.tourists-table .tourist-birthday-age {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tourists-table .tourist-name-secondary {
  text-transform: uppercase;
}

.tourists-table .tourist-passport-cell {
  width: 240px;
  max-width: 240px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.tourists-table .tourist-note-cell {
  min-width: 220px;
  max-width: 360px;
  overflow-wrap: anywhere;
  vertical-align: top;
  white-space: normal;
}

.tourists-table .tourist-note {
  position: relative;
}

.tourists-table .tourist-note-content {
  display: -webkit-box;
  max-height: 4.05em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.35;
}

.tourists-table .tourist-note.is-collapsible .tourist-note-content {
  padding-right: 28px;
}

.tourists-table .tourist-note.is-expanded .tourist-note-content {
  display: block;
  max-height: none;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.tourists-table .tourist-note-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.tourists-table .tourist-note-toggle[hidden] {
  display: none;
}

.tourists-table .tourist-note-toggle:hover,
.tourists-table .tourist-note-toggle:focus-visible {
  background: #e8edf5;
}

.tourists-table .tourist-note-toggle img {
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
}

.tourists-table .tourist-note.is-expanded .tourist-note-toggle img {
  transform: rotate(180deg);
}

.tourists-table .table-edit-link {
  width: 24px;
  height: 24px;
}

.tourists-table .table-edit-link img {
  width: 12px;
  height: 12px;
}

.data-table .table-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.data-table--compact {
  min-width: 520px;
}

.data-table--wide {
  min-width: 1100px;
}

.list-filter-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.list-filter-search-row {
  --list-filter-search-border: #aeb7c4;
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-filter-search-control {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: stretch;
  border: 1px solid var(--list-filter-search-border);
  border-radius: 5px;
  background: #fff;
}

.list-filter-search-control:focus-within {
  border-color: #788698;
  box-shadow: 0 0 0 2px rgb(120 134 152 / 14%);
}

.list-filter-search-control .list-filter-search-input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  margin-top: 0;
  border: 0;
  border-radius: 5px 0 0 5px;
  outline: none;
}

.list-filter-search-submit.button-nav {
  min-height: auto;
  border: 0;
  border-left: 1px solid var(--list-filter-search-border);
  border-radius: 0 5px 5px 0;
  background: transparent;
}

.list-filter-toggle.button-nav {
  border-color: var(--list-filter-search-border);
  background: transparent;
}

.list-filter-toggle-chevron {
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.list-filter-toggle[aria-expanded="true"] .list-filter-toggle-chevron {
  transform: rotate(0);
}

.list-filter-search-submit.button-nav:hover,
.list-filter-search-submit.button-nav:focus-visible,
.list-filter-toggle.button-nav:hover,
.list-filter-toggle.button-nav:focus-visible {
  background: transparent;
  color: var(--accent);
}

.list-filter-toggle.button-nav:hover,
.list-filter-toggle.button-nav:focus-visible {
  border-color: #788698;
}

.list-filter-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f8fafc;
}

.list-filter-group {
  min-width: 0;
  flex: 1 1 520px;
  padding: 0;
  margin: 0;
  border: 0;
}

.list-filter-group legend {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.list-filter-result-count {
  color: var(--muted);
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
}

.list-filter-fields {
  display: grid;
  gap: 12px;
}

.list-filter-row {
  display: grid;
  grid-template-columns: 160px minmax(180px, 220px) minmax(180px, 220px);
  align-items: end;
  gap: 12px;
}

.list-filter-row > label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.list-filter-row > label input[type="date"] {
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

.list-filter-row-title {
  display: flex;
  min-height: 38px;
  align-items: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.list-filter-multiselect-field {
  grid-column: 2 / 4;
  min-width: 0;
  max-width: 452px;
}

.list-filter-select-field {
  grid-column: 2 / 4;
  width: 220px;
  max-width: 100%;
}

.list-filter-select-field select {
  width: 100%;
  margin-top: 0;
}

.filter-multiselect {
  position: relative;
}

.filter-multiselect-toggle {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.filter-multiselect-toggle:hover,
.filter-multiselect-toggle:focus-visible {
  border-color: var(--accent);
}

.filter-multiselect-toggle:focus-visible,
.filter-multiselect-search:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 1px;
}

.filter-multiselect-toggle img {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  transition: transform 0.16s ease;
}

.filter-multiselect-toggle[aria-expanded="true"] img {
  transform: rotate(180deg);
}

.filter-multiselect-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, 320px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 12px 28px rgb(15 23 42 / 14%);
}

.filter-multiselect-search {
  width: 100%;
  min-height: 36px;
  margin: 0 0 6px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.filter-multiselect-options {
  max-height: 240px;
  overflow-y: auto;
}

.filter-multiselect-selected {
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.filter-multiselect-section-title {
  padding: 6px 8px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.filter-multiselect-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 5px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
}

.filter-multiselect-option:hover {
  background: #f3f7ff;
}

.filter-multiselect-option input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 1px 0 0;
}

.filter-multiselect-empty {
  display: block;
  padding: 10px 8px;
  color: var(--muted);
  font-size: 13px;
}

.filter-multiselect-empty[hidden] {
  display: none;
}

.list-filter-panel-actions {
  display: flex;
  width: 100%;
  flex: 1 0 100%;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.clickable-row {
  cursor: pointer;
  transition: background-color .15s ease;
}

.clickable-row:hover,
.clickable-row:focus {
  background: #f3f7ff;
  outline: none;
}

@media (max-width: 1100px) {
  .data-page {
    width: calc(100% + 32px);
    margin-right: -16px;
    margin-left: -16px;
  }
}

@media (max-width: 768px) {
  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 560px) {
  .list-filter-search-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .list-filter-toggle,
  .list-filter-panel,
  .list-filter-group,
  .list-filter-fields,
  .list-filter-panel-actions {
    width: 100%;
  }

  .list-filter-row {
    grid-template-columns: 1fr;
  }

  .list-filter-multiselect-field,
  .list-filter-select-field {
    width: 100%;
    max-width: none;
    min-width: 0;
    grid-column: auto;
  }

  .filter-multiselect-menu {
    width: 100%;
  }

  .list-filter-panel-actions .btn {
    flex: 1 1 0;
  }

  .list-filter-panel {
    align-items: stretch;
  }
}
