:root {
  --ink: #12221a;
  --muted: #607268;
  --line: #d7e7dd;
  --soft: #f1f8f3;
  --surface: #ffffff;
  --green: #1f9d68;
  --green-dark: #126643;
  --mint: #daf4e5;
  --lime: #bfe67a;
  --yellow: #f2c94c;
  --blue: #3176b7;
  --red: #c95c4c;
  --shadow: 0 18px 45px rgba(20, 62, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background: #fbfdfb;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(215, 231, 221, 0.85);
  background: rgba(251, 253, 251, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.nav-button,
.nav-item {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
}

.nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.nav-item {
  color: var(--muted);
  padding: 8px 2px;
}

.nav-item.active,
.nav a:hover,
.nav-item:hover {
  color: var(--green-dark);
}

.auth-button {
  white-space: nowrap;
}

.page {
  display: none !important;
}

.page.active {
  display: grid !important;
}

.section.page.active {
  display: block !important;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
  gap: 40px;
  align-items: center;
  min-height: calc(100vh - 70px);
  padding: 6vh 5vw;
  background:
    linear-gradient(135deg, rgba(236, 247, 238, 0.98) 0%, rgba(255, 255, 255, 0.85) 60%),
    radial-gradient(circle at 75% 20%, rgba(191, 230, 122, 0.35), transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(200, 240, 210, 0.4), transparent 35%);
  overflow: hidden;
}

.hero-tagline {
  margin: 0 0 16px;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 900;
  line-height: 1.12;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.hero-sub {
  margin: 0 0 32px;
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--muted);
  line-height: 1.7;
}

.hero-btn-primary {
  font-size: 15px;
  padding: 0 28px;
  min-height: 50px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(31, 157, 104, 0.35);
}

.hero-features {
  display: flex;
  gap: 24px;
  margin-top: 44px;
  flex-wrap: wrap;
}

.hero-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 130px;
}

.hf-icon {
  font-size: 22px;
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-feature strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.hero-feature p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* 右侧视觉区 */
.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.hero-food-bowl {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.hero-bowl-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 24px 48px rgba(20, 80, 40, 0.18));
  border-radius: 50%;
}

.hero-leaf {
  position: absolute;
  font-size: 32px;
  animation: leafFloat 4s ease-in-out infinite;
  pointer-events: none;
}
.hero-leaf-1 { top: -10px; left: -20px; animation-delay: 0s; }
.hero-leaf-2 { bottom: 20px; right: -10px; animation-delay: 2s; font-size: 24px; }

@keyframes leafFloat {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

/* 浮动卡片 */
.hero-float-card {
  position: absolute;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 28px rgba(20,62,42,0.12);
  backdrop-filter: blur(8px);
  z-index: 5;
  animation: cardFloat 5s ease-in-out infinite;
}
.hfc-top { top: 10px; right: -10px; animation-delay: 0.5s; }
.hfc-bottom { bottom: 40px; left: -10px; animation-delay: 2.5s; }

@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hfc-icon { font-size: 24px; }
.hfc-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--green-dark);
  line-height: 1;
}
.hfc-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 40px 5vw;
    gap: 30px;
  }
  .hero-visual { min-height: 280px; }
  .hero-food-bowl { max-width: 280px; margin: 0 auto; }
  .hfc-top { top: 0; right: 0; }
  .hfc-bottom { bottom: 10px; left: 0; }
}

main {
  min-height: calc(100vh - 70px);
}

.hero-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(40px, 6.2vw, 76px);
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  font-size: 32px;
  line-height: 1.2;
}

h3 {
  font-size: 22px;
  line-height: 1.25;
}

.lead,
.section-title p,
.panel p,
.api-state,
.footer {
  color: var(--muted);
  line-height: 1.75;
}

.lead {
  max-width: 670px;
  font-size: 18px;
}

.hero-actions,
.tag-row,
.stat-row,
.voice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  color: #fff;
  background: var(--green);
}

.button.ghost {
  color: var(--green-dark);
  border-color: #a9d7ba;
  background: #fff;
}

.dashboard-preview {
  position: relative;
  min-height: 540px;
}

.plate {
  position: absolute;
  inset: 75px 48px auto auto;
  width: min(82vw, 400px);
  aspect-ratio: 1;
  border: 18px solid #fff;
  border-radius: 50%;
  background: #ecf7ef;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.plate span {
  position: absolute;
  display: block;
}

.leaf {
  inset: 9% 50% 52% 8%;
  border-radius: 45% 55% 50% 46%;
  background: #2fb574;
}

.grain {
  inset: 12% 12% 50% 54%;
  border-radius: 48% 40% 54% 44%;
  background: #efd469;
}

.protein {
  inset: 52% 48% 10% 10%;
  border-radius: 42% 58% 44% 50%;
  background: #df765f;
}

.fat {
  inset: 52% 12% 12% 54%;
  border-radius: 50%;
  background: #91b85d;
}

.preview-card {
  position: absolute;
  z-index: 2;
  width: 182px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 30px rgba(20, 62, 42, 0.12);
}

.preview-card span,
.preview-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.preview-card strong {
  display: block;
  margin: 7px 0;
  font-size: 28px;
}

.preview-card.wide {
  left: 0;
  top: 20px;
  width: 245px;
}

.preview-card.score {
  left: 18px;
  bottom: 76px;
}

.preview-card.food {
  right: 0;
  bottom: 32px;
  width: 210px;
}

.section {
  padding: 84px 5vw;
  border-top: 1px solid var(--line);
  background: var(--soft);
}

.section.white {
  background: #fff;
}

.section-title {
  max-width: 860px;
  margin-bottom: 24px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 62, 42, 0.05);
}

.hidden {
  display: none !important;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.full {
  grid-column: 1 / -1;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  color: #33483c;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cadfd2;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

legend {
  padding: 0 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.check input {
  width: auto;
}

.advice-panel {
  margin-top: 18px;
}

.profile-layout,
.recommend-layout,
.planner-layout {
  display: grid;
  gap: 18px;
}

.profile-layout {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.recommend-layout {
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr) minmax(260px, 0.9fr);
  margin-top: 18px;
}

.planner-layout {
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.2fr) minmax(280px, 0.9fr);
}

.profile-grid,
.food-columns {
  display: grid;
  gap: 12px;
}

.profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-grid span,
.food-columns div,
.meal-card,
.meal-echo {
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.profile-grid strong,
.food-columns strong,
.meal-card strong,
.meal-echo strong {
  display: block;
  margin-bottom: 4px;
  color: var(--green-dark);
}

.food-columns p,
.meal-card p,
.meal-echo p,
.plan-items p {
  margin: 0;
}

.planner-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.user-plan,
.manual-food {
  display: grid;
  gap: 12px;
}

.manual-food {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manual-food .button {
  grid-column: 1 / -1;
}

.plan-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.plan-slot-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.plan-slot-head span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.tiny {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.stat-row span {
  flex: 1 1 150px;
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: var(--soft);
}

.stat-row strong {
  display: block;
  color: var(--green-dark);
  font-size: 25px;
}

.meal-layout,
.weight-layout,
.diet-detail {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
}

.upload-panel {
  display: grid;
  gap: 16px;
}

.upload-box {
  min-height: 210px;
  place-items: center;
  border: 1px dashed #92c7a6;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background: #f7fcf8;
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.meal-preview {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}

.hint {
  color: var(--muted);
  line-height: 1.6;
}

.plus {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 32px;
}

.recognition-panel {
  display: grid;
  align-content: center;
  gap: 12px;
}

.score-ring {
  display: grid;
  width: 126px;
  height: 126px;
  place-items: center;
  position: relative;
  color: var(--green-dark);
  font-size: 38px;
  font-weight: 900;
}
.score-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-ring .ring-bg { fill: none; stroke: var(--mint); stroke-width: 10; }
.score-ring .ring-fill { fill: none; stroke: var(--green); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.score-ring span { position: relative; z-index: 1; }

.candidate-list {
  display: grid;
  gap: 10px;
}

.candidate {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  min-width: 0;
  overflow: hidden;
}

.candidate strong {
  color: var(--ink);
}

.candidate span,
.tag,
.action {
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--green-dark);
  background: var(--mint);
  font-size: 13px;
  font-weight: 800;
  /* 防止内容撑破容器 */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 照片预览容器 */
.preview-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* 删除照片叉号按钮 */
.preview-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(18, 34, 26, 0.6);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
}

.preview-delete:hover {
  background: rgba(201, 92, 76, 0.85);
}

.food-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  max-width: 820px;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.meal-plan {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.meal-plan h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.food-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.food-card .button {
  margin-top: 4px;
}

.food-card h3 {
  margin: 0;
  font-size: 18px;
}

.food-card p {
  margin: 0;
}

.macro-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.macro-mini span {
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: var(--soft);
  font-size: 12px;
}

.diet-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.tab {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid #c7decf;
  border-radius: 8px;
  padding: 0 14px;
  color: #3d5547;
  background: #fff;
  cursor: pointer;
}

.tab.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.macro-bars {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.macro-row {
  display: grid;
  grid-template-columns: 76px 1fr 64px;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.bar {
  height: 12px;
  border-radius: 999px;
  background: #e6f0e9;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.chart-panel {
  min-width: 0;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.weight-panel {
  display: grid;
  gap: 14px;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action {
  border-radius: 8px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 5vw;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: grid;
  gap: 4px;
  width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toast strong {
  color: var(--green-dark);
}

.toast span {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 34, 26, 0.32);
}

.modal-panel {
  position: relative;
  width: min(760px, 100%);
  border-radius: 8px;
  padding: 26px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 28px;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.login-method {
  display: grid;
  gap: 10px;
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.login-method span {
  color: var(--muted);
  font-weight: 500;
}

.qr-placeholder {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 8px;
  color: var(--green-dark);
  background: #fff;
  font-weight: 900;
}

@media (max-width: 1040px) {
  .hero,
  .meal-layout,
  .weight-layout,
  .diet-detail,
  .profile-layout,
  .recommend-layout,
  .planner-layout {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .food-grid,
  .meal-plan,
  fieldset,
  .manual-food {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-preview {
    min-height: 470px;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 5vw;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .hero {
    min-height: auto;
    padding-top: 50px;
  }

  h1 {
    font-size: 38px;
  }

  .dashboard-preview {
    display: grid;
    gap: 12px;
    min-height: auto;
  }

  .plate,
  .preview-card {
    position: static;
    width: 100%;
  }

  .plate {
    width: min(88vw, 360px);
    justify-self: center;
  }

  .form-grid,
  .food-search,
  .food-grid,
  .meal-plan,
  .profile-grid,
  fieldset,
  .manual-food,
  .login-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
  }
}

/* ===================================================
   新增：顶栏右侧按钮组
   =================================================== */
.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-action-btn {
  font-size: 13px;
  min-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
  border-color: var(--green);
  color: var(--green-dark);
}

/* ===================================================
   饮食计划 — 双栏布局
   =================================================== */
.planner-tip {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 18px;
}

.dual-planner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.planner-col {
  display: grid;
  gap: 16px;
}

/* 日期导航栏 */
.planner-col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.date-arrow {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.date-arrow:hover {
  background: var(--mint);
}

.date-label {
  flex: 1;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--soft);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dark);
  transition: background 0.15s;
}

.date-label:hover {
  background: var(--mint);
}

.col-title {
  margin: 0;
  font-size: 18px;
  color: var(--green-dark);
  text-align: center;
}

/* ===================================================
   圆环（小尺寸，用于计划/执行栏）
   =================================================== */
.macro-rings {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mini-ring {
  position: relative;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
}

.mini-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.mini-ring .ring-bg {
  fill: none;
  stroke: var(--mint);
  stroke-width: 8;
}

.mini-ring .ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.mini-ring-val {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}

.mini-ring-label {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.macro-row-edit {
  grid-template-columns: 76px minmax(0, 1fr) 66px;
}

.macro-row-edit strong {
  display: grid;
  gap: 1px;
  text-align: right;
  color: var(--green-dark);
}

.macro-row-edit strong small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.macro-slider-wrap {
  position: relative;
  display: grid;
  align-items: center;
}

.macro-slider {
  position: absolute;
  inset: -7px 0 auto;
  width: 100%;
  opacity: 0;
  cursor: ew-resize;
}

.macro-row-edit:hover .bar {
  box-shadow: 0 0 0 3px rgba(34, 160, 107, .1);
}

.mini-ring-target {
  width: 88px;
  min-height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--green-dark);
  background: rgba(239, 249, 232, .78);
  border: 1px solid rgba(185, 222, 198, .7);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

/* ===================================================
   餐次卡片
   =================================================== */
.meal-slots {
  display: grid;
  gap: 10px;
}

.meal-slot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  transition: box-shadow 0.15s;
}

.meal-slot-card:hover {
  box-shadow: 0 4px 14px rgba(20, 62, 42, 0.08);
}

.meal-slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.meal-slot-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--green-dark);
}

.meal-slot-actions {
  display: flex;
  gap: 6px;
}

.slot-add-btn,
.slot-cam-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.slot-add-btn:hover {
  background: var(--mint);
  border-color: var(--green);
}

.slot-cam-btn {
  color: var(--blue);
  border-color: #b3cfe8;
}

.slot-cam-btn:hover {
  background: #e8f2fb;
}

.slot-items {
  display: grid;
  gap: 5px;
}

.slot-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  background: #fff;
}

.slot-item span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-item-cal {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.slot-del {
  border: none;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}

.slot-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

/* 缩略图 */
.slot-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.slot-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.15s;
}

.slot-thumb:hover {
  transform: scale(1.08);
}

/* ===================================================
   饮水量
   =================================================== */
.water-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--soft);
}

.water-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.water-label {
  font-weight: 800;
  color: var(--blue);
  font-size: 14px;
}

.water-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.water-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #b3cfe8;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.water-btn:hover {
  background: #e8f2fb;
}

#waterDisplay {
  font-weight: 800;
  color: var(--blue);
  min-width: 60px;
  text-align: center;
}

/* ===================================================
   分析按钮
   =================================================== */
.analyze-btn {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
  letter-spacing: 0.3px;
}

/* ===================================================
   食品库 — 推荐区
   =================================================== */
.food-rec-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.7;
  max-width: 760px;
}

.food-cat-list {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

.food-cat-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.food-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: var(--soft);
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  color: var(--green-dark);
  text-align: left;
  gap: 12px;
  transition: background 0.15s;
}

.food-cat-header:hover {
  background: var(--mint);
}

.cat-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  margin-left: auto;
}

.cat-arrow {
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.2s;
}

.food-cat-items {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
  max-height: 320px;
  overflow-y: auto;
}

.food-rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}

.food-rec-item:last-child {
  border-bottom: none;
}

.food-rec-item:hover {
  background: var(--soft);
}

.fri-info strong {
  display: block;
  font-size: 14px;
}

.fri-info small {
  color: var(--muted);
  font-size: 12px;
}

.fri-add {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 添加食物按钮行 */
.add-food-row {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

/* ===================================================
   日历
   =================================================== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 800;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-head {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px;
  font-weight: 700;
}

.cal-day {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  padding: 6px 0;
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
}

.cal-day:hover {
  background: var(--mint);
  border-color: var(--green);
}

.cal-selected {
  background: var(--green) !important;
  color: #fff !important;
  border-color: var(--green-dark) !important;
}

/* ===================================================
   加入计划弹窗 / 拍照识别加入行
   =================================================== */
.add-to-exec-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}

.add-to-exec-row label {
  flex: 1;
  min-width: 160px;
}

/* ===================================================
   响应式
   =================================================== */
@media (max-width: 900px) {
  .dual-planner {
    grid-template-columns: 1fr;
  }
  .topbar-right {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 5vw;
  }
  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
  }
  .topbar-right {
    width: 100%;
  }
  .macro-rings {
    gap: 6px;
  }
  .mini-ring {
    width: 58px;
    height: 58px;
  }
}

/* ===================================================
   新增样式
   =================================================== */

/* 滚轮式输入 */
.wheel-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 6px;
}

.wheel-btn {
  background: var(--soft);
  border: 0;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.wheel-btn:hover { background: var(--mint); }

.wheel-input {
  flex: 1;
  border: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 0;
  min-width: 0;
}
.wheel-input:focus { outline: none; }

/* 拍照识别页 - 小图预览 */
.meal-preview-small {
  max-height: 160px;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
  display: block;
  margin: 10px 0;
}

/* candidate 营养详情 */
.candidate {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--soft);
}
.cand-name-row {
  margin-bottom: 10px;
}
.cand-name-row input {
  width: 100%;
}
.cand-nutrients {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.cand-nutrient-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.cand-nutrient-row label {
  color: var(--muted);
  width: 44px;
  flex-shrink: 0;
}

/* myWords modal */
.word-item {
  border-left: 3px solid var(--green);
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--soft);
  border-radius: 0 8px 8px 0;
}
.word-text {
  font-size: 15px;
  font-style: italic;
  margin: 0 0 6px;
  color: var(--green-dark);
}
.word-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.word-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 2px 6px;
}
.word-del:hover { color: var(--red); }

/* 档案模块按钮行 */
.profile-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* 食品库空结果提示 */
.food-empty-tip {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}

/* ===================================================
   识别结果：营养数据单行显示
   =================================================== */
.cand-inline-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--soft);
  border-radius: 8px;
  font-size: 13px;
}
.cand-inline-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cand-inline-item label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.cand-inline-sep {
  color: var(--line);
  font-size: 14px;
  flex-shrink: 0;
}
.cand-cal-wrap {
  font-weight: 600;
  color: var(--green-dark);
}

/* ===================================================
   饮食知识搜索区
   =================================================== */
.diet-search-wrap {
  max-width: 760px;
  margin: 0 auto 32px;
}
.diet-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.diet-search-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  transition: border-color 0.2s;
}
.diet-search-bar input:focus {
  outline: none;
  border-color: var(--green);
}
.diet-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.diet-suggest-label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.diet-tag-btn {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 13px;
  color: var(--green-dark);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.diet-tag-btn:hover {
  background: var(--mint);
  border-color: var(--green);
}

/* 知识结果双栏 */
.diet-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 36px;
}
@media (max-width: 700px) {
  .diet-results-grid { grid-template-columns: 1fr; }
}
.diet-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.diet-panel-icon { font-size: 22px; }
.diet-panel-head h3 { margin: 0; font-size: 16px; }

.diet-ai-text {
  line-height: 1.8;
  font-size: 14px;
  white-space: pre-wrap;
}

/* 网络搜索结果 */
.diet-web-item {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.15s;
}
.diet-web-item:last-child { border-bottom: none; }
.diet-web-item:hover { opacity: 0.8; }
.diet-web-item-source {
  font-size: 11px;
  color: var(--green);
  margin-bottom: 3px;
}
.diet-web-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.diet-web-item-snippet {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 加载动画 */
.diet-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 16px 0;
}
.diet-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 饮食方法参考子标题 */
.diet-method-title {
  font-size: 17px;
  margin: 0 0 6px;
  color: var(--green-dark);
}

/* ===================================================
   体重控制 — 新增样式
   =================================================== */
.weight-entry-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.weight-entry-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.weight-entry-form input {
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.2s;
}
.weight-entry-form input:focus {
  outline: none;
  border-color: var(--green);
}
.weight-photo-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--soft);
  transition: border-color 0.2s, background 0.2s;
  font-size: 13px;
  color: var(--muted);
}
.weight-photo-upload:hover {
  border-color: var(--green);
  background: var(--mint);
}
.w-upload-icon { font-size: 20px; }

.weight-recent-item {
  background: var(--soft);
  border-radius: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--green);
}
.wri-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.wri-data {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: var(--ink);
}
.wri-photo-dot { color: var(--green); }

/* 折线图tooltip */
.weight-point-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 200;
  min-width: 160px;
  max-width: 220px;
  font-size: 13px;
  pointer-events: none;
}
.wpt-date {
  font-weight: 700;
  font-size: 12px;
  color: var(--green-dark);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.wpt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}
.wpt-row span { color: var(--muted); }
.wpt-row strong { color: var(--ink); }

/* ===================================================
   饮食研究 & 推文卡片
   =================================================== */
.diet-research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.diet-research-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s, transform 0.15s;
}
.diet-research-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(20, 62, 42, 0.14);
}
.drc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.drc-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.research-badge {
  background: var(--mint);
  color: var(--green-dark);
}
.tweet-badge {
  background: #e7f0fd;
  color: #1d4ed8;
  margin-left: auto;
}
.drc-source {
  font-size: 12px;
  color: var(--muted);
}
.drc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.4;
}
.drc-summary, .drc-content {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}
.drc-content {
  font-style: italic;
  color: var(--ink);
}
.drc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.drc-link {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
.drc-link:hover { text-decoration: underline; }

/* Tweet card styles */
.tweet-card { background: linear-gradient(135deg, var(--surface) 0%, #f0f7ff 100%); }
.tweet-header { align-items: flex-start; }
.tweet-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tweet-author { font-weight: 700; font-size: 13px; color: var(--ink); }
.tweet-handle { font-size: 11px; color: var(--muted); }

/* NutriFit Logo 图片 */
.brand-logo-img {
  height: 36px;
  width: auto;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}


/* NutriFit refreshed green-health theme */
:root {
  --ink: #10251a;
  --muted: #66766b;
  --line: #dbeade;
  --soft: #f3faf1;
  --surface: #ffffff;
  --green: #1a9460;
  --green-dark: #0e5234;
  --mint: #dff5e8;
  --lime: #cfe875;
  --yellow: #f4c84f;
  --blue: #2d7db7;
  --red: #c95c4c;
  --shadow: 0 18px 45px rgba(30, 96, 56, 0.12);
}
body { background: #f8fbf5; }
.topbar { background: rgba(248, 251, 245, 0.9); box-shadow: 0 10px 30px rgba(36, 91, 55, 0.06); }
.brand { color: var(--green-dark); letter-spacing: 0; }
.brand-logo-img { height: 38px; max-width: 48px; padding: 4px; border-radius: 12px; background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(222,245,231,.88)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.8), 0 8px 22px rgba(39,126,73,.12); }
.hero { background: linear-gradient(135deg, rgba(240,249,235,.98) 0%, rgba(255,255,255,.9) 58%), radial-gradient(circle at 82% 18%, rgba(207,232,117,.42), transparent 34%), radial-gradient(circle at 8% 82%, rgba(140,215,167,.32), transparent 34%); }
.button { border-radius: 10px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, #25a66f, #168254); box-shadow: 0 10px 24px rgba(34, 160, 107, .22); }
.button.ghost { background: rgba(255,255,255,.84); border-color: #b9dec6; }
.panel, .food-card, .meal-slot-card, .food-cat-group { box-shadow: 0 12px 30px rgba(32, 91, 54, .06); }
.nav-item.active { font-weight: 800; }
.auth-panel { width: min(460px, 100%); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; padding: 4px; border-radius: 12px; background: var(--soft); }
.auth-tab { border: 0; border-radius: 9px; min-height: 38px; cursor: pointer; color: var(--green-dark); background: transparent; font-weight: 800; }
.auth-tab.active { color: #fff; background: var(--green); }
.auth-form { display: grid; gap: 14px; }
.auth-hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.friends-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.friend-card, .friend-feed-wrap { display: grid; gap: 16px; }
.friend-id-card { display: grid; gap: 8px; padding: 18px; border-radius: 12px; background: linear-gradient(135deg, #eff9ee, #ffffff); border: 1px solid var(--line); }
.friend-id-card span, .friend-list-item span, .feed-head span, .muted-line { color: var(--muted); font-size: 13px; }
.friend-id-card strong { color: var(--green-dark); font-size: 28px; letter-spacing: .5px; }
.friend-request-form { display: grid; gap: 12px; }
.friend-mini-section h3 { margin: 0 0 10px; font-size: 16px; color: var(--green-dark); }
.friend-stack { display: grid; gap: 10px; }
.friend-request-item, .friend-list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.friend-request-item div { display: grid; gap: 3px; }
.friend-share-panel { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.friend-share-panel h3 { margin-bottom: 4px; }
.friend-share-panel p { margin: 0; }
.friend-share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.friend-feed { display: grid; gap: 14px; }
.empty-feed { color: var(--muted); text-align: center; }
.feed-post { display: grid; gap: 12px; }
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feed-head div { display: grid; gap: 2px; }
.feed-score { border-radius: 999px; padding: 6px 10px; color: var(--green-dark); background: var(--mint); font-weight: 900; }
.feed-photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.feed-text { margin: 0; color: var(--ink); }
.feed-actions button, .feed-comment-chip { border: 1px solid var(--line); background: #fff; color: var(--green-dark); border-radius: 999px; padding: 6px 10px; cursor: pointer; font-weight: 700; }
.feed-comments { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.feed-comment-chips { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .friends-layout { grid-template-columns: 1fr; } .friend-share-panel { align-items: stretch; flex-direction: column; } }


/* Brand mark repair */
.brand-logo-img { display: none; }
.brand-logo-badge {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eaf7ef 0%, #d4f0e1 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.9), 0 10px 26px rgba(14, 82, 52, .14);
  border: 1.5px solid rgba(165, 215, 185, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
/* NF monogram logo rendered via CSS */
.brand-logo-badge::before {
  content: 'NF';
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #0e5234, #1a9460);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: Georgia, serif;
  line-height: 1;
}
.brand-logo-badge::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 5px;
  width: 9px;
  height: 6px;
  background: linear-gradient(135deg, #2ec27e, #1a9460);
  border-radius: 0 4px 0 4px;
  clip-path: polygon(0 100%, 50% 0, 100% 30%, 60% 100%);
}
.brand span:last-child { font-size: 22px; }

/* Interactive homepage preparation scene */
.legacy-hero-bowl { display: none; }
.kitchen-scene {
  --mx: 0;
  --my: 0;
  position: relative;
  width: min(500px, 92vw);
  aspect-ratio: 1 / .92;
  display: grid;
  place-items: center;
  isolation: isolate;
  transform: perspective(900px) rotateX(calc(var(--my) * -4deg)) rotateY(calc(var(--mx) * 5deg));
  transition: transform .18s ease;
}
.stage-card {
  position: absolute;
  border: 1px solid rgba(213, 235, 218, .88);
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 18px 42px rgba(32, 91, 54, .1);
  backdrop-filter: blur(8px);
  transition: transform .22s ease, box-shadow .22s ease;
}
.stage-card:hover,
.kitchen-scene.is-playing .stage-card {
  box-shadow: 0 24px 54px rgba(32, 91, 54, .16);
}
.stage-pill {
  position: absolute;
  top: -13px;
  left: 18px;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}
.prep-stage {
  left: 2%;
  bottom: 11%;
  width: 48%;
  height: 38%;
  border-radius: 28px;
  transform: rotate(-7deg);
}
.eat-stage {
  right: 3%;
  bottom: 8%;
  width: 48%;
  height: 44%;
  border-radius: 30px;
}
.life-stage {
  right: 12%;
  top: 10%;
  width: 38%;
  height: 34%;
  border-radius: 30px;
}
.kitchen-scene::before {
  content: "";
  position: absolute;
  inset: 10% 3% 8%;
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(255,255,255,.82), rgba(239,249,232,.58));
  border: 1px solid rgba(207, 232, 117, .28);
  box-shadow: 0 28px 70px rgba(32, 91, 54, .13);
  z-index: -2;
}
.sun-orbit {
  position: absolute;
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(34, 160, 107, .22);
  animation: slowSpin 16s linear infinite;
  z-index: -1;
}
.cutting-board {
  position: absolute;
  left: 6%;
  bottom: 8%;
  width: 88%;
  height: 74%;
  border-radius: 28px;
  background: linear-gradient(135deg, #f2d6a5, #d9a96c);
  box-shadow: 0 22px 36px rgba(126, 86, 38, .18);
  transform: translate(calc(var(--mx) * -10px), calc(var(--my) * -8px));
}
.cutting-board::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 21px;
  border: 1px solid rgba(120, 78, 36, .12);
}
.knife {
  position: absolute;
  right: 9%;
  top: 18%;
  width: 42%;
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e9f0ef, #9dadab 70%, #6d8a75 70%);
  transform: rotate(-15deg);
  animation: knifeTap 3.2s ease-in-out infinite;
}
.ingredient, .salad, .scene-note, .steam {
  position: absolute;
  display: block;
  transition: transform .22s ease;
}
.avocado { left: 12%; top: 38%; width: 58px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 55% 52%, #cda34d 0 22%, #a4cf64 23% 58%, #356b35 59%); }
.tomato { left: 35%; top: 28%; width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #ff9d8b 0 12%, #e95645 13%); }
.egg { left: 22%; bottom: 18%; width: 48px; height: 36px; border-radius: 50%; background: radial-gradient(circle at 52% 48%, #f4c84f 0 24%, #fff7df 25%); }
.grain { left: 47%; bottom: 20%; width: 54px; height: 28px; border-radius: 50%; background: #d8bc76; box-shadow: 12px 2px 0 #c6a762, -10px 4px 0 #e3ca8a; }
.leaf-a, .leaf-b { width: 64px; height: 28px; border-radius: 70% 0 70% 0; background: linear-gradient(135deg, #2ba66c, #8bd06e); }
.leaf-a { left: 11%; top: 15%; transform: rotate(-22deg); }
.leaf-b { left: 58%; top: 50%; transform: rotate(26deg); }
.prep-bowl {
  position: absolute;
  right: 8%;
  bottom: 9%;
  width: 84%;
  height: 68%;
  border-radius: 18% 18% 48% 48%;
  background: linear-gradient(180deg, #ffffff, #eaf6ed);
  border: 1px solid #d7e9db;
  box-shadow: 0 24px 42px rgba(31, 96, 56, .16);
  overflow: hidden;
  transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 8px));
}
.bowl-rim { left: 3%; top: 2%; width: 94%; height: 28%; border-radius: 50%; background: #f8fff8; border: 1px solid #d5ebda; }
.salad { border-radius: 70% 0 70% 0; }
.s1 { width: 88px; height: 34px; left: 17%; top: 22%; background: #36a96f; transform: rotate(-18deg); }
.s2 { width: 74px; height: 30px; right: 13%; top: 28%; background: #83c85d; transform: rotate(24deg); }
.s3 { width: 42px; height: 42px; left: 41%; top: 32%; border-radius: 50%; background: #e95645; }
.s4 { width: 64px; height: 24px; left: 31%; top: 17%; background: #f4c84f; border-radius: 999px; }
.happy-face {
  position: absolute;
  left: 50%;
  bottom: 19%;
  width: 48px;
  height: 28px;
  transform: translateX(-50%);
  border-bottom: 4px solid rgba(17, 92, 59, .55);
  border-radius: 0 0 999px 999px;
}
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 6px rgba(244, 200, 79, .16);
  animation: sparkle 2.4s ease-in-out infinite;
}
.spark-a { left: 15%; top: 22%; }
.spark-b { right: 16%; top: 18%; animation-delay: .8s; background: #83c85d; }
.life-person {
  position: absolute;
  left: 26%;
  top: 26%;
  width: 72px;
  height: 100px;
  animation: happyWalk 2.8s ease-in-out infinite;
}
.person-head {
  position: absolute;
  left: 23px;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f5c89b;
}
.person-body {
  position: absolute;
  left: 20px;
  top: 31px;
  width: 34px;
  height: 42px;
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(135deg, #22a06b, #8bd06e);
}
.person-arm, .person-leg {
  position: absolute;
  width: 9px;
  border-radius: 999px;
  background: #115c3b;
  transform-origin: top center;
}
.person-arm { top: 37px; height: 35px; }
.arm-l { left: 15px; transform: rotate(32deg); }
.arm-r { right: 13px; transform: rotate(-35deg); }
.person-leg { top: 70px; height: 34px; }
.leg-l { left: 28px; transform: rotate(17deg); }
.leg-r { right: 25px; transform: rotate(-18deg); }
.life-sun {
  position: absolute;
  top: 18%;
  right: 15%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f4c84f;
  box-shadow: 0 0 0 9px rgba(244, 200, 79, .18);
}
.life-path {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 16%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34,160,107,.18), rgba(207,232,117,.55));
}
.steam {
  width: 16px;
  height: 70px;
  border-radius: 999px;
  border-left: 3px solid rgba(34, 160, 107, .24);
  top: 14%;
  right: 30%;
  animation: steamRise 3.6s ease-in-out infinite;
}
.steam-b { right: 20%; top: 19%; animation-delay: 1.2s; }
.scene-note {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255,255,255,.88);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(32, 91, 54, .09);
  animation: noteFloat 4s ease-in-out infinite;
}
.note-a { left: 8%; top: 18%; }
.note-b { left: 47%; top: 8%; animation-delay: .9s; }
.note-c { right: 8%; top: 28%; animation-delay: 1.6s; }
@keyframes slowSpin { to { transform: rotate(360deg); } }
@keyframes knifeTap { 0%, 100% { transform: rotate(-15deg) translateY(0); } 50% { transform: rotate(-11deg) translateY(8px); } }
@keyframes steamRise { 0%, 100% { opacity: .28; transform: translateY(12px) scale(.92); } 50% { opacity: .72; transform: translateY(-12px) scale(1.08); } }
@keyframes noteFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sparkle { 0%, 100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.22); } }
@keyframes happyWalk { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
.kitchen-scene.is-playing .prep-stage { animation: stagePop .7s ease both; }
.kitchen-scene.is-playing .eat-stage { animation: stagePop .7s ease .14s both; }
.kitchen-scene.is-playing .life-stage { animation: stagePop .7s ease .28s both; }
@keyframes stagePop { 0% { transform: translateY(10px) scale(.96); } 55% { transform: translateY(-8px) scale(1.03); } 100% { transform: translateY(0) scale(1); } }
@media (max-width: 800px) {
  .kitchen-scene { width: min(360px, 94vw); }
  .brand-logo-badge { width: 42px; height: 42px; flex-basis: 42px; }
  .stage-pill { font-size: 11px; left: 10px; }
}

.custom-food-photo {
  border: 1px dashed #b9dec6;
  border-radius: 12px;
  padding: 12px;
  background: rgba(239, 249, 232, .55);
  cursor: pointer;
}
.custom-food-photo input {
  margin-top: 8px;
}
.custom-food-photo span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* ===================================================
   Macro Pie Chart
   =================================================== */
.macro-layout-wrap {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 24px;
  align-items: center;
}
.macro-pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.macro-pie-wrap canvas {
  width: 140px !important;
  height: 140px !important;
  display: block;
  border-radius: 50%;
}
.macro-pie-legend {
  display: grid;
  gap: 5px;
  width: 100%;
}
.macro-pie-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink);
}
.macro-pie-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.macro-pie-legend-item span:last-child {
  color: var(--muted);
  margin-left: auto;
}
@media (max-width: 600px) {
  .macro-layout-wrap {
    grid-template-columns: 1fr;
  }
  .macro-pie-wrap {
    flex-direction: row;
    justify-content: center;
  }
}

/* ===================================================
   Improved macro slider
   =================================================== */
.macro-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e6f0e9;
  outline: none;
  cursor: pointer;
  transition: background .15s;
}
.macro-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(14,82,52,.25);
  cursor: grab;
  transition: transform .12s, box-shadow .12s;
}
.macro-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
  box-shadow: 0 3px 10px rgba(14,82,52,.35);
}
.macro-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(14,82,52,.25);
  cursor: grab;
}
.macro-slider-wrap {
  display: grid;
  gap: 5px;
}
.macro-row strong {
  font-size: 13px;
  color: var(--green-dark);
  white-space: nowrap;
}
.macro-row strong small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* ===================================================
   Feed thumbs
   =================================================== */
.feed-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.feed-thumb-up, .feed-thumb-down {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, border-color .15s, transform .1s;
}
.feed-thumb-up:hover { background: #eaf7ef; border-color: var(--green); transform: translateY(-1px); }
.feed-thumb-down:hover { background: #fff0ee; border-color: #c95c4c; transform: translateY(-1px); }
.feed-thumb-down { color: #c95c4c; }
.feed-thumb-down.active { background: #fff0ee; border-color: #c95c4c; }
.feed-thumb-up.active { background: #eaf7ef; border-color: var(--green); }

/* ===================================================
   Editable comment
   =================================================== */
.feed-custom-comment-wrap {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.feed-custom-comment-input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.feed-custom-comment-input:focus { border-color: var(--green); }
.feed-custom-comment-send {
  padding: 7px 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s;
}
.feed-custom-comment-send:hover { background: var(--green-dark); }

/* ===================================================
   Diet research refresh button
   =================================================== */
.diet-research-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.diet-research-header p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.diet-refresh-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1.5px solid var(--green);
  border-radius: 999px;
  background: #fff;
  color: var(--green-dark);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, transform .12s;
  white-space: nowrap;
}
.diet-refresh-btn:hover { background: #eaf7ef; transform: translateY(-1px); }
.diet-refresh-btn.spinning .refresh-icon { animation: spin360 .6s linear; }
@keyframes spin360 { to { transform: rotate(360deg); } }
.refresh-icon { display: inline-block; font-size: 15px; transition: transform .1s; }

/* Food search result stability */
.food-grid {
  min-height: 0;
  transition: none;
}
