:root {
  /* Основная тёмная тема */
  --primary-color: #0a84ff;
  --background-color: #000000;
  --surface-color: #1c1c1e;
  --text-primary: #ffffff;
  --text-secondary: #8e8e93;
  --border-color: #38383a;
  --income-color: #30d158;
  --expense-color: #ff453a;
  --other-color: #8e8e93;
  --positive-color: #30d158;
  --negative-color: #ff453a;
}

[data-theme="light"] {
  /* Светлая тема */
  --primary-color: #007aff;
  --background-color: #ffffff;
  --surface-color: #f2f2f7;
  --text-primary: #000000;
  --text-secondary: #8e8e93;
  --border-color: #c6c6c8;
  --income-color: #34c759;
  --expense-color: #ff3b30;
  --other-color: #8e8e93;
  --positive-color: #34c759;
  --negative-color: #ff3b30;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

body {
  background-color: var(--background-color);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
  padding-bottom: 20px;
}

.container {
  max-width: 100%;
  padding: 0 16px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background-color: var(--background-color);
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--primary-color);
  font-size: 24px;
  font-weight: bold;
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute; /* Добавляем абсолютное позиционирование */
  left: 50%; /* Смещаем в центр */
  transform: translateX(-50%); /* Корректируем выравнивание */
}

/* Обновленные стили для логотипа как в bankcards.html */
.app-title .logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

[data-theme="dark"] .app-title .logo {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .app-title .logo {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.app-title .logo-content {
  text-align: center;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.app-title .logo-main-text {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #000000 0%, #222222 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  line-height: 1;
  position: relative;
  text-shadow: 1px 0 0 rgba(120, 120, 120, 0.8),
    2px 0 0 rgba(150, 150, 150, 0.5);
  margin: 0;
}

[data-theme="dark"] .app-title .logo-main-text {
  background: linear-gradient(135deg, #ffffff 0%, #cccccc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 1px 0 0 rgba(0, 0, 0, 0.4), 2px 0 0 rgba(0, 0, 0, 0.2);
}

.app-title .logo-sub-text {
  display: none; /* Скрываем подпись Analyst в header */
}

/* Анимация для логотипа */
@keyframes subtleGlow {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.15),
      0 0 10px rgba(255, 255, 255, 0.05);
  }
}

.app-title .logo {
  animation: subtleGlow 4s ease-in-out infinite;
}

/* Убираем старую синюю иконку */
.app-logo {
  display: none;
}

.settings-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 20px;
  cursor: pointer;
}

/* Month Selector */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  margin-bottom: 8px;
}

.month-nav {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
}

.current-month {
  font-size: 18px;
  font-weight: 600;
}

/* Analytics Cards */
.analytics-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analytics-card {
  background-color: var(--surface-color);
  border-radius: 12px;
  padding: 16px;
  position: relative;
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
}

.card-period {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Balance Summary */
.balance-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

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

.balance-label {
  font-size: 16px;
  color: var(--text-secondary);
}

.balance-amount {
  font-size: 16px;
  font-weight: 600;
}

.balance-amount.income {
  color: var(--income-color);
}

.balance-amount.expense {
  color: var(--expense-color);
}

/* Тонкие полоски для доходов и расходов */
.balance-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 1px;
  transition: width 0.5s ease;
}

.income-bar {
  background-color: var(--primary-color); /* Синяя полоска для доходов */
}

.expense-bar {
  background-color: var(--expense-color); /* Красная полоска для расходов */
}

.balance-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 0 0;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

.total-label {
  font-size: 18px;
  font-weight: 600;
}

.total-amount {
  font-size: 18px;
  font-weight: 600;
}

.total-amount.positive {
  color: var(--positive-color);
}

.total-amount.negative {
  color: var(--negative-color);
}

/* Categories List */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

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

.category-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.category-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--background-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.category-details {
  flex: 1;
}

.category-name {
  font-size: 16px;
  margin-bottom: 2px;
}

.category-progress {
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.category-progress-bar {
  height: 100%;
  border-radius: 2px;
}

.category-amount {
  font-size: 16px;
  font-weight: 600;
}

/* Cards Summary */
.cards-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  width: 36px;
  height: 24px;
  border-radius: 4px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: bold;
}

.card-name {
  font-size: 16px;
}

.card-balance {
  font-size: 16px;
  font-weight: 600;
}

/* Comparison List */
.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comparison-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comparison-label {
  font-size: 16px;
  color: var(--text-secondary);
}

.comparison-values {
  display: flex;
  align-items: center;
  gap: 16px;
}

.comparison-value {
  font-size: 16px;
  font-weight: 600;
}

.comparison-diff {
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.comparison-diff.positive {
  background-color: rgba(52, 199, 89, 0.1);
  color: var(--positive-color);
}

.comparison-diff.negative {
  background-color: rgba(255, 59, 48, 0.1);
  color: var(--negative-color);
}

/* Premium Insights */
.premium-insights {
  background: linear-gradient(135deg, #5856d6, #007aff);
  color: white;
  position: relative;
  overflow: hidden;
}

.premium-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.premium-insights .card-title {
  color: white;
}

.ai-insights {
  margin-bottom: 16px;
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.insight-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.insight-text {
  font-size: 14px;
  line-height: 1.4;
  opacity: 0.9;
}

.premium-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 12px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background-color 0.2s;
}

.premium-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background-color: var(--background-color);
  border-radius: 14px;
  z-index: 2001;
  width: 340px;
  max-width: 90vw;
  max-height: 80vh;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--primary-color);
  cursor: pointer;
  padding: 4px;
}

/* Transactions Detail */
.transactions-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

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

.detail-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.detail-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--surface-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.detail-text {
  flex: 1;
}

.detail-description {
  font-size: 16px;
  margin-bottom: 2px;
}

.detail-meta {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
}

.detail-amount {
  font-size: 16px;
  font-weight: 600;
}

.detail-amount.income {
  color: var(--income-color);
}

.detail-amount.expense {
  color: var(--expense-color);
}

/* Input Groups */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-group input,
.category-select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--surface-color);
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.3s;
}

.input-group input:focus,
.category-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.amount-input-group {
  display: flex;
  align-items: center;
  background-color: var(--surface-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.currency-symbol {
  font-size: 16px;
  font-weight: 600;
  padding: 0 12px;
  color: var(--text-secondary);
}

.amount-input {
  border: none;
  background: none;
  font-size: 16px;
  padding: 12px 0;
  width: 100%;
  color: var(--text-primary);
}

.amount-input:focus {
  outline: none;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.cancel-btn,
.save-btn,
.delete-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.cancel-btn {
  background-color: var(--surface-color);
  color: var(--text-primary);
}

.cancel-btn:hover {
  background-color: var(--border-color);
}

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

.save-btn:hover {
  background-color: #0056cc;
}

.delete-btn {
  background-color: var(--expense-color);
  color: white;
}

.delete-btn:hover {
  background-color: #d70015;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* No Data Message */
.no-data-message {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.no-data-text {
  font-size: 16px;
  font-style: italic;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-ai-btn {
  background: linear-gradient(135deg, #007aff, #5856d6);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-ai-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.header-ai-btn:active {
  transform: translateY(0);
}

/* === AI iOS Style Modal === */
.ios-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  box-sizing: border-box;
}

.ios-modal.active {
  display: flex;
}

.ios-modal-content {
  background: var(--surface-color);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.ios-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ios-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.ios-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.ios-modal-close:hover {
  background: var(--surface-color);
}

.ios-modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  color: var(--text-primary);
}

.ios-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.ios-button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ios-button.primary {
  background: var(--primary-color);
  color: white;
}

.ios-button.secondary {
  background: var(--surface-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.ios-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* AI Loading State */
.ai-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-primary);
}

.ios-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* AI Result Text */
.ai-result-text {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}
/* Premium Lock Styles - Упрощенная версия */
.premium-lock {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  color: white;
  text-align: center;
}

.premium-lock-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.premium-lock-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.premium-lock-text h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
}

.premium-lock-text p {
  margin: 0 0 16px 0;
  opacity: 0.9;
  font-size: 14px;
  line-height: 1.4;
}

/* Убираем ненужные списки */
.premium-features-list {
  display: none;
}

.premium-purchase-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.premium-purchase-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* AI Section Styles */
.ai-section .ai-content {
  padding: 15px 0;
}

.ai-action-section {
  text-align: center;
  margin-top: 15px;
}

.ai-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 12px;
}

.ai-btn:not(.premium-locked) {
  background: linear-gradient(135deg, #007aff, #5856d6);
  color: white;
}

.ai-btn.premium-locked {
  background: #8e8e93;
  color: white;
  cursor: not-allowed;
  opacity: 0.7;
}

.ai-btn:not(.premium-locked):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.ai-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .app-title .logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    margin-right: 10px;
  }

  .app-title .logo-main-text {
    font-size: 1rem;
  }

  .app-title {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .app-title .logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-right: 8px;
  }

  .app-title .logo-main-text {
    font-size: 0.9rem;
  }

  .app-title {
    font-size: 15px;
  }

  .premium-lock {
    padding: 16px;
  }

  .premium-lock-icon {
    font-size: 36px;
  }
}
/* Исправленная кнопка AI Аналитика в header - компактная версия */
.header-ai-btn {
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 8px;
  padding: 6px 12px; /* Уменьшил padding для компактности */
  font-size: 13px; /* Чуть меньший шрифт */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  min-width: auto; /* Убрал фиксированную ширину */
  text-align: center;
  line-height: 1.2;
  white-space: nowrap; /* Запрещаем перенос текста */
  flex-shrink: 0; /* Запрещаем сжатие */
}

.header-ai-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.header-ai-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.header-ai-btn.premium-locked {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.7;
}

.header-ai-btn.premium-locked:hover {
  background: none;
  color: var(--text-secondary);
  transform: none;
  box-shadow: none;
}

/* Оптимизация для мобильных устройств */
@media (max-width: 768px) {
  .header-ai-btn {
    padding: 5px 10px; /* Еще более компактно на мобильных */
    font-size: 12px; /* Меньший шрифт */
    border-radius: 6px;
    min-width: 80px; /* Минимальная ширина для мобильных */
  }

  /* Оптимизация header для мобильных */
  .header {
    padding: 10px 12px; /* Уменьшаем отступы */
    gap: 8px; /* Уменьшаем расстояние между элементами */
  }

  .app-title {
    font-size: 16px; /* Чуть меньший шрифт заголовка */
    gap: 6px;
    flex: 1; /* Занимает доступное пространство */
    min-width: 0; /* Разрешаем сжатие */
    overflow: hidden; /* Скрываем переполнение */
  }

  .app-title .logo {
    width: 32px; /* Уменьшаем логотип */
    height: 32px;
    margin-right: 8px;
    flex-shrink: 0; /* Запрещаем сжатие логотипа */
  }

  .app-title .logo-main-text {
    font-size: 0.9rem; /* Уменьшаем текст логотипа */
  }

  .app-title span {
    white-space: nowrap; /* Запрещаем перенос названия */
    overflow: hidden;
    text-overflow: ellipsis; /* Добавляем многоточие если не помещается */
  }

  .header-actions {
    flex-shrink: 0; /* Запрещаем сжатие действий */
    margin-left: auto; /* Прижимаем к правому краю */
  }
}

@media (max-width: 480px) {
  .header-ai-btn {
    padding: 4px 8px; /* Минимальные отступы */
    font-size: 11px; /* Самый маленький шрифт */
    min-width: 70px; /* Минимальная ширина */
  }

  .header {
    padding: 8px 10px;
  }

  .app-title {
    font-size: 15px;
  }

  .app-title .logo {
    width: 28px;
    height: 28px;
    margin-right: 6px;
  }

  .back-btn {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
  .header-ai-btn {
    min-width: 65px;
    padding: 3px 6px;
    font-size: 10px;
  }

  .app-title span {
    font-size: 14px;
  }
}

/* Улучшенная анимация загрузки */
#loadingIndicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface-color);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  display: none;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: var(--text-primary);
}

#loadingIndicator .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Улучшенные стили для состояния загрузки данных */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

/* Оптимизация отображения при загрузке */
.analytics-section {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.analytics-section.loading {
  opacity: 0.6;
  pointer-events: none;
}
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.retry-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  margin-top: 16px;
  cursor: pointer;
}
/* Добавим в CSS */
.loading-state.small {
  padding: 20px;
}

.loading-spinner.small {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.skeleton-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.data-loaded .skeleton-loading {
  display: none;
}