:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text-color: #1a202c;
  --text-color-secondary: #4a5568;
  --bg-color: #f7fafc;
  --card-bg: #ffffff;
  --card-bg-hover: #edf2f7;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --border-radius: 0.5rem;
  --toast-success-bg: #ecfdf5;
  --toast-success-text: #047857;
  --toast-error-bg: #fef2f2;
  --toast-error-text: #b91c1c;
  --toast-info-bg: #eff6ff;
  --toast-info-text: #1e40af;
  --fg:#111;
  --muted:#6b7280;
  --line:#e5e7eb;
  --pill:#f1f5f9;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.title {
  text-align: center;
  color: var(--primary);
  margin-bottom: 20px;
}

.screen {
  padding-bottom: 0;
}

#analyticsScreen {
  margin: 0;
  padding: 0;
  width: 100%;
}

.navbar {
  background: linear-gradient(135deg, #1d1d1f 0%, #2c2c2e 100%);
  color: #ffffff;
  padding: 8px 20px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

/* Контейнер полосы с местом для текста */
#loadingBar {
  position: relative;
  width: 100%;
  height: 24px;                     /* даёт место для текста по центру */
  display: none;                    /* включаем классом is-active */
}

/* Тонкая «дорожка» внизу */
#loadingBar::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  overflow: hidden;
}

/* Бегущий прожектор по дорожке */
#loadingBar .loading-progress {
  position: absolute;
  bottom: 0;                        /* держим по нижнему краю */
  left: -35%;
  width: 35%;
  height: 3px;
  background: linear-gradient(
    90deg,
    rgba(59,130,246,0) 0%,
    rgba(59,130,246,1) 50%,
    rgba(59,130,246,0) 100%
  );
  animation: nbSlide 1s linear infinite;
  border-radius: 999px;
}

/* Центрированный текст поверх полосы */
#loadingBar::after {
  content: attr(data-label);
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font: 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: rgba(255,255,255,0.92);
  background: rgba(0,0,0,0.28);     /* лёгкая подложка для контраста */
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

/* Включение/ошибка */
#loadingBar.is-active { display: block !important; }
#loadingBar.is-fail .loading-progress {
  background: linear-gradient(
    90deg,
    rgba(239,68,68,0) 0%,
    rgba(239,68,68,1) 50%,
    rgba(239,68,68,0) 100%
  );
}
#loadingBar.is-fail::after { color: #ffb4b4; font-weight: 600; }

@keyframes nbSlide {
  0% { left: -35%; }
  100% { left: 100%; }
}

.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

h2 {
  margin-top: 0;
  color: var(--primary);
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

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

input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-top: 4px;
  margin-bottom: 10px;
  box-sizing: border-box;
  font-size: 1rem;
}

button,
.btn {
  display: inline-block;
  padding: 10px 15px;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s ease;
}

button.primary,
.btn.primary {
  background-color: var(--primary);
  color: #fff;
}

button.primary:hover,
.btn.primary:hover {
  background-color: var(--primary-hover);
}

button:not(.primary),
.btn:not(.primary) {
  background-color: var(--card-bg-hover);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

button:not(.primary):hover,
.btn:not(.primary):hover {
  background-color: var(--border-color);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.form-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--card-bg);
  color: var(--text-color);
  font-size: 14px;
  min-width: 0;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mt-3 {
  margin-top: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

/* Apple Health стили для истории */
.health-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: -20px -20px 2rem -20px;
}

.health-header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: white;
}

.health-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}

.health-list {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-item {
  background: #ffffff;
  border-radius: 16px;
  margin: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.health-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 0, 0, 0.08);
}

.health-item:active {
  transform: translateY(-1px);
  transition: all 0.15s;
}

.health-item-header {
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
  position: relative;
}

.health-item-header::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  width: 8px;
  height: 8px;
  border-right: 2px solid #86868b;
  border-bottom: 2px solid #86868b;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.health-item-header.expanded::after {
  transform: translateY(-50%) rotate(45deg);
}

.health-item-date {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.health-item-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: #86868b;
}

.health-metric {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 20px;
  font-weight: 500;
  color: #1d1d1f;
}

.health-metric-icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  border-radius: 50%;
  display: inline-block;
}

.health-metric-icon.weight { background: #ff6b6b; }
.health-metric-icon.calories { background: #4ecdc4; }
.health-metric-icon.steps { background: #45b7d1; }
.health-metric-icon.water { background: #96ceb4; }
.health-metric-icon.protein { background: #ffa726; }
.health-metric-icon.fat { background: #ab47bc; }
.health-metric-icon.carbs { background: #66bb6a; }
.health-metric-icon.activity { background: #ef5350; }

.health-item-expanded {
  padding: 20px;
  background: #fafafa;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  animation: expandDown 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes expandDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

.health-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.health-metric-card {
  background: #ffffff;
  padding: 14px 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.health-metric-card:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.health-metric-value {
  font-size: 24px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.health-metric-label {
  font-size: 11px;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.health-note {
  background: #ffffff;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  margin-top: 12px;
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.08);
}

.health-note-label {
  font-size: 11px;
  color: #007aff;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  margin-bottom: 8px;
}

.health-note-text {
  color: #1d1d1f;
  line-height: 1.5;
  font-size: 14px;
}

.health-actions {
  padding: 1rem;
  text-align: center;
}

.health-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
}

.health-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.health-empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.health-empty-subtitle {
  color: #666;
  line-height: 1.5;
}

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

.health-item-expanded {
  animation: slideDown 0.3s ease;
}

/* Адаптивность */
@media (max-width: 480px) {
  .health-header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .health-header h1 {
    font-size: 1.5rem;
  }
  
  .health-item-summary {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .health-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Стили профиля в стиле Apple Health */
.profile-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: -20px -20px 2rem -20px;
}

.profile-avatar {
  margin-bottom: 1rem;
}

.avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-initials {
  font-size: 2rem;
  font-weight: 600;
  color: white;
}

.profile-name {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: white;
}

.profile-email {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #1a1a1a;
}

.profile-sections {
  padding: 0 1rem;
}

.profile-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.profile-field {
  margin-bottom: 1rem;
}

.profile-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 0.5rem;
}

.profile-field input,
.profile-field select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  background-color: white;
}

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

.profile-field input[type="url"] {
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}

.field-hint {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border-radius: 4px;
  display: none;
}

.field-hint.warning {
  display: block;
  background-color: #fff3cd;
  color: #856404;
  border-left: 3px solid #ffc107;
}

.field-hint.success {
  display: block;
  background-color: #d4edda;
  color: #155724;
  border-left: 3px solid #28a745;
}

.field-hint.error {
  display: block;
  background-color: #f8d7da;
  color: #721c24;
  border-left: 3px solid #dc3545;
}

.fatsecret-info {
  margin-bottom: 1rem;
}

.fatsecret-info .info-text {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  padding: 0.75rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #667eea;
}

.sync-status {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}

.sync-status.show {
  display: block;
}

.sync-status.loading {
  background-color: #e3f2fd;
  color: #1976d2;
  border-left: 3px solid #2196f3;
}

.sync-status.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left: 3px solid #4caf50;
}

.sync-status.error {
  background-color: #ffebee;
  color: #c62828;
  border-left: 3px solid #f44336;
}

.profile-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 0.25rem;
}

.stat-text {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-description {
  color: #666;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.app-version {
  font-size: 0.8rem;
  color: #999;
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

/* Адаптивность для профиля */
@media (max-width: 480px) {
  .profile-header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .profile-name {
    font-size: 1.5rem;
  }
  
  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .stat-card {
    padding: 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .profile-actions {
    flex-direction: column;
  }
}

/* Стили аналитики в стиле Apple Health */
.analytics-header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: -20px -20px 2rem -20px;
}

.analytics-header h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: white;
}

.analytics-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
  color: white;
}

/* Селектор режимов аналитики */
.analytics-mode-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 12px;
}

.mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: #667eea;
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-btn:hover:not(.active) {
  background: #e9ecef;
  color: #1a1a1a;
}

/* Секция выбора даты */
.date-selector-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.date-selector-section label {
  display: block;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.date-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.date-input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.date-input:focus {
  outline: none;
  border-color: #667eea;
}

.check-data-btn {
  padding: 0.75rem 1rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.check-data-btn:hover {
  background: #218838;
}

.test-data-btn {
  padding: 0.75rem 1rem;
  background: #17a2b8;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.test-data-btn:hover {
  background: #138496;
}

.morning-weight-section {
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.weight-input-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.weight-input-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.weight-input-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
  align-items: center;
}

.weight-input {
  width: 100px;
  padding: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
  outline: none;
}

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

.weight-btn {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.weight-btn:hover {
  background: #5a6fd8;
}

.weight-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.weight-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #667eea;
}

.weight-date {
  font-size: 0.8rem;
  color: #666;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.stat-chip {
  background: white;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  transition: transform 0.2s ease;
}

.stat-chip:hover {
  transform: translateY(-2px);
}

.stat-chip .stat-label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stat-chip .stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a1a;
}

.smart-suggestions {
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}

.suggestion-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #667eea;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.suggestion-card:hover {
  transform: translateX(4px);
}

.suggestion-card.warning {
  border-left-color: #ff6b6b;
}

.suggestion-card.success {
  border-left-color: #4ecdc4;
}

.suggestion-title {
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}

.suggestion-text {
  font-size: 0.9rem;
  color: #666;
}

.analytics-chat {
  background: #f5f5f7;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
  overflow: hidden;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
}

.chat-header {
  background: white;
  padding: 16px;
  border-bottom: 1px solid #e9ecef;
  margin: 0;
}

.chat-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: #1a1a1a;
}

.chat-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
}

.message {
  margin-bottom: 1rem;
  display: flex;
}

.message.bot-message {
  justify-content: flex-start;
}

.message.user-message {
  justify-content: flex-end;
}

.message-content {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.bot-message .message-content {
  background: #f1f3f4;
  color: #1a1a1a;
}

.user-message .message-content {
  background: #667eea;
  color: white;
}

.quick-questions {
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
  margin: 0;
}

.question-group {
  margin-bottom: 1.5rem;
}

.question-group:last-child {
  margin-bottom: 0;
}

.question-group h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-group .quick-btn {
  margin: 4px 8px 4px 0;
}

.quick-btn {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  width: auto;
  margin: 4px 8px 4px 0;
  text-align: center;
  white-space: nowrap;
}

.quick-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.quick-btn.daily {
  background: #e8f2ff;
  border-color: #667eea;
  color: #667eea;
}

.quick-btn.daily:hover {
  background: #667eea;
  color: white;
}

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

.quick-btn.weight:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-1px);
}

.quick-btn.food {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #1a1a1a;
  border: none;
}

.quick-btn.food:hover {
  background: linear-gradient(135deg, #96e6e1 0%, #fec7d7 100%);
  transform: translateY(-1px);
}

.quick-btn.planning {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  color: #1a1a1a;
  border: none;
}

.quick-btn.planning:hover {
  background: linear-gradient(135deg, #ffe0b3 0%, #fca085 100%);
  transform: translateY(-1px);
}

.quick-btn.highlight {
  background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
  color: white;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.quick-btn.highlight:hover {
  background: linear-gradient(135deg, #30d158 0%, #34c759 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(52, 199, 89, 0.4);
}

.quick-btn.disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.6;
}

.quick-btn.disabled:hover {
  background: #f3f4f6;
  color: #9ca3af;
  transform: none;
}

/* Подзаголовки для кнопок */
.quick-btn .subtitle {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  font-weight: normal;
}

.quick-btn.disabled .subtitle {
  color: #bbb;
}

/* Стили для кнопки analyze-yesterday */
.quick-btn[data-question="analyze-yesterday"] {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
  color: white;
  border: none;
}

.quick-btn[data-question="analyze-yesterday"]:hover {
  background: linear-gradient(135deg, #ff5252 0%, #ff7979 100%);
  transform: translateY(-1px);
}

.quick-btn[data-question="analyze-yesterday-disabled"] {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  cursor: not-allowed;
}

.quick-btn[data-question="analyze-yesterday-disabled"]:hover {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  transform: none;
}

.chat-input-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px 12px 16px;
  background: white;
  border-top: none;
  width: 100%;
  box-sizing: border-box;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-questions {
  padding: 0;
  background: white;
  border: none;
  margin: 0;
}

.quick-questions .question-group {
  margin-bottom: 0;
}

.quick-questions .question-group:last-child {
  margin-bottom: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 15px;
  outline: none;
  min-width: 0;
}

.chat-input:focus {
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.send-btn {
  background: #34c759;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.send-btn:hover {
  background: #30d158;
  transform: translateY(-1px);
}

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

.send-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Адаптивность для аналитики */
@media (max-width: 480px) {
  .analytics-chat {
    margin: 0;
    border-radius: 0;
    width: 100vw;
    min-height: calc(100vh - 140px);
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding-bottom: 0;
  }
  
  .chat-header {
    padding: 16px;
    margin: 0;
    width: 100%;
  }
  
  .chat-messages {
    padding: 16px;
    margin: 0;
    width: 100%;
  }
  
  .quick-questions {
    padding: 16px;
    margin: 0;
    width: 100%;
  }
  
  .chat-input-container {
    padding: 12px 16px;
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 0;
    width: 100vw;
  }
  
  .send-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .analytics-header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .analytics-header h1 {
    font-size: 1.5rem;
  }
  
  .quick-stats {
    justify-content: center;
  }
  
  .stat-chip {
    min-width: 70px;
    padding: 0.4rem 0.8rem;
  }
  
  .quick-questions {
    justify-content: center;
  }
  
  .quick-btn {
    font-size: 0.7rem;
    padding: 0.4rem 0.8rem;
  }
  
  .chat-messages {
    max-height: 250px;
  }
}

/* Стили для модального окна */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #1a1a1a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #e9ecef;
}

.modal-body {
  padding: 1.5rem;
  max-height: calc(90vh - 100px);
  overflow-y: auto;
}

/* Стили для деталей дня */
.day-summary {
  margin-bottom: 2rem;
}

.day-summary h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.summary-item {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.summary-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a1a1a;
}

/* Стили для приемов пищи */
.meals-section {
  margin-bottom: 2rem;
}

.meals-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.meal-card {
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.meal-header {
  background: #667eea;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Единый стиль для приема пищи за день */
.meal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.meal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meal-icon {
  font-size: 1.2rem;
}

.meal-header h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.meal-time {
  font-size: 0.8rem;
  opacity: 0.8;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.meal-total {
  font-size: 0.9rem;
  opacity: 0.9;
  text-align: right;
}

.meal-items {
  padding: 1rem;
}

.food-item {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid #667eea;
}

.food-item:last-child {
  margin-bottom: 0;
}

.food-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.food-name {
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.food-brand {
  font-weight: 400;
  color: #666;
  font-size: 0.9rem;
}

.food-time {
  font-size: 0.8rem;
  color: #666;
  background: #f8f9fa;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.food-details {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

.serving, .grams {
  background: #e9ecef;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.food-macros {
  font-size: 0.9rem;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.food-source {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

.no-food-data {
  text-align: center;
  padding: 2rem;
  color: #666;
}

/* Стили для PDF импорта */
.pdf-import-info {
  margin-bottom: 2rem;
}

.pdf-import-info h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.pdf-details {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
}

.pdf-details p {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
}

.pdf-details p:last-child {
  margin-bottom: 0;
}

/* Стили для заметки */
.day-note {
  margin-bottom: 2rem;
}

.day-note h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.day-note p {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin: 0;
  line-height: 1.6;
  color: #1a1a1a;
}

/* Стили для кнопок действий */
.health-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.health-item-actions button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  letter-spacing: -0.2px;
}

.btn.secondary {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.btn.secondary:hover {
  background: #e8e8ed;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn.secondary:active {
  transform: scale(0.98);
}

.btn.danger {
  background: #ff3b30;
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
  transition: background 0.2s ease;
}

.btn.danger:hover {
  background: #ff1f13;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn.danger:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(255, 59, 48, 0.2);
}

/* Apple-стиль модального окна подтверждения удаления */
.apple-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
}

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

.apple-confirm-dialog {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 340px;
  width: 100%;
  overflow: hidden;
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.apple-confirm-content {
  padding: 20px 16px;
  text-align: center;
}

.apple-confirm-title {
  font-size: 17px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 8px;
  letter-spacing: -0.4px;
}

.apple-confirm-message {
  font-size: 13px;
  color: #86868b;
  line-height: 1.5;
  margin: 0;
}

.apple-confirm-date {
  font-weight: 600;
  color: #1d1d1f;
}

.apple-confirm-actions {
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  display: flex;
}

.apple-confirm-actions button {
  flex: 1;
  padding: 16px;
  border: none;
  background: transparent;
  font-size: 17px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.15s;
  color: #007aff;
  letter-spacing: -0.4px;
}

.apple-confirm-actions button:not(:last-child) {
  border-right: 0.5px solid rgba(0, 0, 0, 0.1);
}

.apple-confirm-actions button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.apple-confirm-actions button:active {
  background: rgba(0, 0, 0, 0.08);
}

.apple-confirm-actions button.danger {
  color: #ff3b30;
  font-weight: 600;
}

/* Адаптивность для модального окна */
@media (max-width: 768px) {
  .modal-content {
    margin: 0.5rem;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: 1rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .meal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .meal-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .food-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .food-time {
    margin-left: 0;
    align-self: flex-start;
  }
  
  .health-item-actions {
    flex-direction: column;
  }
  
  .health-item-summary {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .health-metric {
    font-size: 13px;
    padding: 5px 10px;
  }
  
  .apple-confirm-dialog {
    max-width: calc(100% - 40px);
  }
  
  .apple-confirm-title {
    font-size: 16px;
  }
  
  .apple-confirm-message {
    font-size: 12px;
  }
}

.row label {
  margin-bottom: 0;
  flex-shrink: 0;
}

.row input[type="number"],
.row input[type="text"] {
  flex-grow: 1;
  margin-bottom: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.water-buttons button {
  width: 100%;
}

progress {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
  -webkit-appearance: none;
  appearance: none;
}

progress::-webkit-progress-bar {
  background-color: var(--border-color);
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background-color: var(--primary);
  border-radius: 4px;
}

progress::-moz-progress-bar {
  background-color: var(--primary);
  border-radius: 4px;
}

.fab-wrap {
  position: fixed;
  bottom: 80px; /* Above navbar */
  right: 20px;
  left: 20px;
  display: flex;
  justify-content: center;
  pointer-events: none; /* Allow clicks to pass through */
}

.fab {
  pointer-events: auto;
  border-radius: 999px;
  padding: 15px 30px;
  font-size: 1.1rem;
  background-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.tabbar {
  display: flex;
  justify-content: space-around;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
  z-index: 1000;
}

.tab {
  flex-grow: 1;
  text-align: center;
  padding: 12px 0;
  color: var(--text-color-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.tab.active {
  color: var(--primary);
  font-weight: 600;
}

.tab:hover {
  color: var(--primary-hover);
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.small { font-size: 0.85em; }
.muted { color: var(--text-color-secondary); }

/* Toast messages */
#toastContainer {
  position: fixed;
  bottom: 70px; /* Above the tabbar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: 90%;
  max-width: 350px;
}

.toast {
  padding: 12px 15px;
  border-radius: var(--border-radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  font-weight: 500;
  text-align: center;
}

.toast.success {
  background-color: var(--toast-success-bg);
  color: var(--toast-success-text);
}

.toast.error {
  background-color: var(--toast-error-bg);
  color: var(--toast-error-text);
}

.toast.info {
  background-color: var(--toast-info-bg);
  color: var(--toast-info-text);
}

/* PDF Processing Result styles (simplified version for initial revert) */
#pdfProcessingResult {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.data-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.data-preview-table th,
.data-preview-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.data-preview-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.data-preview-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-preview-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* Обертка для горизонтальной прокрутки таблицы */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Уменьшаем ширину колонок в таблице food-logs-table */
.food-logs-table th:nth-child(1), .food-logs-table td:nth-child(1) { width: 15%; }
.food-logs-table th:nth-child(2), .food-logs-table td:nth-child(2) { width: 40%; } /* Увеличена ширина для Продукта */
.food-logs-table th:nth-child(3), .food-logs-table td:nth-child(3) { width: 10%; }
.food-logs-table th:nth-child(n+4), .food-logs-table td:nth-child(n+4) { width: 7%; } /* Уменьшена ширина для остальных */

.nutri-m{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;
}
.c-name{
  width:auto;
}
.c-macros{
  width:46%;
}
.c-kcal{
  width:64px;
}
thead th{
  position:sticky;
  top:0;
  background:#fff;
  z-index:1;
  text-align:left;
  padding:8px 12px;
  border-bottom:1px solid var(--line);
  font-weight:600;
}
tbody td, tfoot th, tfoot td{
  padding:8px 12px;
  border-bottom:1px solid var(--line);
  vertical-align:middle;
}
.name .title{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  line-height:1.2;
}
.name .meta{
  color:var(--muted);
  font-size:12px;
  margin-top:2px;
  white-space:nowrap;
}
.macros{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.chip{
  display:inline-block;
  background:var(--pill);
  border-radius:999px;
  padding:2px 6px;
  font-size:12px;
  margin-right:4px;
}
.kcal{
  text-align:right;
  font-weight:700;
  font-size:15px;
}
.num{
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
/* Детали микропитательных */
.item-more td{
  padding:0 12px 8px;
}
details summary{
  cursor:pointer;
  color:#0ea5e9;
  padding:8px 0;
  list-style:none;
}
details summary::-webkit-details-marker{
  display:none;
}
.micro{
  display:grid;
  grid-template-columns: auto minmax(48px,auto);
  gap:6px 12px;
  padding-bottom:6px;
}
.micro > :nth-child(odd){
  color:var(--muted);
}
.micro > :nth-child(even){
  text-align:right;
}
/* Декор и читаемость */
tbody tr.item:nth-child(4n+1), tbody tr.item:nth-child(4n+2){
  background:#fff;
}
tbody tr.item:nth-child(4n+3), tbody tr.item:nth-child(4n+4){
  background:#fafafa;
}
.subtotal th{
  text-align:left;
}
.sum-macros{
  white-space:nowrap;
}

.history-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--card); }
.history-head { font-weight: 700; }
#historyList { border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); margin-top: 12px; }

/* Загрузка / Spinner */
.upload-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.upload-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.upload-message {
  margin-top: 20px;
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  max-width: 80%;
}

.upload-submessage {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-align: center;
}

/* Пульсирующая анимация для текста */
.upload-message.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.progress-container {
  width: 100%;
  max-width: 400px;
  margin-top: 24px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #34c759, #30d158);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(52, 199, 89, 0.5);
}

.progress-text {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ========== PULSE PAGE STYLES ========== */

/* Navbar */
.pulse-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
}

.nav-action-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--primary);
  border-radius: 8px;
  transition: background-color 0.2s;
}

.nav-action-btn:hover {
  background-color: #f5f5f5;
}

/* Pulse Header */
.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.pulse-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: #1a1a1a;
}

.period-selector {
  display: flex;
  gap: 4px;
  background: #f5f5f5;
  padding: 4px;
  border-radius: 12px;
}

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

.period-btn.active {
  background: white;
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Insights Bar */
.insights-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.insights-bar::-webkit-scrollbar {
  display: none;
}

.insight-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.insight-text {
  font-size: 14px;
  color: #666;
}

.insight-text strong {
  color: #1a1a1a;
  font-weight: 600;
}

/* Goals Rings Card */
.goals-rings-card {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
}

.ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.goal-ring {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #f0f0f0;
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.6s ease;
}

.ring-calories {
  stroke: #ff6b6b;
}

.ring-activity {
  stroke: #51cf66;
}

.ring-steps {
  stroke: #4dabf7;
}

.ring-water {
  stroke: #748ffc;
}

.ring-value {
  text-align: center;
}

.ring-number {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
}

.ring-label {
  font-size: 12px;
  color: #666;
}

/* Mini Trend Cards Grid */
.trend-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.mini-trend-card {
  background: white;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mini-trend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.mini-trend-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #666;
}

.mini-trend-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.mini-trend-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1a1a1a;
}

.mini-trend-avg {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #999;
}

.mini-trend-card canvas {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
}

.mini-trend-minmax {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.minmax-item {
  font-size: 11px;
  color: #999;
  font-variant-numeric: tabular-nums;
}

/* Цвета для мин/макс в зависимости от метрики */
/* Шаги, Белки: больше = зеленый, меньше = красный */
#stepsMin, #proteinMin {
  color: #ff6b6b;
}

#stepsMax, #proteinMax {
  color: #51cf66;
}

/* Калории, Жиры, Углеводы: больше = красный, меньше = зеленый */
#caloriesMin, #fatMin, #carbsMin {
  color: #51cf66;
}

#caloriesMax, #fatMax, #carbsMax {
  color: #ff6b6b;
}


/* Trends Section */
.trends-section {
  margin-bottom: 32px;
}

.trends-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1a1a1a;
}

.trends-summary {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.trends-summary::-webkit-scrollbar {
  display: none;
}

.trend-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 180px;
}

.trend-stat-label {
  font-size: 13px;
  color: #666;
}

.trend-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  font-variant-numeric: tabular-nums;
}


/* Responsive adjustments */
@media (max-width: 640px) {
  .goals-rings-card {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .pulse-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .period-selector {
    align-self: stretch;
  }
  
  .period-btn {
    flex: 1;
  }
}

/* Animation for ring progress */
@keyframes ring-glow {
  0%, 100% {
    filter: drop-shadow(0 0 4px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 8px currentColor);
  }
}

.ring-progress[data-progress="100"] {
  animation: ring-glow 2s ease-in-out infinite;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .ring-progress,
  .period-btn,
  .nav-action-btn {
    transition: none;
  }
  
  .ring-progress[data-progress="100"] {
    animation: none;
  }
}

/* ========== PLAN PAGE STYLES ========== */

.plan-screen {
  background: #ffffff;
  font-size: 16px;
  line-height: 1.4;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.plan-header {
  margin-bottom: 24px;
}

.plan-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #1d1d1f;
  letter-spacing: -0.2px;
}

.plan-subtitle {
  font-size: 16px;
  color: #86868b;
  margin: 0;
  max-width: 80%;
  line-height: 1.4;
}

.plan-form-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  margin-bottom: 24px;
  border: 1px solid #f0f0f0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 8px;
}

.form-group textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea:focus {
  outline: none;
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.form-group textarea:required {
  border-left: 3px solid #ff3b30;
}

.form-group textarea:required:valid {
  border-left: 3px solid #34c759;
}

.form-group textarea::placeholder {
  color: #86868b;
}

.plan-context {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 20px;
}

.context-item {
  display: flex;
  gap: 8px;
  font-size: 14px;
}

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

.context-value {
  color: #1a1a1a;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-generate-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  background: linear-gradient(135deg, #34c759 0%, #30d158 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.plan-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

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

/* Кнопка офлайнового генератора плана */
.btn.secondary.plan-generate-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

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

.btn.secondary.plan-generate-btn:active {
  transform: translateY(0);
}

.error-banner {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.success-banner {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-weight: 600;
}

.plan-days-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 768px) {
  .plan-days-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}

.plan-day-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid #f5f5f7;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0;
  transform: translateY(12px);
  animation: slideUpFade 180ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

.plan-day-card:nth-child(1) { animation-delay: 0ms; }
.plan-day-card:nth-child(2) { animation-delay: 40ms; }
.plan-day-card:nth-child(3) { animation-delay: 80ms; }
.plan-day-card:nth-child(4) { animation-delay: 120ms; }
.plan-day-card:nth-child(5) { animation-delay: 160ms; }
.plan-day-card:nth-child(6) { animation-delay: 200ms; }
.plan-day-card:nth-child(7) { animation-delay: 240ms; }

.plan-day-card.fasting-day {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
}

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

.day-date {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: #1d1d1f;
  letter-spacing: -0.2px;
}

@media (max-width: 767px) {
  .day-date {
    font-size: 20px;
  }
}

.day-badge {
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.day-badge.fasting {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fbbf24;
}

.day-badge.weekend {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
  border: 1px solid #86efac;
}

.day-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.stat-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  background: #f9f9fb;
  border-radius: 12px;
  min-height: 64px;
  border: 1px solid #f0f0f2;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #86868b;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  font-variant-numeric: tabular-nums;
}

.day-extras {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 400;
  color: #8e8e93;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}

.day-notes {
  font-size: 14px;
  font-weight: 500;
  color: #86868b;
  font-style: italic;
  margin-bottom: 10px;
  padding: 8px;
  background: #fffbeb;
  border-radius: 8px;
}

.day-meals {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meal-block {
  padding: 0;
  margin-bottom: 12px;
  background: transparent;
}

.meal-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.meal-type {
  font-size: 16px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: -0.2px;
  margin: 0;
}

.meal-kbzhu {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.3;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Цветные фоны для разных приёмов пищи в стиле Apple Health */

/* Завтрак - тёплый оранжевый (sunrise) */
.meal-block:nth-child(1) .meal-header {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  border: 1px solid #fb923c;
}

.meal-block:nth-child(1) .meal-type {
  color: #c2410c;
}

.meal-block:nth-child(1) .meal-kbzhu {
  color: #9a3412;
  background: rgba(255, 255, 255, 0.9);
}

/* Обед - свежий зелёный (healthy) */
.meal-block:nth-child(2) .meal-header {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid #4ade80;
}

.meal-block:nth-child(2) .meal-type {
  color: #15803d;
}

.meal-block:nth-child(2) .meal-kbzhu {
  color: #166534;
  background: rgba(255, 255, 255, 0.9);
}

/* Ужин - спокойный синий (evening) */
.meal-block:nth-child(3) .meal-header {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 1px solid #60a5fa;
}

.meal-block:nth-child(3) .meal-type {
  color: #1e40af;
}

.meal-block:nth-child(3) .meal-kbzhu {
  color: #1e3a8a;
  background: rgba(255, 255, 255, 0.9);
}

/* Перекус - мягкий фиолетовый (snack) */
.meal-block:nth-child(4) .meal-header {
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  border: 1px solid #c084fc;
}

.meal-block:nth-child(4) .meal-type {
  color: #7e22ce;
}

.meal-block:nth-child(4) .meal-kbzhu {
  color: #6b21a8;
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 767px) {
  .meal-header {
    gap: 5px;
    padding: 9px 12px;
  }
  
  .meal-type {
    font-size: 15px;
  }
  
  .meal-kbzhu {
    font-size: 11px;
    padding: 4px 8px;
  }
}

.meal-items {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.meal-item {
  display: grid;
  grid-template-columns: 76px 1fr 90px;
  gap: 6px;
  align-items: center;
  font-size: 14px;
  line-height: 1.3;
  padding: 1px 0;
}

@media (max-width: 767px) {
  .meal-item {
    grid-template-columns: 70px 1fr 85px;
    font-size: 13px;
  }
}

.item-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: lowercase;
  white-space: nowrap;
  text-align: center;
}

.meal-item .item-role {
  grid-column: 1;
}

/* Основное - более заметный */
.item-role:not([data-role="добор"]) {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  font-weight: 600;
}

/* Добор - светлый, ненавязчивый */
.item-role[data-role="добор"] {
  background: #f5f5f7;
  color: #9e9e9e;
  border: 1px solid #e0e0e0;
  font-weight: 400;
}

.item-name {
  grid-column: 2;
  color: #1d1d1f;
  font-size: 13px;
  font-weight: 500;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

@media (max-width: 767px) {
  .item-name {
    font-size: 12px;
    font-weight: 500;
  }
}

.item-serving {
  grid-column: 3;
  color: #8e8e93;
  font-size: 12px;
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-brand {
  color: #c7c7cc;
  font-size: 11px;
  margin-left: 4px;
}

.existing-plan-banner {
  background: linear-gradient(135deg, #fffaf5 0%, #fff7ed 100%);
  border: 1px solid #ffe4cc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.banner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
  color: #9a3412;
}

.plan-dates {
  font-size: 13px;
  font-weight: 400;
  color: #8e8e93;
}

.banner-text {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: #9a3412;
}

.plan-regenerate-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px 0;
  position: relative;
}

.plan-regenerate-separator::before,
.plan-regenerate-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.plan-regenerate-separator span {
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: #999;
  background: #ffffff;
}

/* Reduce Motion для страницы План */
@media (prefers-reduced-motion: reduce) {
  .plan-day-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .plan-generate-btn {
    transition: none;
  }
}

/* ========== TODAY PAGE (REPORT) - APPLE FITNESS STYLE ========== */

.today-screen {
  background: #f5f5f7;
  padding: 0;
}

.navbar-time {
  font-size: 14px;
  font-weight: 500;
  color: #86868b;
}

.today-time-block {
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
}

.current-time {
  font-size: 48px;
  font-weight: 700;
  color: #1d1d1f;
  letter-spacing: -1px;
  line-height: 1;
}

.current-date {
  font-size: 16px;
  font-weight: 500;
  color: #86868b;
  margin-top: 8px;
}

/* Напоминания */
.reminders-block {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reminder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
  border: 1px solid #ffc107;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.reminder-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.reminder-message {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #856404;
}

.reminder-arrow {
  font-size: 18px;
  color: #856404;
  opacity: 0.5;
}

/* Статус отчёта */
.report-status-card {
  margin: 16px;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.status-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0;
}

.status-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-text {
  font-size: 16px;
  font-weight: 600;
  color: #34c759;
}

.progress-bar-container {
  height: 8px;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #34c759 0%, #30d158 100%);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.status-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.status-item.completed {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #86efac;
}

.status-item.pending {
  opacity: 0.6;
}

.status-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.status-item.completed .status-icon {
  color: #16a34a;
}

.status-item.pending .status-icon {
  color: #9ca3af;
}

.status-label {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
}

.status-value {
  font-size: 14px;
  font-weight: 500;
  color: #16a34a;
}

/* Раскрывающиеся элементы приёмов пищи */
.status-item-expandable {
  padding: 0;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.status-item-expandable.completed {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #86efac;
}

.status-item-expandable.pending {
  opacity: 0.6;
}

.status-item-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.status-item-summary::-webkit-details-marker {
  display: none;
}

.expand-arrow {
  margin-left: auto;
  font-size: 18px;
  color: #6b7280;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.status-item-expandable[open] .expand-arrow {
  transform: rotate(90deg);
}

.meal-details-expanded {
  padding: 0 12px 12px 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.5);
}

.meal-totals-summary {
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  margin-top: 10px;
}

.meal-items-expanded {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expanded-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.expanded-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 4px;
}

.expanded-item-meta {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}

.expanded-item-meta .separator {
  margin: 0 4px;
  opacity: 0.5;
}

/* План на сегодня */
.today-plan-card {
  margin: 16px;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

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

.plan-card-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0;
}

.plan-status-badge {
  font-size: 13px;
  font-weight: 600;
  color: #007aff;
  background: #e3f2fd;
  padding: 6px 12px;
  border-radius: 8px;
}

.plan-note {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
  border: 1px solid #ffc107;
  border-radius: 10px;
  margin-bottom: 20px;
}

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

.note-text {
  font-size: 14px;
  font-weight: 500;
  color: #856404;
  line-height: 1.5;
}

/* Круговые диаграммы прогресса */
.progress-circles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.circle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.circle-progress {
  position: relative;
  margin-bottom: 8px;
}

.circle-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 700;
  color: #1d1d1f;
}

.circle-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.circle-stats {
  font-size: 12px;
  font-weight: 500;
  color: #1d1d1f;
}

.circle-remaining {
  font-size: 11px;
  font-weight: 600;
  color: #34c759;
  margin-top: 2px;
}

/* Запланированные блюда */
.plan-meals-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
}

.plan-meals-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 12px 0;
}

.plan-meal-details {
  margin-bottom: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.plan-meal-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.plan-meal-summary::-webkit-details-marker {
  display: none;
}

.plan-meal-name {
  font-size: 15px;
  font-weight: 600;
  color: #1d1d1f;
  flex: 1;
}

.plan-meal-count {
  font-size: 13px;
  color: #6b7280;
}

.plan-meal-items {
  padding: 0 12px 12px 12px;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-item {
  display: grid;
  grid-template-columns: 76px 1fr 90px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  font-size: 13px;
}

.plan-item-role {
  font-size: 11px;
  font-weight: 500;
  background: #f5f5f7;
  color: #9e9e9e;
  border: 1px solid #e0e0e0;
  padding: 3px 6px;
  border-radius: 4px;
  text-align: center;
}

.plan-item-role[data-role="основное"] {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
  font-weight: 600;
}

.plan-item-name {
  font-weight: 500;
  color: #1d1d1f;
}

.plan-item-serving {
  font-size: 12px;
  color: #6b7280;
  text-align: right;
}

/* Детальные карточки приёмов пищи */
.meal-detail-card {
  margin: 0 16px 16px 16px;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.meal-завтрак {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border: 1px solid #fb923c;
}

.meal-обед {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid #4ade80;
}

.meal-ужин {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 1px solid #60a5fa;
}

.meal-detail-header {
  margin-bottom: 16px;
}

.meal-detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

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

.meal-name {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
}

.meal-detail-kbzhu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.meal-завтрак .meal-detail-kbzhu {
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.meal-обед .meal-detail-kbzhu {
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.meal-ужин .meal-detail-kbzhu {
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.kbzhu-value {
  font-size: 24px;
  font-weight: 700;
  color: #1d1d1f;
  line-height: 1;
}

.kbzhu-macros {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
}

.meal-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meal-item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  font-size: 14px;
}

.item-name-detail {
  font-weight: 500;
  color: #1d1d1f;
}

.item-portion {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.item-kbzhu-detail {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}

/* Быстрые действия */
.quick-actions-card {
  margin: 16px;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.quick-actions-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px 0;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #f3f4f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-icon {
  font-size: 32px;
}

.action-label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
}

/* Импорт PDF */
.import-card {
  margin: 16px;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.import-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 8px 0;
}

.import-description {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}

.file-input {
  width: 100%;
  margin-bottom: 12px;
}

/* Форма ввода данных */
.data-entry-card,
.macros-card {
  margin: 16px;
  padding: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.data-entry-card h3,
.macros-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 8px 0;
}

.data-entry-description {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}

.date-selector-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.form-select-modern {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  background: #ffffff;
  transition: all 0.2s ease;
}

.form-select-modern:focus {
  outline: none;
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.selected-date-info {
  font-size: 13px;
  color: #6b7280;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 16px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

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

.data-field label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
}

.input-modern {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  background: #ffffff;
  transition: all 0.2s ease;
}

.input-modern:focus {
  outline: none;
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.textarea-modern {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  background: #ffffff;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.textarea-modern:focus {
  outline: none;
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.water-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn-water {
  flex: 1;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-water:hover {
  background: #34c759;
  color: #ffffff;
  border-color: #34c759;
  transform: translateY(-1px);
}

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

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

.note-field label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
}

.btn-modern {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-modern.primary {
  background: #34c759;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.btn-modern.primary:hover {
  background: #30d158;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
}

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

.btn-modern.secondary {
  background: #f9fafb;
  color: #1d1d1f;
  border: 1px solid #d1d5db;
}

.btn-modern.secondary:hover {
  background: #f3f4f6;
  transform: translateY(-1px);
}

.btn-modern.full-width {
  width: 100%;
}

.file-input-modern {
  width: 100%;
  padding: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-input-modern:hover {
  border-color: #34c759;
  background: #f0fdf4;
}

.progress-modern {
  width: 100%;
  height: 8px;
  margin: 16px 0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-modern::-webkit-progress-bar {
  background: #e5e7eb;
  border-radius: 10px;
}

.progress-modern::-webkit-progress-value {
  background: linear-gradient(90deg, #34c759 0%, #30d158 100%);
  border-radius: 10px;
}

.progress-modern::-moz-progress-bar {
  background: linear-gradient(90deg, #34c759 0%, #30d158 100%);
  border-radius: 10px;
}

.processing-result {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
}

/* ========== ANALYTICS PAGE - SUBTABS ========== */

.chat-subtabs {
  display: flex;
  gap: 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 16px;
}

.subtab {
  flex: 1;
  padding: 12px 20px;
  text-decoration: none;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.subtab.active {
  color: #1d1d1f;
  border-bottom-color: #007aff;
}

.subtab:hover {
  color: #1d1d1f;
  background: #f9fafb;
}

.analytics-screen {
  background: #f5f5f7;
  padding: 0;
}

.analytics-header {
  padding: 24px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border-bottom: 1px solid #e5e7eb;
}

.analytics-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 6px 0;
}

.analytics-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Кнопки промптов - минималистичные */
.quick-prompts-today,
.quick-prompts-analysis {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.date-selector-section {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.date-input-modern {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1d1d1f;
  background: #ffffff;
}

.date-input-modern:focus {
  outline: none;
  border-color: #34c759;
  box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.1);
}

.prompt-btn-mini {
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.prompt-btn-mini:hover {
  background: #34c759;
  color: #ffffff;
  border-color: #34c759;
  transform: scale(1.02);
}

.prompt-btn-mini:active {
  transform: scale(0.98);
}

/* Новая верстка чата в стиле Apple */
.analytics-chat-new {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f5f5f7;
  margin: 0;
  padding: 0;
  width: 100%;
  position: relative;
  overflow-x: hidden;
}

.chat-header-new {
  background: white;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.chat-header-new h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #1d1d1f;
}

.chat-header-new p {
  font-size: 14px;
  color: #666;
  margin: 0;
}

.chat-messages-new {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  background: white;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.message-new {
  margin: 0 0 12px 0;
  width: 100%;
}

/* Сообщения сценариев: добавим место под кнопку */
.message-new.bot-message-new .message-content-new {
  position: relative;
  padding-bottom: 36px; /* чтобы кнопка не перекрывала текст */
  display: flex;
  flex-direction: column;
}

/* Мини-кнопка «поделиться» в правом нижнем углу сообщения */
.message-new.bot-message-new .share-btn {
  position: absolute;
  right: 8px;
  bottom: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #6b7280;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 80ms ease;
  opacity: 1;
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

.message-new.bot-message-new .share-btn:hover {
  background: #edf2f7;
  color: #1a202c;
  opacity: 1;
}

.message-new.bot-message-new .share-btn:active {
  transform: translateY(1px) scale(0.98);
}

.message-new.bot-message-new .share-btn svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: currentColor;
}

/* Небольшой тост для fallback копирования */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--toast-success-bg, #ecfdf5);
  color: var(--toast-success-text, #047857);
  border-radius: 999px;
  padding: 8px 14px;
  font: 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: var(--shadow, 0 6px 18px rgba(0,0,0,0.12));
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.bot-message-new {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px 16px;
  border: none;
  width: 100%;
  box-sizing: border-box;
}

.user-message-new {
  background: #34c759;
  border-radius: 12px;
  padding: 12px 16px;
  border: none;
  width: 100%;
  box-sizing: border-box;
  margin-left: auto;
  max-width: 80%;
}

.user-message-new .message-content-new {
  color: white;
}

/* Стили для форматирования сообщений */
.message-content-new h1,
.message-content-new h2,
.message-content-new h3 {
  margin: 12px 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}

.message-content-new h1 {
  font-size: 18px;
  color: #1d1d1f;
}

.message-content-new h2 {
  font-size: 16px;
  color: #1d1d1f;
}

.message-content-new h3 {
  font-size: 15px;
  color: #1d1d1f;
}

.message-content-new p {
  margin: 8px 0;
  line-height: 1.5;
}

.message-content-new strong {
  font-weight: 600;
  color: #1d1d1f;
}

.message-content-new em {
  font-style: italic;
  color: #666;
}

.message-content-new ul {
  margin: 8px 0;
  padding-left: 16px;
}

.message-content-new li {
  margin: 4px 0;
  line-height: 1.4;
}

.message-content-new li.numbered {
  list-style-type: decimal;
}

.message-content-new hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.message-content-new br {
  line-height: 1.5;
}

.message-content-new {
  font-size: 15px;
  line-height: 1.5;
  color: #1d1d1f;
  margin: 0;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.quick-questions-new {
  background: white;
  padding: 16px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  border-top: 1px solid #e5e7eb;
}

.question-group-new h4 {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.buttons-grid-new {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.quick-btn-new {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 4px 6px;
  font-size: 10px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin: 0;
  text-align: center;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-btn-new:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.quick-btn-new.highlight {
  background: #34c759;
  color: white;
  border-color: #34c759;
}

.quick-btn-new.disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

/* Подзаголовки для quick-btn-new */
.quick-btn-new .subtitle {
  display: block;
  font-size: 9px;
  color: #888;
  margin-top: 1px;
  font-weight: normal;
  line-height: 1.2;
}

.quick-btn-new.disabled .subtitle {
  color: #bbb;
}

/* Стили для кнопки analyze-yesterday в новом дизайне */
.quick-btn-new[data-question="analyze-yesterday"] {
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
  color: white;
  border: none;
}

.quick-btn-new[data-question="analyze-yesterday"]:hover {
  background: linear-gradient(135deg, #ff5252 0%, #ff7979 100%);
  transform: translateY(-1px);
}

.quick-btn-new[data-question="analyze-yesterday-disabled"] {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  cursor: not-allowed;
}

.quick-btn-new[data-question="analyze-yesterday-disabled"]:hover {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  transform: none;
}

.chat-input-new {
  background: white;
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}

.chat-input-field-new {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 15px;
  outline: none;
  background: #f8f9fa;
}

.chat-input-field-new:focus {
  border-color: #34c759;
  background: white;
}

.send-btn-new {
  background: #34c759;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.send-btn-new:hover {
  background: #30d158;
}

/* Мобильные стили для кнопок */
@media (max-width: 480px) {
  .buttons-grid-new {
    gap: 6px;
  }
  
  .quick-btn-new {
    padding: 8px 6px;
    font-size: 10px;
    min-height: 40px;
    line-height: 1.2;
  }
  
  .question-group-new h4 {
    font-size: 11px;
    margin-bottom: 8px;
  }
}

/* Глобальное правило для предотвращения горизонтальной прокрутки */
body {
  overflow-x: hidden;
}

/* Чат - дублирующиеся стили удалены */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: white;
  margin: 0;
}

.message {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  margin: 0;
}

.bot-message {
  align-self: stretch;
  background: #ffffff;
  border: none;
  box-shadow: none;
  width: 100%;
}

.user-message {
  align-self: flex-end;
  background: #34c759;
  color: #ffffff;
  box-shadow: none;
  max-width: 80%;
}

.message-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Дублирующиеся стили удалены - используются стили выше */

@media (max-width: 767px) {
  .current-time {
    font-size: 40px;
  }
  
  .progress-circles {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .prompt-btn {
    padding: 12px 14px;
    gap: 12px;
  }
  
  .prompt-icon {
    font-size: 24px;
  }
  
  .prompt-label {
    font-size: 14px;
  }
  
  .quick-prompts-today,
  .quick-prompts-analysis {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .prompt-btn-mini {
    font-size: 12px;
    padding: 7px 8px;
  }
  
  .data-grid {
    grid-template-columns: 1fr;
  }
  
  .meal-item-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .item-portion,
  .item-kbzhu-detail {
    justify-self: start;
  }
  
  .action-buttons {
    grid-template-columns: 1fr;
  }
  
  .plan-item {
    grid-template-columns: 70px 1fr 85px;
    font-size: 12px;
  }
}
