body,
html {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
}

label,
h3 {
  margin: 0px;
}

.container-fluid {
  margin: 0 auto;
  overflow: hidden;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.table th {
  font-weight: normal;
  padding: 6px;
  background: #fff;
  position: sticky;
  top: 0;
  white-space: nowrap;
  z-index: 3;
  border-bottom: 1px solid #dee2e6;
}

/* Стили для строки итогов */
.table-summary-row {
  background: #fff !important;
  font-weight: 600;
  color: #495057;
  border-top: 2px solid #dee2e6;
  border-bottom: 2px solid #dee2e6;
}

.table-summary-row th {
  position: sticky;
  top: 40px;
  background: #fff !important;
  z-index: 2;
  padding: 6px;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  color: #495057;
}

.table td {
  padding: 6px;
  border-bottom: 1px solid #dee2e6;
}

.result>.col-md-2 {
  padding-right: 8px;
  padding-left: 8px;
}

.border_blue:hover {
  color: #0075ff;
  cursor: pointer;
}

/* Стили для drag-item */
.drag-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid #eee;
  background: #f8f8f8;
  margin: 4px 0;
  cursor: move;
}

/* Стили для содержимого */
.item-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.item-content .title {
  flex-grow: 1;
  /* Занимает всё доступное место слева */
}

.item-content i.fa-bars {
  margin-left: auto;
  /* Отправляет иконку вправо */
  cursor: move;
}

/* Ховер эффект */
.drag-item:hover {
  background: #e8e8e8;
}

.visibility-checkbox {
  margin-right: 5px;
  /* Отступ между чекбоксом и текстом */
}

.table-striped tbody tr:nth-child(odd) {
  background-color: #f8f8f8;
}

/* Подсветка строки при наведении */
.table-striped tbody tr:nth-child(even):hover {
  background-color: #e7eef7;
}

/* Подсветка для нечётных строк */
.table-striped tbody tr:nth-child(odd):hover {
  background-color: #e7eef7;
}

/* Подсветка найденного товара */
.table-striped tbody tr.found-good {
  background-color: #fff3cd !important;
  animation: highlight-found 2s ease-in-out;
}

@keyframes highlight-found {
  0% {
    background-color: #fff3cd;
  }

  50% {
    background-color: #ffeaa7;
  }

  100% {
    background-color: #fff3cd;
  }
}

.col-auto {
  padding-left: 8px;
  padding-right: 0px;
  padding-top: 0px;
  padding-bottom: 0px;
}

.tree>.tree-root {
  padding: 0px !important;
}

.tree-anchor {
  padding: 0px !important;
  margin: 0px !important;
}

/* Первый уровень */
.tree-content {
  padding-left: 0px !important;
}

/* Второй уровень */
.tree-children .tree-content {
  padding-left: 0px !important;
}

/* Третий уровень */
.tree-children .tree-children .tree-content {
  padding-left: 10px !important;
}

/* Четвертый уровень */
.tree-children .tree-children .tree-children .tree-content {
  padding-left: 20px !important;
}

/* Пятый уровень */
.tree-children .tree-children .tree-children .tree-children .tree-content {
  padding-left: 30px !important;
}

.tree-content[data-color="red"] {
  background-color: rgba(255, 68, 68, 0.2) !important;
}

.tree-content[data-color="yellow"] {
  background-color: rgba(255, 235, 59, 0.2) !important;
}

.tree-content[data-color="green"] {
  background-color: rgba(76, 175, 80, 0.2) !important;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  animation: fade-in-out 8s ease-in-out;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 600px;
}

.toast-message {
  flex: 1;
}

.toast-success {
  background-color: #4CAF50;
}

.toast-error {
  background-color: #F44336;
}

.toast-info {
  background-color: #2196F3;
}

.toast-warning {
  background-color: #FF9800;
}

.toast-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.toast-close-btn:hover {
  opacity: 1;
}

.toast-close-btn:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

@keyframes fade-in-out {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  10% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  90% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Vue transition для плавного появления/исчезновения toast */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.col-name {
  width: 60%;
}

.name-with-action {
  position: relative;
  display: block;
  width: 100%;
  padding-right: 30px;
  z-index: 1;
}

.name-action-button {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 2px 5px;
  font-size: 14px;
  z-index: 1;
}

.name-action-button:hover {
  color: #1890ff;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.events-popover {
  position: absolute;
  top: 28px;
  right: 0;
  width: 360px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  z-index: 2000;
  border: 1px solid #e0e0e0;
  animation: fade-in-popover 0.2s;
}

@keyframes fade-in-popover {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Events tabs styles */
.events-tab-btn {
  transition: all 0.2s ease;
}

.events-tab-btn:hover {
  background-color: #f8f9fa;
}

.events-tab-btn.active {
  background-color: #f8f9fa;
}

.events-tab-btn.active:first-child {
  border-bottom: 1px solid #dc3545 !important;
  /* Красный для "Важно" */
}

.events-tab-btn.active:last-child {
  border-bottom: 1px solid #fd7e14 !important;
  /* Оранжевый для "Требует внимания" */
}

/* Events list styles */
.event-item {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  transition: all 0.2s ease;
}

.event-item:hover {
  background: #e9ecef;
  border-color: #dee2e6;
}

.event-clickable {
  cursor: pointer;
}

.event-clickable:hover {
  background: #e2e6ea !important;
  border-color: #adb5bd !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.event-articul {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
}

.event-count {
  background: #dc3545;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.event-product {
  font-weight: 500;
  color: #212529;
  margin-bottom: 4px;
  font-size: 13px;
}

.event-client {
  color: #6c757d;
  font-size: 12px;
  margin-bottom: 6px;
}

.event-description {
  color: #dc3545;
  font-size: 11px;
  font-style: italic;
  background: #f8d7da;
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid #dc3545;
}

/* Events header buttons */
.events-popover .fa-refresh:hover,
.events-popover .fa-cogs:hover {
  color: #495057 !important;
  transform: scale(1.1);
  transition: all 0.2s ease;
}

.events-popover .fa-refresh:hover {
  animation: spin 0.5s linear;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.modal-mask {
  position: fixed;
  z-index: 3000;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-wrapper {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-container {
  background: #fff;
  margin: 0px auto;
  border-radius: 1px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
  padding: 0;
  min-width: 300px;
  max-width: 550px;
  width: 100%;
}

.modal-header {
  padding: 8px 20px 8px 20px;
  border-bottom: 1px solid #eee;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 8px 20px 8px 20px;
  border-top: 1px solid #eee;
}

.articul-search-popover {
  position: absolute;
  left: 0;
  top: 36px;
  z-index: 3000;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.articul-search-popover input[type="text"] {
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
  min-width: 250px;
}

.tags-search-popover {
  flex-direction: column;
  align-items: stretch;
  min-width: 220px;
}

.tags-multiselect-header {
  font-size: 13px;
  color: #333;
  margin-bottom: 6px;
  font-weight: 500;
}

.tags-multiselect-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 4px;
}

.tags-multiselect-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 2px;
}

.tags-multiselect-item:hover {
  background: #f5f5f5;
}

.tags-multiselect-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.tags-multiselect-empty {
  display: block;
  color: #888;
  font-size: 13px;
  padding: 8px;
}

/* Стили для кастомного мультиселект */
.custom-multiselect-container {
  position: relative;
  width: 100%;
}

.custom-multiselect {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 25px;
  height: auto;
  padding: 0 8px;
  border: 1px solid #000000;
  border-radius: 2px;
  background-color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
}

.custom-multiselect-display {
  flex: 1;
  overflow: visible;
  white-space: normal;
}

.custom-multiselect-display .placeholder {
  color: #000000;
}

.custom-multiselect-display .selected-count {
  font-weight: normal;
}

.custom-multiselect-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #6c757d;
  transition: transform 0.2s ease;
  margin-left: 8px;
}

.custom-multiselect.open .custom-multiselect-arrow {
  transform: rotate(180deg);
}

.custom-multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200%;
  max-height: 200px;
  overflow-y: auto;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.custom-multiselect-option {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.4;
  border-bottom: 1px solid #f8f9fa;
}

.custom-multiselect-option:last-child {
  border-bottom: none;
}

.custom-multiselect-option:hover {
  background-color: #0075ff;
  color: white;
}

.custom-multiselect-option input[type="checkbox"] {
  margin: 0;
  margin-right: 8px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #0075ff;
}

.custom-multiselect-option .option-text {
  flex: 1;
  white-space: normal;
  overflow: visible;
}

/* Pagination styles */
.pagination-container {
  padding: 8px 0;
  border-top: 1px solid #dee2e6;
  background-color: #f8f9fa;
}

.pagination-info {
  font-size: 14px;
  color: #6c757d;
}

.pagination .page-link {
  color: #0075ff;
  background-color: #fff;
  border: 1px solid #dee2e6;
  padding: 0.375rem 0.75rem;
  font-size: 14px;
}

.pagination .page-link:hover {
  color: #0075ff;
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
  background-color: #0075ff;
  border-color: #0075ff;
  color: white;
}

.pagination .page-item.disabled .page-link {
  color: #6c757d;
  background-color: #fff;
  border-color: #dee2e6;
  cursor: not-allowed;
}

.form-select-sm {
  padding: 0.25rem 0.5rem;
  font-size: 14px;
  border-radius: 0.2rem;
}

/* Стили для размещения "Показывать" и пагинации на одной линии */
.pagination-controls-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.pagination-nav {
  flex-shrink: 0;
}

/* Стили для модального окна товара */
.product-modal-container {
  max-width: 600px;
  width: 90%;
}

.product-modal-title h4 {
  margin: 0;
  color: #333;
  font-weight: 600;
}

.product-modal-title small {
  font-size: 0.875rem;
}

.close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  margin-left: 1rem;
}

.close:hover {
  color: #000;
}

.nav-tabs {
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 1rem;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  padding: 0.5rem 1rem;
  color: #495057;
  background: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
  border-color: #e9ecef #e9ecef #dee2e6;
  isolation: isolate;
}

.nav-tabs .nav-link.active {
  color: #495057;
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
}

.tab-content {
  min-height: 200px;
}

.tab-content-placeholder {
  padding: 2rem;
  text-align: center;
}

/* Стили для формы параметров заказа */
.order-params-form {
  padding: 1.5rem;
}

.order-params-form .form-group {
  margin-bottom: 1.5rem;
}

.order-params-form .form-check {
  margin-bottom: 0.5rem;
}

.order-params-form .form-check-label {
  font-weight: 400;
  color: #495057;
}

.order-params-form .form-label {
  font-weight: 400;
  color: #495057;
  margin-bottom: 0.5rem;
}

.order-params-form .form-control {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.order-params-form .form-control:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.order-params-form .form-check-input:checked {
  background-color: #007bff;
  border-color: #007bff;
}

.order-params-form .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.order-params-form hr {
  margin: 1.5rem 0;
  border-top: 1px solid #dee2e6;
}

.order-params-form .spinner-border {
  width: 2rem;
  height: 2rem;
  color: #007bff;
}

.tab-pane {
  display: none;
}

.tab-pane.show.active {
  display: block;
}

/* Стили для кликабельных наименований товаров */
.product-name-link {
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
}

.product-name-link:hover {
  text-decoration: underline;
}

.numeric-filter-wrapper {
  position: relative;
  display: inline-block;
}

.numeric-filter-popover {
  position: absolute;
  top: 22px;
  right: 0;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  width: 197px;
  z-index: 2100;
}

.numeric-filter-row {
  margin-bottom: 8px;
}

.numeric-filter-popover .form-select,
.numeric-filter-popover .form-control {
  width: 100%;
}

.numeric-filter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.numeric-filter-actions .btn {
  flex: 0 1 auto;
}

/* === matrix.html flex layout (height adaptation) === */

#app.container-fluid {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.matrix-header-row {
  flex-shrink: 0;
}

.matrix-filters-row {
  flex-shrink: 0;
}

.matrix-content-row {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-wrap: nowrap;
  min-height: 0;
}

.matrix-panel {
  overflow: auto;
  min-height: 0;
}

.matrix-footer-row {
  flex-shrink: 0;
}

/* Footer pagination bar: prevent items from stacking on resize */
.matrix-footer-pagination {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.matrix-footer-pagination-info {
  flex-shrink: 0;
  white-space: nowrap;
}

.matrix-footer-pagination-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.matrix-footer-pagination-nav-col {
  flex-shrink: 0;
}

.matrix-footer-pagination-nav-col .pagination-controls-container {
  flex-wrap: nowrap;
  gap: 8px;
}