/* ==========================================================================
   禾野轻食记 · 账单式多层卡片
   配色：浅绿 / 白 / 浅灰；字体：系统默认；质感：叠卡 + 内嵌层，不做花哨动效
   ========================================================================== */

:root {
  --bg: #eef2ef;
  --bg-wash: #e3ece6;
  --card: #ffffff;
  --inset: #f5f8f6;
  --ink: #1c2621;
  --ink-2: #5e6d64;
  --ink-3: #8b9a91;
  --sage: #4d8a63;
  --sage-deep: #3b6d4e;
  --sage-soft: #e3f0e7;
  --line: rgba(28, 38, 33, 0.08);
  --amber: #a57a38;
  --amber-soft: #f4eee2;
  --red: #a85a50;
  --red-soft: #f6eae7;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-1: 0 1px 2px rgba(28, 38, 33, 0.04), 0 10px 28px rgba(28, 38, 33, 0.06);
  --shadow-2: 0 2px 8px rgba(28, 38, 33, 0.06), 0 22px 48px rgba(28, 38, 33, 0.1);
  --shadow-nav: 0 8px 28px rgba(28, 38, 33, 0.12);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "HarmonyOS Sans", "MiSans", "Microsoft YaHei", "Segoe UI", "Noto Sans SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(90% 50% at 80% -8%, rgba(227, 240, 231, 0.9) 0%, transparent 58%),
    radial-gradient(70% 40% at 8% 8%, rgba(255, 255, 255, 0.7) 0%, transparent 50%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input {
  font-family: inherit;
}

h1, h2, h3, p {
  margin: 0;
}

img {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   布局骨架
   -------------------------------------------------------------------------- */

.app-shell {
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
}

.view {
  padding: 2px 18px calc(108px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 20px 10px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 4px;
}

.topbar-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.topbar-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--ink-2);
  box-shadow: var(--shadow-1);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.avatar,
.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(77, 138, 99, 0.16);
}

/* --------------------------------------------------------------------------
   卡片与叠层
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 18px;
}

.stack {
  position: relative;
  z-index: 0;
}

.stack::before,
.stack::after {
  content: "";
  position: absolute;
  border-radius: var(--radius-lg);
  background: var(--card);
  z-index: -1;
}

.stack::before {
  left: 10px;
  right: 10px;
  top: 8px;
  bottom: -7px;
  opacity: 0.55;
  box-shadow: var(--shadow-1);
}

.stack::after {
  left: 22px;
  right: 22px;
  top: 16px;
  bottom: -13px;
  opacity: 0.28;
  background: #fbfdfb;
}

.inset {
  margin-top: 14px;
  background: var(--inset);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.inset-empty {
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  padding: 16px 12px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-note {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.65;
}

.empty-inline {
  padding: 22px 18px;
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-1);
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
}

.empty-inline.nested {
  background: transparent;
  box-shadow: none;
  padding: 10px 4px;
}

/* --------------------------------------------------------------------------
   按钮 / 徽章 / 进度
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
}

.button:active {
  transform: scale(0.97);
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.button.primary {
  background: var(--sage);
  color: #fff;
}

.button.secondary {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.button.quiet {
  background: transparent;
  color: var(--ink-2);
}

.button.soft-primary {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.button.compact {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 13.5px;
}

.text-action {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sage-deep);
  padding: 6px 2px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--inset);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.is-on {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pass,
.status-ok,
.status-excellent,
.status-acceptable {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.status-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-fail,
.status-error {
  background: var(--red-soft);
  color: var(--red);
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--inset);
  overflow: hidden;
}

.progress-track.slim {
  height: 4px;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--sage);
}

/* --------------------------------------------------------------------------
   首页主卡：大数字 + 三张错落小卡
   -------------------------------------------------------------------------- */

.hero-card {
  padding: 22px 20px 18px;
  overflow: visible;
}

.hero-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.hero-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.hero-number {
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.hero-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.hero-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c5d0c8;
}

.hero-card .progress-track {
  margin-top: 14px;
}

.hero-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 18px;
  padding: 2px 2px 8px;
}

.tile {
  background: var(--inset);
  border-radius: 16px;
  padding: 12px 10px 11px;
  box-shadow: var(--shadow-1);
  position: relative;
}

.tile:nth-child(1) {
  transform: translateY(8px) rotate(-1.4deg);
  z-index: 1;
}

.tile:nth-child(2) {
  transform: translateY(-6px);
  z-index: 3;
  background: var(--card);
  box-shadow: var(--shadow-2);
}

.tile:nth-child(3) {
  transform: translateY(10px) rotate(1.6deg);
  z-index: 2;
}

.tile-label {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
}

.tile-value {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tile-hint {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   账单行与餐次叠卡
   -------------------------------------------------------------------------- */

.meal-deck {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meal-card,
.day-meal {
  overflow: hidden;
}

.meal-card.is-highlighted {
  box-shadow: 0 0 0 1.5px var(--sage), var(--shadow-2);
}

.meal-card-head,
.day-meal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.meal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.meal-name,
.day-meal-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.meal-kcal,
.day-meal-kcal {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meal-kcal small {
  margin-left: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
}

.meal-target-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.inset-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

.bill-list {
  display: flex;
  flex-direction: column;
}

.bill-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.bill-list .bill-row:last-child,
.bill-card .completion-row:last-child,
.builder-items .builder-item:last-child {
  border-bottom: 0;
}

.bill-name {
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.bill-dots {
  flex: 1;
  min-width: 12px;
  border-bottom: 1px dotted #cfd8d2;
  transform: translateY(-5px);
}

.bill-value {
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bill-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.replace-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sage-deep);
  padding: 2px 0;
}

.meal-card-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.bill-card {
  padding: 6px 18px;
}

/* --------------------------------------------------------------------------
   计划页
   -------------------------------------------------------------------------- */

.control-card {
  padding: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--inset);
  border-radius: 14px;
}

.segment {
  min-height: 36px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

.segment.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 12px;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  border-radius: 12px;
  color: var(--ink-3);
}

.week-day-label {
  font-size: 10.5px;
  font-weight: 600;
}

.week-day-number {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.week-day.is-active {
  background: var(--sage-soft);
}

.week-day.is-active .week-day-label,
.week-day.is-active .week-day-number {
  color: var(--sage-deep);
}

.builder-macros {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   记录页
   -------------------------------------------------------------------------- */

.completion-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.completion-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
}

.completion-note {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.check-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #d5ddd7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
}

.check-circle .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}

.completion-row.is-done .check-circle {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

.stat-overlap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 6px 8px 12px;
}

.stat-overlap .stat-card:first-child {
  transform: rotate(-1.6deg) translateY(10px);
  z-index: 1;
}

.stat-overlap .stat-card:last-child {
  transform: rotate(1.8deg) translate(-6px, -4px);
  z-index: 2;
}

.stat-card {
  padding: 16px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.stat-label {
  font-size: 12px;
  color: var(--ink-3);
}

.stat-value {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
}

.weight-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.weight-value {
  margin-top: 4px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.weight-value small {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}

.weight-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.text-input {
  width: 84px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--inset);
  outline: none;
}

.text-input:focus {
  border-color: rgba(77, 138, 99, 0.45);
  background: #fff;
}

.mini-chart {
  width: 100%;
  height: 84px;
}

/* --------------------------------------------------------------------------
   我的
   -------------------------------------------------------------------------- */

.mine-view {
  gap: 18px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.mine-profile-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mine-profile-meta {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.mine-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 2px 6px;
}

.mine-card:nth-child(1) {
  transform: rotate(-0.7deg);
}

.mine-card:nth-child(2) {
  transform: rotate(0.9deg) translateY(8px);
}

.mine-card-wide,
.mine-card-trend {
  grid-column: 1 / -1;
  transform: none;
}

.mine-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mine-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.mine-card-note {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
}

.mine-card-mainline {
  margin-top: 6px;
}

.mine-card-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.mine-card-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 2px;
}

.mine-card-macros {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.mine-card-macros > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.mine-card-macros strong {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.mine-card-action {
  font-size: 12px;
  font-weight: 600;
  color: var(--sage-deep);
  white-space: nowrap;
}

.mine-sparkline {
  width: 100%;
  height: 64px;
}

.mine-sparkline-base {
  stroke: var(--line);
  stroke-width: 1;
}

.mine-sparkline-line {
  fill: none;
  stroke: var(--sage);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mine-sparkline-point {
  fill: #fff;
  stroke: var(--sage);
  stroke-width: 1.5;
}

.mine-settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mine-group-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding: 0 4px;
  margin-bottom: 8px;
}

.mine-settings-list {
  padding: 4px 16px;
}

.mine-setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--ink-3);
}

.mine-setting-row:last-child {
  border-bottom: 0;
}

.mine-setting-title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.mine-setting-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.mine-setting-row .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   关于：卡片轻微叠压
   -------------------------------------------------------------------------- */

.about-deck {
  display: flex;
  flex-direction: column;
}

.about-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-card + .about-card {
  margin-top: -8px;
}

.about-card:nth-child(even) {
  transform: rotate(0.35deg);
}

.about-card:nth-child(odd) {
  transform: rotate(-0.25deg);
}

.about-card .section-title {
  font-size: 15.5px;
}

/* --------------------------------------------------------------------------
   搭配页
   -------------------------------------------------------------------------- */

.builder-view {
  gap: 16px;
}

.builder-target-head,
.builder-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.target-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.builder-target-calories,
.builder-actual {
  margin-top: 4px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.builder-target-calories span,
.builder-actual span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}

.builder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.builder-item-copy strong {
  display: block;
  font-size: 14.5px;
}

.builder-item-copy span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.builder-add {
  width: 100%;
  border: 1px dashed #c9d6cc;
  box-shadow: none;
  color: var(--sage-deep);
  background: rgba(255, 255, 255, 0.55);
}

.builder-directions {
  margin: 14px 0 0;
  padding: 0 0 0 18px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.builder-summary {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

.builder-footer {
  position: sticky;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
}

.builder-footer .button {
  flex: 1;
}

.builder-back {
  align-self: flex-start;
}

.inline-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
}

.inline-warning .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.food-tax {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.food-tax-all {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-1);
  text-align: left;
}

.food-tax-all.is-active,
.food-tax-tag.is-active {
  box-shadow: 0 0 0 1.5px var(--sage), var(--shadow-1);
}

.food-tax-all-label {
  font-size: 14px;
  font-weight: 700;
}

.food-tax-all-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--sage-deep);
  font-variant-numeric: tabular-nums;
}

.food-tax-all-hint {
  font-size: 11.5px;
  color: var(--ink-3);
}

.food-tax-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.food-tax-item.is-wide {
  grid-column: 1 / -1;
}

.food-tax-tag {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: var(--card);
  box-shadow: var(--shadow-1);
  text-align: left;
}

.food-tax-label {
  font-size: 13.5px;
  font-weight: 600;
}

.food-tax-count {
  margin-left: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.food-tax-arrow {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.food-tax-branch {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-left: 10px;
}

.food-tax-rail {
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.food-tax-sub {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-list {
  padding: 4px 18px;
}

.candidate-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.candidate-row:last-child,
.candidate-block:last-child {
  border-bottom: 0;
}

.candidate-row:disabled {
  cursor: default;
}

.candidate-name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
}

.candidate-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.candidate-side {
  color: var(--ink-3);
  font-size: 12.5px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.candidate-side .icon {
  width: 16px;
  height: 16px;
}

.candidate-row.is-current .candidate-name {
  color: var(--sage-deep);
}

.candidate-block {
  border-bottom: 1px solid var(--line);
}

.candidate-block .candidate-row {
  border-bottom: 0;
}

.state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--inset);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.chip.is-active {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.chip:disabled {
  opacity: 0.6;
  cursor: default;
}

/* --------------------------------------------------------------------------
   底部弹层
   -------------------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 38, 30, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 48px rgba(24, 38, 30, 0.18);
  overflow: hidden;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #cfd8d2;
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 12px;
}

.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sheet-title {
  font-size: 16.5px;
  font-weight: 700;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--card);
  box-shadow: 0 -1px 0 var(--line);
}

.sheet-footer .button {
  flex: 1;
}

.current-food {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: 14px 16px;
}

.current-food-label,
.preview-food-label {
  font-size: 11.5px;
  color: var(--ink-3);
}

.current-food-name {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
}

.current-food .grams {
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.sheet .candidate-list {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}

.preview-section {
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.preview-hero {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-food {
  flex: 1;
  min-width: 0;
  background: var(--inset);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.preview-food-name {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-food-grams {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.preview-arrow {
  color: var(--sage-deep);
  flex-shrink: 0;
}

.preview-arrow .icon {
  width: 18px;
  height: 18px;
}

.food-change-list {
  border-top: 1px solid var(--line);
}

.food-change-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.food-change-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.change-name {
  font-weight: 600;
}

.change-value {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.change-value.removed {
  color: var(--red);
}

.macro-compare {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.macro-compare-item {
  background: var(--inset);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.macro-compare-label {
  font-size: 11px;
  color: var(--ink-3);
}

.macro-compare-value {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.macro-compare-value small {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
}

.macro-compare-delta {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.macro-compare-delta.up {
  color: var(--amber);
}

.macro-compare-delta.down {
  color: var(--sage-deep);
}

.preview-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
}

.preview-status .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.preview-status.success {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.preview-status.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.preview-status.error {
  background: var(--red-soft);
  color: var(--red);
}

.preview-status-text strong {
  display: block;
  margin-bottom: 2px;
}

.warning-list {
  margin: 6px 0 0;
  padding-left: 16px;
}

.details-disclosure {
  font-size: 12.5px;
  color: var(--ink-2);
}

.details-disclosure summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-3);
}

.details-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.details-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.details-row span {
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   底部导航 / 轻提示 / 骨架屏 / 错误态
   -------------------------------------------------------------------------- */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-radius: 22px;
  box-shadow: var(--shadow-nav);
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 7px;
  border-radius: 16px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
}

.nav-item .icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.7;
}

.nav-item.is-active {
  color: var(--sage-deep);
  background: var(--sage-soft);
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(28, 38, 33, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
}

.skeleton {
  border-radius: 8px;
  background: #e6eee8;
}

.skeleton-line {
  height: 14px;
  margin: 8px 0;
}

.skeleton-line.short {
  width: 42%;
}

.error-state {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.error-state > div {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 28px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
}

.error-state strong {
  font-size: 16px;
}

.error-state p {
  font-size: 13px;
  color: var(--ink-3);
  word-break: break-all;
}

@media (min-width: 560px) {
  .app-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .stat-overlap .stat-card,
  .mine-card,
  .about-card {
    transform: none;
  }
}
