/* --- СТРОГИЙ МИНИМАЛИЗМ: ЕДИНЫЕ СТИЛИ ДЛЯ ВСЕХ МОДАЛОК (transaction_modal, transaction_view_modal) --- */
#transactionViewModal {
  background: #f8fafc;
  border-radius: 0;
  box-shadow: -4px 0 28px rgba(60, 70, 120, 0.15);
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 100vw;
  max-width: 440px;
  z-index: 1010;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trx-modal-header {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid #f1f2f4;
  padding: 16px 32px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  z-index: 10;
  position: sticky;
  top: 0;
}
.trx-modal-header-main {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.trx-modal-header-titles {
  display: flex;
  flex-direction: column;
}
.trx-modal-header-divider {
  width: 100%;
  height: 1px;
  background: #f1f2f4;
  margin-top: 24px;
}
.trx-modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #232b39;
  margin-bottom: 0.2em;
  letter-spacing: -0.5px;
}
.trx-account-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9em;
  color: #475569;
  font-weight: 500;
  margin-top: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.trx-modal-close {
  background: none;
  border: none;
  font-size: 2.3rem;
  color: #bcc4d0;
  cursor: pointer;
  line-height: 1;
  margin-left: 24px;
  padding: 0;
  align-self: center;
  transition: color 0.18s;
}
.trx-modal-close:hover {
  color: #5270e7;
}

/* Стили для кнопки добавления файлов */
.custom-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.custom-file-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-file-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.trx-modal-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px); /* Вычитаем высоту шапки */
}

/* Стили для современного отображения категорий */
.transaction-details-scroll {
  padding: 24px 32px;
  background-color: transparent;
}
.transaction-view-details {
  width: 100%;
  background-color: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  border: none;
  max-width: 100%;
}
.transaction-view-details-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-right: 0;
  padding-left: 0;
}
.detail-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 0;
  border-bottom: 1px solid #f1f2f4;
  width: 100%;
}
.detail-item:last-child {
  border-bottom: none;
}
/* Удалены стили для is-group-start, больше не используются */
.detail-label {
  flex: 0 0 140px;
  font-weight: 600;
  color: #2b3e8e;
  padding-right: 12px;
  min-width: 140px;
}
.detail-value {
  flex: 1;
  text-align: right;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-right: 0;
  max-width: calc(100% - 140px);
  overflow-wrap: break-word;
  word-wrap: break-word;
}
/* Стили для категорий */
.category-path {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  line-height: 1.5;
  gap: 4px;
  max-width: 100%;
  justify-content: flex-end;
  text-align: right;
}
.separator {
  color: #94a3b8;
  margin: 0 2px;
  font-size: 0.9em;
}
.trx-modal-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 32px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  border-top: 1px solid #f1f2f4;
  margin-top: auto;
  position: sticky;
  bottom: 0;
}

.action-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5270e7;
  background: rgba(82, 112, 231, 0.1);
  cursor: pointer;
  margin-left: 16px;
  transition: all 0.2s ease;
}

.action-icon-btn:hover {
  background: rgba(82, 112, 231, 0.2);
  transform: translateY(-2px);
}

.action-icon-btn:active {
  transform: translateY(0);
}

.action-icon-btn.delete-btn {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

.action-icon-btn.delete-btn:hover {
  background: rgba(229, 57, 53, 0.2);
}

/* Стили для простой галереи */
.simple-gallery-section {
  margin: 16px 0 0;
  background: transparent;
  padding: 16px 0 0;
  border-top: none;
  width: 100%;
  overflow: visible;
}

.simple-gallery-container {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.gallery-main-image {
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin: 0 auto;
  width: auto;
}

.gallery-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  width: 100%;
}

.gallery-arrow {
  background: #f1f4fd;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #5270e7;
  transition: all 0.2s;
  margin: 0 8px;
}

.gallery-arrow:hover {
  background: #e4e9fb;
  color: #304cad;
}

.gallery-arrow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gallery-counter {
  min-width: 60px;
  text-align: center;
  font-size: 0.9em;
  color: #707a8a;
}

.gallery-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
  width: 100%;
}

.note-box {
  background: #f7f8fa;
  border-radius: 8px;
  padding: 8px 12px;
  color: #232b39;
  font-size: 1em;
  margin-top: 2px;
  min-height: 24px;
  box-shadow: none;
  border: none;
  word-break: break-word;
  text-align: left !important;
  padding-top: 4px;
  font-weight: 500;
}

/* Стили для детальной заметки в модальном окне просмотра */
.detail-note {
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 12px;
  color: #232b39;
  font-size: 1em;
  font-weight: normal;
  font-style: normal;
  width: 100%;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.modern-gallery-section {
  margin: 24px 32px 0 32px;
}

.modern-gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.gallery-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e1e4ea;
  background: #fff;
  color: #5270e7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.gallery-nav-btn:hover {
  background: #f1f4fd;
  color: #304cad;
}

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

.gallery-counter {
  font-size: 0.95em;
  color: #8b95a7;
  margin: 0 10px;
}

.gallery-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.gallery-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbnail.active {
  opacity: 1;
  border-color: #5270e7;
}

.gallery-counter {
  font-size: 0.9em;
  color: #707a8a;
  min-width: 50px;
  text-align: center;
}

/* Стили для отображения типа транзакции */
.transaction-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.95em;
  font-weight: 500;
  text-align: right;
}

.type-income {
  background-color: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.type-expense {
  background-color: rgba(235, 87, 87, 0.15);
  color: #eb5757;
}

.type-transfer {
  background-color: rgba(82, 112, 231, 0.15);
  color: #5270e7;
}

/* Стили для отображения суммы */
.amount-display {
  font-size: 1.2em;
  font-weight: 600;
  text-align: right;
}

.amount-income {
  color: #16a34a;
}

.amount-expense {
  color: #dc2626;
}

.amount-transfer {
  color: #5270e7;
}

/* Стили для даты и времени */
.detail-date {
  font-weight: 500;
}

.detail-time {
  color: #8b95a7;
  margin-left: 6px;
}

.transaction-number-badge {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95em;
  font-weight: 500;
  color: #64748b;
  background: #f0f2f5;
  padding: 6px 16px;
  border-radius: 20px;
  letter-spacing: 0;
  text-align: right;
}

/* Стили для клиента */
.client-tag {
  display: flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
}

.client-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5270e7;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9em;
  margin-right: 8px;
}

/* Стили для отображения пользователя */
.user-info {
  display: flex;
  align-items: center;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
}

.user-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5270e7;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9em;
  margin-right: 8px;
}
/* Адаптивные стили для мобильных устройств */
@media (max-width: 639px) {
  #transactionViewModal {
    max-width: 100vw;
    width: 100vw;
  }
  
  .trx-modal-header {
    padding: 16px 24px;
  }
  
  .transaction-details-scroll {
    padding: 24px 24px;
  }
  
  .simple-gallery-section {
    padding: 16px 0;
    margin: 16px 0 0;
  }
  
  .trx-modal-actions {
    padding: 16px 24px;
  }
  
  .detail-label {
    flex: 0 0 110px;
    min-width: 110px;
  }
  
  .trx-modal-btn-row {
    gap: 28px !important; /* увеличенный отступ между кнопками */
  }
}

/* Backdrop как у других модальных окон */
#transactionViewModalBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(32,38,80,0.14);
  z-index: 10000;
  display: none;
  overflow: hidden; /* Предотвращаем скроллинг backdrop */
}

#transactionViewModalBackdrop.active {
  display: block;
}

/* Модальное окно в правой части экрана как другие модальные окна */
#transactionViewModal.active {
  transform: translateX(0);
}

/* Галерея — отступ сверху */
.simple-gallery-section {
  margin-top: 18px;
}

/* Кастомный скроллбар для WebKit браузеров */
.trx-modal-content::-webkit-scrollbar {
  width: 6px;
}

.trx-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.trx-modal-content::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

.trx-modal-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(156, 163, 175, 0.7);
}

/* Старые стили галереи удалены */

/* Скроллируемый контейнер для белого блока с деталями (как в trxModal) */

.transaction-details-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding: 24px 32px;
  box-shadow: none;
}


/* transaction-details-list больше не используется, убираем белый фон и отступы */
.transaction-details-list {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}


.detail-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
  min-height: 48px;
  position: relative;
  background: transparent;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
  transition: all 0.2s ease;
  width: 100%;
}


.detail-item:hover {
  background-color: transparent;
  box-shadow: none;
  border-radius: 0;
}

.detail-item:last-child {
  border-bottom: none;
}


.detail-label {
  font-size: 1.03rem;
  font-weight: 400;
  color: #64748b;
  width: 140px;
  flex-shrink: 0;
  line-height: 1.4;
  position: relative;
  padding-left: 0;
  letter-spacing: 0;
}


.detail-value {
  flex: 1;
  font-size: 1.03rem;
  font-weight: 500;
  color: #232b39;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
  gap: 8px;
  flex-wrap: wrap;
  padding-left: 0;
  padding-right: 0;
  margin-left: 20px;
  max-width: calc(100% - 160px);
}


.detail-time {
  color: #64748b;
  font-weight: 500;
  margin-left: 8px;
  font-size: 0.97rem;
  letter-spacing: 0.01em;
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.detail-date {
  font-weight: 500;
}


.detail-note {
  white-space: pre-wrap;
  line-height: 1.5;
  align-items: flex-start !important;
  background: none !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Типы операций - более сдержанный стиль */
.operation-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.operation-type-badge.income {
  background: #f0f9f4;
  color: #16a34a;
}

.operation-type-badge.expense {
  background: #fef2f2;
  color: #dc2626;
}

.operation-type-badge.transfer {
  background: #f8fafc;
  color: #475569;
}

/* Суммы - более компактные */
.amount-display {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  display: inline-flex;
  align-items: center;
}

.amount-display.positive {
  color: #16a34a;
}

.amount-display.negative {
  color: #dc2626;
}

.amount-display.transfer {
  color: #475569;
}

/* Пути категорий */
.category-path {
  display: flex;
  align-items: center;
  gap: 4px; /* Уменьшаем отступы между элементами категорий */
  flex-wrap: wrap;
}

/* Стили для элементов категорий в деталях транзакций (НЕ для дерева категорий!) */
.transaction-view-modal .category-item,
.detail-value .category-item {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
  line-height: 1.4;
}

.category-separator {
  color: #94a3b8;
  font-size: 0.85em;
  letter-spacing: 1px;
  font-weight: 500;
  margin: 0 2px;
}

/* Специальные стили для типов операций и сумм */
.detail-value .amount-display,
.detail-value .type-display {
  font-size: 16px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  background-color: rgba(241, 245, 249, 0.6);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  line-height: 1.2;
}

.detail-value .amount-display {
  min-width: 110px;
  justify-content: flex-end;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "tnum";
  background: transparent;
  box-shadow: none;
  border: none;
}

.detail-value .type-display {
  min-width: 80px;
  justify-content: center;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.95em;
  font-weight: 500;
  box-shadow: none;
  border: none;
}

.detail-value .amount-display.positive {
  color: #15803d;
  background-color: rgba(220, 252, 231, 0.7);
  border-color: rgba(134, 239, 172, 0.5);
}

.detail-value .amount-display.negative {
  color: #b91c1c;
  background-color: rgba(254, 226, 226, 0.7);
  border-color: rgba(252, 165, 165, 0.5);
}

.detail-value .amount-display.transfer {
  color: #0369a1;
  background-color: rgba(224, 242, 254, 0.7);
  border-color: rgba(125, 211, 252, 0.5);
}

.detail-value .type-display.income {
  color: #15803d;
  background-color: #dcfce7;
  border: none;
}

.detail-value .type-display.expense {
  color: #b91c1c;
  background-color: #fee2e2;
  border: none;
}

.detail-value .type-display.transfer {
  color: #0369a1;
  background-color: #e0f2fe;
  border: none;
}

/* Кнопки действий (компактные прямоугольные) */
.transaction-action-icons {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

.action-icon-btn {
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  min-width: 70px;
}

.action-icon-btn svg {
  width: 14px;
  height: 14px;
}

.action-icon-btn.edit-btn {
  background: #3b82f6;
  color: white;
}

.action-icon-btn.edit-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.action-icon-btn.delete-btn {
  background: #ef4444;
  color: white;
}

.action-icon-btn.delete-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Стили для категорий и клиентов */
.detail-value .category-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.detail-value .category-path {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 400;
  color: #4b5563;
  background-color: #f8fafc;
  border-right: 3px solid #64748b;
  margin: 2px 0;
  line-height: 1.5;
  max-width: 100%;
  gap: 6px;
  width: 100%;
  text-align: right;
  font-size: 0.95em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.detail-value .category-path .separator {
  color: #94a3b8;
  font-size: 13px;
  margin: 0 4px;
}

.detail-value .category-path .cat-item {
  color: #64748b;
  font-size: 0.95em;
  font-weight: 400;
}

.detail-value .category-path .cat-item-final {
  color: #334155;
  font-size: 0.95em;
  font-weight: 500;
}

.detail-value .client-tag,
.detail-value .account-tag,
.detail-value .dividend-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.3;
  margin: 2px 0;
}

.detail-value .client-tag {
  color: #6d28d9;
  background-color: rgba(243, 232, 255, 0.7);
  border-color: rgba(216, 180, 254, 0.4);
  font-size: 0.85em;
  white-space: normal;
  word-wrap: break-word;
  overflow: visible;
  max-width: 100%;
}

.detail-value .account-tag {
  color: #0369a1;
  background-color: rgba(224, 242, 254, 0.7);
  border-color: rgba(125, 211, 252, 0.4);
}

.detail-value .dividend-tag {
  color: #b45309;
  background-color: rgba(254, 243, 199, 0.7);
  border-color: rgba(253, 224, 71, 0.4);
}

.detail-value .user-info {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  background-color: rgba(241, 245, 249, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(203, 213, 225, 0.4);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.detail-value .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  border: 1px solid rgba(203, 213, 225, 0.7);
}

/* Улучшенные стили для заметки */
.detail-note {
  background-color: rgba(254, 252, 232, 0.6);
  border-right: 3px solid #fbbf24;
  padding: 10px 14px;
  margin: 3px 0;
  border-radius: 8px 0 0 8px;
  width: 100%;
  line-height: 1.5;
  text-align: right;
  color: #334155;
  font-size: 0.97em;
  font-weight: 400;
  font-style: normal;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

/* Стили для вложений */
.detail-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
}

.detail-attachment {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.detail-attachment:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.detail-attachment img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: block;
}

.detail-attachment-count {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 10px;
  font-size: 10px;
  padding: 2px 6px;
  font-weight: 600;
}

/* Анимация для элементов деталей */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.transaction-view-modal .detail-item {
  animation: fadeIn 0.25s ease-out forwards;
  opacity: 0;
}

.transaction-view-modal .detail-item:nth-child(1) { animation-delay: 0.03s; }
.transaction-view-modal .detail-item:nth-child(2) { animation-delay: 0.06s; }
.transaction-view-modal .detail-item:nth-child(3) { animation-delay: 0.09s; }
.transaction-view-modal .detail-item:nth-child(4) { animation-delay: 0.12s; }
.transaction-view-modal .detail-item:nth-child(5) { animation-delay: 0.15s; }
.transaction-view-modal .detail-item:nth-child(6) { animation-delay: 0.18s; }
.transaction-view-modal .detail-item:nth-child(7) { animation-delay: 0.21s; }
.transaction-view-modal .detail-item:nth-child(8) { animation-delay: 0.24s; }

/* Анимация для значений при наведении */
.detail-value .amount-display,
.detail-value .type-display,
.detail-value .category-path,
.detail-value .client-tag,
.detail-value .account-tag,
.detail-value .dividend-tag,
.detail-value .user-info,
.detail-value .transaction-number {
  transition: all 0.2s ease;
}

.detail-value .amount-display:hover,
.detail-value .type-display:hover,
.detail-value .category-path:hover,
.detail-value .client-tag:hover,
.detail-value .account-tag:hover,
.detail-value .dividend-tag:hover,
.detail-value .user-info:hover,
.detail-value .transaction-number:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}

/* Премиальные стили для основного контейнера транзакций */
.transaction-view-modal .transaction-view-details {
  background-color: transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  border: none;
}

.transaction-view-modal .transaction-view-details-header {
  padding: 16px;
  background-color: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.transaction-view-modal .transaction-view-details-title {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
}

.transaction-view-modal .transaction-view-details-body {
  padding: 0;
  background: transparent;
  margin-top: 0;
}

/* Улучшенная группировка информации */
.detail-item.is-group-start {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  margin-top: 8px;
  padding-top: 16px;
}

.detail-item.is-group-end {
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  margin-bottom: 8px;
  padding-bottom: 16px;
}

/* Стили для индикаторов типа информации */
.detail-value .indicator {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  margin-right: 8px;
}

.detail-value .indicator.income {
  background-color: #15803d;
}

.detail-value .indicator.expense {
  background-color: #b91c1c;
}

.detail-value .indicator.transfer {
  background-color: #0369a1;
}

.detail-value .indicator.general {
  background-color: #64748b;
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 639px) {
  #transactionViewModal {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
  }
  #transactionViewModal .trx-modal-content {
    padding: 0 0 32px 0;
  }
}

/* Блокировка скроллинга основной страницы при открытом модальном окне */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* 1. Фон модального окна — серый */
#transactionViewModal {
  background: #f9fafb;
}

/* 2. Детали — убираем лишний паддинг, делаем контент шире */
.transaction-details-scroll {
  padding: 24px 32px;
  background: transparent;
}

/* 3. Галерея — фон тоже серый, убираем белый */
.modern-gallery-main {
  background: #f9fafb;
  box-shadow: none;
}

/* 4. Кнопки действий — фон серый */
.trx-modal-actions {
  background: #f9fafb;
}

/* 5. Убираем белый фон у заметки, если он есть */
.detail-note {
  background: none !important;
  border-left: 3px solid #fbbf24;
  padding: 10px 14px;
  margin: 3px 0;
  border-radius: 0 8px 8px 0;
  width: 100%;
  line-height: 1.5;
  font-size: 14px;
  color: #422006;
  box-shadow: none !important;
}

/* Фон модального окна — серый */
#transactionViewModal {
  background: #f9fafb;
}

/* Скроллируется только .trx-modal-content */
#transactionViewModal .trx-modal-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0;
  background: #f9fafb;
  min-height: 0;
  height: calc(100vh - 70px);
}

/* Галерея и детали — общие настройки */
.modern-gallery-section {
  background: transparent !important;
  box-shadow: none !important;
  margin: 0 0 24px 0 !important;
}

/* Кнопки действий — настройки позиционирования */
.trx-modal-actions {
  position: static;
  border-top: 1px solid #f1f2f4;
  background: #f9fafb;
  padding: 16px 32px;
  justify-content: flex-end;
  display: flex;
}

/* У detail-item убираем лишние паддинги по бокам */
.detail-item {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* На мобильных — на всю ширину */
@media (max-width: 639px) {
  #transactionViewModal {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
  }
  #transactionViewModal .trx-modal-content {
    padding: 0 0 32px 0;
  }
}

/* Убираем спецстили для суммы и номера */
.detail-value .amount-display,
.detail-value .transaction-number {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: #232b39 !important;
  font-size: 1.03rem !important;
  font-weight: 500 !important;
}
/* --- СТИЛИ МОДАЛЬНЫХ ОКОН (перенесено из financi-modal.css 01.07.2025) --- */

.modal-backdrop,
#clientModalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(32,38,80,0.14);
  z-index: 1090;
  display: none;
}
.modal-backdrop.active,
#clientModalBackdrop.active {
  display: block;
}

.modal,
#clientModal {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: 100vw;
  max-width: 420px;
  background: #fff;
  z-index: 1100;
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -4px 0 28px rgba(60, 70, 120, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.modal.active,
#clientModal.active {
  transform: translateX(0);
}

.client-modal-header {
  display: flex;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid #f0f2f6;
}
.client-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #232b39;
  flex: 1;
  letter-spacing: -0.4px;
}
.client-modal-close {
  font-size: 2.3rem;
  color: #bcc4e0;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 12px;
  line-height: 1;
  transition: color 0.18s;
}
.client-modal-close:hover {
  color: #5270e7;
}
.client-modal-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background: #fff;
  padding-bottom: 32px;
}
.client-modal-label {
  display: block;
  font-size: 1.03rem;
  color: #445174;
  font-weight: 600;
  margin-bottom: 12px; /* Унифицированный отступ под заголовками */
  margin-top: 12px; /* Унифицированный отступ над заголовками */
  letter-spacing: -0.2px;
}
.client-modal-input,
.cat-modal-input {
  width: 100%;
  border-radius: 11px;
  border: 1.35px solid #e9eaf2;
  padding: 15px 16px;
  font-size: 1rem;
  margin-bottom: 12px; /* Единый отступ между полями */
  background: #fcfcfe;
  color: #222a38;
  font-weight: 500;
  box-shadow: 0 2px 7px rgba(60, 80, 140, 0.04);
  transition: border-color 0.15s, box-shadow 0.16s;
}
.client-modal-input:focus,
.cat-modal-input:focus {
  border-color: #5270e7;
  outline: none;
  box-shadow: 0 2px 12px rgba(82, 112, 231, 0.13);
}
.client-modal-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 33px;
}
.client-modal-btn {
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  min-width: 110px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 6px rgba(80,110,210,0.03);
  transition: background 0.17s, color 0.13s, box-shadow 0.14s;
}
.client-modal-btn:hover {
  background: #1743b3;
}
.client-modal-btn-row .client-modal-btn:first-child {
  background: #f3f7fd;
  color: #29385a;
  border: 1.3px solid #e3e5f0;
}
.client-modal-btn-row .client-modal-btn:first-child:hover {
  background: #e9effd;
}

/* --- Category modal specific styles --- */

/* Slide-in модалка категорий */
#categoryModalBackdrop {
  position: fixed;
  inset: 0;
  background: transparent; /* убирает голубой фон */
  z-index: 1090; /* ниже панели, но выше контента и шапки */
  display: none;
}
#categoryModalBackdrop.active {
  display: block;
}

#categoryModal {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 100vw;
  max-width: 420px;
  background: #fff;
  z-index: 1100; /* выше backdrop и sticky-хедера */
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -4px 0 28px rgba(60, 70, 120, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
#categoryModal.active {
  transform: translateX(0);
}
@media (max-width: 640px) {
  #categoryModal {
    max-width: 100vw;
    padding-left: 1.5rem; /* Увеличиваем левый отступ */
    padding-right: 1.5rem; /* Увеличиваем правый отступ */
  }
}

/* Заголовок и кнопка закрытия */
.cat-modal-header {
  display: flex;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid #f0f2f6;
}
.cat-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #232b39;
  flex: 1;
  letter-spacing: -0.4px;
}
.cat-modal-close {
  font-size: 2.3rem;
  color: #bcc4e0;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 12px;
  line-height: 1;
  transition: color 0.18s;
}
.cat-modal-close:hover {
  color: #5270e7;
}

/* Контент и поля формы */
.cat-modal-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background: #fff;
  padding-bottom: 32px;
}
.cat-modal-label {
  font-size: 1.03rem;
  color: #445174;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 17px;
  letter-spacing: -0.2px;
}
.cat-modal-input {
  width: 100%;
  border-radius: 11px;
  border: 1.35px solid #e9eaf2;
  padding: 15px 16px;
  font-size: 1rem;
  margin-bottom: 12px; /* Единый отступ между полями */
  background: #fcfcfe;
  color: #222a38;
  font-weight: 500;
  box-shadow: 0 2px 7px rgba(60, 80, 140, 0.04);
  transition: border-color 0.15s, box-shadow 0.16s;
}
.cat-modal-input:focus {
  border-color: #5270e7;
  outline: none;
  box-shadow: 0 2px 12px rgba(82, 112, 231, 0.13);
}

/* Кнопки */
.cat-modal-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 33px;
}
.cat-modal-btn {
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  min-width: 110px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 6px rgba(80, 110, 210, 0.03);
  transition: background 0.17s, color 0.13s, box-shadow 0.14s;
}
.cat-modal-btn:hover {
  background: #1743b3;
}
.cat-modal-btn-row .cat-modal-btn:first-child {
  background: #f3f7fd;
  color: #29385a;
  border: 1.3px solid #e3e5f0;
}
.cat-modal-btn-row .cat-modal-btn:first-child:hover {
  background: #e9effd;
}

/* ---- Селектор категорий (дерево) ---- */
.cat-tree-select-wrap { position: relative; margin-bottom: 12px; }
.cat-tree-select-display {
  display: flex; align-items: center; justify-content: space-between;
  background: #fcfcfe; border: 1.35px solid #e9eaf2;
  border-radius: 11px; padding: 16px 17px; font-size: 1rem; font-weight: 500; color: #222a38;
  cursor: pointer; box-shadow: 0 2px 9px rgba(60,80,140,0.04); min-height: 54px;
  transition: border-color .18s, box-shadow .18s;
}
.cat-tree-select-display.active, .cat-tree-select-display:focus { border-color: #5270e7; box-shadow: 0 2px 16px rgba(82,112,231,0.13);}
.cat-tree-select-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 2022;
  background: #fff; border: 1.35px solid #e9eaf2; border-radius: 14px;
  box-shadow: 0 10px 30px 0 rgba(60,80,130,0.15);
  max-height: 330px; overflow-y: auto; animation: fadeIn .13s; margin-top: 2px;
  padding: 4px 0;
}
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
.cat-tree-option {
  display: flex; align-items: center;
  font-size: 1.06rem; color: #232b39;
  padding: 15px 10px 15px 0;
  cursor: pointer; border-radius: 8px;
  gap: 8px; user-select: none; margin-bottom: 2px;
  position: relative; background: #fff; min-height: 48px;
  padding-left: 18px;
  transition: background .13s, color .13s, box-shadow .17s;
}
.cat-tree-option:hover, .cat-tree-option.selected {
  background: linear-gradient(90deg, #f4f7fd 70%, #eef2fa 100%);
  color: #2563eb; box-shadow: 0 1px 4px #e6e9fa;
}
.cat-tree-option.selected::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #2563eb; border-radius: 2.5px;
}
.cat-tree-chevron {
  width: 23px; height: 23px; margin-right: 7px; color: #bbc4d6;
  transition: transform .17s cubic-bezier(.32,1.14,.34,1);
  display: inline-block; vertical-align: middle;
}
.cat-tree-chevron.open { transform: rotate(180deg);}
.cat-tree-option .cat-tree-label { flex: 1; font-size: 1.07em;}
.cat-tree-option.selected .cat-tree-label { font-weight: 600; color: #2563eb;}
.cat-tree-option.root { font-weight: 500; color: #a0a3ae;}
.cat-tree-option.root.selected .cat-tree-label { color: #2563eb;}
.cat-tree-children { margin: 0; padding: 0; }
.cat-tree-indent { display: inline-block; width: 18px; }

/* ---- Кастомный селект типа ---- */
.cat-type-select-wrap { position: relative; margin-bottom: 12px; }
.cat-type-select-display {
  display: flex; align-items: center; justify-content: space-between;
  background: #fcfcfe; border: 1.35px solid #e9eaf2; border-radius: 11px;
  padding: 16px 17px; font-size: 1rem; font-weight: 500; color: #222a38;
  cursor: pointer; box-shadow: 0 2px 9px rgba(60,80,140,0.04); min-height: 54px;
  transition: border-color .18s, box-shadow .17s;
}
.cat-type-select-display.active, .cat-type-select-display:focus {
  border-color: #5270e7; box-shadow: 0 2px 16px rgba(82,112,231,0.13);
}
.cat-type-select-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 2022;
  background: #fff; border: 1.35px solid #e9eaf2; border-radius: 14px;
  box-shadow: 0 10px 30px 0 rgba(60,80,130,0.14);
  animation: fadeIn .12s; margin-top: 2px; padding: 5px 0;
}
.cat-type-option {
  font-size: 1.05rem; color: #232b39; padding: 15px 24px 15px 21px; cursor: pointer;
  border-radius: 7px; transition: background .14s, color .13s;
  background: #fff;
}
.cat-type-option:hover, .cat-type-option.selected {
  background: linear-gradient(90deg, #f5f8fe 60%, #e6f0fd 100%);
  color: #2563eb;
}
.cat-type-option.selected { font-weight: 600; }

/* Красивый селектор цвета */
.color-select-wrap {
  position: relative;
  margin-bottom: 15px;
}
.color-select-display {
  display: flex;
  align-items: center;
  background: #fcfcfe;
  border: 1.35px solid #e9eaf2;
  border-radius: 11px;
  padding: 14px 17px;
  font-size: 1rem;
  font-weight: 500;
  color: #222a38;
  cursor: pointer;
  box-shadow: 0 2px 9px rgba(60,80,140,0.04);
  min-height: 54px;
  transition: border-color .18s, box-shadow .18s;
}
.color-select-display.active,
.color-select-display:focus {
  border-color: #5270e7;
  box-shadow: 0 2px 16px rgba(82,112,231,0.13);
}
.color-select-dropdown {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 3px); z-index: 2022;
  background: #fff;
  border: 1.35px solid #e9eaf2;
  border-radius: 14px;
  box-shadow: 0 10px 30px 0 rgba(60,80,130,0.14);
  animation: fadeIn .12s;
  margin-top: 2px;
  padding: 7px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
}
.color-select-option {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 7px;
  transition: background .14s;
}
.color-select-option:hover,
.color-select-option.selected {
  background: linear-gradient(90deg, #f5f8fe 60%, #e6f0fd 100%);
}
.color-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #e9eaf2;
  box-shadow: 0 1px 4px #e6e9fa;
  display: inline-block;
}
.color-select-option.selected .color-circle,
.color-select-option:hover .color-circle {
  border-color: #5270e7;
}
.color-code {
  margin-left: 12px;
  font-size: 1rem;
  color: #232b39;
}

/* Кастомные кнопки для выбора цвета */
.color-custom-btn {
  background: none;
  border: none;
  color: #5270e7;
  font-weight: 500;
  cursor: pointer;
  margin-top: 6px;
  padding: 0;
  font-size: 1em;
  transition: color .13s;
}
.color-custom-btn:hover { color: #2b3e8e; }

/* Селектор цвета (новый) */
.color-picker-wrap {
  display: flex;
  align-items: center;
}
.color-picker-btn {
  background: none; /* или transparent */
  border: 1.35px solid #e9eaf2;
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 500;
  color: #222a38;
  cursor: pointer;
  min-height: 54px;
  box-shadow: 0 2px 9px rgba(60,80,140,0.04);
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
  justify-content: flex-start;
}
.color-picker-btn:focus,
.color-picker-btn.active {
  border-color: #5270e7;
  box-shadow: 0 2px 16px rgba(82,112,231,0.13);
}
.color-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #e9eaf2;
  box-shadow: 0 1px 4px #e6e9fa;
  display: inline-block;
}

/* Стилизация чекбокса */
.user-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #bfc8e6;
  border-radius: 7px;
  background: #fff;
  margin-right: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  vertical-align: middle;
  position: relative;
  box-shadow: 0 1px 4px #e6e9fa;
}

.user-option input[type="checkbox"]:checked {
  border-color: #2563eb;
  background: #2563eb;
}

.user-option input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.user-option label {
  font-size: 1.08em;
  color: #232b39;
  cursor: pointer;
  user-select: none;
}
/* Для всех label внутри модальных окон — отступ вниз */
.cat-modal-label,
.client-modal-label {
  display: block;         /* На всякий случай, чтобы label был блочным */
  margin-bottom: 8px;     /* Здесь можно подправить под твой вкус: 6-12px */
}

/* Унификация отступов для всех лейблов */
.trx-modal-label,
.cat-modal-label,
.client-modal-label {
  display: block;
  font-size: 1.04rem;
  color: #445174;
  font-weight: 600;
  margin-top: 14px !important;
  margin-bottom: 8px !important;
  letter-spacing: -0.2px;
}

/* Унификация отступов для всех input, select, textarea */
.trx-modal-input,
.cat-modal-input,
.client-modal-input,
#trxNoteInput,
.cat-select-wrap,
.cat-type-select-wrap,
.cat-tree-select-wrap,
.color-select-wrap,
.multiselect-wrap {
  margin-bottom: 14px !important; /* Единый отступ между элементами */
  margin-top: 0 !important; /* Сброс лишнего отступа сверху */
}

/* Удаление нестандартных margin у #trxNoteInput */
#trxNoteInput {
  height: 90px;
  min-height: 90px;
  max-height: 300px;
  resize: none;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 14px !important; /* Применение унифицированного отступа */
  margin-top: 0 !important; /* Сброс лишнего отступа сверху */
}

@media (max-width: 640px) {
  .modal, #clientModal, #categoryModal {
    max-width: 100vw;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Мобильные стили для модальных окон категорий */
  #categoryModal .cat-modal-content {
    padding: 20px 20px 24px 20px; /* Увеличиваем левый отступ */
  }
  
  /* Стили для полей ввода в модальных окнах категорий */
  .cat-modal-input {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px; /* Обеспечиваем внутренний отступ */
    padding-right: 16px;
  }
  
  /* Стили для селекторов в модальных окнах категорий */
  .cat-tree-select-display,
  .cat-type-select-display {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px; /* Обеспечиваем внутренний отступ */
    padding-right: 16px;
  }
  
  /* Стили для лейблов в модальных окнах категорий */
  .cat-modal-label {
    margin-left: 0;
    padding-left: 4px; /* Небольшой отступ для лейблов */
  }
  
  /* Убираем отрицательные отступы на мобильных */
  .cat-tree-select-wrap,
  .cat-type-select-wrap {
    margin-left: 0;
    margin-right: 0;
  }
  
  /* Мобильные стили для выпадающих списков в категориях */
  .cat-tree-select-dropdown,
  .cat-type-select-dropdown {
    margin-left: 0;
    margin-right: 0;
    left: 0;
    right: 0;
  }
  
  /* Стили для опций в дропдаунах на мобильных */
  .cat-tree-option,
  .cat-type-option {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }
}

/* --- Стили для модального окна пользователя (универсальные) --- */
.user-modal-photo-preview {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #e8eefa;
  box-shadow: 0 2px 12px 0 rgba(64,80,130,0.09);
}
.user-modal-input-file {
  width: 100%;
  border-radius: 10px;
  border: 1.2px solid #e7eaf2;
  padding: 11px 16px;
  font-size: 1rem;
  margin-bottom: 8px;
  background: #f4f6fd;
  color: #232b39;
  transition: border-color 0.16s;
  font-weight: 500;
  cursor: pointer;
  border-style: dashed;
}

/* --- Стили для мультиселектора ролей/прав --- */
.multiselect-wrap {
  position: relative;
  margin-bottom: 18px;
}
.multiselect-selected {
  background: #fcfcfe;
  border: 1.35px solid #e9eaf2;
  border-radius: 11px;
  padding: 15px 16px;
  font-size: 1rem;
  font-weight: 500;
  color: #222a38;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(60, 80, 140, 0.04);
  min-height: 54px;
  transition: border-color .18s, box-shadow .18s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.multiselect-selected:focus,
.multiselect-selected.active {
  border-color: #5270e7;
  box-shadow: 0 2px 16px rgba(82,112,231,0.13);
}
.multiselect-dropdown {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 3px); z-index: 2022;
  background: #fff;
  border: 1.35px solid #e9eaf2;
  border-radius: 14px;
  box-shadow: 0 10px 30px 0 rgba(60,80,130,0.15);
  max-height: 330px;
  overflow-y: auto;
  animation: fadeIn .13s;
  margin-top: 2px;
  padding: 4px 0;
}
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
.multiselect-option {
  display: flex;
  align-items: center;
  font-size: 1.06rem;
  color: #232b39;
  padding: 12px 18px;
  cursor: pointer;
  border-radius: 8px;
  gap: 8px;
  user-select: none;
  background: #fff;
  transition: background .13s, color .13s, box-shadow .17s;
}
.multiselect-option.selected,
.multiselect-option:hover {
  background: linear-gradient(90deg, #f4f7fd 70%, #eef2fa 100%);
  color: #2563eb;
}
.multiselect-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #bfc8e6;
  border-radius: 7px;
  background: #fff;
  margin-right: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  box-shadow: 0 1px 4px #e6e9fa;
  vertical-align: middle;
}
.multiselect-checkbox:checked {
  border-color: #2563eb;
  background: #2563eb;
}
.multiselect-checkbox:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.multiselect-placeholder {
  color: #bfc6cf;
}
.multiselect-chevron {
  display: flex;
  align-items: center;
  margin-left: 8px;
  transition: transform 0.18s;
}
.multiselect-selected.open .multiselect-chevron svg {
  transform: rotate(180deg);
}
.multiselect-chevron svg {
  display: block;
}

/* Required field asterisk */
.required-star {
  color: #e53e3e;
  font-size: 1.15em;
  margin-left: 4px;
  vertical-align: super;
  font-weight: bold;
  user-select: none;
}

.custom-file-wrap {
  display: flex;
  align-items: center;
  border: 1.35px solid #e9eaf2;
  border-radius: 11px;
  background: #fcfcfe;
  padding: 14px 18px;
  cursor: pointer;
  min-height: 62px;
  transition: border-color .18s, box-shadow .18s;
  box-shadow: 0 2px 7px rgba(60, 80, 140, 0.04);
  position: relative;
  gap: 14px;
}
.custom-file-wrap:hover, .custom-file-wrap:focus {
  border-color: #5270e7;
  box-shadow: 0 2px 16px rgba(82,112,231,0.13);
}
.custom-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.custom-file-text {
  font-size: 1.08em;
  color: #232b39;
  font-weight: 500;
  margin-right: 10px;
  white-space: nowrap;
}
.user-modal-photo-preview {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #e8eefa;
  margin-left: auto;
  margin-right: 0;
  box-shadow: 0 2px 12px 0 rgba(64,80,130,0.09);
  display: block;
}

.photo-field-wrap {
  display: flex;
  align-items: center;
  gap: 16px; /* расстояние между фото и текстом */
  justify-content: flex-start; /* выравнивание по левому краю */
}

.user-modal-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  /* Можно добавить border, если нужно */
}

.checkbox-wrap {
  margin-bottom: 28px; /* увеличенный отступ под чекбоксом */
  margin-top: 8px;
}

#trxModalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(32,38,80,0.14);
  z-index: 1090;
  display: none;
}
#trxModalBackdrop.active {
  display: block;
}
#trxModal {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background: #fff;
  z-index: 1100;
  box-shadow: -4px 0 40px rgba(30,40,90,0.12);
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 440px;
  transition: transform .34s cubic-bezier(.32,1.14,.34,1);
  transform: translateX(100%);
  padding: 0;
  border-radius: 0;
}
#trxModal.active {
  transform: translateX(0);
}
@media (max-width: 639px) {
  .trx-modal-content {
    padding-bottom: 90px !important;
  }
}
.trx-modal-header {
  padding: 27px 27px 11px 27px;
  border-bottom: 1px solid #f3f4f7;
  display: flex;
  align-items: center;
  background: #fff;
}
.trx-modal-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #232b39;
  flex:1;
  letter-spacing: -.5px;
}
.trx-modal-close {
  font-size: 2.3rem;
  color: #bcc4d0;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 12px;
  line-height: 1;
  transition: color .18s;
}
.trx-modal-close:hover {
  color: #5270e7;
}
.trx-modal-content {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  padding: 0 23px 22px 23px;
}
.trx-modal-label {
  font-size: 1.03rem;
  color: #445174;
  font-weight: 600;
  margin-bottom: 12px !important;
  margin-top: 12px;
  letter-spacing: -.2px;
}
.trx-modal-input {
  width: 100%;
  border-radius: 11px;
  border: 1.35px solid #e9eaf2;
  padding: 15px;
  font-size: 1rem;
  margin-bottom: 12px;
  background: #fcfcfe;
  color: #222a38;
  transition: border-color .15s, box-shadow .16s;
  font-weight: 500;
  box-shadow: 0 2px 7px rgba(60,80,140,0.04);
  min-height: 48px;
  max-height: 150px;
  resize: vertical;
  box-sizing: border-box;
}
.trx-modal-input:focus {
  border-color: #5270e7;
  outline: none;
  box-shadow: 0 2px 12px rgba(82,112,231,0.13);
}
.trx-modal-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 33px;
}
.trx-modal-btn {
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  min-width: 110px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 6px rgba(80,110,210,0.03);
  transition: background .17s, color 0.13s, box-shadow 0.14s;
}
.trx-modal-btn:hover {
  background: #1743b3;
}
.trx-modal-btn-row .trx-modal-btn:first-child {
  background: #f3f7fd;
  color: #29385a;
  border: 1.3px solid #e3e5f0;
}
.trx-modal-btn-row .trx-modal-btn:first-child:hover {
  background: #e9effd;
}
.trx-modal-error {
  color: #e11d48;
  font-size: 0.95em;
  margin-bottom: 2px;
  display: none;
}
.trx-modal-attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 0.5rem;
  width: 100%;
}
.trx-modal-attachments-preview img,
.trx-modal-attachments-preview video {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.13);
  cursor: default;
}
.trx-modal-attachments-preview .file-icon {
  width: 120px;
  height: 120px;
  border-radius: 14px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #64748b;
}
.cat-select-wrap {
  position: relative;
  margin-bottom: 12px;
}
.cat-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fcfcfe;
  border: 1.8px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 500;
  color: #1e293b;
  cursor: pointer;
  min-height: 48px;
  transition: border-color .18s, box-shadow .18s;
}
.cat-select-display:focus, .cat-select-display.active {
  border-color: #2563eb;
  box-shadow: 0 2px  12px #93c5fd55;
}
.cat-select-placeholder {
  color: #7b8498;
}
.cat-select-chevron {
  display: inline-block;
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease-in-out;
}
.cat-select-display.active .cat-select-chevron {
  transform: rotate(180deg);
}
.cat-select-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  z-index: 2022;
  background: #fff;
  border: 1.8px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 10px 30px 0 rgba(60,80,130,0.13);
  max-height: 500px; /* Увеличено с 400px до 500px */
  overflow-y: auto;
  animation: fadeIn .13s;
  margin-top: 2px;
  padding: 4px 0;
}
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }

/* Стили для поиска в селекторе категорий */
.cat-search-input {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 12px 16px !important;
  border: none !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: 0 !important;
  font-size: 15px !important;
  background: #f8fafc !important;
  color: #1e293b !important;
  font-weight: 500 !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}

.cat-search-input:focus {
  border-bottom-color: #3b82f6 !important;
  background: #ffffff !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15) !important;
}

.cat-search-input::placeholder {
  color: #94a3b8 !important;
  font-weight: 400 !important;
  opacity: 1 !important;
}

/* Обертка для категорий (создается динамически) */
.cat-options-wrapper {
  padding: 4px 0 !important;
}

/* Мобильные стили для поиска в селекторе категорий */
@media (max-width: 640px) {
  .cat-search-input {
    padding: 15px 16px !important;
    font-size: 16px !important; /* 16px для предотвращения зума на iOS */
    min-height: 50px !important;
    touch-action: manipulation !important;
    background: #ffffff !important;
    border-bottom: 2px solid #e2e8f0 !important;
  }
  
  .cat-search-input:focus {
    background: #f8fafc !important;
    border-bottom-color: #3b82f6 !important;
  }
  
  .cat-select-dropdown {
    max-height: 60vh !important; /* Используем viewport height для лучшей адаптации */
    padding: 0 !important;
    border-radius: 12px !important;
  }
  
  /* Категории внутри дропдауна */
  .cat-tree-option {
    padding: 14px 16px !important;
    font-size: 15px !important;
    min-height: 48px !important;
  }
  
  .cat-tree-option:first-of-type {
    margin-top: 4px !important;
  }
}

/* Стили для очень маленьких экранов */
@media (max-width: 480px) {
  .cat-search-input {
    font-size: 16px !important;
    padding: 16px !important;
    min-height: 52px !important;
  }
  
  .cat-tree-option {
    padding: 15px 16px !important;
    font-size: 16px !important;
    min-height: 50px !important;
  }
}

.cat-tree-option {
  display: flex;
  align-items: center;
  font-size: 1.06rem;
  color: #232b39;
  padding: 12px 10px 12px 18px;
  cursor: pointer;
  border-radius: 8px;
  gap: 8px;
  user-select: none;
  margin-bottom: 2px;
  position: relative;
  background: #fff;
  min-height: 38px;
  transition: background .13s, color .13s, box-shadow .17s;
}
.cat-tree-option:hover, .cat-tree-option.selected {
  background: linear-gradient(90deg, #f4f7fd 70%, #eef2fa 100%);
  color: #2563eb;
  box-shadow: 0 1px 4px #e6e9fa;
}
.cat-tree-option.selected::after {
  content: "";
  position: absolute;
 left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #2563eb;
  border-radius: 2.5px;
}
.cat-tree-label {
  flex: 1;
  font-size: 1.07em;
}
.cat-tree-option.selected .cat-tree-label {
  font-weight: 600;
 color: #2563eb;
}
.cat-tree-option.root { 
  font-weight: 500; 
  color: #a0a3ae;
}
.cat-tree-option.root.selected .cat-tree-label { 
  color: #2563eb;
}
.cat-tree-children { 
  margin: 0; 
  padding: 0;
  background: #f8fafc;
  border-left: 2px solid #e2e8f0;
  margin-left: 12px;
}
.cat-tree-chevron { 
  display: inline-block; 
  width: 18px; 
  margin-right: 2px; 
  font-size: 1.1em; 
  color: #b5b9c7; 
  cursor: pointer; 
  transition: transform .18s; 
  transform: rotate(0deg); 
  user-select: none;
}
.cat-tree-chevron.open { 
  transform: rotate(90deg); 
  color: #2563eb;
}

/* Визуализация уровней вложенности через отступы */
.cat-tree-children .cat-tree-option {
  padding-left: 24px !important;
}
.cat-tree-children .cat-tree-children .cat-tree-option {
  padding-left: 36px !important;
  background: #fcfdfe;
}
.cat-tree-children .cat-tree-children .cat-tree-children .cat-tree-option {
  padding-left: 48px !important;
}

/* Мобильная адаптация для дерева категорий */
@media (max-width: 640px) {
  .cat-tree-option {
    padding: 14px 16px !important;
    font-size: 15px !important;
    min-height: 48px !important;
  }
  
  .cat-tree-children {
    margin-left: 8px;
    border-left-width: 3px;
  }
  
  .cat-tree-children .cat-tree-option {
    padding-left: 28px !important;
  }
  .cat-tree-children .cat-tree-children .cat-tree-option {
    padding-left: 40px !important;
  }
  .cat-tree-children .cat-tree-children .cat-tree-children .cat-tree-option {
    padding-left: 52px !important;
  }
}
.trx-tree-option {
  display: flex;
  align-items: center;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 1.03rem;
  color: #445174;
  padding: 12px 10px 12px 18px;
  cursor: pointer;
  border-radius: 8px;
  gap: 8px;
  user-select: none;
  margin-bottom: 2px;
  position: relative;
  background: #fff;
  min-height: 36px;
  font-weight: 600;
  letter-spacing: -.2px;
  transition: background .13s, color .13s, box-shadow .17s;
}
.trx-tree-option:hover, .trx-tree-option.selected {
  background: linear-gradient(90deg, #f4f7fd 70%, #eef2fa 100%);
  color: #2563eb;
  box-shadow: 0 1px 4px #e6e9fa;
}
.trx-tree-option.selected::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #2563eb;
  border-radius: 2.5px;
}
.trx-tree-label {
  flex: 1;
  font-family: inherit;
  font-size: 1em;
  font-weight: inherit;
  color: inherit;
  letter-spacing: inherit;
}
.trx-tree-option.selected .trx-tree-label {
  font-weight: 700;
  color: #2563eb;
}
.trx-balance {
  font-weight: 500;
  color: #64748b;
  margin-left: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
#trxNoteInput {
  height: 90px;
  min-height: 90px;
  max-height: 300px;
  resize: none;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 14px !important; /* Применение унифицированного отступа */
  margin-top: 0 !important; /* Сброс лишнего отступа сверху */
}

/* --- КОНЕЦ СТИЛЕЙ МОДАЛЬНЫХ ОКОН --- */

/* --- Стили для модального окна просмотра транзакции --- */
#transactionViewModalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(32,38,80,0.14);
  z-index: 1000;
  display: none;
}
#transactionViewModalBackdrop.active {
  display: block;
}
#transactionViewModal {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background: #fff;
  z-index: 1010;
  box-shadow: -4px 0 40px rgba(30,40,90,0.12);
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 440px;
  transition: transform .34s cubic-bezier(.32,1.14,.34,1);
  transform: translateX(100%);
  padding: 0;
  border-radius: 0;
}
#transactionViewModal.active {
  transform: translateX(0);
}

.details-table {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.detail-row {
  display: flex;
  padding: 14px 0;
  border-bottom: 1px solid rgba(203, 213, 225, 0.4);
}

.detail-row-primary {
  background-color: #f8fafc;
  padding: 16px;
  border-radius: 10px;
  margin: 6px 0;
}

.detail-label {
  width: 35%;
  color: #64748b;
  font-weight: 500;
  font-size: 0.95rem;
  padding-right: 10px;
}

.detail-value {
  width: 65%;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.note-row {
  flex-direction: column;
}

.note-row .detail-label {
  width: 100%;
  margin-bottom: 10px;
}

.note-row .detail-value {
  width: 100%;
}

.note-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  color: #334155;
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.transaction-number-badge {
 
  display: inline-block;
  background-color: #f1f5f9;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
}

.transaction-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.type-income {
  background-color: #dcfce7;
  color: #166534;
}

.type-expense {
  background-color: #fee2e2;
  color: #991b1b;
}

.type-transfer {
  background-color: #e0f2fe;
  color: #0369a1;
}

.transaction-amount {
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.amount-income {
  color: #16a34a;
}

.amount-expense {
  color: #dc2626;
}

.amount-transfer {
  color: #2563eb;
}

.trx-account-tag {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 400;
}

/* Галерея для просмотра вложений */
.modern-gallery-section {
  margin-top: 20px;
}

.modern-gallery-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 15px;
}

.modern-gallery-viewer {
  background: #f8fafc;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  margin-bottom: 10px;
  overflow: hidden;
}

.modern-gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.gallery-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
}

.gallery-nav-btn:hover {
  background: #cbd5e1;
}

.gallery-counter {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

.modern-gallery-thumbnails {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  padding: 5px 0;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.gallery-thumbnail {
  flex: 0 0 70px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}

.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumbnail.active {
  border-color: #2563eb;
}

/* Стили для хлебных крошек категорий в просмотре транзакции (НЕ для дерева категорий!) */
.transaction-view-modal .category-list,
.detail-value .category-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.transaction-view-modal .category-list-item,
.detail-value .category-list-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.category-arrow {
  width: 12px;
  height: 12px;
  margin: 0 2px;
  flex-shrink: 0;
}

.category-label {
  color: #334155;
  font-weight: 500;
}

.transaction-view-modal .category-list-item:last-child .category-label,
.detail-value .category-list-item:last-child .category-label {
  color: #2563eb;
  font-weight: 600;
}

/* Дополнительные стили для карточек */
.client-info, .dividend-info, .related-account-info, .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-initials, .client-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* Специальные стили для заметки в модальном окне просмотра транзакции */
#trxViewNoteRow .detail-value {
  flex-wrap: wrap;
  justify-content: flex-end;
  text-align: right;
  max-width: 100%;
  width: 100%;
}

#trxViewNote {
  width: 100%;
  max-width: 100%;
  text-align: right;
  font-style: normal;
  color: #4b5563;
  padding: 10px 14px;
  background-color: #f8fafc;
  border-radius: 8px;
  border-right: 3px solid #64748b;
  margin-left: 0;
  margin-right: 0;
  font-size: 0.95em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  line-height: 1.5;
  word-break: break-word;
}

/* Простое отображение категорий в одну строку */
.category-inline {
  font-size: 0.97em;
  color: #334155;
  font-weight: 400;
  line-height: 1.5;
  word-wrap: break-word;
}

/* ========================================
   КНОПКИ ДЕЙСТВИЙ В МОДАЛЬНОМ ОКНЕ ДЕТАЛЕЙ ТРАНЗАКЦИИ
======================================== */

/* Стили для кнопок просмотра транзакций */
.trx-view-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
}

.trx-view-icon-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

.trx-view-icon-btn:active {
  background: #e5e7eb;
}

/* SVG иконки в кнопках */
.trx-view-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
  display: block;
  margin: 0 auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Специфичные стили для кнопки редактирования */
.trx-view-icon-btn.edit-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #d97706;
}

/* Специфичные стили для кнопки удаления */
.trx-view-icon-btn.delete-btn:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .trx-view-icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
  }
  
  .trx-view-icon-btn svg {
    width: 22px;
    height: 22px;
    display: block;
    margin: 0 auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
  .trx-view-icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
  }
  
  .trx-view-icon-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* Модификация контейнера кнопок для выравнивания по правой стороне в модальном окне просмотра */
#trxViewActions.trx-modal-btn-row {
  justify-content: flex-end;
  gap: 12px;
}

/* ================================================================
   СТИЛИ ДЛЯ СТРАНИЦ КЛИЕНТОВ, ДИВИДЕНДОВ, РОЛЕЙ И ДРУГИХ СУЩНОСТЕЙ
================================================================ */

/* Header */
.clients-page-header,
.divcat-page-header {
  max-width: 1100px;
  margin: 18px auto 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 18px 0;
}

/* Заголовок */
.clients-page-title,
.divcat-page-title {
  position: relative;
  display: inline-block;
  font-size: 1.22rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.clients-page-title::after,
.divcat-page-title::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 7px;
  width: 100%;
  background: linear-gradient(
    90deg,
    rgba(180, 186, 200, 0) 0%,
    rgba(180, 186, 200, 0.7) 20%,
    rgba(180, 186, 200, 0.7) 80%,
    rgba(180, 186, 200, 0) 100%
  );
  border-radius: 2px;
}

/* Кнопки */
.clients-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.client-search-btn,
.client-add-btn {
  height: 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  font-size: 1.7rem;
  font-weight: 700;
  box-shadow: 0 1px 6px rgba(80, 110, 210, 0.03);
  border: none;
  line-height: 1;
  transition: background 0.13s;
}
.client-search-btn {
  background: rgba(37,99,235,0.07);
  color: #2563eb;
  margin-right: 4px;
}
.client-search-btn:hover {
  background: #2563eb;
  color: #fff;
}
.client-add-btn {
  background: #2563eb;
  color: #fff;
}
.client-add-btn:hover {
  background: #1743b3;
}

/* Поисковая строка */
.clients-search-row {
  max-width: 1100px;
  margin: 0 auto 0 auto;
  transition: all 0.2s;
  display: flex;
  justify-content: flex-end;
  padding: 0;
}
.clients-search-row input.search-input {
  width: 340px;
  max-width: 100%;
  font-size: 1.08rem;
  border-radius: 12px;
  border: 1.5px solid #e0e4ef;
  padding: 13px 18px;
  background: #f7f8fa;
  color: #232b39;
  outline: none;
  margin-bottom: 0;
  box-sizing: border-box;
  transition: width 0.2s;
}

/* Списки */
.divcat-list-wrap,
.clients-list-wrap {
  max-width: 1100px;
  margin: 24px auto 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(60,70,120,0.10);
  padding: 0;
}
.divcat-list,
.clients-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Элементы списка */
.divcat-list-item,
.clients-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 13px 24px;
  border-bottom: 1.5px solid #f0f2f6;
  font-size: 1.13rem;
  font-weight: 500;
  transition: background 0.13s;
}
.clients-list-item {
  padding: 13px 16px 13px 24px;
}
.divcat-list-item:first-child,
.clients-list-item:first-child {
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}
.divcat-list-item:last-child,
.clients-list-item:last-child {
  border-bottom: none;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}
.divcat-list-item:hover,
.clients-list-item:hover {
  background: #f7f8fa;
}

/* Описание категории и клиента */
.divcat-list-item__desc {
  color: #888;
  font-size: 0.82em;
  font-weight: 400;
  margin-left: 0;
  margin-top: 2px;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.client-fio {
  font-size: 1.13rem;
  font-weight: 600;
  color: #232b39;
  margin-bottom: 7px;
}
.client-phones {
  margin-bottom: 2px;
}
.client-phone-label {
  color: #b0b8c9;
  font-size: 0.95em;
  font-weight: 500;
}
.client-phone-main, .client-phone-extra {
  color: #7b8497;
  font-size: 0.97rem;
  font-weight: 500;
  display: block;
  margin-top: 2px;
  line-height: 1.4;
}
.client-phone-value {
  color: #7b8497;
  font-size: 0.97rem;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}
.client-address-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 10px;
  background: #eaf1fd;
  color: #2563eb;
  border-radius: 6px;
  font-size: 0.89rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: none;
  border: 1px solid #d0e2ff;
  line-height: 1.2;
}

/* Контекстное меню */
.trx-menu-popup {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  padding: 4px 0;
  border-radius: 10px;
  background: #fff;
  border: 1.2px solid #d3d7e6;
  box-shadow: 0 4px 18px rgba(60,70,120,0.09);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  position: fixed;
  z-index: 9999;
  overflow: hidden;
  animation: fadeInMenu 0.18s;
}
@keyframes fadeInMenu {
  from { opacity: 0; transform: translateY(10px);}
  to   { opacity: 1; transform: translateY(0);}
}
.trx-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
  color: #232b39;
  border-radius: 6px;
  transition: background 0.13s, color 0.13s;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.trx-menu-item:hover {
  background: #f5f7fa;
  color: #2563eb;
}
.trx-menu-divider {
  height: 1px;
  background: #eceff5;
  margin: 2px 0;
  border: none;
}

/* Кнопка меню */
.trx-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.trx-menu-btn:hover svg circle { fill: #5270e7; }

/* Модальные кнопки */
.client-modal-btn {
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  padding: 12px 28px;
  border: none;
  cursor: pointer;
  min-width: 110px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 6px rgba(80, 110, 210, 0.03);
  transition: background 0.17s, color 0.13s, box-shadow 0.14s;
}
.client-modal-btn:hover { background: #1743b3; }

.client-add-btn:hover {
  background: #1743b3;
}
.client-add-btn svg {
  display: block;
}

/* Основной контент страниц клиентов */
.clients-page-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 32px 0;
}
@media (max-width: 700px) {
  .clients-page-main {
    padding: 0 0 18px 0;
  }
}

/* --- Модальное окно просмотра категории --- */
#categoryViewModal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30,40,60,0.18);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s;
}
#categoryViewModal .modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px 24px 32px;
  min-width: 180px;
  max-width: 340px;
  width: 96vw;
  box-shadow: 0 4px 16px rgba(80,110,210,0.10), 0 1.5px 6px rgba(80,110,210,0.03);
  position: relative;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  color: #232b39;
  animation: fadeInModal 0.18s;
  transition: box-shadow 0.18s;
  box-sizing: border-box;
}
@keyframes fadeInModal {
  from { opacity: 0; transform: translateY(24px);}
  to   { opacity: 1; transform: translateY(0);}
}
#categoryViewModal .modal-close-btn {
  position: absolute;
  right: 10px;
  top: 8px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #bfc4d0;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
  line-height: 1;
}
#categoryViewModal .modal-close-btn:hover {
  color: #5270e7;
}
.cat-view-row {
  margin-bottom: 13px;
}
.category-view-label {
  color: #7b8497;
  font-size: 0.98em;
  margin-bottom: 1px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.category-view-value {
  font-weight: 700;
  font-size: 1.04em;
  margin-bottom: 0;
  color: #232b39;
  word-break: break-word;
  letter-spacing: -0.01em;
}
.category-view-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.role-tag {
  display: inline-block;
  background: #eaf1ff;
  color: #2563eb;
  font-size: 0.82em;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 8px 2px 8px;
  line-height: 1.3;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(80,110,210,0.03);
  user-select: none;
}
.role-tag--empty {
  background: #f3f4f6;
  color: #bfc6cf;
}
@media (max-width: 600px) {
  #categoryViewModal .modal-content {
    padding: 22px 20px 20px 20px; /* Увеличиваем левый и правый отступы */
    min-width: 0;
    width: auto;
    max-width: 94vw;
    border-radius: 15px;
  }
  .cat-view-row {
    margin-bottom: 9px;
  }
  .category-view-label {
    font-size: 0.93em;
  }
  .category-view-value {
    font-size: 0.98em;
  }
  .role-tag {
    font-size: 0.75em;
    border-radius: 5px;
    padding: 1.5px 7px;
  }
}

/* Аватар клиента */
.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(60,70,120,0.10);
}

/* Аватар пользователя (новый стиль) */
.user-avatar-circle {
  border-radius: 9999px;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  background-color: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  object-fit: cover;
  display: inline-block;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
}
.user-avatar-circle:hover {
  border-color: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.7);
}
@media (max-width: 600px) {
  .user-avatar-circle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
  }
}

/* Профиль */
.profile-flex-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 32px;
  padding: 32px;
}
.profile-avatar-col {
  flex-shrink: 0;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.profile-info-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 12px;
}
.profile-avatar-img {
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  max-width: 112px;
  max-height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 2px 8px rgba(60,80,130,0.10);
  margin-bottom: 18px;
}
.profile-fio-main {
  font-size: 1.35rem;
  font-weight: 700;
  color: #232b39;
  margin-bottom: 2px;
  line-height: 1.2;
  word-break: break-word;
}
.profile-fio-middle {
  font-size: 1.1rem;
  font-weight: 500;
  color: #232b39;
  margin-bottom: 10px;
  line-height: 1.2;
  word-break: break-word;
}
.profile-contacts {
  width: 100%;
  margin-bottom: 14px;
}
.profile-contacts .client-phone-value {
  color: #7b8497;
  font-size: 0.97rem;
  font-weight: 500;
  display: block;
  margin-top: 2px;
  text-align: left;
  word-break: break-word;
}
.profile-label {
  margin-top: 18px;
  font-weight: 600;
  color: #7b8497;
  text-align: left;
  margin-bottom: 7px;
}
.profile-roles-list {
  display: flex;
  gap: 10px 11px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.profile-role-badge {
  background: #eaf1ff;
  color: #2563eb;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.97rem;
}
@media (max-width: 900px) {
  .clients-list-wrap {
    max-width: 98vw;
    margin: 18px auto 0 auto;
  }
  .profile-flex-row {
    gap: 18px;
    padding: 18px;
  }
}
@media (max-width: 700px) {
  .profile-flex-row {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 14px 0 18px 0;
  }
  .profile-avatar-col {
    width: 100%;
    align-items: center;
    margin-bottom: 0;
  }
  .profile-info-col {
    width: 100%;
    min-width: 0;
    align-items: center;
    padding: 0 8px;
  }
  .profile-fio-main,
  .profile-fio-middle,
  .profile-label,
  .profile-contacts .client-phone-value {
    text-align: center !important;
  }
  .profile-roles-list {
    justify-content: center;
  }
}

/* Минималистичное модальное окно подтверждения */
.financi-confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(30,40,60,0.18);
  /* Надёжное центрирование во всех браузерах */
  display: grid;
  place-items: center;
  /* Динамическая высота вьюпорта для iOS/мобилок */
  height: 100dvh;
  transition: background 0.18s;
}

/* Пока открыто подтверждение, скрываем любые всплывающие меню */
body.modal-open .trx-menu-popup { display: none !important; }
.financi-confirm-modal-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(60,70,120,0.13), 0 1.5px 6px rgba(80,110,210,0.03);
  min-width: 0;
  max-width: 92vw;
  width: 230px;
  min-height: 160px;
  padding: 28px 16px 18px 16px;
  text-align: center;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  animation: fadeInModal 0.18s;
  border: 1.5px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
@media (max-width: 500px) {
  .financi-confirm-modal-box {
    width: 90vw;
    min-width: 0;
    padding: 22px 5vw 14px 5vw;
    border-radius: 13px;
  }
}
.financi-confirm-modal-text {
  font-size: 0.98rem;
  font-weight: 500;
  color: #232b39;
  margin-bottom: 22px;
  word-break: break-word;
  text-align: center;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.financi-confirm-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  width: 100%;
}
.financi-confirm-btn {
  font-size: 0.97rem;
  font-weight: 500;
  border-radius: 8px;
  padding: 7px 0;
  border: none;
  cursor: pointer;
  min-width: 80px;
  width: 48%;
  transition: background 0.15s, color 0.13s;
  box-shadow: none;
  outline: none;
  margin: 0;
}
.financi-confirm-btn-cancel {
  background: #f3f4f6;
  color: #232b39;
}
.financi-confirm-btn-cancel:hover {
  background: #e5e7eb;
}
.financi-confirm-btn-ok {
  background: #2563eb;
  color: #fff;
}
.financi-confirm-btn-ok:hover {
  background: #1743b3;
}

/* Модальное окно деталей аккаунта */
#accountDetailsModalBackdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30,40,60,0.18);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
#accountDetailsModalBackdrop .modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(60,70,120,0.13);
  min-width: 220px;
  max-width: 380px;
  width: 96vw;
  padding: 24px 28px 20px 28px;
  animation: fadeInModal 0.10s cubic-bezier(.4,0,.2,1);
  display: block;
}
#accountDetailsModalBackdrop .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
#accountDetailsModalBackdrop .modal-close-btn {
  background: none;
  border: none;
  font-size: 1.7em;
  color: #64748b;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s;
}
#accountDetailsModalBackdrop .modal-close-btn:hover {
  color: #2563eb;
}

.account-users-list {
  font-size: 0.97em;
  color: #64748b;
  font-weight: 400;
  margin-top: 18px;
  margin-bottom: 2px;
  padding-left: 2px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  word-break: break-word;
}

/* Красивая кнопка для "Добавить файл" в модальном окне */
.custom-file-btn {
  display: inline-block;
  font-size: 0.97rem;
  font-weight: 500;
  border-radius: 8px;
  padding: 7px 18px;
  border: 1.5px solid #2563eb;
  background: rgba(37,99,235,0.04);
  color: #2563eb;
  box-shadow: none;
  transition: background 0.15s, color 0.13s, border-color 0.13s;
  margin-right: 8px;
}
.custom-file-btn:hover, .custom-file-btn:focus {
  background: #e8f0fe;
  color: #1743b3;
  border-color: #1743b3;
}

/* ================================================================
   ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ПРАВИЛЬНОГО ОТОБРАЖЕНИЯ СТРАНИЦЫ КАТЕГОРИЙ
================================================================ */

/* Убираем конфликты со стилями списков для дерева категорий */
.category-list-wrap .category-list {
  display: block !important; /* Переопределяем flex */
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.category-list-wrap .category-list ul {
  display: block !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.category-list-wrap .category-item {
  display: flex !important;
  list-style: none !important;
  margin: 0 !important;
}

/* Убеждаемся, что li элементы отображаются вертикально */
.category-list-wrap li {
  display: block !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ================================================================
   ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ СТРАНИЦЫ КАТЕГОРИЙ - ПЕРЕОПРЕДЕЛЕНИЯ
================================================================ */

/* Убеждаемся, что стили из categories.css работают правильно */
.category-list-wrap .category-item {
  display: flex !important;
  align-items: center !important;
  padding: 12px 16px !important;
  position: relative !important;
  transition: background 0.2s !important;
  font-size: 1.10rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  line-height: normal !important;
  color: inherit !important;
}

.category-list-wrap .category-item:hover {
  background: #fafbfc !important;
}

/* Правильные отступы для вложенности */
.category-list-wrap .category-item {
  padding-left: calc(16px + var(--depth, 0) * 24px) !important;
}

/* Стили для кнопки-экспандера */
.category-list-wrap .category-item__expander {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.65em !important;
  height: 1.65em !important;
  margin-right: 8px !important;
  border: none !important;
  background: none !important;
  color: #bfc6cf !important;
  cursor: pointer !important;
  padding: 5px !important;
  border-radius: 50% !important;
  transition: background 0.2s, transform 0.2s !important;
}

.category-list-wrap .category-item__expander:hover {
  background: #f4f5fa !important;
}

.category-list-wrap .category-item__expander[disabled] {
  visibility: hidden !important;
}

/* Стили для названия категории */
.category-list-wrap .category-item__name {
  flex: 1 !important;
  font-weight: 700 !important;
  font-size: 1.10rem !important;
  letter-spacing: -0.01em !important;
}

/* Цвета для типов категорий */
.category-list-wrap .category-item--income .category-item__name {
  color: #059669 !important;
}

.category-list-wrap .category-item--expense .category-item__name {
  color: #dc2626 !important;
}

.category-list-wrap .category-item--both .category-item__name {
  color: #2563eb !important;
}

/* Стили для кнопки меню (три точки) */
.category-list-wrap .category-item__menu {
  background: none !important;
  border: none !important;
  font-size: 1.2rem !important;
  color: #bbb !important;
  cursor: pointer !important;
  padding: 4px !important;
}

.category-list-wrap .category-item__menu:hover {
  color: #444 !important;
}