:root {
  --primary-color: #2fc6f7;
  --primary-hover: #25b5e4;
  --secondary-color: #f8f9fa;
  --border-color: #e0e0e0;
  --text-color: #333;
  --text-light: #777;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --radius: 4px;
}

body {
  overflow-x: hidden;
}


body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7f8;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

#user-name {
  flex-shrink: 1; /* позволяем уменьшаться */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px; /* допустимая длина имени */
}


#logout-btn {
  flex-shrink: 0; /* кнопка не должна сжиматься */
  white-space: nowrap;
}

.bitrix-container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 20px;
}


.bitrix-header {
  width: 95%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap; /* Для адаптивности */

}


.bitrix-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bitrix-header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: nowrap;
  margin-left: auto;
}



.bitrix-title {

  display: flex;
  align-items: center;
  gap: 10px;
}

.bitrix-title h2 {
  margin: 0;
  font-size: 3.5rem;
  font-weight: 500;
  color: #333;
}

.bitrix-title i {
  color: var(--primary-color);
  font-size: 24px;
}


.bitrix-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  width: 94%;
  overflow-x: auto;
}

.bitrix-form-group {
  margin-bottom: 15px;
}

.bitrix-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-color);
}

.bitrix-input-container {
  display: flex;
  gap: 10px;
}

.bitrix-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.3s;
}

.bitrix-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(47, 198, 247, 0.2);
}

.bitrix-btn {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bitrix-btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.bitrix-btn-primary:hover {
  background-color: var(--primary-hover);
}

.bitrix-table-toolbar {
  position: relative;
  z-index: 1;
  background-color: white;
  padding: 10px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}
.scrollable-table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
  scrollbar-width: thin;             /* Firefox */
  scrollbar-color: #ccc transparent; /* Firefox */
}

.bitrix-date-filter {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.bitrix-date-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bitrix-date-input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: auto;
}



.bitrix-table {
  width: 100%;
  table-layout: fixed;
}




.bitrix-table th {
  background-color: #f5f7f8;
  padding: 12px 15px;
  text-align: left;
  font-weight: 500;
  color: var(--text-color);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.bitrix-table td {
  max-width: 250px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.bitrix-table tr:hover td {
  background-color: #f8fafb;
}

.cell-text {
  display: inline-block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-dialog {
  background: white;
  border-radius: 8px;
  padding: 20px;
  max-width: 800px;
  width: 90%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  margin: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.modal-title {
  font-size: 1.2em;
  font-weight: 500;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-content {
  background: #fff;
  padding: 25px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

.modal-body {
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 10px;
}

.modal-content, .modal-body {
  overflow-x: hidden !important;
}


.columns-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 0;
}

.column-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.column-item input[type="checkbox"] {
  margin-left: 10px;
}

.filter-list {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}

.filter-item:hover {
  background-color: #f5f5f5;
}

.filter-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.table-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dt-button-collection {
  background: #fff;
  padding: 15px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dt-button-collection .dt-button {
  color: var(--text-color) !important;
  padding: 4px 7px !important;
  margin: 2px 0;
}

.dt-button-collection .dt-button:hover {
  background-color: #f5f5f5 !important;
}

img{
  height: 6rem;
  width: auto;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .bitrix-input-container,
  .bitrix-date-filter,
  .bitrix-date-group,
  .table-controls {
    flex-direction: column;
    width: 100%;
  }

  .bitrix-title h2 {
    font-size: 2rem;
  }

  img{
    height: 3rem;
    width: auto;
    vertical-align: middle;
  }

  .bitrix-btn {
    width: 100%;
    justify-content: center;
  }

  .bitrix-date-input {
    width: 100%;
  }

  .columns-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* ДЛЯ шапки на телефоне */
  .bitrix-user-controls {
    max-width: 100%;
    width: 100%;
    justify-content: center;
  }

  #user-name {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 50%;
    text-align: center;
  }

  #logout-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .columns-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grip {
  width: 2px;
  background-color: #ccc;
  height: 100%;
  cursor: col-resize;
}

.dragging .grip {
  background-color: #007bff;
}
.row-selected {
  background-color: #d9edf7 !important;
}

.my-column-name {
  width: 100px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bitrix-top-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.bitrix-search-container {
  flex: 1 1 auto;
  text-align: center;
}

.bitrix-settings-container {
  flex: 0 0 auto;
}

.bitrix-settings-container .dt-button {
  background: none !important;
  border: none !important;
  padding: 4px 6px !important;
  font-size: 18px !important;
  line-height: 1 !important;
  color: #007bff !important;
  cursor: pointer !important;
  box-shadow: none !important;
  min-width: unset !important;
}

.bitrix-settings-container .dt-button:hover {
  color: #0056b3 !important;
}


.bitrix-pagination-container {
  flex: 0 1 auto;
  text-align: center;
}

.bitrix-length-container {
  flex: 0 1 auto;
  text-align: right;
}

.bitrix-bottom-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
}

#lotsTable_info {
  flex: 1;
  text-align: left;
  order: 1;
}



#lotsTable_length {
  flex: 1;
  text-align: right;
  order: 3;
}

.bitrix-user-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 300px; /* Ограничиваем весь блок */
  overflow: hidden;
}



.bitrix-navbar {
    background: #2fc6f7;
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.bitrix-navlink {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bitrix-navlink.disabled {
    color: gray;
    pointer-events: none;
    cursor: not-allowed;
}

.au-flex-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 10px;
}
.au-block {
  flex: 1 1 300px;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 15px 20px;
  background-color: #fdfdfd;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.au-block h4 {
  margin-top: 0;
  color: #007bff;
}
.au-block p {
  margin: 4px 0;
}

.stat-card {
  flex: 1 1 300px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  padding: 20px;
}
.stat-card h4 {
  margin-bottom: 10px;
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.table-wrapper-scroll {
  overflow-x: auto;
  width: 100%;
}

#auDebtorsTable {
  white-space: nowrap;
}

.pagination button:hover {
  background-color: var(--primary-hover);
  color: #fff;
}
.pagination span {
  display: inline-block;
  min-width: 40px;
  text-align: center;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  color: #333;
  font-size: 14px;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled):not(.active-page) {
  background-color: var(--primary-hover);
  color: white;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn.active-page {
  background-color: var(--primary-color);
  color: white;
  font-weight: bold;
  border-color: var(--primary-color);
  cursor: default;
}

.disabled-link {
  pointer-events: none;
  color: gray;
  text-decoration: none;
}

.bitrix-navlink.active {
  font-weight: bold;
  color: #007bff;
  text-decoration: underline;
}

.filter-layout {
  flex-wrap: wrap;
  justify-content: space-between;
}

.filter-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
  max-height: 400px; /* увеличили для лучшего обзора */
  overflow-y: auto;
  padding-right: 10px;
  border-right: 1px solid #ddd;
}

/* Добавлено — активная кнопка поля */
.filter-fields .field-tab.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: bold;
  border: 1px solid var(--primary-hover);
}


.filter-fields button {
  background: var(--secondary-color);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
}

.filter-fields button:hover {
  background: #e9f5fb;
}

.filter-values {
  flex: 1;
  min-width: 250px;
  margin-left: 20px;
}

.filter-values label {
  background: #f9f9f9;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 5px;
  display: block;
  cursor: pointer;
  transition: background 0.2s;
}

.filter-values label:hover {
  background: #e9f5fb;
}

.filter-numeric {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.numeric-range {
  min-width: 200px;
  flex: 1 1 200px;
}

.numeric-range label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.field-tab.active {
  background-color: var(--primary-color);
  color: white;
  font-weight: bold;
}

#toast-container {
  z-index: 99999 !important;
}


#filterValueList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
}

#filterFieldModal .modal-footer {
  border-top: 1px solid #ddd;
  padding-top: 10px;
  justify-content: flex-end;
  background: #fff;
  position: sticky;
  bottom: 0;
}

#filterFieldList button.active {
  background-color: var(--primary-color);
  color: white;
}
.modal-footer button + button {
  margin-left: 10px;
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}

#resetFiltersBtn {
  white-space: nowrap;
}

.dataTables_wrapper .custom-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1rem;
}
.dataTables_wrapper .custom-footer .dataTables_info {
  order: 1;
  flex: 1;
  text-align: left;
}
.dataTables_wrapper .custom-footer .dataTables_paginate {
  order: 2;
  margin: 0 auto;
}
.dataTables_wrapper .custom-footer .dataTables_length {
  order: 3;
  text-align: right;
}

.dataTables_paginate .paginate_button {
  margin: 0 5px;
}

#auDebtorsTable_controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

#auDebtorsTable_controls .controls-left,
#auDebtorsTable_controls .controls-center,
#auDebtorsTable_controls .controls-right {
  flex: 1;
  text-align: center;
}

#auDebtorsTable_controls .controls-left {
  text-align: left;
}

#auDebtorsTable_controls .controls-right {
  text-align: right;
}

/* 1. Настроим нижнюю панель datatables */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate,
.dataTables_wrapper .dataTables_length {
  flex: unset !important;
  margin: 0 10px !important;
}

/* 2. Сама панель снизу — отступ сверху + выравнивание */
.dataTables_wrapper .bottom {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.au-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
  margin-top: 10px;
}

.au-field {
  font-size: 16px;
  line-height: 1.4;
}

.deb-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin-top: 10px;
}


.deb-field {
  font-size: 16px;
  line-height: 1.4;
}

