/* ===== CSS 变量 & 全局重置 ===== */
:root {
  --primary: #e67e22;
  --primary-light: #f39c12;
  --primary-dark: #d35400;
  --bg: #f8f6f3;
  --bg-card: #ffffff;
  --bg-sidebar: #2c3e50;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --text-sidebar: #ecf0f1;
  --border: #e0d8d0;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f1c40f;
  --meal-bg: #fef9f4;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== 布局 ===== */
#app { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
#sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h1 { font-size: 20px; font-weight: 700; }
.nav-list { list-style: none; padding: 12px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active {
  background: rgba(255,255,255,0.12);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-icon { font-size: 18px; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
}

/* ===== 主内容 ===== */
#main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
  overflow-y: auto;
}
.page { display: none; }
.page.active { display: block; }

/* ===== 页头 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.page-header h2 { font-size: 24px; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ===== 周导航 ===== */
.week-nav { display: flex; align-items: center; gap: 12px; }
.week-nav span { font-weight: 600; min-width: 100px; text-align: center; }

/* ===== 周网格 ===== */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }

.day-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-height: 200px;
}
.day-card.today { border: 2px solid var(--primary); }
.day-card-header {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--meal-bg);
  display: flex;
  justify-content: space-between;
}
.day-card-header .date-badge {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

.meal-slot {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--meal-bg);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.meal-slot:hover { background: #fef0e0; }
.meal-slot.breakfast { border-left-color: var(--primary-light); }
.meal-slot.lunch { border-left-color: var(--primary); }
.meal-slot.dinner { border-left-color: var(--primary-dark); }

.meal-label { font-size: 12px; color: var(--text-light); font-weight: 600; display: block; margin-bottom: 2px; }
.meal-name { font-size: 14px; font-weight: 600; }
.meal-empty { font-size: 13px; color: #bbb; font-style: italic; }

/* ===== 食谱卡片网格 ===== */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.recipe-card h3 { font-size: 18px; margin-bottom: 6px; }
.recipe-card .recipe-meta {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
}
.recipe-card .recipe-ingredients {
  font-size: 13px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1000;
  padding: 40px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  margin: auto 0;
}
.modal.modal-lg { max-width: 680px; }
.modal.modal-xl { max-width: 95vw; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 28px 32px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 0 24px 20px;
  justify-content: flex-end;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
.form-group .required { color: var(--danger); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-row { display: flex; gap: 16px; }
.flex-1 { flex: 1; }

.ingredient-row,
.ingredient-row input { flex: 1; }
.ingredient-row .ingr-amount { max-width: 80px; }
.ingredient-row .ingr-unit { max-width: 80px; }
.btn-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}
.btn-remove:hover { background: #fde8e8; }

/* ===== 食谱详情 ===== */
.recipe-detail .rd-header { margin-bottom: 16px; }
.recipe-detail .rd-header h2 { font-size: 22px; margin-bottom: 4px; }
.recipe-detail .rd-meta { color: var(--text-light); font-size: 14px; }
.recipe-detail .rd-section { margin-bottom: 20px; }
.recipe-detail .rd-section h4 {
  font-size: 16px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.recipe-detail .rd-ingredient {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.recipe-detail .rd-step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.recipe-detail .rd-step .step-num {
  font-weight: 700;
  color: var(--primary);
  min-width: 28px;
  height: 28px;
  background: var(--meal-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.recipe-detail .rd-step .rd-step-content { flex: 1; }
.recipe-detail .rd-step-img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  object-fit: contain;
  background: #f8f8f8;
}

/* ===== 步骤配图（表单中） ===== */
.step-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.step-row .step-num {
  font-weight: 700; color: var(--primary); min-width: 24px; padding-top: 8px;
}
.step-row .step-text-input { flex: 1; }
.step-image-area {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #fafafa;
}
.btn-step-img {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-light);
  padding: 4px;
  line-height: 1.3;
  text-align: center;
}
.btn-step-img:hover { color: var(--primary); }
.step-img-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.btn-step-img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn-step-img-remove:hover { background: var(--danger); }

/* ===== 购物清单 ===== */
.shopping-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.shopping-summary {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.shopping-summary span strong { color: var(--text); }

.shopping-list { display: flex; flex-direction: column; gap: 8px; }
.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.shopping-item.checked { opacity: 0.6; background: #f5f5f5; }
.shopping-item.checked .item-name { text-decoration: line-through; }
.shopping-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.shopping-item .item-info { flex: 1; }
.shopping-item .item-name { font-weight: 600; font-size: 15px; }
.shopping-item .item-amount { color: var(--text-light); font-size: 13px; margin-left: 8px; }
.shopping-item .item-source { font-size: 12px; color: var(--primary-light); }
.shopping-item .item-actions { display: flex; gap: 6px; }
.shopping-item .btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-light);
}
.shopping-item .btn-icon:hover { background: #f0f0f0; color: var(--danger); }

/* ===== 厨房库存 ===== */
.inventory-actions { display: flex; gap: 10px; align-items: center; }
.search-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 220px;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--primary); }

.inventory-grid { display: flex; flex-direction: column; gap: 20px; }
.inv-category h3 {
  font-size: 16px;
  margin-bottom: 10px;
  padding: 8px 0;
  border-bottom: 2px solid var(--meal-bg);
}
.inv-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.inv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: all 0.15s;
}
.inv-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.inv-item .inv-name { font-weight: 600; font-size: 14px; }
.inv-item .inv-amount { color: var(--text-light); font-size: 13px; margin-left: 6px; }
.inv-item .inv-actions { display: flex; gap: 4px; }
.inv-item .inv-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-light);
}
.inv-item .inv-actions button:hover { background: #f0f0f0; }
.inv-item .inv-actions .inv-del:hover { color: var(--danger); }
.inv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 15px;
}

/* ===== 营养标签 ===== */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.nutrition-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fafaf7;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.nutrition-field label {
  font-size: 12px;
  font-weight: 500 !important;
  margin-bottom: 0 !important;
  min-width: 56px;
  white-space: nowrap;
}
.nutrition-field input {
  width: 60px !important;
  padding: 6px 8px !important;
  font-size: 13px !important;
  text-align: center;
}
.nutrition-field .nutrition-unit {
  font-size: 12px;
  color: var(--text-light);
}

/* 库存卡片上的营养标签 */
.inv-nutrition {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.inv-nutrition .nut-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #f0f7ee;
  color: #4a7c3f;
  white-space: nowrap;
}
.inv-nutrition .nut-tag.protein { background: #fdf0f0; color: #c0392b; }
.inv-nutrition .nut-tag.fiber { background: #f0f7ee; color: #4a7c3f; }
.inv-nutrition .nut-tag.carbs { background: #fef9f0; color: #b8860b; }
.inv-nutrition .nut-tag.fat { background: #fdf6f0; color: #8b6914; }

/* ===== 食谱选择器 ===== */
.picker-search {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
}
.picker-search:focus { outline: none; border-color: var(--primary); }
.picker-list { max-height: 300px; overflow-y: auto; }
.picker-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.picker-item:hover { background: var(--meal-bg); }
.picker-item .pi-name { font-weight: 600; font-size: 14px; }
.picker-item .pi-meta { font-size: 12px; color: var(--text-light); }
.picker-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-light);
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-sidebar);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 食谱卡片图片 ===== */
.recipe-card-img {
  width: calc(100% + 40px);
  height: 180px;
  object-fit: cover;
  margin: -20px -20px 12px -20px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block;
}
.recipe-card-img-placeholder {
  width: calc(100% + 40px);
  height: 120px;
  margin: -20px -20px 12px -20px;
  background: linear-gradient(135deg, #fef9f4 0%, #fef0e0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ===== 食谱详情图片 ===== */
.recipe-detail-img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ===== 照片上传 ===== */
.photo-upload-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.photo-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #f8f8f8;
  padding: 4px;
}
.photo-preview.hidden { display: none; }
.photo-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* ===== 小红书导入 ===== */
.import-guide {
  background: #fef9f4;
  border: 1px solid #fef0e0;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.8;
}
.import-guide ol { padding-left: 20px; }
.import-guide li { margin-bottom: 2px; }
#import-text:focus { outline: none; border-color: var(--primary) !important; }

.import-result {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}
.import-result.hidden { display: none; }

.import-ing-row,
.import-step-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
.import-ing-row input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; }
.import-ing-row input:focus { outline: none; border-color: var(--primary); }
.import-ing-row .ii-amount { max-width: 80px; }
.import-ing-row .ii-unit { max-width: 70px; }
.import-step-row .is-num {
  font-weight: 700; color: var(--primary); min-width: 22px; font-size: 13px;
}
.import-step-row input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; }
.import-step-row input:focus { outline: none; border-color: var(--primary); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

/* 导入图片区 */
.import-images {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 80px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
  align-items: center;
}
.import-images-empty {
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
  width: 100%;
}
.import-img-thumb {
  width: 100px;
  height: 100px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.import-img-thumb:hover { border-color: var(--primary); }
.import-img-thumb.cover { border-color: var(--success); }
.import-img-wrapper {
  position: relative;
  display: inline-block;
}
.import-img-wrapper .img-label {
  position: absolute;
  top: -6px;
  left: -6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--success);
  color: #fff;
  z-index: 1;
}
.import-img-wrapper .img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.import-img-wrapper .img-remove:hover { background: var(--danger); }
.import-step-img {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  object-fit: cover;
  vertical-align: middle;
  margin-left: 8px;
}

.parsed-badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== 全屏烹饪模式 ===== */
.cooking-overlay {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.cooking-overlay.hidden { display: none; }
.cooking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0,0,0,0.3);
}
.cooking-title { font-size: 18px; font-weight: 700; }
.cooking-controls { display: flex; align-items: center; gap: 16px; }
.cooking-progress { font-size: 14px; color: rgba(255,255,255,0.7); }
.cooking-close-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.cooking-close-btn:hover { background: rgba(255,255,255,0.2); }

.cooking-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.cooking-step-img-container {
  width: 100%;
  max-width: 600px;
  height: 50vh;
  max-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  border-radius: 16px;
  margin-bottom: 24px;
  overflow: hidden;
}
.cooking-step-img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cooking-no-img { font-size: 64px; opacity: 0.3; }
.cooking-step-text {
  font-size: 20px;
  line-height: 1.7;
  text-align: center;
  max-width: 600px;
  padding: 0 16px;
  color: rgba(255,255,255,0.9);
}

.cooking-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0,0,0,0.3);
}
.cooking-footer .btn { min-width: 120px; justify-content: center; }
.cooking-footer .btn-outline {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.3);
}
.cooking-footer .btn-outline:hover {
  border-color: rgba(255,255,255,0.7);
  color: #fff;
}

.cooking-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cooking-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: all 0.3s;
  cursor: pointer;
}
.cooking-dot.active { background: var(--primary); transform: scale(1.3); }
.cooking-dot.done { background: var(--success); }

/* ===== 今日营养概览 ===== */
.nutrition-summary {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.nutrition-summary.hidden { display: none; }
.nutrition-summary h3 {
  font-size: 15px;
  margin-bottom: 14px;
}
.nutrition-summary-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.ns-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ns-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ns-bar-label {
  font-size: 13px;
  font-weight: 600;
}
.ns-bar-nums {
  font-size: 12px;
  color: var(--text-light);
}
.ns-bar-nums .current { font-weight: 700; color: var(--text); }
.ns-bar-track {
  height: 8px;
  border-radius: 4px;
  background: #eee;
  overflow: hidden;
}
.ns-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.ns-bar-fill.protein { background: #e74c3c; }
.ns-bar-fill.fiber { background: #4caf50; }
.ns-bar-fill.carbs { background: #f39c12; }
.ns-bar-fill.fat { background: #8d6e63; }
.ns-bar-fill.over { opacity: 0.7; }
.ns-no-profile {
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
  padding: 8px;
}
@media (max-width: 700px) {
  .nutrition-summary-bars { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 智能推荐 ===== */
.recommend-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.recommend-panel.hidden { display: none; }
.recommend-panel h3 { font-size: 15px; margin-bottom: 6px; }
.recommend-panel .rec-reason { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }
.rec-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
}
.rec-card {
  flex: 1;
  min-width: 200px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.rec-card:hover { border-color: var(--primary); background: #fef9f4; }
.rec-card h4 { font-size: 16px; margin-bottom: 4px; }
.rec-card .rec-score { font-size: 12px; color: var(--success); margin-bottom: 8px; }
.rec-card .rec-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.rec-card .rec-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e8f5e9;
  color: #2e7d32;
}
.rec-card .rec-tag.gap { background: #fde8e8; color: #c0392b; }
.rec-card .rec-tag.stock { background: #e3f2fd; color: #1565c0; }
.rec-card .rec-actions { display: flex; gap: 6px; margin-top: 10px; }
.rec-card .rec-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.rec-card .rec-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.rec-loading { text-align: center; padding: 20px; color: var(--text-light); font-size: 14px; }

/* ===== 个人档案 ===== */
.profile-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.profile-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-tab:hover { border-color: var(--primary); }
.profile-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.profile-tab .pt-delete {
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.6;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: inherit;
}
.profile-tab .pt-delete:hover { opacity: 1; background: rgba(0,0,0,0.15); }
.profile-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.profile-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--meal-bg);
}
.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.profile-info-item {
  background: var(--meal-bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-info-item .pi-label {
  font-size: 12px;
  color: var(--text-light);
}
.profile-info-item .pi-value {
  font-size: 18px;
  font-weight: 700;
}
.profile-info-item .pi-status {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  display: inline-block;
  width: fit-content;
}
.pi-status.low { background: #fde8e8; color: #c0392b; }
.pi-status.ok { background: #e8f5e9; color: #2e7d32; }
.pi-status.high { background: #fff3e0; color: #e65100; }
.pi-status.warn { background: #fff8e1; color: #f9a825; }

/* 营养目标大卡片 */
.nutrition-goals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.nutrition-goal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--border);
}
.nutrition-goal-card.protein { border-top-color: #e74c3c; }
.nutrition-goal-card.fiber { border-top-color: #4caf50; }
.nutrition-goal-card.carbs { border-top-color: #f39c12; }
.nutrition-goal-card.fat { border-top-color: #8d6e63; }

.nutrition-goal-card .ng-icon { font-size: 28px; margin-bottom: 8px; }
.nutrition-goal-card .ng-label { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.nutrition-goal-card .ng-value { font-size: 32px; font-weight: 700; }
.nutrition-goal-card .ng-unit { font-size: 14px; color: var(--text-light); }
.nutrition-goal-card .ng-desc { font-size: 12px; color: var(--text-light); margin-top: 4px; }

@media (max-width: 700px) {
  .nutrition-goals { grid-template-columns: repeat(2, 1fr); }
  .profile-info-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 日视图（今日吃什么） ===== */
.day-view {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.day-view .dv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.day-view .dv-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.day-view .dv-today-badge {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}
.day-view .dv-meals { display: flex; flex-direction: column; gap: 10px; }
.day-view .dv-meal {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--meal-bg);
  border-left: 4px solid var(--primary);
  cursor: pointer;
  transition: all 0.15s;
  gap: 12px;
}
.day-view .dv-meal:active { transform: scale(0.98); }
.day-view .dv-meal.breakfast { border-left-color: var(--primary-light); }
.day-view .dv-meal.lunch { border-left-color: var(--primary); }
.day-view .dv-meal.dinner { border-left-color: var(--primary-dark); }
.day-view .dv-meal-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  min-width: 44px;
  white-space: nowrap;
}
.day-view .dv-meal-name {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
}
.day-view .dv-meal-empty {
  color: #bbb;
  font-weight: 400;
  font-style: italic;
  font-size: 14px;
}
.day-view .dv-meal-action {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  white-space: nowrap;
  transition: all 0.15s;
}
.day-view .dv-meal-action:hover { border-color: var(--primary); color: var(--primary); }
.day-view .dv-meal-action:active { transform: scale(0.95); }
.day-view .dv-go-link {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.day-view .dv-go-link:hover { text-decoration: underline; }

/* ===== GO！按钮 ===== */
.go-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(135deg, #ff2442, #ff6b81);
  color: #fff !important;
  text-align: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 3px;
  text-decoration: none;
  transition: all 0.2s;
  min-height: 48px;
  box-shadow: 0 2px 8px rgba(255, 36, 66, 0.25);
}
.go-btn:hover { transform: scale(1.02); box-shadow: 0 4px 16px rgba(255, 36, 66, 0.35); }
.go-btn:active { transform: scale(0.97); }

/* ===== 底部导航栏（手机端） ===== */
#mobile-nav { display: none; }

/* ===== 手机端适配 ===== */
@media (max-width: 768px) {
  /* 隐藏侧边栏 */
  #sidebar { display: none; }

  /* 显示底部导航 */
  #mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    z-index: 900;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0);
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .mnav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 8px 0 10px;
    font-size: 12px;
    flex: 1;
    min-height: 64px;
    cursor: pointer;
    border-top: 3px solid transparent;
    transition: all 0.2s;
    opacity: 0.6;
    color: var(--text-sidebar);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-item.active {
    opacity: 1;
    border-top-color: var(--primary);
  }
  .mnav-item:active { opacity: 0.8; }

  #main-content {
    padding: 14px;
    padding-bottom: 72px;
    max-width: 100%;
    flex: 1;
  }

  /* 全屏弹窗 */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }
  .modal.modal-lg,
  .modal.modal-xl { max-width: 100%; border-radius: 16px 16px 0 0; }
  .modal-header { padding: 14px 18px 0; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 0 18px 14px; }

  /* 大触摸区域 */
  .btn { min-height: 44px; padding: 12px 18px; font-size: 15px; }

  /* 食谱卡片 — 两列 */
  .recipe-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .recipe-card { padding: 14px; }
  .recipe-card h3 { font-size: 15px; }
  .recipe-card-img { height: 120px; }
  .recipe-card-img-placeholder { height: 80px; font-size: 28px; }
  .recipe-card .recipe-meta { font-size: 11px; margin-bottom: 6px; }
  .recipe-card .recipe-ingredients { font-size: 12px; -webkit-line-clamp: 1; }

  /* 周网格 — 横滑 */
  .week-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 12px;
  }
  .day-card {
    min-width: 82vw;
    flex-shrink: 0;
    scroll-snap-align: start;
    min-height: auto;
    padding: 14px;
  }

  /* 购物清单 */
  .shopping-item { padding: 14px 16px; gap: 14px; }
  .shopping-item input[type="checkbox"] { width: 22px; height: 22px; }
  .shopping-item .item-name { font-size: 15px; }
  .shopping-actions { flex-direction: column; }
  .shopping-actions .btn { justify-content: center; }

  /* 库存 */
  .inv-items { grid-template-columns: 1fr; }
  .search-input { width: 100%; }
  .inventory-actions { flex-direction: column; align-items: stretch; }

  /* 页头纵向排列 */
  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-header h2 { font-size: 20px; }
  .page-header > div { flex-direction: column; }
  .page-header > div .btn { justify-content: center; }

  /* 周导航 */
  .week-nav span { min-width: auto; font-size: 13px; }

  /* 营养概览 */
  .nutrition-summary { padding: 16px; }
  .nutrition-summary-bars { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* 推荐卡片 */
  .rec-cards { gap: 10px; }
  .rec-card { min-width: 160px; padding: 12px; flex: 0 0 auto; }

  /* 营养目标卡片 */
  .nutrition-goals { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* 档案 */
  .profile-info-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .profile-section { padding: 16px; }

  /* 表单 */
  .form-row { flex-direction: column; gap: 0; }
  .nutrition-grid { grid-template-columns: 1fr; }

  /* 食谱详情 */
  .recipe-detail .rd-header h2 { font-size: 20px; }
  .recipe-detail-img { max-height: 200px; }

  /* 导入区域 */
  .import-guide { font-size: 13px; padding: 12px; }

  /* 全屏烹饪模式 */
  .cooking-step-img-container { height: 35vh; }
  .cooking-step-text { font-size: 17px; }
  .cooking-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .cooking-footer { padding: 12px 16px; }
  .cooking-footer .btn { min-width: auto; flex: 1; }

  /* Toast 避开底部导航 */
  .toast-container { bottom: 80px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}
