@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

/* ===== ПЕРЕМЕННЫЕ (светлая тема) ===== */
:root {
  --primary-color: #9bc4b2;
  --primary-dark: #7daf95;
  --primary-light: #c0dacc;
  --text-color: #3d4a42;
  --light-text: #f5f9f7;
  --background: linear-gradient(135deg, #6a8f7e 0%, #b8d5c5 100%);
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-alt: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.07);
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --form-width: 94vw;
  --max-form-width: 500px;
  --input-padding: 14px;

  /* Теминговые переменные */
  --card-bg: rgba(255, 255, 255, 0.96);
  --chart-bg: #f8faf9;
  --input-bg: #ffffff;
  --input-border: #dde8e3;
  --input-color: #3d4a42;
  --label-color: #4a5c52;
  --text-secondary: #6b7a72;
  --text-muted: #9aada4;
  --transaction-bg: #ffffff;
  --cat-btn-bg: #f5f9f7;
  --cat-btn-border: #ddeae4;
  --cat-btn-hover: #eaf3ee;
  --city-toggle-bg: rgba(155, 196, 178, 0.10);
  --city-toggle-border: #e0ece6;
  --city-label-color: #5a6b62;
  --offline-offline-bg: #fff3e0;
  --offline-offline-text: #7a4800;
  --offline-offline-border: #ffd580;
  --offline-syncing-bg: #e8f5ee;
  --offline-syncing-text: #2a6b4a;
  --offline-syncing-border: #b2d8c1;
  --income-card-bg: #e8f5ee;
  --income-card-border: #b2d8c1;
  --expense-card-bg: #fdf0ec;
  --expense-card-border: #f0c4b5;
  --balance-card-bg: #eef4fb;
  --balance-card-border: #b5cee8;
}

/* ===== ТЁМНАЯ ТЕМА ===== */
[data-theme="dark"] {
    --background: linear-gradient(135deg, #3a5a48 0%, #5a7a65 100%);
    --text-color: #e2f0e8;
    --card-bg: rgba(62, 88, 72, 0.97);
    --chart-bg: #4a6a58;
    --input-bg: #4a6a58;
    --input-border: #72987e;
    --input-color: #daeee2;
    --label-color: #b8d8c4;
    --text-secondary: #9abfac;
    --text-muted: #7a9e8c;
    --transaction-bg: #4a6a58;
    --cat-btn-bg: #3e5e4c;
    --cat-btn-border: #6a9278;
    --cat-btn-hover: #4a6e5a;
    --city-toggle-bg: rgba(120, 200, 160, 0.10);
    --city-toggle-border: #6a9278;
    --city-label-color: #a0c4b0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.20);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.14);
    --offline-offline-bg: #6a4820;
    --offline-offline-text: #ffe0a0;
    --offline-offline-border: #a07840;
    --offline-syncing-bg: #3a6050;
    --offline-syncing-text: #a0ecc0;
    --offline-syncing-border: #5a8a70;
    --income-card-bg: #3a6050;
    --income-card-border: #5a8a70;
    --expense-card-bg: #6a3e3e;
    --expense-card-border: #8a5e5e;
    --balance-card-bg: #3e4e6a;
    --balance-card-border: #5e6e8a;
}

/* ===== БАЗОВЫЕ СТИЛИ ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--background);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-attachment: fixed;
  min-height: 100%;
  width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

/* ===== ОФЛАЙН БАННЕР ===== */
.offline-banner {
  width: 100%;
  padding: 10px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-alt);
  letter-spacing: 0.2px;
  transition: all 0.3s ease;
  position: sticky;
  top: 0;
  z-index: 100;
}

.offline-banner.hidden {
  display: none;
}

.offline-banner.offline {
  background: var(--offline-offline-bg);
  color: var(--offline-offline-text);
  border-bottom: 1.5px solid var(--offline-offline-border);
}

.offline-banner.syncing {
  background: var(--offline-syncing-bg);
  color: var(--offline-syncing-text);
  border-bottom: 1.5px solid var(--offline-syncing-border);
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.app-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 0 15px;
}

/* ===== ФОРМА ===== */
.form-wrapper {
  width: 100%;
  max-width: var(--max-form-width);
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ===== ШАПКА ФОРМЫ + ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ===== */
.form-top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 22px;
}

h1 {
  font-family: var(--font-alt);
  font-weight: 600;
  color: var(--primary-dark);
  text-align: center;
  font-size: 24px;
  letter-spacing: -0.3px;
  margin: 0;
}

.theme-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--cat-btn-bg);
  border: 1.5px solid var(--cat-btn-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: background 0.2s, transform 0.25s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--cat-btn-hover);
  border-color: var(--primary-color);
  transform: translateY(-50%) rotate(20deg);
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-family: var(--font-alt);
  font-weight: 500;
  color: var(--label-color);
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="date"],
input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: var(--input-padding);
  border: 1.5px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-main);
  font-size: 16px;
  background-color: var(--input-bg);
  color: var(--input-color);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237daf95'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

input:focus, select:focus {
  border-color: var(--primary-dark);
  outline: none;
  box-shadow: 0 0 0 3px rgba(125, 175, 149, 0.18);
}

/* ===== СЕТКА КАТЕГОРИЙ ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  background: var(--cat-btn-bg);
  border: 1.5px solid var(--cat-btn-border);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  min-height: 62px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.cat-btn:hover {
  background: var(--cat-btn-hover);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.cat-btn:active {
  transform: scale(0.94);
}

.cat-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(125, 175, 149, 0.40);
}

/* Доход — золотой */
.cat-btn--income.active {
  background: linear-gradient(135deg, #f0c060, #d4a020);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(212, 160, 32, 0.40);
}

.cat-emoji {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.cat-label {
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-alt);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
  transition: color 0.15s;
}

.cat-btn.active .cat-label {
  color: rgba(255, 255, 255, 0.92);
}

/* ===== БЫСТРЫЕ СУММЫ ===== */
.quick-amounts {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.quick-amt {
  flex: 1;
  padding: 8px 4px;
  background: var(--cat-btn-bg);
  border: 1.5px solid var(--cat-btn-border);
  border-radius: 999px;
  font-family: var(--font-alt);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-align: center;
}

.quick-amt:hover {
  background: var(--cat-btn-hover);
  border-color: var(--primary-color);
}

.quick-amt:active {
  transform: scale(0.92);
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: transparent;
  color: white;
}

/* ===== КНОПКА ОТПРАВКИ ===== */
button[type="submit"] {
  width: 100%;
  padding: 16px;
  background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-alt);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(125, 175, 149, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(125, 175, 149, 0.45);
}

button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ===== АНАЛИТИКА ===== */
.analytics-wrapper {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.analytics-wrapper h2 {
  font-family: var(--font-alt);
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 20px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* ===== ФИЛЬТР ПЕРИОДА ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar label {
  margin-bottom: 0;
  white-space: nowrap;
  font-size: 12px;
}

.filter-bar select {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  font-size: 14px;
}

/* ===== КАРТОЧКИ СВОДКИ ===== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.summary-card {
  border-radius: var(--border-radius-sm);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

.summary-card:hover {
  transform: translateY(-1px);
}

.summary-card.income-card {
  background: var(--income-card-bg);
  border: 1.5px solid var(--income-card-border);
}

.summary-card.expense-card {
  background: var(--expense-card-bg);
  border: 1.5px solid var(--expense-card-border);
}

.summary-card.balance-card {
  background: var(--balance-card-bg);
  border: 1.5px solid var(--balance-card-border);
}

.summary-card.balance-card.negative {
  background: var(--expense-card-bg);
  border-color: var(--expense-card-border);
}

.summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.summary-value {
  font-family: var(--font-alt);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-color);
  word-break: break-all;
}

.income-card .summary-value { color: #2e8b57; }
.expense-card .summary-value { color: #c0553a; }
.balance-card .summary-value { color: #2a5ea8; }
.balance-card.negative .summary-value { color: #c0553a; }

[data-theme="dark"] .income-card .summary-value { color: #6ddb9a; }
[data-theme="dark"] .expense-card .summary-value { color: #e87a62; }
[data-theme="dark"] .balance-card .summary-value { color: #70a8e8; }
[data-theme="dark"] .balance-card.negative .summary-value { color: #e87a62; }

/* ===== ГРАФИКИ ===== */
.charts-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.chart-box {
  background: var(--chart-bg);
  border-radius: var(--border-radius-sm);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--input-border);
}

.chart-box h3 {
  font-family: var(--font-alt);
  color: var(--primary-dark);
  text-align: center;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.chart-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
}

/* ===== ПОСЛЕДНИЕ ОПЕРАЦИИ ===== */
.transactions-section {
  margin-top: 4px;
}

.transactions-section h3 {
  font-family: var(--font-alt);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.transaction-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--transaction-bg);
  border-radius: var(--border-radius-sm);
  padding: 11px 14px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid transparent;
  gap: 10px;
  transition: transform 0.15s;
  border: 1.5px solid var(--input-border);
  border-left: 3px solid transparent;
}

.transaction-row:hover {
  transform: translateX(2px);
}

.transaction-row.income {
  border-left-color: #7daf95;
}

.transaction-row.expense {
  border-left-color: #e1a692;
}

.tr-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tr-category {
  font-weight: 500;
  font-size: 13px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.tr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.tr-amount {
  font-family: var(--font-alt);
  font-weight: 700;
  font-size: 14px;
}

.income .tr-amount { color: #2e8b57; }
.expense .tr-amount { color: #c0553a; }

[data-theme="dark"] .income .tr-amount { color: #6ddb9a; }
[data-theme="dark"] .expense .tr-amount { color: #e87a62; }

.tr-date {
  font-size: 11px;
  color: var(--text-muted);
}

.loading-text, .no-data {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px 0;
}

/* ===== УДАЛЕНИЕ ТРАНЗАКЦИИ ===== */
.tr-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
  min-height: unset;
  transition: color 0.15s, background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.35;
}

.tr-delete:hover,
.transaction-row:hover .tr-delete {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.10);
  opacity: 1;
}

.tr-delete:active {
  transform: scale(0.88);
}

/* Инлайн-подтверждение удаления */
.tr-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  animation: fadeIn 0.15s ease;
}

.tr-confirm-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.tr-confirm-yes,
.tr-confirm-no {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-alt);
  cursor: pointer;
  min-height: unset;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tr-confirm-yes {
  border: 1.5px solid #e74c3c;
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
}

.tr-confirm-yes:hover {
  background: #e74c3c;
  color: white;
}

.tr-confirm-no {
  border: 1.5px solid var(--input-border);
  color: var(--text-secondary);
  background: transparent;
}

.tr-confirm-no:hover {
  background: var(--cat-btn-hover);
}

/* ===== КНОПКА "ПОКАЗАТЬ ЕЩЁ" ===== */
.show-more-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--input-border);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-alt);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  letter-spacing: 0.2px;
  -webkit-tap-highlight-color: transparent;
}

.show-more-btn:hover {
  background: var(--cat-btn-hover);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.show-more-btn:active {
  transform: scale(0.97);
}

/* ===== ТОСТ-УВЕДОМЛЕНИЯ ===== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background-color: var(--text-color);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
}

.toast.error {
  background: linear-gradient(to right, #e74c3c, #c0392b);
}

.toast-msg {
  flex: 1;
}

.toast-undo-btn {
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.40);
  color: white;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-alt);
  letter-spacing: 0.3px;
  transition: background 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.toast-undo-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===== СПИННЕР ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.hidden { display: none !important; }

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

/* ===== АДАПТИВНОСТЬ ===== */
@media (min-width: 768px) {
  .charts-container {
    grid-template-columns: 1fr 1fr;
  }

  .form-wrapper {
    padding: 30px;
  }

  .analytics-wrapper {
    padding: 30px;
  }

  .summary-value {
    font-size: 19px;
  }

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

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    text-align: left;
  }

  .summary-label {
    margin-bottom: 0;
  }

  .summary-value {
    font-size: 16px;
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .cat-btn {
    min-height: 58px;
    padding: 8px 3px 6px;
  }

  .cat-emoji {
    font-size: 20px;
  }
}

/* ===== iOS ФИКСЫ ===== */
@supports (-webkit-touch-callout: none) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  input, select, button {
    font-size: 16px;
    min-height: 44px;
  }

  .cat-btn {
    min-height: 58px;
  }

  .quick-amt {
    min-height: 40px;
  }

  .form-wrapper {
    width: calc(100vw - 30px);
  }

  .toast {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }

  input[type="date"]::before {
    content: attr(placeholder);
    color: var(--text-muted);
    margin-right: 0.5em;
  }

  input[type="date"]:focus::before,
  input[type="date"]:valid::before {
    content: "";
  }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-group {
  animation: fadeIn 0.35s ease forwards;
}

.form-group:nth-child(1) { animation-delay: 0.05s; }
.form-group:nth-child(2) { animation-delay: 0.10s; }
.form-group:nth-child(3) { animation-delay: 0.15s; }
.form-group:nth-child(4) { animation-delay: 0.20s; }

.summary-card {
  animation: fadeIn 0.3s ease forwards;
}

.transaction-row {
  animation: fadeIn 0.25s ease forwards;
}

/* ===== ГОРОД (переключатель) ===== */
.city-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -4px 0 16px;
  padding: 11px 14px;
  border: 1.5px solid var(--city-toggle-border);
  border-radius: var(--border-radius-sm);
  background: var(--city-toggle-bg);
}

.city-toggle__label {
  font-family: var(--font-alt);
  font-weight: 600;
  font-size: 12px;
  color: var(--city-label-color);
  margin: 0;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.city-pill {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-color);
  padding: 7px 16px;
  border-radius: 999px;
  font-family: var(--font-alt);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  line-height: 1;
  min-height: 36px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.city-pill:hover {
  transform: translateY(-1px);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.city-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(125, 175, 149, 0.28);
}

.city-pill.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
  box-shadow: 0 4px 14px rgba(125, 175, 149, 0.35);
}

.city-toggle__hint {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1 1 200px;
  text-align: right;
  min-width: 0;
}

.city-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  margin-right: 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #2f6b4f;
  background: rgba(125, 175, 149, 0.18);
  border: 1px solid rgba(125, 175, 149, 0.30);
  vertical-align: middle;
  flex: 0 0 auto;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .city-badge {
  color: #8ddbb0;
  background: rgba(125, 175, 149, 0.12);
  border-color: rgba(125, 175, 149, 0.22);
}

@media (max-width: 480px) {
  .city-toggle__hint {
    text-align: left;
    flex-basis: 100%;
  }
}
