:root {
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --accent: #6c5ce7;
    --success: #00b894;
    --danger: #d63031;
    --warning: #fdcb6e;
    --border: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
}

.app {
    max-width: 100%;
}

/* Навигация */
.nav-tabs {
    display: flex;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nav-tab {
    flex: 1;
    padding: 14px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.nav-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* Вкладки */
.tab-content {
    display: none;
    padding: 16px;
}

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

/* Карточки секций */
.section-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.section-card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text);
}

.section-card h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

/* Форма ввода еды */
textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 15px;
    resize: none;
    margin-bottom: 12px;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

textarea::placeholder {
    color: var(--text-secondary);
}

/* Кнопки */
.buttons-row {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    flex: 1;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-full {
    width: 100%;
}

/* Кнопка в режиме анализа */
.btn.analyzing {
    background: var(--text-secondary);
    cursor: wait;
    opacity: 0.7;
}

.btn.analyzing:active {
    transform: none;
}

/* Превью фото */
.photo-preview {
    position: relative;
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
}

.photo-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}

.btn-remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Резул
ьтат анализа */
.greeting {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 16px;
    line-height: 1.5;
}

.products-list {
    margin-bottom: 16px;
}

.product-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

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

.product-cal {
    color: var(--text-secondary);
    font-weight: 500;
}

.totals-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}

.total-row span:last-child {
    font-weight: 600;
}

.recommendation {
    background: rgba(108, 92, 231, 0.08);
    border-left: 3px solid var(--accent);
    padding: 12px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Статистика сегодня */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.stat-icon {
    font-size: 20px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.cal-bar {
    background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
}

.prot-bar {
    background: linear-gradient(90deg, #4ecdc4, #44b3ab);
}

.fat-bar {
    background: linear-gradient(90deg, #ffeaa7, #fdcb6e);
}

.carb-bar {
    background: linear-gradient(90deg, #81ecec, #00cec9);
}

.stat-goal {
    font-size: 10px;
    color: var(--text-secondary);
}

/* История */
.date-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.btn-date {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
}

.btn-date:active {
    background: var(--border);
}

.current-date {
    font-size: 16px;
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

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

.day-total-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.day-total-item .label {
    color: var(--text-secondary);
}

.day-total-item .value {
    font-weight: 500;
    color: var(--text);
}

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

.meal-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px;
}

.meal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.meal-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.meal-calories {
    font-weight: 600;
    color: #ff6b6b;
}

.meal-products {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 6px;
}

.meal-macros {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

/* П
рофиль */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

input[type="text"],
input[type="number"],
select {
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

select {
    cursor: pointer;
}

/* Нормы */
.norms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.norm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
}

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

.norm-label {
    flex: 1;
    color: var(--text-secondary);
}

.norm-value {
    font-weight: 600;
    color: var(--text);
}

/* Модалки */
.hint-modal,
.date-modal {
    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: 20px;
}

.hint-content,
.date-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.hint-content p {
    margin-bottom: 16px;
    line-height: 1.5;
    color: var(--text);
}

.date-modal-content h3 {
    margin-bottom: 16px;
    color: var(--text);
}

.date-modal-content input[type="date"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

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

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

.loading-content p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* А
ктивность */
.activity-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.activity-input {
    flex: 1;
}

.activity-input.full {
    width: 100%;
}

.activity-input label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.activity-input input,
.activity-input textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
}

.activity-input textarea {
    min-height: 60px;
    resize: none;
}

.activity-result {
    text-align: right;
    min-width: 80px;
}

.activity-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

.activity-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--success);
}

.workout-result {
    background: rgba(0, 184, 148, 0.1);
    border-radius: 12px;
    margin-top: 12px;
    overflow: hidden;
}

/* Заголовок тренировки (кликабельный) */
.workout-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.workout-summary:hover {
    background: rgba(0, 184, 148, 0.15);
}

.workout-summary-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.workout-icon {
    font-size: 18px;
}

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

.workout-summary-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workout-total-cal {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
}

.workout-expand-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.workout-summary.expanded .workout-expand-icon {
    transform: rotate(180deg);
}

/* Детали тренировки */
.workout-details {
    padding: 0 16px 16px;
    border-top: 1px solid rgba(0, 184, 148, 0.2);
}

.workout-detail-card {
    background: white;
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

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

.workout-detail-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.workout-stat {
    font-size: 13px;
    color: var(--text-secondary);
}

.workout-stat b {
    font-size: 16px;
    color: var(--text);
    margin-right: 2px;
}

.workout-detail-formula {
    font-size: 11px;
    font-family: monospace;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 8px 10px;
    border-radius: 6px;
    opacity: 0.8;
}

.workout-total-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 10px 12px;
    background: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

/* Баланс дня */
.balance-section {
    margin-bottom: 16px;
}

.balance-section h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.balance-breakdown {
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

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

.balance-item.total {
    background: rgba(108, 92, 231, 0.05);
    font-weight: 600;
}

.balance-item.tef span:last-child {
    color: var(--success);
}

/* Итоговый баланс */
.final-balance {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    margin-bottom: 16px;
}

.final-balance.deficit {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.final-balance.surplus {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
}

.balance-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.balance-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
}

.balance-hint {
    display: block;
    font-size: 13px;
    opacity: 0.8;
    margin-top: 4px;
}

/* Fiber bar */
.fiber-bar {
    background: linear-gradient(90deg, #a8e6cf, #88d8b0);
}

/* Intensity selector */
.intensity-selector {
    margin: 12px 0;
}

.intensity-selector label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.intensity-selector select {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    cursor: pointer;
}

/* Intensity Modal */
.intensity-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.intensity-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 340px;
    width: 100%;
}

.intensity-modal-content h3 {
    margin-bottom: 16px;
    text-align: center;
}

.intensity-list {
    margin-bottom: 16px;
}

.intensity-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.intensity-item p {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.intensity-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

.intensity-badge.warmup {
    background: rgba(158, 158, 158, 0.2);
    color: #757575;
}

.intensity-badge.light {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.intensity-badge.medium {
    background: rgba(255, 193, 7, 0.2);
    color: #FFC107;
}

.intensity-badge.intense {
    background: rgba(244, 67, 54, 0.2);
    color: #F44336;
}

/*
 Workout details */
.workout-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-expand {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    transition: transform 0.2s;
}

.btn-expand.expanded {
    transform: rotate(180deg);
}

.workout-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.detail-formula {
    margin-top: 8px;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 12px;
    font-family: monospace;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* К
нопка дополнить */
.btn-warning {
    background: var(--warning);
    color: var(--text);
}

/* Блок дополнений */
.correction-block {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(253, 203, 110, 0.15);
    border-radius: 10px;
    border: 1px dashed var(--warning);
}

.correction-block textarea {
    min-height: 60px;
    margin-bottom: 10px;
    background: white;
}

/* Раскрывающиеся продукты с КБЖУ */
.product-item {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-name {
    color: var(--text);
    font-size: 14px;
}

.product-weight {
    color: var(--text-secondary);
    font-size: 12px;
}

.product-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-cal {
    color: var(--text-secondary);
    font-weight: 500;
}

.product-expand {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.product-item.expanded .product-expand {
    transform: rotate(180deg);
}

.product-macros {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 8px;
}

.macro-item {
    font-size: 12px;
    color: var(--text-secondary);
}

.macro-item b {
    color: var(--text);
}

/*
 Строка общего веса */
.total-weight-row {
    background: rgba(108, 92, 231, 0.08);
    border-radius: 8px;
    margin-bottom: 4px;
}

.total-weight-row span:last-child {
    color: var(--accent);
    font-weight: 700;
}

/* Улучшенные рекомендации */
.recommendation {
    white-space: pre-line;
    line-height: 1.6;
}

/* =
== ПРОГРЕСС ЦЕЛИ === */
.goal-progress-card {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.goal-progress-card h3 {
    margin-bottom: 12px;
    font-size: 14px;
}

.progress-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.progress-item {
    flex: 1 1 45%;
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 13px;
}

.progress-item.highlight {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.progress-item .label {
    opacity: 0.9;
}

/* === АКТИВНОСТЬ В ИСТОРИИ === */
.history-activity {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-activity .activity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
}

.history-activity .activity-item .label {
    flex: 0 0 auto;
    font-size: 13px;
}

.history-activity .activity-item .value {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.history-activity .activity-item .calories {
    color: var(--success);
    font-weight: 600;
    font-size: 13px;
}

/* =
== TEF СТИЛИ === */
.calories-with-tef {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calories-with-tef .net-cal {
    color: var(--success);
    font-weight: 600;
}

.tef-details {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.tef-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    font-size: 13px;
}

.tef-header:hover {
    background: rgba(0, 0, 0, 0.06);
}

.tef-total {
    color: var(--success);
    font-weight: 500;
}

.tef-breakdown {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: 8px;
}

.tef-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* TEF в балансе дня */
.balance-item.expandable {
    cursor: pointer;
}

.balance-item.expandable:hover {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.tef-detail-breakdown {
    margin: 4px 0 8px 16px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border-left: 2px solid var(--success);
}

.tef-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/ *===СВОРАЧИВАЕМЫЕ БЛОКИ===*/ .collapsible .collapse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 4px 0;
}

.collapsible .collapse-header h3 {
    margin: 0;
    flex: 1;
}

.collapse-summary {
    font-size: 12px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.collapse-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.collapse-header.expanded .collapse-icon {
    transform: rotate(180deg);
}

.collapse-content {
    margin-top: 12px;
}

/* === КНОПКА УДАЛЕНИЯ ПРИЁМА ПИЩИ === */
.meal-item {
    position: relative;
}

.meal-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meal-header .meal-time {
    font-weight: 500;
}

.meal-header .meal-calories {
    flex: 1;
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
}

.btn-delete-meal {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-delete-meal:hover {
    opacity: 1;
}

/* =
== МИКРОНУТРИЕНТЫ === */
.micro-section {
    margin-bottom: 16px;
}

.micro-section h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.micro-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.micro-item {
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 11px;
}

.micro-item.low {
    background: rgba(214, 48, 49, 0.1);
}

.micro-item.good {
    background: rgba(0, 184, 148, 0.1);
}

.micro-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.micro-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

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

.micro-item.low .micro-fill {
    background: var(--danger);
}

.micro-item.good .micro-fill {
    background: var(--success);
}

.micro-value {
    color: var(--text-secondary);
    font-size: 10px;
}

/* ==
= МИКРОНУТРИЕНТЫ В ИНГРЕДИЕНТАХ === */
.product-details {
    padding-top: 8px;
}

.product-micro-toggle {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    color: var(--accent);
}

.product-micro-toggle.open {
    background: rgba(108, 92, 231, 0.2);
}

.product-micro {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 11px;
}

.micro-group {
    margin-bottom: 6px;
}

.micro-group b {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.micro-tag {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px;
    background: white;
    border-radius: 4px;
    font-size: 10px;
}

.micro-empty {
    color: var(--text-secondary);
    font-style: italic;
}

/* Микронутриенты блюда */
.meal-micro-section {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.meal-micro-header {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--accent);
}

.meal-micro-header:hover {
    background: rgba(108, 92, 231, 0.15);
}

.meal-micro-content {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

/* =
== ИНГРЕДИЕНТЫ - РАСКРЫТИЕ === */
.product-item {
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-name {
    font-weight: 500;
}

.product-weight {
    color: var(--text-secondary);
    font-size: 12px;
}

.product-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-cal {
    font-weight: 500;
}

.product-expand {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

/* Скрываем детали по умолчанию */
.product-details {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* Показываем при раскрытии */
.product-item.expanded .product-details {
    display: block;
}

.product-item.expanded .product-expand {
    transform: rotate(180deg);
}


/* === МОДАЛКА ЦЕЛЕЙ === */
.goal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    overflow-y: auto;
}

.goal-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 360px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.goal-modal-content h3 {
    margin-bottom: 16px;
    text-align: center;
}

.goal-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 12px;
}

.goal-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.goal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.goal-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.goal-details span {
    font-size: 11px;
    padding: 3px 8px;
    background: white;
    border-radius: 4px;
    color: var(--text);
}

.goal-note {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

/* ==
= ПРИЁМЫ ПИЩИ - РАСКРЫВАЮЩИЕСЯ === */
.meal-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
}

.meal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.meal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.meal-time {
    font-weight: 600;
    color: var(--text);
}

.meal-calories {
    color: var(--text-secondary);
    font-size: 13px;
}

.meal-expand {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.meal-item.expanded .meal-expand {
    transform: rotate(180deg);
}

.meal-macros {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meal-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.meal-item.expanded .meal-details {
    display: block;
}

.meal-products-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.meal-products-list {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

/* ==
= БАДы === */
.supplements-list {
    margin-bottom: 12px;
}

.supplement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.supplement-info {
    flex: 1;
}

.supplement-name {
    font-weight: 500;
    font-size: 14px;
}

.supplement-unit {
    font-size: 12px;
    color: var(--text-secondary);
}

.supplement-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.supplement-amount {
    width: 70px;
    min-width: 50px;
    padding: 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.btn-take-supp {
    padding: 6px 12px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.btn-delete-supp {
    padding: 6px 8px;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    opacity: 0.6;
}

.btn-delete-supp:hover {
    opacity: 1;
}

/* Модалка БАДа */
.supplement-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    overflow-y: auto;
}

.supplement-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 12px;
    max-width: 100%;
    width: calc(100% - 24px);
    margin: auto 0;
    max-height: 90vh;
    overflow-y: auto;
}

/* Контейнер нутриентов со скроллом */
#supp-composition {
    max-height: 35vh;
    overflow-y: auto;
    padding-right: 4px;
}

.supplement-modal-content h3 {
    margin-bottom: 10px;
    text-align: center;
    font-size: 16px;
}

.supplement-modal-content .form-group {
    margin-bottom: 10px;
}

.supplement-modal-content .form-group label {
    font-size: 12px;
    margin-bottom: 4px;
}

.supplement-modal-content input[type="text"],
.supplement-modal-content select {
    padding: 8px;
    font-size: 13px;
}

.supp-composition {
    margin-bottom: 8px;
}

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

.supp-nutrient {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
}

.supp-amount {
    width: 60px;
    flex-shrink: 0;
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
}

.btn-remove-row {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    padding: 0;
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-add-nutrient {
    width: 100%;
    margin-bottom: 12px;
    padding: 8px;
    font-size: 13px;
}

/* Сканирование БАДа */
.scan-section {
    margin-bottom: 10px;
}

.scan-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.3;
}

.scan-section .buttons-row {
    margin-bottom: 6px;
}

.scan-section .buttons-row .btn {
    padding: 8px 12px;
    font-size: 12px;
}

.scan-section textarea {
    min-height: 50px;
    font-size: 12px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}

/* Результат сканирования */
.scan-result {
    background: rgba(0, 184, 148, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.scan-result-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--success);
}

.scan-result-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.scan-notes {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}


/* Календарь в истории */
.current-date.clickable {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.current-date.clickable:hover {
    background: var(--bg);
}

.current-date.clickable:active {
    background: var(--border);
}

.hidden-date-picker {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.date-selector {
    position: relative;
}

/ *===ПРОДУКТЫ В ИСТОРИИ===*/ .hist-product-item {
    padding: 8px;
    background: white;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
}

.hist-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.hist-product-name {
    font-weight: 500;
}

.hist-product-cal {
    color: var(--text-secondary);
    font-size: 12px;
}

.hist-product-details {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.hist-product-item.expanded .hist-product-details {
    display: block;
}

.hist-product-item.expanded .hist-product-cal::after {
    content: '';
}

.hist-product-macros {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hist-product-micro {
    font-size: 11px;
}

.hist-product-simple {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

/* Микронутриенты приёма в истории */
.meal-details .meal-micro-section {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.meal-details .meal-micro-header {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: var(--accent);
}

.meal-details .meal-micro-header:hover {
    background: rgba(108, 92, 231, 0.15);
}

.meal-details .meal-micro-header.open {
    background: rgba(108, 92, 231, 0.2);
}

.meal-details .meal-micro-content {
    margin-top: 8px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

/ *===КОМПАКТНЫЙ ПРОФИЛЬ В ИСТОРИИ===*/ .profile-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-row label {
    flex: 0 0 100px;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-row input,
.profile-row select {
    flex: 1;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.profile-norms {
    padding: 12px;
    background: rgba(108, 92, 231, 0.08);
    border-radius: 10px;
    margin-top: 12px;
}

.norm-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.norm-row span:last-child {
    font-weight: 600;
    color: var(--accent);
}

/* Двухко
лоночная раскладка профиля */
.profile-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profile-row-half .profile-row {
    flex-direction: column;
    align-items: stretch;
}

.profile-row-half .profile-row label {
    flex: none;
    margin-bottom: 4px;
}

/* ==
= МОДАЛКА ОПИСАНИЯ ЦЕЛЕЙ === */
.goal-info-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    overflow-y: auto;
}

.goal-info-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    margin: auto 0;
}

.goal-info-content h3 {
    text-align: center;
    margin-bottom: 16px;
}

.goal-info-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 12px;
}

.goal-info-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.goal-info-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.goal-info-props {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.goal-info-props span {
    font-size: 11px;
    padding: 3px 8px;
    background: white;
    border-radius: 4px;
    color: var(--accent);
    font-weight: 500;
}

.goal-info-why {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

/* ==
= HEADER С КАЛЕНДАРЁМ И ПРОФИЛЕМ === */
.header-card {
    padding: 12px 16px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-icon-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.profile-icon {
    font-size: 18px;
}

.profile-weight {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* === МОДАЛКА ПРОФИЛЯ === */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    overflow-y: auto;
}

.profile-modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 360px;
    width: 100%;
    margin: auto 0;
}

.profile-modal-content h3 {
    text-align: center;
    margin-bottom: 16px;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

/*
 === ИСТОРИЯ - КБЖУ КАРТОЧКИ === */
.balance-card {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.balance-card.deficit {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
}

.balance-card.surplus {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
}

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

.hist-stat-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.hist-stat-card.protein-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.hist-stat-card.fat-card {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
}

.hist-stat-card.carbs-card {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
}

.hist-stat-card.fiber-card {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.hist-stat-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.hist-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

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

.hist-stat-progress {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.hist-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.hist-prot-bar {
    background: linear-gradient(90deg, #4ecdc4, #44b3ab);
}

.hist-fat-bar {
    background: linear-gradient(90deg, #ffeaa7, #fdcb6e);
}

.hist-carb-bar {
    background: linear-gradient(90deg, #81ecec, #00cec9);
}

.hist-fiber-bar {
    background: linear-gradient(90deg, #a8e6cf, #88d8b0);
}

.hist-stat-goal {
    font-size: 11px;
    color: var(--text-secondary);
}


/* === ПАНЕЛЬ БЫСТРЫХ ДЕЙСТВИЙ === */
.action-panel {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.action-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.15);
}

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

.action-btn.active .action-label {
    color: white;
}

.action-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.action-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.action-content {
    margin-bottom: 16px;
    animation: slideDown 0.2s ease;
}

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

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


/* === РАСКРЫТИЕ КАЛОРИЙ В ПРОФИЛЕ === */
.norm-row.expandable {
    cursor: pointer;
    transition: background 0.2s;
}

.norm-row.expandable:hover {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
}

.calories-breakdown {
    margin: 8px 0;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.cal-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.cal-item.total {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 10px;
    font-weight: 600;
}

.cal-item-hint {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 0 8px 0;
    line-height: 1.4;
    opacity: 0.8;
}

/* ==
= МИКРОНУТРИЕНТЫ В БЛОКЕ КБЖУ === */
.day-total-item.micro-row {
    cursor: pointer;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
}

.day-total-item.micro-row:hover {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
}

.micro-content-inline {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}


/* === МОДАЛКА ИСТОЧНИКОВ МИКРОНУТРИЕНТА === */
.micro-source-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.micro-source-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 340px;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
}

.micro-source-content h3 {
    margin-bottom: 8px;
}

.micro-source-total {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.micro-source-list {
    margin-bottom: 16px;
}

.source-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.source-name {
    flex: 1;
}

.source-type {
    font-size: 11px;
    color: var(--text-secondary);
}

.source-value {
    font-weight: 600;
    color: var(--accent);
}

.micro-item.clickable {
    cursor: pointer;
    transition: transform 0.1s;
}

.micro-item.clickable:hover {
    transform: scale(1.02);
}

/* =
== МНОЖЕСТВЕННОЕ ПРЕВЬЮ ФОТО === */
.photo-preview-multi {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.photo-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .btn-remove-photo {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === М
ОДАЛКА ДЕТАЛИЗАЦИИ ПРИЁМА ПИЩИ === */
.meal-detail-modal {
    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: 16px;
}

.meal-detail-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.meal-detail-header h3 {
    margin: 0;
    font-size: 18px;
}

.btn-close-modal {
    background: var(--bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-detail-totals {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
}

.meal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

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

.meal-detail-products h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.meal-detail-product-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.meal-detail-product-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.meal-detail-product-macros {
    font-size: 12px;
    color: var(--text-secondary);
}

.meal-detail-product-micro {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
}

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

.meal-detail-micro .meal-micro-header {
    background: var(--bg);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.meal-detail-micro .meal-micro-content {
    padding: 12px;
    font-size: 13px;
}


/* === ПОЛНОЭКРАННЫЙ ПРОСМОТР ФОТО === */
.fullscreen-photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.fullscreen-photo-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 2001;
}

.photo-count {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 4px;
    width: 100%;
}

.photo-preview-item img {
    cursor: pointer;
}

/*
 === КОМПАКТНЫЕ СТИЛИ ДЛЯ МОБИЛЬНОГО (9:16) === */
.supplement-modal .buttons-row {
    gap: 8px;
    margin-top: 10px;
}

.supplement-modal .buttons-row .btn {
    padding: 10px 16px;
    font-size: 13px;
}

/* Компактный select с optgroup */
.supp-nutrient optgroup {
    font-size: 10px;
    font-weight: 600;
}

.supp-nutrient option {
    font-size: 12px;
    padding: 2px 4px;
}

/* Фото превью в модалке БАДов */
.supplement-modal .photo-preview-multi {
    max-height: 80px;
    margin-bottom: 8px;
}

.supplement-modal .photo-preview-item {
    width: 60px;
    height: 60px;
}

.supplement-modal .photo-preview-item img {
    width: 60px;
    height: 60px;
}

/*
 === КНОПКА "ПОДРОБНЕЕ" В МОДАЛКЕ НУТРИЕНТА === */
.btn-desc-toggle {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.micro-source-description {
    background: rgba(108, 92, 231, 0.08);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    max-height: 200px;
    overflow-y: auto;
}

/* =
== РЕДАКТИРОВАНИЕ ПРИЁМА ПИЩИ === */
.meal-detail-product-item.editable {
    position: relative;
}

.meal-detail-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.btn-remove-product {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}

.meal-add-product {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.meal-add-product input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.meal-add-product .btn {
    width: 44px;
    padding: 10px;
}

.meal-detail-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.meal-detail-buttons .btn {
    flex: 1;
    padding: 12px;
}

/* === МОДАЛКА ДЕТАЛИЗАЦИИ ПРИЁМА ПИЩИ === */
.meal-detail-modal {
    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: 16px;
}

.meal-detail-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 16px;
}

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

.meal-detail-header h3 {
    font-size: 16px;
    margin: 0;
}

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

.meal-detail-totals {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.meal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.meal-detail-row .net-cal {
    color: var(--success);
    font-weight: 600;
}

.meal-detail-products h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.meal-detail-product-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.meal-detail-product-item.editable {
    border: 1px solid var(--border);
}

.meal-detail-product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meal-detail-product-name {
    font-size: 14px;
    font-weight: 500;
}

.btn-remove-product {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-detail-product-macros {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Добавление продукта */
.meal-add-product {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.meal-add-product input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
}

.meal-add-product button {
    padding: 10px 16px;
    font-size: 18px;
    font-weight: bold;
}

/* Микронутриенты в модалке */
.meal-detail-micro {
    margin: 12px 0;
}

.meal-detail-micro .meal-micro-header {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.meal-detail-micro .meal-micro-content {
    padding: 10px;
    font-size: 12px;
    line-height: 1.6;
}

/* Кнопки действий */
.meal-detail-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.meal-detail-buttons .btn {
    flex: 1;
    padding: 12px;
    font-size: 14px;
}


/* === РЕДАКТИРОВАНИЕ ПРОДУКТА === */
.meal-detail-product-buttons {
    display: flex;
    gap: 6px;
}

.btn-edit-product {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-edit-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.product-edit-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
}

.product-edit-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.product-edit-result {
    margin-top: 10px;
    padding: 10px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 8px;
    border: 1px solid var(--accent);
}

.edit-result-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-result-name {
    font-weight: 600;
    font-size: 14px;
}

.edit-result-macros {
    font-size: 12px;
    color: var(--text-secondary);
}

.edit-result-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}


/* === МИКРОНУТРИЕНТЫ ПРОДУКТА === */
.product-micro-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    margin-top: 6px;
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    border-top: 1px dashed var(--border);
}

.product-micro-content {
    padding: 8px 0;
    font-size: 11px;
}

.product-micro-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-micro-list .micro-item {
    background: rgba(108, 92, 231, 0.1);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Кнопка сохранить */
.btn-success {
    background: var(--success);
    color: white;
}


/* === РЕЖИМ РЕДАКТИРОВАНИЯ ПРОДУКТА === */
.meal-detail-product-item.editing {
    background: rgba(108, 92, 231, 0.1);
    border: 1px dashed var(--accent);
}

.meal-detail-product-item.editing .product-edit-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.product-edit-hint {
    font-size: 11px;
    color: var(--accent);
    margin-top: 6px;
    font-style: italic;
}

.btn-edit-product {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-detail-product-buttons {
    display: flex;
    gap: 6px;
}


/* === ПРОДУКТ ОЖИДАЕТ ПЕРЕСЧЁТА === */
.meal-detail-product-item.needs-recalc {
    background: rgba(253, 203, 110, 0.2);
    border: 1px dashed var(--warning);
}

.product-recalc-hint {
    font-size: 12px;
    color: #e67e22;
    margin-top: 6px;
}

/* Кнопки редактирования продукта */
.product-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.product-edit-actions .btn {
    flex: 1;
}