.dark .meal-type-section input::placeholder {
  color: rgba(148, 163, 184, 0.65);
}
/* Кнопка дозагрузки прошлых записей */
.backdate-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px 40px;
}

.backdate-button {
  min-width: 220px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.backdate-button:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.08);
  color: var(--accent);
}

.backdate-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.dark .backdate-button {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.dark .backdate-button:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
}

.backdate-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.dark .backdate-empty {
  color: rgba(226, 232, 240, 0.7);
}
/* Базовая стилистика: минимализм, мобильный приоритет */
:root{
  --bg:#ffffff;
  --card:#fbfbfb;
  --muted:#6b7280;
  --accent:#16a34a; /* зелёный */
  --accent-2:#f59e0b; /* оранж */
  --shadow: 0 6px 18px rgba(15,23,42,0.06);
  --radius:14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --text-size:14px;
  --transition-duration: 0.3s;
  
  /* Дополнительные переменные для совместимости */
  --background: #ffffff;
  --text: #1f2937;
  --text-color: #1f2937;
  --border: #e5e7eb;
}

/* Фиксация viewport для iOS - предотвращение изменения расположения при появлении клавиатуры */
html {
  height: 100%;
  height: -webkit-fill-available;
}

/* Для iOS Safari - предотвращение изменения размера viewport при появлении клавиатуры */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: 100%;
    min-height: -webkit-fill-available;
    position: relative;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
}

/* Улучшение качества Canvas для четкости на Retina дисплеях */
canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  image-rendering: auto;
}

/* Красивый заголовок аналитики */
.analytics-header {
  margin-bottom: 0;
  background: linear-gradient(135deg, var(--card) 0%, rgba(22, 163, 74, 0.03) 100%);
  border-radius: 16px;
  border: 1px solid rgba(22, 163, 74, 0.1);
  padding: 12px 16px;
  position: relative;
  overflow: hidden;
}

.analytics-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 16px 16px 0 0;
}

.analytics-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.analytics-title h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.analytics-periods {
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 0;
}

.period-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.period-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 8px;
}

.period-btn:hover::before {
  opacity: 0.1;
}

.period-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  transform: translateY(-1px);
}

.period-btn.active::before {
  opacity: 0;
}

.period-btn:hover:not(.active) {
  color: var(--accent);
  transform: translateY(-1px);
}

/* Компактная статистика */
.stats-overview-compact {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.06);
}

.stat-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
}

.stat-item .stat-icon {
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-item .stat-icon svg {
  width: 100%;
  height: 100%;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Красивые графики */
.charts-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-section-beautiful {
  background: linear-gradient(135deg, var(--card) 0%, rgba(22, 163, 74, 0.02) 100%);
  border-radius: 16px;
  border: 1px solid rgba(22, 163, 74, 0.1);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.chart-section-beautiful:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.15);
}

.chart-section-beautiful::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 16px 16px 0 0;
}

.chart-header-beautiful {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.chart-title h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.chart-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.chart-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.trend-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.trend-icon svg {
  width: 100%;
  height: 100%;
}

.chart-summary {
  padding: 6px 12px;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.chart-container-beautiful {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.macros-chart-container-beautiful {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 180px;
}

.macros-chart-wrapper {
  position: relative;
  flex-shrink: 0;
}

.chart-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.center-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.center-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.macros-legend-beautiful {
  flex: 1;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.legend-item:hover {
  background: rgba(22, 163, 74, 0.05);
  transform: translateX(2px);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend-label {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.legend-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* Компактный топ продуктов */
.top-foods-section-compact {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 12px;
}

.section-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-header-compact h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.food-category {
  display: flex;
  gap: 4px;
}

.category-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.top-foods-list-compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.food-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 6px;
  font-size: 12px;
}

.food-rank {
  font-weight: 700;
  color: var(--accent);
  min-width: 16px;
}

.food-name {
  flex: 1;
  font-weight: 500;
}

.food-progress {
  flex: 1;
  margin: 0 8px;
}

.food-progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.food-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.food-value {
  font-size: 11px;
  color: var(--muted);
  min-width: 40px;
  text-align: right;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  /* Analytics header для мобильных */
  .analytics-header {
    padding: 12px;
    margin-bottom: 0;
  }
  
  .analytics-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .analytics-title h2 {
    font-size: 18px;
    line-height: 1.2;
  }
  
  .analytics-periods {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }
  
  .period-btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 12px;
    text-align: center;
    min-width: 0;
  }
  
  .charts-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stats-overview-compact {
    flex-direction: column;
    gap: 6px;
  }
  
  .stat-item {
    padding: 6px;
  }
  
  .macros-chart-container-beautiful {
    flex-direction: column;
    height: auto;
    gap: 12px;
  }
  
  .chart-section-beautiful {
    padding: 12px;
  }
  
  .chart-container-beautiful {
    height: 160px;
  }
  
  .macros-chart-wrapper {
    align-self: center;
  }
}

/* Dark theme variables (applied via .dark on body) */
.dark{
  --bg:#0b1020;
  --card:#0f1724;
  --muted:#9aa6b2;
  --accent:#34d399;
  --accent-2:#fbbf24;
  --shadow: 0 8px 26px rgba(0,0,0,0.6);
  color: #e6eef6;
}

/* Dark theme для analytics-header */
.dark .analytics-header {
  background: linear-gradient(135deg, var(--card) 0%, rgba(52, 211, 153, 0.05) 100%);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.dark .analytics-periods {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
}

.dark .period-btn:hover:not(.active) {
  color: var(--accent);
}

/* CSS3 Card Deck Drop Down */
.card-drop {
  position: relative;
  width: 100%;
  z-index: 10;
}

.card-drop a {
  display: block;
  width: 100%;
  background-color: white;
  padding: 12px;
  text-decoration: none;
  color: #2c3e50;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  transition: all 0.3s ease-out;
  box-sizing: border-box;
  min-height: 60px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 400;
}

.card-drop > a.toggle {
  position: relative;
  z-index: 100;
  background-color: white;
  cursor: pointer;
}

.card-drop > a.toggle:before {
  font-family: 'FontAwesome';
  content: '\f0d7';
  font-size: 1.2em;
  color: #6b7280;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}

.card-drop > a.toggle.active:before {
  transform: translateY(-50%) rotate(180deg);
}

.card-drop ul {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e1e5e9;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 99;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-drop.active ul {
  max-height: 300px;
  opacity: 1;
  visibility: visible;
}

/* Для селектора часового пояса увеличиваем высоту, так как элементов больше */
#timezone-select.active ul {
  max-height: 500px;
  overflow-y: auto;
}

.card-drop ul li {
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

.card-drop ul li a {
  display: block;
  padding: 12px;
  background-color: white;
  color: #2c3e50;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s ease;
  min-height: 60px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 400;
}

.card-drop ul li:last-child a {
  border-bottom: none;
}

.card-drop ul li a:hover {
  background-color: #f8f9fa;
  color: #3b82f6;
}

.card-drop ul li.active a {
  background-color: #3b82f6;
  color: white;
}

/* Темная тема для Card Drop селектов */
.dark .card-drop a {
  background-color: #1e293b;
  color: #e6eef6;
  border-color: rgba(255,255,255,0.1);
}

.dark .card-drop > a.toggle {
  background-color: #1e293b;
}

.dark .card-drop > a.toggle:before {
  color: #9aa6b2;
}

.dark .card-drop ul {
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
}

.dark .card-drop ul li a {
  background-color: #1e293b;
  color: #e6eef6;
  border-bottom-color: rgba(255,255,255,0.1);
}

.dark .card-drop ul li a:hover {
  background-color: #334155;
  color: #60a5fa;
}

.dark .card-drop ul li.active a {
  background-color: #3b82f6;
  color: #ffffff;
}

/* Современные кастомные селекты в стиле CodePen */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select {
  position: relative;
  width: 100%;
  background: #fff;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.custom-select:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.custom-select.active {
  border-color: #3b82f6;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
  transform: translateY(-2px);
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-height: 48px;
}

.select-value {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  transition: color 0.3s ease;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.select-arrow::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-select.active .select-arrow {
  color: #3b82f6;
  transform: rotate(180deg);
}

.custom-select.active .select-arrow::before {
  transform: rotate(180deg);
}

.select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid #3b82f6;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
  z-index: 10;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, visibility 0.3s ease;
}

.custom-select.active .select-options {
  max-height: 300px !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: 1px solid #f3f4f6;
  position: relative;
  font-size: 14px;
  color: #374151;
}

.select-option:last-child {
  border-bottom: none;
}

.select-option:hover {
  background: #f8fafc;
  color: #3b82f6;
  transform: translateX(2px);
}

.select-option.selected {
  background: #3b82f6;
  color: white;
  font-weight: 500;
}

.option-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-option:hover .option-icon {
  background: #e2e8f0;
  color: #3b82f6;
  transform: scale(1.05);
}

.option-text {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.option-desc {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
  line-height: 1.3;
}

.select-option.selected .option-desc {
  color: rgba(255,255,255,0.8);
}

.select-option.selected .option-icon {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Убираем анимацию появления опций для стабильной работы */
.select-option {
  opacity: 1;
  transform: translateY(0);
}

/* Темная тема для кастомных селектов */
.dark .custom-select {
  background: var(--card);
  border-color: rgba(255,255,255,0.1);
}

.dark .custom-select:hover {
  border-color: var(--accent);
}

.dark .select-trigger {
  background: linear-gradient(135deg, var(--card) 0%, rgba(52, 211, 153, 0.05) 100%);
}

.dark .select-options {
  background: var(--card);
  border-color: var(--accent);
}

.dark .select-option {
  border-bottom-color: rgba(255,255,255,0.1);
}

.dark .select-option:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.1) 0%, rgba(52, 211, 153, 0.15) 100%);
}

/* Dark theme specific styles for inputs and buttons */
.dark textarea#text-input{
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
  color: #e6eef6;
}

.dark textarea#text-input::placeholder{
  color: #9aa6b2;
}

.dark .manual-cal input[type=number]{
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
  color: #e6eef6;
}

.dark .fake-file{
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
  color: #9aa6b2;
}

.dark .controls button{
  border-color: rgba(255,255,255,0.1);
  color: #e6eef6;
}

.dark .controls button.active{
  background: linear-gradient(90deg, #34d399, #fbbf24);
  color: #0b1020;
}

.dark .btn.ghost{
  border-color: rgba(255,255,255,0.1);
  color: #e6eef6;
}

.dark .btn.ghost:hover{
  background: rgba(255,255,255,0.05);
}

.dark .calories-panel{
  background: #1e293b;
  border-color: rgba(255,255,255,0.1);
}

.dark .progress{
  background: rgba(255,255,255,0.1);
}

/* Темная тема для активных кнопок навигации */
.dark .nav-btn.active{
  background:var(--card);color:var(--accent);border-color:var(--accent);
}
.dark .nav-btn.active .nav-label{
  color:var(--accent);
}

/* Стили для динамически создаваемых input элементов в результатах */
.dark .result-items input[type=number]{
  background: #1e293b !important;
  border-color: rgba(255,255,255,0.1) !important;
  color: #e6eef6 !important;
}

/* === СТИЛИ ДЛЯ ОБЪЕДИНЁННОЙ СТРАНИЦЫ ПРОФИЛЯ === */

/* Профиль-герой */
.profile-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius);
  margin-bottom: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.profile-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  z-index: 0;
}


/* Секции профиля */
.profile-section {
  margin-bottom: 32px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.section-icon {
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.section-icon svg {
  width: 100%;
  height: 100%;
}

/* Новый дизайн сетки целей */
.goals-grid-new {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin-bottom: 24px !important;
}

.goal-item {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 16px !important;
  background: var(--card) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  border-radius: var(--radius) !important;
  transition: all var(--transition-duration) ease !important;
  position: relative !important;
  overflow: hidden !important;
}

.goal-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.goal-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition-duration) ease;
}

.goal-item:hover::before {
  opacity: 1;
}

.goal-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.goal-icon svg {
  width: 100%;
  height: 100%;
}

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

.goal-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}

.goal-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.goal-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.goal-stats .current {
  color: var(--accent);
  font-weight: 600;
}

.goal-stats .separator {
  color: var(--muted);
}

.goal-target {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-color);
  font-size: 14px;
  text-align: center;
  transition: all var(--transition-duration) ease;
}

.goal-target:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.1);
}

.goal-stats .unit {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Цветовая схема для разных целей */
.goal-item[data-goal="calories"] .progress-fill {
  background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
}

.goal-item[data-goal="protein"] .progress-fill {
  background: linear-gradient(90deg, #4ecdc4, #6dd5d0);
}

.goal-item[data-goal="fat"] .progress-fill {
  background: linear-gradient(90deg, #ffd93d, #ffe066);
}

.goal-item[data-goal="carbs"] .progress-fill {
  background: linear-gradient(90deg, #a8e6cf, #b8f0d9);
}

/* Темная тема для нового дизайна */
.dark .goal-item {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .goal-item:hover {
  border-color: var(--accent);
}

.dark .goal-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.dark .goal-target {
  background: var(--bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .goal-target:focus {
  border-color: var(--accent);
}

/* Счетчик символов */
.char-counter {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.char-counter.warning {
  color: #f59e0b;
}

.char-counter.danger {
  color: #ef4444;
}

/* Темная тема для счетчика */
.dark .char-counter {
  color: var(--muted);
}

.dark .char-counter.warning {
  color: #fbbf24;
}

.dark .char-counter.danger {
  color: #f87171;
}

/* Кнопка адаптации целей */
.btn-icon-only {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all var(--transition-duration) ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-only:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: rotate(180deg);
}

/* Рекомендации */
.recommendations {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.recommendation-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  transition: all var(--transition-duration) ease;
}

.recommendation-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.recommendation-content h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
}

.recommendation-content p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.advice-hint {
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  background: rgba(52, 211, 153, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(52, 211, 153, 0.1);
}

body.dark .advice-hint {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.2);
  color: rgba(148, 163, 184, 0.9);
}

/* Переменные для темной темы */
.dark {
  --background: #1e293b;
  --text: #e2e8f0;
  --text-color: #e2e8f0;
  --border: #334155;
}

/* Адаптивность */
@media (max-width: 768px) {
  .profile-hero {
    padding: 16px 12px;
  }
  
  .goals-grid-new {
    gap: 8px;
  }
  
  .goal-item {
    padding: 12px;
  }
  
  .goal-icon {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}

/* Темная тема для новых элементов */
.dark .profile-hero {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}



.dark .goal-input {
  background: var(--bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .goal-input:focus {
  border-color: var(--accent);
}

.dark .recommendation-card {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .btn-icon-only {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .btn-icon-only:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text-color, #0f172a);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  display:flex;
  flex-direction:column;
  min-height:100vh;
  min-height:-webkit-fill-available;
  transition:background var(--transition-duration) ease, color var(--transition-duration) ease;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  overflow-x:hidden;
  overflow-y:auto;
  position:relative;
  width:100%;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

header{
  padding:18px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid rgba(0,0,0,0.06);
  background:linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.3));
  transition:background var(--transition-duration) ease, border-color var(--transition-duration) ease;
}
.dark header{
  border-bottom-color: rgba(255,255,255,0.04);
  background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}
header h1{font-size:18px;margin:0;font-weight:600;letter-spacing:-0.01em}
header .controls{display:flex;gap:10px;align-items:center}
header .settings{font-size:18px;color:var(--muted);cursor:pointer;transition:color var(--transition-duration) ease}
header .theme-toggle{font-size:18px;color:var(--muted);cursor:pointer;transition:color var(--transition-duration) ease}

main{flex:1;padding:16px;max-width:900px;margin:0 auto;width:100%;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y}

.day-summary{
  margin-bottom:14px;
  display:flex;gap:12px;align-items:center;justify-content:space-between
}
.totals{
  background:var(--card);padding:12px;border-radius:12px;box-shadow:var(--shadow);flex:1;
  display:flex;flex-direction:column;gap:6px;transition:background-color var(--transition-duration) ease, color var(--transition-duration) ease, box-shadow .2s ease, transform .18s ease;
}
.totals:hover{transform:translateY(-4px)}
.totals .kcal{font-weight:700;font-size:20px;letter-spacing:-0.02em}
.totals .sub{color:var(--muted);font-size:14px;font-weight:500}

.meals{display:flex;flex-direction:column;gap:10px}
.meal-card{
  background:var(--card);padding:10px;border-radius:10px;box-shadow:var(--shadow);transition:transform .18s ease,box-shadow .18s ease, background-color var(--transition-duration) ease;
}
.meal-card:hover{transform:translateY(-6px)}
.meal-card h3{margin:0 0 6px 0;font-size:15px;font-weight:600;letter-spacing:-0.01em}
.food-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-top:1px dashed rgba(15,23,42,0.04)}
.food-row:first-of-type{border-top:0;padding-top:0}
.food-name{font-size:14px;font-weight:500}
.food-kcal{font-size:14px;color:var(--muted);font-weight:500}

.add-btn{
  position:fixed;right:18px;bottom:78px;background:var(--accent);color:white;border:0;padding:14px;border-radius:999px;font-size:20px;box-shadow:0 8px 24px rgba(22,163,74,0.18);cursor:pointer;transform-origin:center;animation:float 4s ease-in-out infinite;
}
@keyframes float{0%{transform:translateY(0)}50%{transform:translateY(-6px)}100%{transform:translateY(0)}}

/* Нижняя навигация */
nav.bottom-nav{
  height:68px;display:flex;align-items:center;justify-content:space-between;border-top:1px solid rgba(0,0,0,0.05);background:var(--bg);position:sticky;bottom:0;z-index:40;transition:background-color var(--transition-duration) ease, color var(--transition-duration) ease;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  /* Фиксируем размеры навигации */
  min-height:68px;
  max-height:68px;
  padding: 0 20px;
  /* Полностью убираем возможность прокрутки на панели навигации */
  touch-action: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  pointer-events: auto;
}
/* Темная тема для bottom-nav */
.dark nav.bottom-nav {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-btn{
  background:none;border:2px solid transparent;padding:0;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer;border-radius:12px;position:relative;min-width:56px;flex-shrink:0;box-sizing:border-box;
  /* Фиксируем размеры чтобы кнопки не двигались */
  width: 56px;
  height: 56px;
  /* Плавные анимации */
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
  /* Улучшенная тактильная обратная связь */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: var(--muted);
}
.nav-icon{
  width:20px;
  height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:opacity 0.2s ease;
}
.nav-icon svg{
  width:100%;
  height:100%;
  stroke:currentColor;
  fill:none;
}
.nav-label{
  display:none !important;
}
.nav-btn.active{
  background:var(--card);color:var(--accent);
  border:2px solid transparent;
  transform:none;
  padding:0;
  box-shadow:0 2px 8px rgba(22, 163, 74, 0.08);
}
.nav-btn.active .nav-icon{
  transform:none;
  color:var(--accent);
}
.nav-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.nav-btn:active {
  transform: scale(0.95);
  background: rgba(0, 0, 0, 0.08);
  transition: transform 0.1s ease, background 0.1s ease;
}

.nav-btn:hover:not(.active) .nav-icon{
  transform: none;
  color: var(--text);
}

/* Темная тема для кнопок навигации */
.dark .nav-btn {
  color: var(--muted);
}
.dark .nav-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: #e6eef6;
}
.dark .nav-btn.active {
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.2);
  color: var(--accent);
}
.dark .nav-btn.active .nav-icon {
  color: var(--accent);
}

/* Специальная кнопка "Добавить" по центру */
.add-btn-nav{
  background: var(--accent) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25) !important;
  transform: none;
  border-radius: 50% !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  padding: 0 !important;
  position: relative;
  flex-shrink: 0;
  border: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-btn-nav:hover {
  background: var(--accent) !important;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35) !important;
  transform: scale(1.05);
}

.add-btn-nav:active {
  transform: scale(0.95) !important;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3) !important;
}

.add-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: none;
}

.add-icon svg {
  stroke: currentColor;
}

/* Темная тема для кнопки добавления */
.dark .add-btn-nav {
  background: var(--accent) !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3) !important;
}

.dark .add-btn-nav:hover {
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4) !important;
}

/* Стили для кнопки удаления */
.delete-meal-btn {
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.delete-meal-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.delete-meal-btn:hover {
  transform: scale(1.1);
  color: #ef4444;
}

.delete-meal-btn:active {
  transform: scale(0.9);
}

/* Темная тема для кнопки удаления */
.dark .delete-meal-btn {
  color: rgba(255, 255, 255, 0.6);
}

.dark .delete-meal-btn:hover {
  background: rgba(255, 0, 0, 0.15) !important;
  color: #f87171;
}

/* Кнопка редактирования записи */
.edit-meal-btn {
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.edit-meal-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.edit-meal-btn:hover {
  transform: scale(1.1);
  color: var(--accent);
}

.edit-meal-btn:active {
  transform: scale(0.9);
}

/* Темная тема для кнопки редактирования */
.dark .edit-meal-btn {
  color: rgba(255, 255, 255, 0.6);
}

.dark .edit-meal-btn:hover {
  background: rgba(22, 163, 74, 0.15) !important;
  color: #4ade80;
}

/* Страницы */
.page{
  min-height:calc(100vh - 140px);padding-bottom:20px;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-y;
}
.page-header{
  margin-bottom:20px;text-align:center;
}
.page-header h2{
  margin:0 0 8px 0;font-size:26px;font-weight:700;letter-spacing:-0.02em;
}
.page-subtitle{
  margin:0;color:var(--muted);font-size:15px;font-weight:400;
}

/* Аналитика */
.analytics-grid{
  display:grid;grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));gap:16px;margin-bottom:24px;
}
.analytics-card{
  background:var(--card);border-radius:16px;padding:20px;box-shadow:var(--shadow);transition:transform .2s ease, box-shadow .2s ease;display:flex;align-items:center;gap:16px;
}
.analytics-card:hover{
  transform:translateY(-4px);box-shadow:0 8px 25px rgba(0,0,0,0.1);
}
.analytics-icon{
  font-size:32px;width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg, var(--accent), var(--accent-2));border-radius:16px;color:white;
}
.analytics-content{
  flex:1;
}
.analytics-content h3{
  margin:0 0 8px 0;font-size:14px;color:var(--muted);font-weight:500;
}
.analytics-value{
  font-size:24px;font-weight:700;margin-bottom:4px;
}
.analytics-subtitle{
  font-size:12px;color:var(--muted);
}
.analytics-progress{
  margin-top:12px;
}
.analytics-progress-text{
  font-size:12px;color:var(--muted);margin-top:4px;display:flex;justify-content:space-between;
}

/* График */
.analytics-chart{
  background:var(--card);border-radius:16px;padding:20px;box-shadow:var(--shadow);margin-top:20px;
}
.analytics-chart h3{
  margin:0 0 16px 0;font-size:18px;font-weight:600;
}
.chart-container{
  height:120px;display:flex;align-items:end;gap:8px;padding:16px 0;
}
.chart-bars{
  display:flex;gap:8px;align-items:end;height:100%;width:100%;
}
.chart-bar{
  flex:1;background:linear-gradient(to top, var(--accent), var(--accent-2));border-radius:4px 4px 0 0;min-height:20px;position:relative;transition:all .3s ease;
}
.chart-bar:hover{
  transform:scaleY(1.1);
}
.chart-bar::after{
  content:attr(data-value);position:absolute;top:-20px;left:50%;transform:translateX(-50%);font-size:10px;color:var(--muted);white-space:nowrap;
}

/* История */
.history-filters{
  display:flex;gap:8px;margin-bottom:20px;justify-content:center;
}
.filter-btn{
  padding:8px 16px;border-radius:20px;border:1px solid rgba(0,0,0,0.06);background:transparent;color:var(--muted);cursor:pointer;transition:all var(--transition-duration) ease;font-size:13px;
}
.filter-btn.active{
  background:var(--accent);color:white;border-color:var(--accent);
}
.filter-btn:hover:not(.active){
  background:rgba(0,0,0,0.02);
}
.history-list{
  display:flex;flex-direction:column;gap:12px;
}
.history-item{
  background:var(--card);border-radius:12px;padding:16px;box-shadow:var(--shadow);transition:transform .2s ease;
}
.history-item:hover{
  transform:translateY(-2px);
}
.history-date{
  font-size:14px;font-weight:600;margin-bottom:8px;color:var(--accent);
}
.history-stats{
  display:flex;gap:16px;font-size:13px;color:var(--muted);
}
.history-meals{
  margin-top:12px;display:flex;flex-direction:column;gap:8px;
}
.history-meal{
  padding:8px;background:rgba(0,0,0,0.02);border-radius:8px;font-size:13px;
}

/* Дневной прогресс */
.daily-progress{
  margin:16px 0;
}
.progress-section{
  background:var(--card);border-radius:16px;padding:16px;box-shadow:var(--shadow);
}
.progress-header{
  display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:14px;font-weight:600;
}
.progress-info{
  display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-top:8px;
}

/* Прогресс-бары для макронутриентов */
.macros-progress {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.macro-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.macro-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.macro-name {
  font-weight: 500;
  color: var(--text);
  font-size: 12px;
}

.macro-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.macro-bar {
  height: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.macro-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
}

.protein-fill {
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.fat-fill {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.carbs-fill {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Темная тема для макронутриентов */
.dark .macro-bar {
  background: rgba(255, 255, 255, 0.1);
}

.dark .macro-name {
  color: var(--text);
}

.dark .macro-value {
  color: var(--muted);
}

.dark .macros-progress {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Анимация анализа */
@keyframes ai-thinking {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes ai-dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.ai-thinking {
  animation: ai-thinking 1.5s ease-in-out infinite;
}

.ai-dots::after {
  content: '';
  animation: ai-dots 2s infinite;
}

/* Анимация кнопки анализа */
.analyze-btn.analyzing {
  pointer-events: none;
  opacity: 0.8;
  background: linear-gradient(45deg, #667eea, #764ba2, #667eea, #f093fb);
  background-size: 400% 400%;
  animation: button-gradient 1.5s ease infinite;
  position: relative;
  overflow: hidden;
}

.analyze-btn.analyzing::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

.analyze-btn.analyzing::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

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

/* Стили для модального окна редактирования */
.edit-modal {
  z-index: 70;
}

.edit-content {
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 20px;
}

.meal-type-section {
  margin-bottom: 20px;
}

.meal-type-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.meal-type-section input {
  width: auto;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.meal-type-section input::placeholder {
  color: rgba(71, 85, 105, 0.7);
  font-weight: 400;
}

.meal-type-section input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
  outline: none;
}

.items-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text);
}

.edit-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
  min-width: 0;
}

.item-name {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.remove-item {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-item:hover {
  background: rgba(255, 0, 0, 0.1);
}

.item-nutrition {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.nutrition-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nutrition-row label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.nutrition-row input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 6px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}

.nutrition-row input:focus {
  border-color: var(--accent);
  outline: none;
}

.edit-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.edit-actions .btn {
  flex: 1;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
}

/* Темная тема для модального окна редактирования */
.dark .edit-modal {
  background: rgba(0, 0, 0, 0.8);
}

.dark .edit-modal .sheet {
  background: var(--card);
  border: 1px solid var(--border);
}

.dark .edit-modal h2 {
  color: var(--text);
}

.dark .edit-modal h3 {
  color: var(--text);
}

.dark .meal-type-section input {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.dark .meal-type-section input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  outline: none;
}

.dark .edit-item {
  background: var(--background);
  border-color: var(--border);
}

.dark .item-name {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.dark .item-name:focus {
  border-color: var(--accent);
  outline: none;
}

.dark .nutrition-row input {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.dark .nutrition-row input:focus {
  border-color: var(--accent);
  outline: none;
}

.dark .nutrition-row label {
  color: var(--muted);
}

.dark .remove-item {
  color: var(--text);
}

.dark .remove-item:hover {
  background: rgba(255, 0, 0, 0.2);
  color: #ff4444;
}

.dark .edit-actions {
  border-top-color: var(--border);
}

.dark .edit-actions .btn.secondary {
  background: var(--background);
  color: var(--text);
  border-color: var(--border);
}

.dark .edit-actions .btn.secondary:hover {
  background: var(--card);
  border-color: var(--accent);
}

.dark .edit-actions .btn.primary {
  background: var(--accent);
  color: white;
}

.dark .edit-actions .btn.primary:hover {
  background: var(--accent-2);
}

/* Добивка макросов - минималистичный стиль */
.macro-focus-selector{
  display:flex;
  gap:8px;
  padding:4px 0 16px;
  overflow-x:auto;
}
.macro-focus-selector::-webkit-scrollbar{
  display:none;
}

/* Чипы выбора макроса - стиль как у filter-btn */
.macro-chip{
  flex:1;
  padding:8px 16px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.06);
  background:var(--card);
  color:var(--muted);
  font-size:13px;
  font-weight:600;
  transition:all var(--transition-duration) ease;
  cursor:pointer;
  white-space:nowrap;
}
.macro-chip.active{
  background:var(--accent);
  color:white;
  border-color:var(--accent);
}
.macro-chip:hover:not(.active){
  background:rgba(0,0,0,0.02);
}
.macro-chip:active{
  transform:scale(0.98);
}

/* Кнопки действий - простые карточки */
.macro-actions{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
  margin-bottom:16px;
}

.macro-action{
  padding:14px 16px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.06);
  background:var(--card);
  color:var(--text);
  font-size:14px;
  font-weight:600;
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:transform .2s ease;
}
.macro-action:hover{
  transform:translateY(-2px);
}
.macro-action.active{
  border-color:var(--accent);
  background:rgba(22, 163, 74, 0.05);
}

/* Блок ввода цели - упрощенный */
.macro-target{
  margin-bottom:16px;
  display:flex;
  flex-direction:column;
  gap:8px;
  background:var(--card);
  border-radius:12px;
  padding:12px 16px;
  border:1px solid rgba(0,0,0,0.06);
}
.macro-target-label{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
}
.macro-target-input{
  display:flex;
  align-items:center;
  gap:8px;
}
.macro-target-input input{
  flex:1;
  border:none;
  background:transparent;
  font-size:16px;
  font-weight:600;
  color:var(--text);
  outline:none;
}
.macro-target-input input:disabled{
  opacity:0.5;
}
.macro-target-input input::placeholder{
  color:var(--muted);
  font-weight:500;
}
.macro-target-unit{
  font-size:14px;
  font-weight:600;
  color:var(--accent);
}

/* Состояние загрузки */
.macro-state{
  margin-bottom:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  position:relative;
  padding:10px 6px;
}
.macro-loader{
  display:flex;
  gap:6px;
  align-items:center;
  justify-content:center;
}
.macro-loader-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--accent);
  animation:macroLoader 0.9s infinite ease-in-out;
}
.macro-loader-dot:nth-child(2){
  animation-delay:0.15s;
}
.macro-loader-dot:nth-child(3){
  animation-delay:0.3s;
}

@keyframes macroLoader{
  0%, 80%, 100%{ transform:scale(0); opacity:0.4; }
  40%{ transform:scale(1); opacity:1; }
}

/* Быстрые кнопки для популярных значений */
.macro-quick-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.macro-quick-btn {
  flex: 1;
  min-width: 60px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.macro-quick-btn:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.macro-quick-btn:active:not(:disabled) {
  transform: translateY(0);
  background: rgba(22, 163, 74, 0.15);
}

.macro-quick-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dark .macro-quick-btn {
  background: #1f2937;
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.dark .macro-quick-btn:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Список предложений */
.macro-suggestions{
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* Карточки предложений - стиль как у history-item */
.macro-card{
  width:100%;
  border:none;
  background:var(--card);
  border-radius:12px;
  padding:16px;
  text-align:left;
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:transform .2s ease;
  position:relative;
}
.macro-card:hover{
  transform:translateY(-2px);
}
.macro-card.loading{
  opacity:0.6;
  pointer-events:none;
}

.macro-card-header{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:12px;
}

/* Бейджи - приглушенные цвета */
.macro-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:4px 10px;
  border-radius:12px;
  font-size:11px;
  font-weight:600;
  letter-spacing:0.02em;
  width:max-content;
}
.macro-badge-protein{
  background:rgba(59, 130, 246, 0.08);
  color:#2563eb;
}
.macro-badge-carbs{
  background:rgba(16, 185, 129, 0.08);
  color:#059669;
}
.macro-badge-fat{
  background:rgba(245, 158, 11, 0.08);
  color:#d97706;
}
.macro-badge-calories{
  background:rgba(22, 163, 74, 0.08);
  color:#16a34a;
}

.macro-card-title{
  font-size:15px;
  font-weight:600;
  color:var(--text);
  line-height:1.4;
}
.macro-card-total{
  font-size:13px;
  font-weight:500;
  color:var(--muted);
}
.macro-card-body{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.macro-card-items{
  margin:0;
  padding-left:18px;
  display:flex;
  flex-direction:column;
  gap:4px;
  color:var(--text);
  font-size:13px;
}
.macro-card-items li{
  list-style:disc;
}
.macro-card-note{
  margin:0;
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
}
.macro-card-extra{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}

/* Отключенные элементы */
.macro-chip:disabled,
.macro-action:disabled{
  opacity:0.5;
  cursor:not-allowed;
  transform:none !important;
}

/* Темная тема - минималистичный стиль */
.dark .macro-chip{
  background:#1f2937;
  color:#9ca3af;
  border-color:rgba(148,163,184,0.2);
}
.dark .macro-chip.active{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}
.dark .macro-chip:hover:not(.active){
  background:rgba(148,163,184,0.1);
}

.dark .macro-action{
  background:#1f2937;
  color:#e5e7eb;
  border:1px solid rgba(148,163,184,0.2);
}
.dark .macro-action.active{
  border-color:var(--accent);
  background:rgba(22, 163, 74, 0.15);
}

.dark .macro-target{
  background:#1f2937;
  border:1px solid rgba(148,163,184,0.2);
}
.dark .macro-target-label{
  color:#9ca3af;
}
.dark .macro-target-input input{
  color:#f8fafc;
}
.dark .macro-target-input input:disabled{
  opacity:0.5;
}
.dark .macro-target-input input::placeholder{
  color:#94a3b8;
}

.dark .macro-card{
  background:#1f2937;
  border:1px solid rgba(148,163,184,0.2);
}
.dark .macro-card-title{
  color:#f8fafc;
}
.dark .macro-card-total{
  color:#94a3b8;
}
.dark .macro-card-items{
  color:#e2e8f0;
}
.dark .macro-card-note{
  color:#94a3b8;
}
.dark .macro-card-extra{
  color:#94a3b8;
}


/* Профиль */
.profile-form{
  max-width:500px;margin:0 auto;padding:0 10px;box-sizing:border-box;
}
.form-group{
  margin-bottom:20px;
}
.form-row{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;
}
.form-group label{
  display:block;margin-bottom:8px;font-size:15px;font-weight:600;color:var(--muted);letter-spacing:0.01em;
}
.form-group input, .form-group select, .form-group textarea{
  width:100%;padding:12px;border-radius:12px;border:1px solid rgba(0,0,0,0.06);background:var(--card);color:var(--text-color, #0f172a);font-size:15px;transition:border-color var(--transition-duration) ease;font-weight:400;box-sizing:border-box;max-width:100%;font-family:inherit;resize:vertical;min-height:60px;
}
#profile-goal{
  text-transform:capitalize;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus{
  outline:none;border-color:var(--accent);
}

/* Темная тема для форм */
.dark .form-group input, .dark .form-group select, .dark .form-group textarea{
  background:#1e293b;border-color:rgba(255,255,255,0.1);color:#e6eef6;
}
.dark .form-group input::placeholder{
  color:#9aa6b2;
}
.dark .form-group select option{
  background:#1e293b;color:#e6eef6;
}

/* Стили для кнопки адаптации целей */
.adaptive-goals-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.adaptive-goals-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.adaptive-goals-btn:active {
  transform: translateY(0);
}

.adaptive-goals-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.adaptive-goals-btn.loading .btn-icon,
.adaptive-goals-btn.loading .btn-text {
  display: none;
}

.adaptive-goals-btn.loading .btn-loading {
  display: inline !important;
  animation: spin 1s linear infinite;
}

/* Стили для кнопки совета */
.advice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.advice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.3);
}

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

.advice-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.advice-btn.loading .btn-icon,
.advice-btn.loading .btn-text {
  display: none;
}

.advice-btn.loading .btn-loading {
  display: inline !important;
  animation: spin 1s linear infinite;
}

/* Стили для модального окна совета */
.advice-modal {
  z-index: 80;
}

.advice-modal .sheet {
  background: var(--background);
  padding: 24px;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  margin: 20px;
}

.advice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.advice-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

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

.advice-content {
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 20px;
}

.advice-text {
  line-height: 1.6;
  color: var(--text);
  font-size: 16px;
  white-space: pre-line;
}

.advice-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Темная тема для модального окна совета */
.dark .advice-modal .sheet {
  background: var(--background);
}

.dark .advice-header {
  border-bottom-color: var(--border);
}

.dark .close-btn {
  color: var(--muted);
}

.dark .close-btn:hover {
  background: var(--border);
}

.dark .advice-actions {
  border-top-color: var(--border);
}

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

/* Старые стили для целей удалены - используются новые стили для goals-grid-new */

/* Модальное окно - минималистичный дизайн */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

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

@keyframes modalFadeOut {
  from {
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  to {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

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

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

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

/* Анимации для страниц */
.page.page-fade-in {
  animation: pageFadeIn 0.25s ease-out;
}

.page.page-fade-out {
  animation: pageFadeOut 0.2s ease-in forwards;
}

/* Анимация закрытия модального окна */
.modal.modal-fade-out {
  animation: modalFadeOut 0.2s ease-in forwards;
}

.modal.modal-fade-out .modal-content {
  animation: modalContentFadeOut 0.2s ease-in forwards;
}

/* Заголовок модального окна */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-color);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

/* Табы */
.modal-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn svg {
  width: 20px;
  height: 20px;
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

.tab-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
}

/* Тело модального окна */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.tab-content {
  display: none;
}

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

/* Зона загрузки */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  cursor: default;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(0, 0, 0, 0.04);
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(22, 163, 74, 0.05);
}

.upload-content {
  position: relative;
}

.upload-icon {
  margin-bottom: 16px;
  opacity: 0.6;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.upload-icon svg {
  width: 100%;
  height: 100%;
}

.upload-zone h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.upload-zone p {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.food-tip {
  margin: 0 0 20px 0;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.1), rgba(16, 185, 129, 0.05));
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-color);
  text-align: left;
  line-height: 1.6;
  border: 1px solid rgba(52, 211, 153, 0.2);
  animation: tipFadeIn 0.5s ease;
  max-width: 100%;
}

.food-tip #tip-text {
  display: block;
  font-weight: 500;
}

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

.upload-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
  position: relative;
  z-index: 10;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--accent);
  color: white;
}

.upload-btn:hover {
  background: #15803d;
}

.file-info {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.8;
}

/* Превью изображения */
.image-preview {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.image-preview img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.btn-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 11;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-icon-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* Контейнер текстового ввода */
.text-input-container {
  margin-bottom: 20px;
}

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

.text-input-container textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  color: var(--text-color);
  background: var(--card);
  transition: border-color 0.2s ease;
}

.text-input-container textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.modern-textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  transition: all 0.3s ease;
}

.modern-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.input-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* Контейнер кнопок для фото */
.photo-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}

.analyze-btn {
  width: 100%;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.analyze-btn:hover {
  background: #15803d;
}

.analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.analyze-btn .btn-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analyze-btn .btn-icon svg {
  width: 100%;
  height: 100%;
}

.btn-secondary {
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--accent);
}

.btn-secondary .btn-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary .btn-icon svg {
  width: 100%;
  height: 100%;
}

/* Кнопка очистки фото (только иконка) */
.clear-photo-btn-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clear-photo-btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: scale(1.05);
}

.clear-photo-btn-icon:active {
  transform: scale(0.95);
}

.dark .clear-photo-btn-icon {
  background: rgba(255, 255, 255, 0.05);
}

.dark .clear-photo-btn-icon:hover {
  background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 480px) {
  .photo-actions {
    gap: 8px;
  }
  
  .clear-photo-btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
}

/* Кнопки анализа */
.analyze-btn.modern {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(52, 211, 153, 0.3);
}

.analyze-btn.modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(52, 211, 153, 0.4);
}

.analyze-btn.modern:active {
  transform: translateY(0);
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Анимация кнопки анализа */
.analyze-btn.analyzing {
  pointer-events: none;
  opacity: 0.9;
  background: linear-gradient(45deg, #667eea, #764ba2, #667eea, #f093fb);
  background-size: 400% 400%;
  animation: button-gradient 1.5s ease infinite;
  position: relative;
  overflow: hidden;
}

.analyze-btn.analyzing .btn-content {
  display: none;
}

.analyze-btn.analyzing .btn-loading {
  display: flex;
}

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

/* Панель калорий */
.calories-panel.modern {
  margin: 20px 24px;
  padding: 20px;
  background: linear-gradient(135deg, 
    rgba(52, 211, 153, 0.08) 0%, 
    rgba(251, 191, 36, 0.08) 100%);
  border-radius: 16px;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.panel-header h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}

.panel-header p {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--muted);
}

.manual-input-group {
  display: flex;
  gap: 12px;
  align-items: end;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.modern-input {
  width: 100%;
  padding: 12px 16px;
  padding-right: 40px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-size: 14px;
  transition: all 0.3s ease;
}

.modern-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.input-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

/* Статус сообщения */
.status-message {
  margin: 20px 24px;
  padding: 16px;
  background: linear-gradient(135deg, 
    rgba(52, 211, 153, 0.1) 0%, 
    rgba(251, 191, 36, 0.1) 100%);
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
}

.status-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(52, 211, 153, 0.3);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Результаты */
.result-section {
  padding: 0 24px 24px;
  margin-top: 24px;
}

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

.result-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
}

.result-badge {
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

.result-card.modern {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.result-total.modern {
  background: linear-gradient(135deg, 
    rgba(52, 211, 153, 0.1) 0%, 
    rgba(251, 191, 36, 0.1) 100%);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.result-actions {
  display: flex;
  gap: 12px;
}

.result-actions .btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.result-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0;
}

.btn.modern {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn.primary.modern {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.3);
}

.btn.primary.modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(52, 211, 153, 0.4);
}

.btn.secondary.modern {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.secondary.modern:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Анимации */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(12px);
  }
}

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

.modern-sheet::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 24px 24px 0 0;
}

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

@keyframes sheetInModern {
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

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

/* Заголовок модального окна */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), rgba(245, 158, 11, 0.05));
}

.header-content {
  flex: 1;
}

.modal-title {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-icon {
  font-size: 24px;
}

.modal-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}

.close-btn-modern {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn-modern:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
  transform: scale(1.1);
}

/* Переключатели режимов */
.mode-selector {
  padding: 20px 24px 16px 24px;
}

.mode-tabs {
  display: flex;
  gap: 12px;
  background: rgba(0, 0, 0, 0.02);
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.mode-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 12px;
}

.mode-tab.active::before {
  opacity: 1;
}

.mode-tab.active {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.3);
}

.mode-tab:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.tab-icon {
  font-size: 20px;
  position: relative;
  z-index: 1;
}

.tab-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.tab-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tab-desc {
  font-size: 12px;
  opacity: 0.8;
}

/* Блоки ввода */
.input-block {
  padding: 0 24px 20px 24px;
}

/* Область загрузки фото */
.photo-upload-area {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.02), rgba(245, 158, 11, 0.02));
  border: 2px dashed rgba(22, 163, 74, 0.2);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.photo-upload-area:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), rgba(245, 158, 11, 0.05));
  transform: translateY(-2px);
}

.upload-zone {
  position: relative;
  cursor: default;
}

.upload-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.7;
}

.upload-text {
  margin-bottom: 24px;
}

.upload-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
}

.upload-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.upload-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.action-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-icon {
  font-size: 16px;
}

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

/* Область ввода текста */
.text-input-area {
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
}

.text-input-area:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.input-header {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
}

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

.textarea-container {
  position: relative;
}

#text-input {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-color);
  font-size: 16px;
  line-height: 1.5;
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
}

#text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

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

.input-tips {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Кнопки анализа */
.analyze-btn-modern {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-top: 20px;
}

.analyze-btn-modern:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
}

.analyze-btn-modern:active {
  transform: translateY(0);
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.analyze-btn-modern:hover .btn-shine {
  left: 100%;
}

/* Панель калорий */
.calories-panel-modern {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(22, 163, 74, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 16px;
  padding: 20px;
  margin: 20px 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-icon {
  font-size: 24px;
}

.panel-content {
  flex: 1;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.manual-input-area {
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-group {
  display: flex;
  gap: 12px;
  flex: 1;
}

.calories-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-color);
  font-size: 16px;
  transition: all 0.3s ease;
}

.calories-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.save-calories-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.save-calories-btn:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
}

/* Статус анализа */
.analyze-status-modern {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 16px;
  padding: 24px;
  margin: 20px 24px;
  text-align: center;
}

.status-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.status-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(22, 163, 74, 0.2);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.status-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-color);
}

/* Результаты */
.result-area-modern {
  padding: 0 24px 20px 24px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(22, 163, 74, 0.1));
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-icon {
  font-size: 24px;
}

.result-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
}

.result-card-modern {
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.result-total-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.action-btn-modern {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn-modern.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.action-btn-modern.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
}

.action-btn-modern.secondary {
  background: transparent;
  color: var(--muted);
  border: 2px solid rgba(0, 0, 0, 0.06);
}

.action-btn-modern.secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--accent);
  color: var(--accent);
}

/* Быстрые действия */
.quick-actions {
  padding: 20px 24px 24px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02), rgba(22, 163, 74, 0.02));
}

.quick-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 16px;
  text-align: center;
}

.quick-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.quick-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.quick-icon {
  font-size: 24px;
}

.quick-text {
  font-size: 12px;
  font-weight: 600;
}

/* Адаптивность */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }
  
  .modern-sheet {
    max-height: 95vh;
    border-radius: 20px;
  }
  
  .modal-header {
    padding: 20px 20px 16px 20px;
  }
  
  .modal-title {
    font-size: 18px;
  }
  
  .mode-selector,
  .input-block,
  .result-area-modern,
  .quick-actions {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .calories-panel-modern {
    margin: 20px;
  }
  
  .analyze-status-modern {
    margin: 20px;
  }
  
  .mode-tabs {
    flex-direction: column;
    gap: 8px;
  }
  
  .mode-tab {
    padding: 12px 16px;
  }
  
  .upload-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
  }
  
  .quick-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .quick-btn {
    padding: 12px 8px;
  }
  
  .quick-icon {
    font-size: 20px;
  }
  
  .quick-text {
    font-size: 10px;
  }
}

/* Темная тема - улучшенная адаптация */
.dark .modern-sheet {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.dark .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(251, 191, 36, 0.08));
}

.dark .modal-title {
  color: var(--text-color);
}

.dark .modal-subtitle {
  color: var(--muted);
}

.dark .close-btn-modern {
  color: var(--muted);
}

.dark .close-btn-modern:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .mode-tabs {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .mode-tab {
  color: var(--text-color);
}

.dark .mode-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.dark .photo-upload-area {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.03), rgba(251, 191, 36, 0.03));
  border-color: rgba(52, 211, 153, 0.3);
}

.dark .photo-upload-area:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(251, 191, 36, 0.08));
  border-color: var(--accent);
}

.dark .upload-title {
  color: var(--text-color);
}

.dark .upload-subtitle {
  color: var(--muted);
}

.dark .action-btn {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.dark .upload-info {
  color: var(--muted);
}

.dark .food-tip {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(16, 185, 129, 0.1));
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--text-color);
}

.dark .text-input-area {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .text-input-area:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.dark .input-label {
  color: var(--text-color);
}

.dark .input-hint {
  color: var(--muted);
}

.dark #text-input {
  background: var(--bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark #text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.dark .char-counter {
  color: var(--muted);
}

.dark .input-tips {
  color: var(--muted);
}

.dark .calories-panel-modern {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(52, 211, 153, 0.08));
  border-color: rgba(251, 191, 36, 0.3);
}

.dark .panel-title {
  color: var(--text-color);
}

.dark .panel-subtitle {
  color: var(--muted);
}

/* Стили для часового пояса */
.timezone-display {
  display: none;
  margin-bottom: 12px;
}

.timezone-display-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.timezone-current-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color);
}

.timezone-change-btn {
  padding: 6px 16px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.timezone-change-btn:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.dark .timezone-display-inner {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.12);
}

.dark .timezone-current-name {
  color: var(--text-color);
}

.dark .timezone-change-btn {
  color: var(--accent);
  border-color: var(--accent);
}

.dark .timezone-change-btn:hover {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}

.dark .calories-input {
  background: var(--bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .calories-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.dark .save-calories-btn {
  background: var(--accent);
  color: white;
}

.dark .save-calories-btn:hover {
  background: var(--accent-2);
}

.dark .analyze-status-modern {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(251, 191, 36, 0.15));
  border-color: rgba(52, 211, 153, 0.3);
}

.dark .status-text {
  color: var(--text-color);
}

.dark .result-header {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.15));
  border-color: rgba(16, 185, 129, 0.3);
}

.dark .result-title {
  color: var(--text-color);
}

.dark .result-card-modern {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .result-total-modern {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.dark .action-btn-modern.secondary {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .action-btn-modern.secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  color: var(--accent);
}

.dark .quick-actions {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(52, 211, 153, 0.03));
  border-top-color: rgba(255, 255, 255, 0.1);
}

.dark .quick-title {
  color: var(--text-color);
}

.dark .quick-btn {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.dark .quick-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Анимация кнопки анализа */
.analyze-btn-modern.analyzing {
  pointer-events: none;
  opacity: 0.8;
  background: linear-gradient(45deg, var(--accent), var(--accent-2), var(--accent), var(--accent-2));
  background-size: 400% 400%;
  animation: buttonGradient 1.5s ease infinite;
  position: relative;
  overflow: hidden;
}

.analyze-btn-modern.analyzing::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

.analyze-btn-modern.analyzing::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

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

/* Темная тема для анимации кнопки */
.dark .analyze-btn-modern.analyzing {
  background: linear-gradient(45deg, var(--accent), var(--accent-2), var(--accent), var(--accent-2));
  background-size: 400% 400%;
}

.dark .analyze-btn-modern.analyzing::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.dark .analyze-btn-modern.analyzing::after {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: white;
}

/* Простые стили для уведомлений - оригинальная версия */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 300px;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
  font-size: 14px;
  color: var(--text-color);
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  border-left: 4px solid var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.notification.error {
  border-left: 4px solid var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.notification.warning {
  border-left: 4px solid var(--warning);
  background: rgba(251, 191, 36, 0.1);
}

/* Темная тема для уведомлений */
.dark .notification {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  color: var(--text-color);
}

.dark .notification.success {
  background: rgba(16, 185, 129, 0.15);
  border-left-color: var(--success);
}

.dark .notification.error {
  background: rgba(239, 68, 68, 0.15);
  border-left-color: var(--error);
}

.dark .notification.warning {
  background: rgba(251, 191, 36, 0.15);
  border-left-color: var(--warning);
}

/* фиксируем размер placeholder и textarea */
textarea#text-input{width:100%;padding:10px;border-radius:10px;border:1px solid rgba(0,0,0,0.06);font-size:14px;line-height:1.3;box-sizing:border-box;resize:none;min-height:68px;max-height:140px;overflow:auto;word-break:break-word;transition:border-color var(--transition-duration) ease}
textarea::placeholder{font-size:14px;opacity:0.7}

/* Блок ручного ввода калорий */
.manual-cal{display:flex;gap:8px;align-items:center;margin-top:8px}
.manual-cal input[type=number]{flex:1;padding:8px;border-radius:8px;border:1px solid rgba(0,0,0,0.06);font-size:14px;transition:border-color var(--transition-duration) ease}
.manual-cal label{font-size:13px;color:var(--muted);white-space:nowrap}

/* Панель калорий */
.calories-panel{
  transition:background-color var(--transition-duration) ease, border-color var(--transition-duration) ease;
}

.result-card{margin-top:10px;background:linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.6));border-radius:12px;padding:10px;border:1px solid rgba(22,163,74,0.09);animation:fadeIn .25s ease;transition:background var(--transition-duration) ease, border-color var(--transition-duration) ease}
.dark .result-card{background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));border:1px solid rgba(52,211,153,0.06)}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.result-items{display:flex;flex-direction:column;gap:6px}
.result-total{display:flex;justify-content:space-between;padding-top:6px;border-top:1px solid rgba(15,23,42,0.03)}
.actions{display:flex;gap:8px;margin-top:10px}
.btn{padding:12px 20px;border-radius:10px;border:0;cursor:pointer;transition:background var(--transition-duration) ease, color var(--transition-duration) ease;font-size:15px;font-weight:500;letter-spacing:0.01em}
.btn.primary{background:var(--accent);color:white}
.btn.ghost{background:transparent;border:1px solid rgba(0,0,0,0.06);transition:background var(--transition-duration) ease, border-color var(--transition-duration) ease, color var(--transition-duration) ease}

/* Аналитика */
.analytics{display:flex;gap:12px;flex-direction:column}
.progress{height:10px;background:rgba(0,0,0,0.06);border-radius:999px;overflow:hidden;transition:background-color var(--transition-duration) ease}
.progress > span{display:block;height:100%;background:linear-gradient(90deg,var(--accent),var(--accent-2));transition:width .7s cubic-bezier(.2,.9,.2,1), background .3s ease}

/* Анимация прогресс-бара с изменением цвета */
.progress-bar-animation{
  background: linear-gradient(90deg, #ef4444, #f59e0b, #16a34a) !important;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1), background 1.5s ease !important;
}

@media(min-width:720px){
  main{padding:24px}
  .add-btn{right:32px}
}

/* Контейнер для уведомлений */
.notifications-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse; /* Новые уведомления добавляются в конец, но отображаются сверху */
  gap: 12px;
  max-width: 350px;
  pointer-events: none;
}

/* Уведомления */
.notification {
  position: relative;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  max-width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.notification-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.notification-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}


/* Кнопка закрытия уведомления */
.notification-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
  opacity: 0.7;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 1;
  transform: scale(1.1);
}

/* Прогресс-бар для уведомлений */
.notification-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0 0 12px 12px;
  animation: notificationProgress 3s linear forwards;
}

@keyframes notificationProgress {
  0% {
    width: 100%;
  }
  100% {
    width: 0%;
  }
}

/* Темная тема для уведомлений */
.dark .notification {
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.dark .notification-close {
  background: rgba(255, 255, 255, 0.1);
}

.dark .notification-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Скелетон-загрузка */
@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Стили для кнопки камеры */
.camera-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 15;
  pointer-events: auto;
}

.camera-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

/* Стили для кнопки анализа фото */
#analyze-photo {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#analyze-photo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

#analyze-photo:active {
  transform: translateY(0);
}

#analyze-photo.analyzing {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  animation: photo-analyzing 1.5s ease-in-out infinite;
  pointer-events: none;
  position: relative;
  overflow: hidden;
}

#analyze-photo.analyzing::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes photo-analyzing {
  0%, 100% {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    transform: scale(1);
  }
  50% {
    background: linear-gradient(135deg, #ff9ff3 0%, #f368e0 100%);
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Стили для превью фото - новый дизайн */
.photo-preview-modern {
  margin-top: 16px;
  animation: fadeInUp 0.3s ease;
}

.preview-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.preview-image {
  position: relative;
  max-height: 300px;
  overflow: hidden;
}

.preview-image img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.preview-container:hover .preview-overlay {
  opacity: 1;
}

.preview-info {
  color: white;
  flex: 1;
}

.preview-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.preview-size {
  font-size: 12px;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.remove-photo-modern {
  background: rgba(239, 68, 68, 0.9);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.remove-photo-modern:hover {
  background: #ef4444;
  transform: scale(1.1);
}

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

/* Темная тема для превью */
.dark .preview-container {
  background: var(--card);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .preview-overlay {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.5));
}

/* Скрытый input для камеры */
#camera-input {
  display: none;
}

/* ===== СТИЛИ АНАЛИТИКИ ===== */

/* Периоды аналитики */
.analytics-periods {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.period-btn {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(0,0,0,0.1);
  background: var(--card);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-duration);
  position: relative;
  overflow: hidden;
}

.period-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.period-btn:hover::before {
  left: 100%;
}

.period-btn.active {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  transform: translateY(-2px);
}

.period-btn:hover:not(.active) {
  background: rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

/* Общая статистика */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-duration);
  border: 1px solid rgba(0,0,0,0.05);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.stat-card.primary::before {
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.stat-card.success::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.stat-card.info::before {
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  font-size: 32px;
  opacity: 0.8;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon svg {
  width: 100%;
  height: 100%;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
}

.stat-trend.positive {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.stat-trend.negative {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* Секции графиков */
.chart-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.05);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.chart-controls {
  display: flex;
  gap: 8px;
}

.chart-btn {
  padding: 8px 16px;
  border: 1px solid rgba(0,0,0,0.1);
  background: var(--bg);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-duration);
}

.chart-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.chart-btn:hover:not(.active) {
  background: rgba(0,0,0,0.05);
}

.chart-container {
  position: relative;
  height: 200px;
  background: linear-gradient(135deg, rgba(0,0,0,0.02), rgba(0,0,0,0.05));
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Макронутриенты */
.macros-chart-container {
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
}

.macros-chart {
  position: relative;
  flex-shrink: 0;
}

.macros-legend {
  flex: 1;
  min-width: 200px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

.legend-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Топ продуктов */
.top-foods-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.food-category {
  display: flex;
  gap: 8px;
}

.category-btn {
  padding: 6px 12px;
  border: 1px solid rgba(0,0,0,0.1);
  background: var(--bg);
  border-radius: 16px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-duration);
}

.category-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.top-foods-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.food-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0,0,0,0.02);
  border-radius: 12px;
  transition: all var(--transition-duration);
  position: relative;
  overflow: hidden;
}

.food-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform var(--transition-duration);
}

.food-item:hover {
  background: rgba(0,0,0,0.05);
  transform: translateX(4px);
}

.food-item:hover::before {
  transform: scaleY(1);
}

.food-rank {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  min-width: 24px;
}

.food-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.food-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  min-width: 60px;
  text-align: right;
}

.food-progress {
  flex: 1;
  margin: 0 12px;
}

.food-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
  overflow: hidden;
}

.food-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Индикатор загрузки аналитики */
.analytics-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.analytics-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.analytics-spinner-container .loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(22, 163, 74, 0.1);
  border-left: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.analytics-spinner-container .loading-text {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  animation: none; /* Убираем анимацию с текста */
}

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

/* Время приёмов пищи */
.meal-times-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.time-analysis {
  font-size: 14px;
  color: var(--muted);
}

.meal-times-chart {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(0,0,0,0.02), rgba(0,0,0,0.05));
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Инсайты */
.insights-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-card {
  padding: 16px;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.05), rgba(16, 185, 129, 0.05));
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.1), transparent);
  border-radius: 50%;
  transform: translate(20px, -20px);
}

.insight-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.insight-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Экспорт */
.export-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.export-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.export-actions .btn {
  flex: 1;
  min-width: 120px;
  position: relative;
  overflow: hidden;
}

.export-actions .btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.export-actions .btn:hover::before {
  left: 100%;
}

/* Анимации */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card.animate,
.chart-section.animate,
.top-foods-section.animate {
  animation: fadeInUp 0.6s ease-out;
}

.stat-card.animate:nth-child(1) { animation-delay: 0.1s; }
.stat-card.animate:nth-child(2) { animation-delay: 0.2s; }
.stat-card.animate:nth-child(3) { animation-delay: 0.3s; }

/* Адаптивность */
@media (max-width: 768px) {
  .stats-overview {
    grid-template-columns: 1fr;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .macros-chart-container {
    flex-direction: column;
    align-items: center;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .export-actions {
    flex-direction: column;
  }
  
  .export-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 16px;
  }
  
  .chart-section,
  .top-foods-section,
  .meal-times-section,
  .insights-section,
  .export-section {
    padding: 16px;
  }
  
  .chart-container {
    height: 150px;
  }
  
  .food-item {
    padding: 12px;
  }
}

/* Редактируемые результаты анализа */
.editable-results {
  margin-top: 20px;
}

.edit-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.edit-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
  overflow: hidden;
}

.edit-item:hover {
  border-color: var(--accent);
}

.edit-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.edit-item-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 6px;
  color: white;
}

.edit-item-name {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-item-serving {
  font-size: 13px;
  color: #64748b;
  background: rgba(100, 116, 139, 0.1);
  padding: 3px 10px;
  border-radius: 16px;
  white-space: nowrap;
}

.remove-edit-item {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-edit-item:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(1.05);
}

.remove-edit-item:active {
  transform: scale(0.95);
}

.dark .remove-edit-item {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.dark .remove-edit-item:hover {
  background: rgba(239, 68, 68, 0.25);
}

.edit-nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.nutrition-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nutrition-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nutrition-input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.8);
  box-sizing: border-box;
  max-width: 100%;
}

.nutrition-input:focus {
  outline: none;
  border-color: #34d399;
  background: white;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.1);
}

.nutrition-input:invalid {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

/* Небольшое предупреждение при достижении 90% от максимума */
.nutrition-input[data-near-max="true"] {
  border-color: rgba(245, 158, 11, 0.5);
}

.nutrition-unit {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin-top: 2px;
}

.edit-total {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-top: 16px;
}

.edit-total-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.edit-total-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 6px;
  color: white;
  flex-shrink: 0;
}

.edit-total-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.edit-total-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.edit-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.total-field {
  text-align: center;
  padding: 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.total-field:hover {
  background: rgba(255,255,255,0.9);
  transform: translateY(-2px);
}

.total-value {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.total-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.save-btn {
  position: relative;
  overflow: hidden;
  min-width: 140px;
}

.save-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.save-btn:hover::before {
  left: 100%;
}

.save-btn.saving {
  pointer-events: none;
}

.save-btn.saving .btn-text {
  display: none;
}

.save-btn.saving .btn-loading {
  display: flex !important;
}

/* Анимации */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.edit-item {
  animation: slideInUp 0.4s ease forwards;
}

.edit-item:nth-child(1) { animation-delay: 0.1s; }
.edit-item:nth-child(2) { animation-delay: 0.2s; }
.edit-item:nth-child(3) { animation-delay: 0.3s; }
.edit-item:nth-child(4) { animation-delay: 0.4s; }

.edit-total {
  animation: fadeInScale 0.5s ease forwards;
  animation-delay: 0.5s;
  opacity: 0;
}

/* Темная тема */
.dark .edit-item {
  background: var(--card);
  border-color: var(--border);
  color: var(--text-color);
}

.dark .edit-item:hover {
  border-color: var(--accent);
}

.dark .edit-item-name {
  color: #e2e8f0;
}

.dark .edit-item-serving {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
}

.dark .nutrition-input {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.dark .nutrition-input:focus {
  background: rgba(30, 41, 59, 1);
  border-color: #34d399;
}

.dark .nutrition-input:invalid {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.dark .nutrition-input[data-near-max="true"] {
  border-color: rgba(245, 158, 11, 0.6);
}

.dark .nutrition-label {
  color: #94a3b8;
}

.dark .nutrition-unit {
  color: #64748b;
}

.dark .edit-total {
  background: var(--card);
  border-color: var(--border);
}

.dark .edit-total-title {
  color: #e2e8f0;
}

.dark .total-field {
  background: rgba(30, 41, 59, 0.6);
}

.dark .total-field:hover {
  background: rgba(30, 41, 59, 0.9);
}

.dark .total-value {
  color: #e2e8f0;
}

.dark .total-label {
  color: #94a3b8;
}

/* Адаптивность для редактируемых результатов */
@media (max-width: 768px) {
  .edit-nutrition-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .edit-total-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .edit-item {
    padding: 12px;
  }
  
  .edit-total {
    padding: 14px;
  }
}

@media (max-width: 480px) {
  .edit-nutrition-grid {
    grid-template-columns: 1fr;
  }
  
  .edit-total-grid {
    grid-template-columns: 1fr;
  }
  
  .result-actions {
    flex-direction: column;
  }
  
  .result-actions .btn {
    width: 100%;
  }
}

/* Add this after existing .modern-sheet styles */

.modern-sheet {
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.modern-sheet::-webkit-scrollbar {
  width: 4px;
}

.modern-sheet::-webkit-scrollbar-track {
  background: transparent;
}

.modern-sheet::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.modern-sheet::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* For dark mode */
.dark .modern-sheet::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dark .modern-sheet::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ensure result-section doesn't cause issues */
.result-section {
  min-height: 200px; /* Ensure space for editable content */
}

/* Inline clear photo button near analyze button */
#clear-photo-btn-inline{
  display: none;
  margin-right: 8px;
}

/* Keep analyze button inline so both sit on one line */
#photo-block .analyze-btn.modern{
  display: inline-flex;
  vertical-align: middle;
}

/* Ensure preview overlay buttons at top-right */
.image-preview .preview-overlay{
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

/* Make sure upload zone shows when image cleared (handled by JS) */