* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
}

/* Контейнер приложения */
.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* Шапка */
.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px 30px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  color: white;
}

.app-header h1,
.app-header-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.app-header-title {
  user-select: none;
  cursor: default;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.session-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Основной layout: левая колонка + правая панель */
.dashboard {
  display: flex;
  gap: 20px;
}

/* Левая колонка управления */
.card-management {
  width: 280px;
  flex-shrink: 0;
}

/* Правая панель (вертикальный стек) */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Карточка информации о клиенте */
.card-info {
  flex-shrink: 0;
}

/* Карточки нотификаций */
.card-notifications {
  flex-shrink: 0;
}

/* Карточки */
.card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e8e8e8;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.card-header p {
  font-size: 12px;
  color: #999;
}

.card-body {
  padding: 20px;
  flex: 1;
}

.card-body.p-0 {
  padding: 0;
}

/* Формы */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Кнопки */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-action {
  background: #1976d2;
  color: white;
  width: 100%;
  font-size: 13px;
  padding: 12px;
  margin-bottom: 10px;
}

.btn-action:last-child {
  margin-bottom: 0;
}

.btn-action:hover {
  background: #1565c0;
  transform: translateY(-1px);
}

/* Кнопка создания пользователя */
.btn-action-success {
  background: #28a745;
  color: white;
  width: 100%;
  font-size: 13px;
  padding: 12px;
  margin-bottom: 10px;
}

.btn-action-success:hover {
  background: #218838;
  transform: translateY(-1px);
}

/* Кнопка удаления */
.btn-action-danger {
  background: #dc3545;
  color: white;
  width: 100%;
  font-size: 13px;
  padding: 12px;
  margin-bottom: 10px;
}

.btn-action-danger:hover {
  background: #c82333;
  transform: translateY(-1px);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

/* Разделитель */
.divider {
  height: 1px;
  background: #e8e8e8;
  margin: 16px 0;
}

/* Информация о клиенте */
.info-group {
  margin-bottom: 12px;
}

.info-field {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.info-field:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: #666;
}

.info-value {
  font-weight: 500;
  color: #333;
  text-align: right;
  word-break: break-word;
  max-width: 60%;
}

/* Красный текст для ошибок/предупреждений */
.status-error-text {
  color: #c62828 !important;
  font-weight: 600;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

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

.status-label {
  font-weight: 500;
  color: #666;
}

.status-value {
  font-weight: 500;
  color: #333;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
}

.status-badge.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-badge.error {
  background: #ffebee;
  color: #c62828;
}

.status-badge.warning {
  background: #fff3e0;
  color: #ef6c00;
}

/* Таблицы */
.table-container {
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
}

/* Убираем обрезание текста, используем перенос */
td {
  word-wrap: break-word;
  white-space: normal;
  max-width: 250px;
}

/* Колонка с датой и временем - не переносим */
td:first-child {
  white-space: nowrap;
  width: 1%;
}

tr:hover {
  background: #f5f5f5;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 13px;
}

/* Загрузка */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Форма входа */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 400px;
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.login-header {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  padding: 20px 24px;
  text-align: center;
  border-radius: 16px 16px 0 0;
}

.login-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-header p {
  opacity: 0.9;
  font-size: 14px;
}

.login-body {
  padding: 24px;
}

.login-error {
  color: #f44336;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  display: none;
}

.login-error.show {
  display: block;
}

/* Уведомления */
#notificationContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.notification {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
  font-size: 13px;
  font-weight: 500;
  min-width: 250px;
}

.notification.success {
  border-left: 4px solid #4caf50;
  color: #2e7d32;
}

.notification.error {
  border-left: 4px solid #f44336;
  color: #c62828;
}

.notification.info {
  border-left: 4px solid #2196f3;
  color: #1565c0;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }

  .card-management {
    width: 100%;
  }

  .app-container {
    padding: 12px;
  }

  .app-header {
    flex-direction: column;
    text-align: center;
  }

  .header-info {
    flex-direction: column;
    width: 100%;
  }

  .btn-logout {
    width: 100%;
  }
}

/* Скролл */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* 4 колонки для информации о клиенте */
.info-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-column-title {
  font-weight: 600;
  color: #1976d2;
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #1976d2;
}

.info-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.info-field:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: #666;
}

.info-value {
  font-weight: 500;
  color: #333;
  text-align: right;
}

/* Адаптивность для 4 колонок */
@media (max-width: 1000px) {
  .info-columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .info-columns {
    grid-template-columns: 1fr;
  }
}

/* Красная строка для ошибок/предупреждений */
.status-error {
  background-color: #ffebee !important;
  color: #c62828 !important;
  border-radius: 8px;
  margin: -4px -8px;
  padding: 4px 8px;
}

.status-error .info-label,
.status-error .info-value {
  color: #c62828 !important;
  font-weight: 600;
}

/* Горизонтальная прокрутка таблиц */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
  max-height: 500px;
}

/* Для мобильных устройств */
@media (max-width: 768px) {
  .table-container {
    max-height: 400px;
  }

  table {
    min-width: 600px;
  }
}

/* Увеличенный отступ для мобильных */
@media (max-width: 480px) {
  .info-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .info-value {
    text-align: left;
    max-width: 100%;
  }
}

/* Вкладки */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: white;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: #f0f2f5;
  color: #333;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Фильтры платежей */
.payments-filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.payments-filters .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.payments-filters select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.payments-filters .btn {
  padding: 10px 24px;
  white-space: nowrap;
}

/* Таблица платежей */
.payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.payments-table th,
.payments-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
}

.payments-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
}

.payments-table tr:hover {
  background: #f5f5f5;
}

/* Статусы платежей */
.status-paid {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
}

.status-pending {
  background: #fff3e0;
  color: #ef6c00;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
}

.status-error {
  background: #ffebee;
  color: #c62828;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  display: inline-block;
}

/* Таблица лимитов */
.limits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.limits-table th,
.limits-table td {
  padding: 12px 16px;
  text-align: center;
  border: 1px solid #e8e8e8;
}

.limits-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
}

.limits-table .channel-name {
  font-weight: 600;
  text-align: left;
}

.limits-table .limit-value {
  font-family: monospace;
  font-size: 14px;
}

.limits-table .deposit {
  background: #e8f5e9;
}

.limits-table .withdraw {
  background: #e3f2fd;
}

.error-message {
  color: #c62828;
  font-weight: 500;
  text-align: center;
  padding: 20px;
}

@media (max-width: 768px) {
  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .payments-filters {
    flex-direction: column;
  }

  .payments-filters .btn {
    width: 100%;
  }
}

/* Платежи - обновленные стили */
.payments-wrapper {
  width: 100%;
}

.payments-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8e8e8;
  font-size: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.payments-info strong {
  color: #1976d2;
  font-size: 16px;
}

/* Таблица платежей */
.payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.payments-table th,
.payments-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid #e8e8e8;
}

.payments-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  position: sticky;
  top: 0;
  font-size: 12px;
}

.payments-table tr:hover {
  background: #f5f5f5;
}

.payments-table td {
  vertical-align: middle;
}

/* Статусы платежей */
.status-paid {
  display: inline-block;
  padding: 4px 12px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.status-pending {
  display: inline-block;
  padding: 4px 12px;
  background: #fff3e0;
  color: #ef6c00;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.status-error {
  display: inline-block;
  padding: 4px 12px;
  background: #ffebee;
  color: #c62828;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e8e8e8;
}

.pagination-btn {
  padding: 8px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: #1976d2;
  color: white;
  border-color: #1976d2;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 13px;
  color: #666;
}

/* Адаптивность для платежей */
@media (max-width: 768px) {
  .payments-info {
    flex-direction: column;
    text-align: center;
  }

  .payments-table {
    font-size: 11px;
  }

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

/* Лимиты - стили */
.limits-wrapper {
  width: 100%;
  padding: 0;
}

.limits-errors {
  padding: 15px 20px;
  background: #ffebee;
  border-bottom: 1px solid #ffcdd2;
}

.error-item {
  color: #c62828;
  font-size: 13px;
  padding: 4px 0;
}

.error-item:first-child {
  margin-top: 0;
}

/* Таблица лимитов */
.limits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}

.limits-table th,
.limits-table td {
  padding: 12px 12px;
  text-align: center;
  border: 1px solid #e8e8e8;
}

.limits-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  font-size: 12px;
}

.limits-table .channel-name {
  font-weight: 600;
  text-align: left;
  background: #fafafa;
}

.limits-table .limit-value {
  font-family: monospace;
  font-size: 13px;
  font-weight: 500;
}

.limits-table .limit-in {
  background: #e8f5e9;
  color: #2e7d32;
}

.limits-table .limit-out {
  background: #e3f2fd;
  color: #1565c0;
}

.limits-table .limit-empty {
  background: #f5f5f5;
  color: #999;
}

/* Строка с использованными реквизитами */
.used-row {
  background: #fafafa;
}

.used-cell {
  padding: 8px 12px 12px 32px !important;
  border-top: none !important;
}

.used-title {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.used-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.used-list li {
  background: white;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 11px;
  font-family: monospace;
  color: #1976d2;
  border: 1px solid #e0e0e0;
}

/* Ховер эффекты */
.limits-table tr:hover td {
  background: #fafafa;
}

.limits-table .channel-row:hover .limit-in {
  background: #c8e6c9;
}

.limits-table .channel-row:hover .limit-out {
  background: #bbdefb;
}

/* Адаптивность для лимитов */
@media (max-width: 768px) {
  .limits-table {
    font-size: 11px;
  }

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

  .limits-table .limit-value {
    font-size: 11px;
  }

  .used-list li {
    font-size: 10px;
    padding: 3px 8px;
  }
}
