:root {
  color-scheme: dark;
  --bg: #1e222e;
  --bg2: #252938;
  --bg3: #2d3445;
  --panel: rgba(37, 41, 56, 0.7);
  --stroke: #3a4052;
  --text: #f0f2f5;
  --muted: #9ba3b8;
  --blue: #5b8dee;
  --blue2: #4a7cd9;
  --green: #20c997;
  --red: #ff4d6d;
  --orange: #ff9f43;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --shadow: 0 0 1px rgba(90, 141, 238, 0.15), 0 12px 40px rgba(0, 0, 0, 0.5);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: linear-gradient(135deg, #1e222e 0%, #252938 25%, #2d3445 50%, #252938 75%, #1e222e 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Новый grid layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  height: 100vh;
  padding: 24px;
  box-sizing: border-box;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
}

/* Навигация по месяцам (старая - удалить) */
.month-navigation {
  display: none;
}

/* Навигация по месяцам - компактная версия в panel-head */
.month-navigation-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Компактные кнопки навигации по месяцам */
.month-nav-btn-small {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  font-weight: bold;
}

.month-nav-btn-small:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
}

.month-nav-btn-small:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.primary-btn-small {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.primary-btn-small:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
}

.add-month-btn {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #8b5cf6;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.add-month-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Кастомный dropdown для месяцев */
.custom-dropdown {
  position: relative;
  display: inline-block;
}

.month-dropdown-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e7ff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s ease;
}

.month-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.month-dropdown-btn.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.month-dropdown-btn.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: #1a1f2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: none !important;
  padding: 4px;
}

.dropdown-menu.show {
  display: block !important;
  animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 10px 12px;
  color: #e0e7ff;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dropdown-item:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.dropdown-item.active {
  background: rgba(59, 130, 246, 0.3);
  color: #fff;
  font-weight: 600;
}

.dropdown-item-text {
  flex: 1;
}

.dropdown-item-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #94a3b8;
}

.dropdown-item-edit {
  opacity: 0;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  color: #e0e7ff;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.dropdown-item:hover .dropdown-item-edit {
  opacity: 1;
}

.dropdown-item-edit:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Модальное окно - на весь экран */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #1a1f2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

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

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

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-danger {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Лого */
.logo-block {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  max-width: 100%;
}

/* Навигация */
.navigation {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-btn {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
}

.nav-btn:hover {
  border-color: var(--blue);
  background: var(--bg3);
}

.nav-btn.active {
  border: 2px solid var(--blue);
  background: transparent;
  color: var(--blue);
}

/* Кнопки «+» добавления (биржа, цель) — мягкий текст, без яркого квадрата */
.btn-add-subtle {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.btn-add-subtle:hover {
  color: var(--blue);
  background: rgba(91, 141, 238, 0.08);
}

/* Панель курса доллара */
.usd-panel {
  flex-shrink: 0;
}

/* Панель целей */
.goals-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}

.goals-panel #goalsContainer {
  flex: 1;
  overflow-y: auto;
}

/* Кнопка «Итоги дня» — в общем ключе дизайна */
.btn-day-wrapped {
  width: 100%;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  background: var(--bg2);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-day-wrapped:hover {
  border-color: var(--blue);
  background: var(--bg3);
}

.btn-day-wrapped:active {
  background: var(--bg2);
}

/* Кнопка «Итоги дня» внутри строки таблицы — аккуратная, но заметная */
.btn-day-wrapped-inline {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(91, 141, 238, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5edff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: box-shadow 0.15s ease, transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-day-wrapped-inline:hover {
  border-color: #5b8dee;
  background: rgba(24, 35, 58, 0.95);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.85);
  transform: translateY(-1px);
}

.btn-day-wrapped-inline:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.8);
}

/* Day Wrapped overlay и карточка */
.day-wrapped-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 2500;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dayWrappedFadeIn 0.3s ease;
}

@keyframes dayWrappedFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.day-wrapped-card {
  position: relative;
  max-width: 420px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #1e1b4b 0%, #312e81 30%, #1e222e 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 24px;
  box-shadow: 0 0 60px rgba(139, 92, 246, 0.3), 0 25px 50px rgba(0,0,0,0.5);
  padding: 32px 28px 36px;
  animation: dayWrappedCardFly 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dayWrappedCardFly {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.day-wrapped-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.day-wrapped-close:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

.day-wrapped-content {
  color: #fff;
}

.day-wrapped-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 8px;
  background: linear-gradient(90deg, #a78bfa, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.day-wrapped-date {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  margin-bottom: 28px;
}

.day-wrapped-metric {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-wrapped-metric-label {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
}

.day-wrapped-metric-value {
  font-size: 18px;
  font-weight: 700;
}

.day-wrapped-metric-value.positive { color: #34d399; }
.day-wrapped-metric-value.negative { color: #f87171; }
.day-wrapped-metric-value.neutral { color: rgba(255,255,255,0.9); }

.day-wrapped-empty {
  text-align: center;
  padding: 40px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 15px;
  line-height: 1.6;
}


button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
  background: var(--bg2);
  border-color: var(--stroke);
}

button:hover {
  border-color: rgba(77, 136, 255, 0.5);
  background: var(--bg3);
}

button:active {
  transform: translateY(1px);
}

.btn-primary {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.btn-primary:hover {
  background: rgba(77, 136, 255, 0.12);
  border-color: var(--blue);
}

/* Метрики-карточки */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex-shrink: 0;
}

.metric-card {
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-icon {
  font-size: 32px;
  line-height: 1;
  opacity: 0.9;
}

.metric-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.metric-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease-out;
  width: 0%;
}

.metric-card.blue .metric-progress-fill {
  background: linear-gradient(90deg, var(--blue), rgba(77, 136, 255, 0.5));
}

.metric-card.green .metric-progress-fill {
  background: linear-gradient(90deg, var(--green), rgba(32, 201, 151, 0.5));
}

.metric-card.orange .metric-progress-fill {
  background: linear-gradient(90deg, var(--orange), rgba(255, 159, 67, 0.5));
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
}

.metric-card.blue::before { background: var(--blue); }
.metric-card.green::before { background: var(--green); }
.metric-card.orange::before { background: var(--orange); }
.metric-card.red::before { background: var(--red); }

.metric-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.metric-card.blue .metric-value { color: var(--blue); }
.metric-card.green .metric-value { 
  color: var(--green); 
  /* Цвет будет меняться через JS */
}
.metric-card.orange .metric-value { color: var(--orange); }
.metric-card.red .metric-value { color: var(--red); }

/* Таблица */
.panel {
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  z-index: 0;
}

.left-column .panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-column .panel .table-wrap {
  flex: 1;
  overflow: auto;
}

/* Строка дня на странице сделок — компактная, без flex-grow, без скролла */
.left-column .panel #dayStatsTable {
  flex: 0 0 auto;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Дата ближе к левому краю */
#dayStatsTable tbody td:first-child {
  padding-left: 12px;
  text-align: left;
}

#dayStatsTable thead th:first-child {
  padding-left: 12px;
  text-align: left;
}

/* Колонки бирж в строке дня — шире для удобного ввода */
#dayStatsTable thead th.exchange-col,
#dayStatsTable tbody td.exchange-col {
  min-width: 90px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--stroke);
}

.panel-head .h {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

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

thead th {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 6px;
  background: #262b39;
  white-space: nowrap;
  min-width: 60px;
}

thead th.exchange-col,
tbody td.exchange-col {
  min-width: 130px;
  max-width: 220px;
  width: 1%;
  overflow: visible;
}

tbody td {
  padding: 8px 6px;
  border-top: 1px solid var(--stroke);
}

/* Фото под сделкой в таблице — до 6 штук, 1 большое / 2 в ряд / по 2 в ряд */
tr.trade-photos-row td {
  border-top: none;
  padding-top: 0;
  padding-bottom: 12px;
}
.trade-photos-grid {
  gap: 8px;
  max-width: 100%;
}
.trade-photos-grid img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.trade-photos-grid img:only-child {
  max-height: 180px;
}
  vertical-align: middle;
  text-align: center;
  background: #262b39;
  min-width: 60px;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #2d3445;
}

.board-wrap {
  width: 100%;
  height: 420px;
  background: var(--bg2);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}

.board-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.board-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.date-cell {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.amount-cell {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

input {
  width: 100%;
  max-width: 320px;
  background: var(--bg2);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  outline: none;
  font-size: 13px;
  font-weight: 500;
  min-width: 40px;
}

input::placeholder {
  color: rgba(138, 154, 184, 0.7);
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77, 136, 255, 0.12);
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--stroke);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* Кнопки «добавить» — текстовая, без тяжёлого квадрата */
.btn-add-inline {
  background: transparent !important;
  border: none !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: color 0.2s, background 0.2s !important;
  width: auto !important;
  height: auto !important;
}
.btn-add-inline:hover {
  color: var(--blue) !important;
  background: rgba(91, 141, 238, 0.08) !important;
}

/* Responsive - убираем перенос правой колонки, просто уменьшаем grid */
@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr 320px;
    padding: 16px;
    gap: 16px;
  }
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr 280px;
    padding: 12px;
    gap: 12px;
  }
  
  .logo {
    height: 50px;
  }
}

@media (max-width: 820px) {
  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  
  .right-column {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    gap: 12px;
  }
  
  .logo-block {
    width: 100%;
    order: 1;
  }
  
  .navigation {
    flex-direction: row;
    width: 100%;
    order: 2;
  }
  
  .usd-panel {
    order: 3;
  }
  
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .navigation {
    flex-direction: column;
  }
  
  .right-column {
    flex-direction: column;
  }
  
  .usd-panel {
    min-width: 100%;
  }
}

/* Кнопки вкладок в стиле метрик */
.tab-btn {
  padding: 16px 24px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #5b8dee, #7ba3f0);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.tab-btn:hover {
  background: var(--bg-alt);
  border-color: #5b8dee;
  box-shadow: 0 2px 8px rgba(91, 141, 238, 0.3);
}

.tab-btn:hover::before {
  transform: translateX(0);
}

.tab-btn.active {
  background: var(--panel-bg);
  border-color: #5b8dee;
  color: white;
  box-shadow: 0 4px 16px rgba(91, 141, 238, 0.4);
}

.tab-btn.active::before {
  transform: translateX(0);
  background: #5b8dee;
}

/* ===========================
   АНИМАЦИИ
   =========================== */

/* Плавное появление карточек выводов */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Пульсация свечения */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(32, 201, 151, 0.4), inset 0 0 20px rgba(32, 201, 151, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(32, 201, 151, 0.6), inset 0 0 30px rgba(32, 201, 151, 0.2);
  }
}

/* Анимация появления модального окна */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* Анимация кнопок */
@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* Анимация загрузки */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Анимация появления уведомлений */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Bounce эффект для новых элементов */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Shake эффект для ошибок */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Применяем анимации к элементам */
.btn-primary {
  transition: all 0.2s ease;
}


.btn-primary:hover {
  box-shadow: 0 3px 10px rgba(32, 201, 151, 0.3);
}

/* Анимация для модальных окон */
[id$="Modal"][style*="display: block"],
[id$="Modal"][style*="display: flex"] {
  animation: modalFadeIn 0.3s ease;
}

[id$="Modal"][style*="display: block"] > div {
  animation: modalSlideIn 0.3s ease;
}

[id$="Modal"][style*="display: flex"] > div {
  animation: fadeInUp 0.3s ease;
}

/* Анимация для вкладок */
.tab-btn {
  transition: all 0.3s ease;
}



/* Плавная анимация для таблиц */
.table-wrap {
  animation: fadeInUp 0.5s ease;
}

/* Hover эффект для строк таблицы */
tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background: rgba(32, 201, 151, 0.05);
  transform: translateX(5px);
}

/* Сегодняшний день — выделение */
tbody tr.row-today {
  background: rgba(91, 141, 238, 0.15);
  border-left: 3px solid var(--blue);
}

/* Анимация для метрик */
.metrics {
  animation: fadeInUp 0.6s ease;
}

.metric {
  transition: all 0.3s ease;
}

.metric:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Анимация для прогресс-баров целей */
.goal-progress-bar {
  transition: width 0.5s ease;
}

/* Скринер — таблица котировок */
.screener-quotes-table tbody tr {
  border-bottom: 1px solid var(--stroke);
}
.screener-quotes-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
.screener-quotes-table tbody td {
  padding: 10px 12px;
  color: var(--text);
}
.screener-quotes-table .col-instrument {
  font-weight: 600;
}
.screener-quotes-table .col-positive {
  color: var(--green);
}
.screener-quotes-table .col-negative {
  color: var(--red);
}

/* Скринер: колонка котировок и ручка ресайза */
.screener-grid .screener-quotes-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.screener-quotes-panel {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Границы ресайза (как у окна) */
.screener-resize-edge,
.screener-resize-corner {
  position: absolute;
  z-index: 5;
}
.screener-resize-edge {
  background: transparent;
}
.screener-resize-edge[data-resize="top"] {
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: n-resize;
}
.screener-resize-edge[data-resize="right"] {
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  cursor: e-resize;
}
.screener-resize-edge[data-resize="bottom"] {
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  cursor: s-resize;
}
.screener-resize-edge[data-resize="left"] {
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  cursor: w-resize;
}
.screener-resize-corner {
  width: 28px;
  height: 28px;
  background: transparent;
  pointer-events: auto;
}
.screener-resize-corner[data-resize="tl"] {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}
.screener-resize-corner[data-resize="tr"] {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}
.screener-resize-corner[data-resize="br"] {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
  z-index: 1000;
}
.screener-resize-corner[data-resize="bl"] {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}
.screener-resize-edge:hover,
.screener-resize-corner:hover {
  background: rgba(91, 141, 238, 0.15);
}

/* Скринер: окна как в приложении — перетаскивание и масштабирование */
.screener-windows-container {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg2);
  border-radius: var(--radius);
}
.screener-window {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  min-width: 260px;
  min-height: 180px;
}
.screener-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.2);
}
.screener-window-header:hover {
  background: rgba(0, 0, 0, 0.3);
}
.screener-window-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  padding: 12px;
  padding-right: 28px;
  padding-bottom: 28px;
  position: relative;
  z-index: 0;
}
.screener-resize-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 100;
}
.screener-resize-layer .screener-resize-edge,
.screener-resize-layer .screener-resize-corner {
  pointer-events: auto;
}
.screener-window .screener-resize-edge {
  z-index: 2;
}
.screener-window .screener-resize-corner {
  z-index: 3;
}
