/* 全局样式 - 优化版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 - 现代青色渐变 */
    --primary-start: #06b6d4;
    --primary-end: #0891b2;
    
    /* 功能色 - 更高对比度 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* 中性色 - 改进可读性 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 圆角 */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* 过渡 */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--gray-50);
    min-height: 100vh;
    box-shadow: var(--shadow-xl);
}

/* 导航栏 - 改进对比度 */
.navbar {
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    color: white;
    padding: 1rem 2.5rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

/* 头部标题 + 折叠按钮同行 */
.navbar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar h1 {
    margin-bottom: 0.75rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 折叠按钮 */
.navbar-toggle {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.35);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.navbar-toggle:hover {
    background: rgba(255,255,255,0.35);
}

/* 可收起面板 */
.navbar-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    opacity: 0;
    margin-top: 0;
}
.navbar-panel.open {
    max-height: 200px;
    opacity: 1;
    margin-top: 0.75rem;
}

.nav-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9375rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-btn:hover::before {
    width: 300px;
    height: 300px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.nav-btn:active {
    transform: translateY(0);
}

.nav-btn.active {
    background: white;
    color: var(--primary-start);
    border-color: white;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.4);
    text-shadow: none;
}

.nav-btn.active::before {
    display: none;
}

/* 成员选择器样式 */
.member-selector-container {
    display: flex;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.member-select {
    background: rgba(255, 255, 255, 0.95);
    color: var(--gray-800);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    min-width: 150px;
}

.member-select:hover {
    background: white;
    border-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.member-select:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* 通用部分样式 - 优化版 */
.section {
    display: none;
    padding: 2.5rem;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section.active {
    display: block;
}

.section h2 {
    color: var(--gray-900);
    margin-bottom: 2rem;
    font-size: 1.875rem;
    font-weight: 800;
    position: relative;
    padding-left: 1.5rem;
    letter-spacing: -0.025em;
}

.section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    border-radius: var(--radius);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.section h3 {
    color: var(--gray-800);
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
}

/* 卡片样式 - 优化版 */
.input-card, .settings-card, .metric-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.input-card:hover, .settings-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

/* 表单样式 - 改进可访问性 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    transition: var(--transition);
    background: white;
    color: var(--gray-900);
    font-weight: 500;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--gray-400);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-start);
    background: white;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

/* 用餐时间选择器 - 改进视觉效果 */
.meal-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: var(--radius-lg);
    border: 2px solid #bae6fd;
}

.meal-selector label {
    font-weight: 600;
    color: var(--primary-start);
    font-size: 0.9375rem;
    white-space: nowrap;
}

.meal-selector select,
.meal-selector input {
    padding: 0.75rem 1rem;
    border: 2px solid #bae6fd;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    background: white;
    transition: var(--transition);
    font-weight: 500;
}

.meal-selector select:focus,
.meal-selector input:focus {
    outline: none;
    border-color: var(--primary-start);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* 上传区域 - 改进交互反馈 */
.upload-area {
    border: 3px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.upload-area:hover::before {
    opacity: 1;
}

.upload-area:hover {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: var(--primary-start);
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.upload-label {
    cursor: pointer;
    display: block;
    position: relative;
    z-index: 1;
}

.upload-label span {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-start);
    margin-bottom: 0.75rem;
}

.upload-label small {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* 图片预览 - 改进样式 */
#imagePreview {
    margin-top: 1rem;
    text-align: center;
}

#imagePreview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* AI 结果 - 改进可读性 */
.ai-result {
    margin-top: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: var(--radius-lg);
    border: 2px solid #86efac;
    display: none;
}

.ai-result.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-result h4 {
    color: var(--success);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

/* API 计数器 - 改进对比度 */
.api-counter {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: #92400e;
    font-weight: 600;
}

#apiCount {
    font-weight: bold;
    color: #d63384;
}

/* 营养预览 */
.nutrition-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.nutrition-item {
    position: relative;
}

.nutrition-item label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}

.nutrition-item input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8ecef;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nutrition-item input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: scale(1.02);
}

/* 按钮样式 - 优化版 */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 0.75rem;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(6, 182, 212, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.3);
}

.btn-secondary:hover {
    background: var(--gray-700);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(75, 85, 99, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

/* 仪表盘网格 - 改进响应式 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    text-align: center;
    position: relative;
    background: white;
    padding: 2rem 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--gray-100);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.metric-card h3 {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 进度环 */
.progress-ring {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    position: relative;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 14px;
    background: #f0f2f5;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill.warning {
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
}

.progress-fill.danger {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin: 15px 0;
    letter-spacing: 0.5px;
}

/* 警告提示 */
.warnings {
    margin: 25px 0;
}

.warning-item {
    padding: 18px 20px;
    margin-bottom: 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    animation: slideInLeft 0.4s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 5px solid;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.warning-item.warning {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    color: #856404;
    border-left-color: #ffc107;
}

.warning-item.danger {
    background: linear-gradient(135deg, #ffe6e6 0%, #f8d7da 100%);
    color: #721c24;
    border-left-color: #dc3545;
}

/* 今日饮食列表 */
.today-meals {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* 今日饮食标题栏 */
.meals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.meals-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 20px;
}

.meals-date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    padding: 10px 16px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.meals-date-picker:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.meals-date-picker label {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    margin: 0;
}

.meals-date-picker input[type="date"] {
    padding: 6px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    color: #2d3748;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.meals-date-picker input[type="date"]:hover {
    border-color: #667eea;
}

.meals-date-picker input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.meal-entry {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 12px;
    border-left: 5px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

.meal-entry:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.meal-entry:hover .btn-delete {
    opacity: 1;
    visibility: visible;
}

.btn-delete {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.5);
    background: linear-gradient(135deg, #ff5252 0%, #e33f4f 100%);
}

.btn-delete:active {
    transform: scale(0.95) rotate(0deg);
}

.meal-info h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 700;
}

.meal-details {
    font-size: 14px;
    color: #6c757d;
}

.meal-nutrition {
    display: flex;
    gap: 12px;
    font-size: 13px;
    flex-wrap: wrap;
}

.meal-nutrition span {
    background: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecff;
}

/* 图表容器 */
.chart-container {
    background: white;
    padding: 28px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #f0f2f5;
    position: relative;
    min-height: 400px;
}

.chart-container canvas {
    max-height: 400px;
    width: 100% !important;
    height: 400px !important;
}

.chart-container h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
}

/* 日期范围选择 */
.date-range {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.date-range label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

.date-range input {
    padding: 12px 16px;
    border: 2px solid #e8ecef;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
}

.date-range input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.date-range span {
    color: #6c757d;
    font-weight: 500;
}

/* 历史表格 */
.history-table {
    overflow-x: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecef;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

thead th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
}

thead th:first-child {
    border-top-left-radius: 16px;
}

thead th:last-child {
    border-top-right-radius: 16px;
}

tbody tr {
    border-bottom: 1px solid #f0f2f5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:hover {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    transform: scale(1.01);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 16px 20px;
    font-size: 14px;
    color: #2c3e50;
}

.status-ok {
    color: #28a745;
    font-weight: 600;
}

.status-warning {
    color: #ffc107;
    font-weight: 600;
}

.status-danger {
    color: #dc3545;
    font-weight: 600;
}

/* 一周总结 */
.weekly-summary {
    background: white;
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 35px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 2px solid #e8ecff;
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.weekly-summary h3 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-period {
    text-align: center;
    margin-bottom: 30px;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    font-size: 16px;
    border: 2px solid #e8ecff;
}

.summary-period strong {
    color: #667eea;
    font-weight: 700;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #f0f2f5;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.summary-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.summary-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.summary-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
}

.summary-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.summary-content {
    padding: 24px;
}

.summary-stats {
    margin-bottom: 18px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 2px solid #f8f9fa;
    transition: all 0.3s;
}

.stat-item:hover {
    background: #f8f9ff;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 8px;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #6c757d;
    font-size: 15px;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    color: #2c3e50;
    font-size: 16px;
}

.stat-value.danger {
    color: #dc3545;
    font-size: 18px;
}

.summary-status {
    padding: 14px 18px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.summary-status.excellent {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 2px solid #b1dfbb;
}

.summary-status.good {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border: 2px solid #abdde5;
}

.summary-status.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
    border: 2px solid #ffe8a1;
}

.summary-status.danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 2px solid #f1b0b7;
}

/* 健康建议 */
.health-advice {
    background: white;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 2px solid #f0f2f5;
}

.health-advice h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.advice-item {
    padding: 16px 20px;
    margin-bottom: 14px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid;
}

.advice-item:hover {
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.advice-item.good {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left-color: #28a745;
}

.advice-item.warning {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-left-color: #ffc107;
}

.advice-item.danger {
    background: linear-gradient(135deg, #ffebee 0%, #f8d7da 100%);
    border-left-color: #dc3545;
}

.advice-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.advice-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.7;
    color: #2c3e50;
}

.advice-text strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
}

/* 成员列表 */
#membersList {
    margin-bottom: 15px;
}

.member-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.member-limits {
    font-size: 13px;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .navbar {
        padding: 12px 16px;
        position: relative;
    }
    
    .navbar h1 {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .nav-buttons {
        gap: 8px;
    }
    
    .nav-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .section {
        padding: 24px 20px;
    }
    
    .section h2 {
        font-size: 22px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .meal-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }
    
    .nutrition-preview {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .date-range {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .meal-entry {
        flex-direction: column;
        gap: 12px;
    }
    
    .meal-nutrition {
        flex-wrap: wrap;
    }
    
    .toast {
        top: 20px;
        right: 20px;
        left: 20px;
        font-size: 14px;
    }
    
    .weekly-summary {
        padding: 20px;
    }
    
    .chart-container {
        padding: 15px 12px;
        min-height: 320px;
        margin-bottom: 20px;
    }
    
    .chart-container canvas {
        max-height: 300px !important;
        height: 300px !important;
    }
    
    table {
        font-size: 13px;
    }
    
    thead th, tbody td {
        padding: 12px 10px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 成功提示 */
/* Toast 通知 - 优化版 */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1.25rem 1.75rem;
    background: var(--success);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 0.9375rem;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 300px;
    max-width: 500px;
}

.toast.success {
    background: var(--success);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.toast.warning {
    background: var(--warning);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

.toast.info {
    background: var(--info);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== 欢迎弹窗样式 - 优化版 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    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;
    }
}

.welcome-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    border-radius: 24px 24px 0 0;
}

.welcome-modal .modal-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.welcome-modal .subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.modal-body {
    padding: 30px;
}

.welcome-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.welcome-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s;
}

.welcome-step:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 18px;
    margin-bottom: 6px;
    color: #2c3e50;
}

.step-content p {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.6;
}

.api-setup-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #667eea;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.api-icon {
    font-size: 48px;
    text-align: center;
}

.api-info {
    text-align: center;
}

.api-info h4 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 8px;
}

.api-info p {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 12px;
}

.api-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-error {
    background: #dc3545;
}

.status-warning {
    background: #ffc107;
}

.status-success {
    background: #28a745;
    animation: pulse 2s infinite;
}

.api-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-text {
    background: none;
    border: none;
    color: #6c757d;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.3s;
}

.btn-text:hover {
    color: #667eea;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== AI 卡片增强样式 ===== */
.ai-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
}

.api-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: white;
    border-radius: 16px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    cursor: pointer;
}

.upload-icon {
    font-size: 64px;
}

.upload-text {
    text-align: center;
}

.upload-text strong {
    display: block;
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.upload-text small {
    color: #6c757d;
    font-size: 13px;
}

.image-preview {
    margin-top: 20px;
}

.image-preview img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.counter-icon {
    margin-right: 6px;
}

.ai-tips details {
    cursor: pointer;
}

.ai-tips summary {
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

.ai-tips ul {
    margin-top: 12px;
    padding-left: 20px;
    color: #6c757d;
    font-size: 13px;
    line-height: 1.8;
}

/* ===== API 设置卡片样式 ===== */
.api-settings-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
}

.card-header-large {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.api-status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.required {
    color: #dc3545;
}

.input-with-action {
    display: flex;
    gap: 8px;
}

.input-with-action input {
    flex: 1;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.help-text {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: 13px;
}

.api-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-box {
    background: white;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-value.success {
    color: #28a745;
}

.api-guide {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin: 24px 0;
}

.api-guide summary {
    font-weight: 600;
    cursor: pointer;
    color: #667eea;
    user-select: none;
}

.guide-content {
    margin-top: 20px;
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.guide-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-desc strong {
    display: block;
    margin-bottom: 6px;
    color: #2c3e50;
}

.step-desc p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

.link-button {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.guide-notes {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px;
    border-radius: 8px;
}

.guide-notes h4 {
    margin-bottom: 12px;
    color: #856404;
}

.guide-notes ul {
    margin-left: 20px;
    color: #856404;
    font-size: 14px;
    line-height: 1.8;
}

.api-danger-zone {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px dashed #dee2e6;
}

.btn-outline,
.btn-danger-outline {
    background: white;
    border: 2px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9fa;
}

.btn-danger-outline {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-danger-outline:hover {
    background: #dc3545;
    color: white;
}

/* 摄入比例控制器样式 */
.portion-control {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e0e0e0;
}

.portion-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, #667eea, #764ba2);
    border-radius: 3px;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.portion-control input[type="range"]:hover {
    opacity: 1;
}

.portion-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
}

.portion-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.5);
}

.portion-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
}

.portion-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.5);
}

.portion-value {
    display: inline-block;
    text-align: center;
}

/* 智能食谱推荐样式 */
.meal-plan-section {
    margin-top: 40px;
    padding: 30px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h4 {
    margin: 0;
    color: #667eea;
    font-size: 20px;
}

.plan-intro {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 24px;
}

.plan-intro p {
    margin: 0;
    color: #555;
    font-size: 14px;
}

.plan-alert {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.plan-alert strong {
    color: #856404;
    font-size: 16px;
}

.plan-alert small {
    color: #856404;
    opacity: 0.9;
}

.meal-plan-options {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.meal-plan-option {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s;
}

.meal-plan-option:hover {
    border-color: #667eea;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.plan-header h5 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.plan-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.plan-description {
    color: #666;
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.6;
}

.plan-summary {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    margin: 16px 0;
}

.plan-summary h6 {
    margin: 0 0 12px 0;
    color: #555;
    font-size: 14px;
}

.nutrition-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nutrition-badge {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
}

.nutrition-badge.good {
    background: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.nutrition-badge.warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.week-schedule {
    margin: 20px 0;
}

.day-details {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.day-details summary {
    padding: 14px 18px;
    cursor: pointer;
    background: white;
    font-weight: 600;
    color: #667eea;
    transition: background 0.2s;
    user-select: none;
}

.day-details summary:hover {
    background: #f5f7ff;
}

.day-details[open] summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.day-meals {
    padding: 16px 18px;
    background: white;
}

.meal-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px 140px;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed #e0e0e0;
    align-items: center;
}

.meal-item:last-child {
    border-bottom: none;
}

.meal-time {
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
}

.meal-name {
    color: #333;
    font-weight: 500;
}

.meal-desc {
    color: #999;
    font-size: 12px;
}

.meal-nutrition-mini {
    color: #666;
    font-size: 11px;
    text-align: right;
}

.plan-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #e0e0e0;
}

.plan-actions button {
    flex: 1;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .meal-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .meal-nutrition-mini {
        text-align: left;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .nutrition-badges {
        flex-direction: column;
    }
}


/* 语言切换按钮样式 */
.language-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.25rem;
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    align-self: flex-start;
}

.lang-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   PWA 底部标签导航（移动端）
   ======================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    z-index: 1000;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    /* 隐藏顶部导航按钮 */
    .nav-buttons {
        display: none !important;
    }
    
    /* 给底部导航留出空间 */
    .container {
        padding-bottom: 80px;
    }
    
    /* 导航栏简化 */
    .navbar {
        padding: 12px 16px !important;
        position: sticky;
        top: 0;
    }
    
    .navbar h1 {
        font-size: 20px !important;
        margin-bottom: 0 !important;
    }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-height: 56px;
}

.bottom-nav-item.active {
    color: var(--primary-start);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 3px;
    background: var(--primary-start);
    border-radius: 0 0 3px 3px;
}

.bottom-nav-icon {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 3px;
}

.bottom-nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.bottom-nav-item.active .bottom-nav-label {
    font-weight: 700;
}

/* ========================================
   设置页安装入口 + 数据导出
   ======================================== */
.install-inline-box {
    background: linear-gradient(135deg, #e0f7fa 0%, #e8f5e9 100%);
    border: 1px solid #b2dfdb;
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.install-status-text {
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.install-inline-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.data-export-group {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.export-buttons .btn-secondary {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

/* ========================================
   离线提示条
   ======================================== */
.offline-toast {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: var(--warning);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ========================================
   老人友好优化 — 更大的字体和触摸区域
   ======================================== */

/* 全局字体放大 */
@media (max-width: 768px) {
    body {
        font-size: 17px;
    }
    
    .section {
        padding: 20px 16px !important;
    }
    
    .section h2 {
        font-size: 24px !important;
        margin-bottom: 20px;
    }
    
    .section h3 {
        font-size: 20px !important;
    }
    
    /* 更大的输入框和下拉框 */
    input[type="number"],
    input[type="text"],
    input[type="password"],
    input[type="date"],
    select {
        font-size: 17px !important;
        padding: 14px 16px !important;
        min-height: 52px;
        border-radius: 12px !important;
    }
    
    /* 更大的按钮 */
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        font-size: 17px !important;
        padding: 16px 24px !important;
        min-height: 52px;
        border-radius: 14px !important;
        font-weight: 700 !important;
    }
    
    /* 表单标签 */
    .form-group label,
    label {
        font-size: 16px !important;
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
    }
    
    /* 仪表盘指标值 */
    .metric-value {
        font-size: 22px !important;
    }
    
    .metric-card h3 {
        font-size: 18px !important;
    }
    
    /* 进度条更粗 */
    .progress-bar {
        height: 12px !important;
        border-radius: 6px !important;
    }
    
    /* 今日饮食列表 */
    .meal-entry {
        padding: 16px !important;
        font-size: 16px !important;
    }
    
    /* 数据管理按钮间距 */
    .settings-card .btn-secondary,
    .settings-card .btn-danger {
        margin: 6px 0 !important;
        width: 100%;
    }
    
    /* 上传区域更大 */
    .upload-label {
        padding: 30px 20px !important;
    }
    
    .upload-icon {
        font-size: 56px !important;
    }
    
    .upload-text strong {
        font-size: 18px !important;
    }
    
    /* 成员选择器 */
    .member-select {
        font-size: 16px !important;
        padding: 10px 16px !important;
    }
    
    /* 表格更大字体 */
    table {
        font-size: 15px !important;
    }
    
    thead th, tbody td {
        padding: 14px 10px !important;
    }
    
    /* 警告提示更明显 */
    .warnings .warning-item,
    #warnings > div {
        font-size: 16px !important;
        padding: 14px !important;
    }
}

/* standalone 模式（从桌面打开时）额外优化 */
@media all and (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top, 12px) !important;
    }
}

@media (max-width: 768px) {
    .install-inline-actions {
        flex-direction: column;
    }

    .install-inline-actions .btn-primary,
    .install-inline-actions .btn-outline {
        width: 100%;
        min-width: auto;
    }

    .export-buttons {
        flex-direction: column;
    }

    .export-buttons .btn-secondary {
        width: 100%;
    }

    .navbar-top h1 {
        font-size: 20px;
        margin-bottom: 0;
    }
}
