/* =========================================================
   幸福营养 · 设计系统
   ========================================================= */
:root {
  --bg: #f3f1e8;
  --bg-deep: #eae6d9;
  --surface: #fffdf8;
  --surface-2: #f8f6ee;
  --surface-3: #efebdf;
  --ink: #1b2a21;
  --ink-soft: #35463b;
  --muted: #748077;
  --muted-2: #9aa39c;
  --line: #e3dfd1;
  --line-strong: #d3cdbb;
  --brand: #2f6b4f;
  --brand-strong: #1e5039;
  --brand-dark: #153b2a;
  --brand-soft: #e7f0e8;
  --brand-mist: #f1f6f1;
  --accent: #d48a3b;
  --accent-strong: #b66e24;
  --accent-soft: #f9eddc;
  --red: #b8543f;
  --red-soft: #f8e7e1;
  --blue: #4d7f99;
  --blue-soft: #e6eff4;
  --gold: #a97a2f;
  --gold-soft: #f7efd9;
  --shadow-sm: 0 1px 2px rgba(30, 45, 35, .04), 0 3px 10px rgba(30, 45, 35, .035);
  --shadow-md: 0 12px 30px rgba(30, 45, 35, .07), 0 2px 6px rgba(30, 45, 35, .04);
  --shadow-lg: 0 24px 60px rgba(20, 38, 28, .12);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar: 248px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(216, 201, 157, .18), transparent 60%),
    radial-gradient(700px 500px at 0 100%, rgba(47, 107, 79, .05), transparent 65%);
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.02em; }
h1, h2 { font-family: var(--serif); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
::selection { background: #cfe3d6; color: var(--brand-dark); }
:focus-visible { outline: 2px solid #78a68b; outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.green { color: var(--brand); }
.red { color: var(--red); }
.gold { color: var(--gold); }
.blue { color: var(--blue); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  color: #e8efe8;
  background:
    radial-gradient(330px 280px at 10% 0%, rgba(217, 182, 112, .13), transparent 70%),
    radial-gradient(300px 420px at 110% 85%, rgba(104, 155, 121, .15), transparent 65%),
    #173c2b;
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center;
  color: #214c36;
  background: linear-gradient(145deg, #f4ead0, #d9c28d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 5px 14px rgba(0, 0, 0, .18);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text strong { display: block; font-family: var(--serif); font-size: 19px; letter-spacing: .06em; color: #fbf7ea; }
.brand-text span { display: block; font-size: 9px; letter-spacing: .24em; color: rgba(237, 243, 234, .52); margin-top: 1px; text-transform: uppercase; }
.side-label { padding: 0 11px; margin: 19px 0 8px; font-size: 10px; letter-spacing: .2em; color: rgba(233, 242, 233, .38); font-weight: 600; }
.nav-list { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 0 12px; border-radius: 11px;
  color: rgba(237, 243, 234, .68); font-size: 13.5px;
  border: 1px solid transparent;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item .icon { opacity: .8; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-item.active {
  color: #fffdf4;
  background: rgba(246, 240, 220, .13);
  border-color: rgba(246, 240, 220, .09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.nav-item.active .icon { color: #e9cf94; opacity: 1; }
.nav-badge { margin-left: auto; font-size: 10px; color: #e9cf94; background: rgba(233, 207, 148, .12); border-radius: 20px; padding: 1px 7px; }
.sidebar-spacer { flex: 1; }
.sidebar-summary {
  border-radius: 15px; padding: 15px; margin: 14px 2px 10px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
  border: 1px solid rgba(255, 255, 255, .09);
}
.sidebar-summary .label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(242, 246, 238, .58); }
.sidebar-summary .value { margin-top: 5px; font-family: var(--serif); font-size: 21px; color: #fbf7e9; letter-spacing: .01em; }
.sidebar-summary .bar { height: 4px; background: rgba(255, 255, 255, .13); border-radius: 8px; overflow: hidden; margin-top: 10px; }
.sidebar-summary .bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #d8bd80, #f3e7c6); }
.sidebar-summary .sub { margin-top: 6px; font-size: 10px; color: rgba(242, 246, 238, .46); }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 12px 8px 2px; border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 4px; }
.sidebar-user .avatar { width: 33px; height: 33px; display: inline-grid; place-items: center; line-height: 1; padding: 0; font-size: 13px; border-color: rgba(255, 255, 255, .2); }
.sidebar-user strong { display: block; font-size: 12.5px; color: #f5f1e3; font-weight: 600; }
.sidebar-user span { display: block; font-size: 10.5px; color: rgba(238, 244, 235, .45); }
.sidebar-close { display: none !important; }
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: 50%; color: #fffdf5; font-size: 11px; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  user-select: none;
}
.sidebar-scrim { display: none; }
.topbar-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  height: 66px; padding: 0 34px;
  display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 30;
  background: rgba(243, 241, 232, .84);
  border-bottom: 1px solid rgba(219, 214, 199, .6);
  backdrop-filter: blur(16px);
}
.topbar-menu { display: none !important; }
.topbar-crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.topbar-crumb b { color: var(--ink-soft); font-weight: 600; }
.topbar-crumb .dot { color: var(--line-strong); }
.topbar-spacer { flex: 1; }
.topbar-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #87a878; box-shadow: 0 0 0 3px rgba(135, 168, 120, .12); }
.live-dot.offline { background: #bd8b52; box-shadow: 0 0 0 3px rgba(189, 139, 82, .12); }
.topbar .icon-btn { background: rgba(255, 255, 255, .6); border-color: var(--line); }
.topbar-avatar { margin-left: 3px; }

.page { max-width: 1460px; margin: 0 auto; padding: 32px 36px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 26px; }
.page-head .eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11.5px; letter-spacing: .09em; color: var(--brand); font-weight: 600; text-transform: uppercase; margin-bottom: 7px; }
.page-head h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.18; color: #1d3025; }
.page-head .subtitle { color: var(--muted); margin-top: 7px; max-width: 680px; font-size: 13.5px; }
.page-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.section-title { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 20px; letter-spacing: -.01em; }
.section-title .icon { color: var(--brand); opacity: .8; }
.section-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 12.5px; line-height: 1; white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .16s, box-shadow .16s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { flex: 0 0 auto; }
.btn-primary { color: #fffdf6; background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 12px rgba(47, 107, 79, .18); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-accent { color: #fffdf6; background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-strong); }
.btn-ghost { color: var(--ink-soft); background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-soft { color: var(--brand); background: var(--brand-soft); border-color: transparent; }
.btn-soft:hover { background: #dcebdd; }
.btn-danger { color: #fff; background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #9f4230; }
.btn-link { min-height: auto; padding: 0; border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12px; }
.btn-link:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 31px; padding: 0 10px; border-radius: 8px; font-size: 11.5px; }
.btn-lg { min-height: 45px; padding: 0 21px; font-size: 13.5px; border-radius: 12px; }
.btn[disabled] { opacity: .48; cursor: not-allowed; transform: none; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 9px; color: var(--muted);
  background: transparent; transition: background .16s, color .16s, border-color .16s;
}
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .8); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-soft); border-color: #f0cdc4; }

.input, .select, .textarea {
  width: 100%; min-height: 39px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fffefa; color: var(--ink); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input::placeholder, .textarea::placeholder { color: #aeb5ae; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: #8db29b; box-shadow: 0 0 0 3px rgba(47, 107, 79, .09); background: #fff; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23748077' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.textarea { min-height: 76px; resize: vertical; }
.input-sm { min-height: 32px; padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 12px; color: var(--muted-2); pointer-events: none; }
.search-field .input { padding-left: 37px; }
.search-field .input.with-clear { padding-right: 36px; }
.search-clear { position: absolute; right: 7px; width: 26px; height: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); letter-spacing: .01em; }
.field .hint { font-size: 10.5px; color: var(--muted); }
.field .error-text { font-size: 10.5px; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-section { padding: 18px 0; border-top: 1px dashed var(--line); }
.form-section:first-child { padding-top: 0; border-top: 0; }
.form-section-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--brand); margin-bottom: 13px; }
.form-section-title .icon { opacity: .8; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 15px; height: 15px; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.segmented button { min-height: 29px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #d7d4c8; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- Common cards & badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-pad-lg { padding: 26px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-body { padding: 18px 22px 22px; }
.card-hover { transition: transform .2s, box-shadow .2s, border-color .2s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 20px; font-size: 10px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-green, .badge-ok { background: var(--brand-soft); color: var(--brand); }
.badge-gold, .badge-warn { background: var(--gold-soft); color: #886022; }
.badge-red, .badge-over, .badge-danger { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-gray, .badge-reference { background: #efede5; color: #7b7d73; }
.badge-live { background: #e4f1e7; color: #2f7a4e; }
.badge-manual { background: #f4ecdf; color: #93652d; }
.badge-purple { background: #efe9f5; color: #775c8d; }
.badge-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.tag-green { background: var(--brand-mist); border-color: #d4e5d8; color: var(--brand); }
.tag-gold { background: var(--accent-soft); border-color: #f0dcc2; color: var(--accent-strong); }
.group-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.group-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.group-grains { color: #a27c3d; } .group-potato { color: #b98545; } .group-vegetables { color: #5f9867; }
.group-fruits { color: #d18139; } .group-meat { color: #b45f50; } .group-aquatic { color: #4d8ca6; }
.group-eggs { color: #c49332; } .group-dairy { color: #6d8bb2; } .group-soy { color: #987649; }
.group-nuts { color: #967054; } .group-oil { color: #b2922e; } .group-salt { color: #85857d; }

/* ---------- Page-level grids ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; padding: 18px 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -45px; top: -48px; background: var(--brand-mist); opacity: .7; }
.stat-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 13px; }
.stat-icon.gold { background: var(--accent-soft); color: var(--accent-strong); }
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; font-family: var(--serif); font-size: 27px; line-height: 1.15; letter-spacing: -.02em; }
.stat-value small { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.stat-foot { margin-top: 7px; font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.stat-foot .up { color: var(--brand); }
.stat-foot .down { color: var(--red); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 18px; align-items: start; }
.dash-stack { display: flex; flex-direction: column; gap: 18px; }
.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.toolbar-card { padding: 13px 15px; background: rgba(255, 253, 248, .78); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 15px; box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); }
.filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 30px; padding: 0 11px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 500; transition: all .15s; }
.chip:hover { border-color: #b8cbbd; color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(47, 107, 79, .16); }
.chip .count { margin-left: 4px; opacity: .65; font-size: 10px; }

/* ---------- Dashboard ---------- */
.welcome-banner { position: relative; overflow: hidden; border-radius: 20px; padding: 24px 26px; margin-bottom: 18px; color: #f7f2e2; background: linear-gradient(120deg, #1c4934, #2b6147 55%, #3b7454); box-shadow: 0 14px 30px rgba(28, 73, 52, .16); }
.welcome-banner::before { content: ""; position: absolute; width: 300px; height: 300px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: -80px; top: -130px; }
.welcome-banner::after { content: ""; position: absolute; width: 190px; height: 190px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: 40px; bottom: -120px; }
.welcome-banner .eyebrow { color: #d7c28b; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
.welcome-banner h2 { font-size: 26px; margin-top: 6px; color: #fdf8ea; }
.welcome-banner p { color: rgba(249, 245, 230, .68); margin-top: 5px; font-size: 12.5px; max-width: 560px; }
.welcome-banner .banner-actions { margin-top: 16px; display: flex; gap: 9px; }
.welcome-banner .btn-ghost { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); color: #f7f2e2; }
.welcome-banner .btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.welcome-banner .btn-primary { background: #e2c98d; border-color: #e2c98d; color: #234f39; box-shadow: none; }
.welcome-banner .btn-primary:hover { background: #efdcae; }
.banner-side { position: absolute; right: 26px; bottom: 20px; display: flex; align-items: center; gap: 14px; }
.banner-side .mini-ring { color: #e6d3a1; }
.banner-side .mini-ring strong { color: #fff8e8; }
.banner-side .mini-ring span { color: rgba(255, 255, 255, .54); }

.score-panel { display: flex; align-items: center; gap: 24px; }
.score-ring { position: relative; flex: 0 0 auto; }
.score-ring svg { transform: rotate(0); }
.ring-track { fill: none; stroke: #eae7dd; stroke-width: 8; }
.ring-value { fill: none; stroke: var(--brand); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.score-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring-label strong { font-family: var(--serif); font-size: 28px; line-height: 1; color: var(--brand-strong); }
.score-ring-label span { font-size: 9px; color: var(--muted); margin-top: 5px; letter-spacing: .06em; }
.macro-list { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.macro-row .macro-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 11.5px; }
.macro-row .macro-top span { color: var(--muted); }
.macro-row .macro-top b { font-weight: 600; font-variant-numeric: tabular-nums; }
.macro-row .bar { height: 5px; background: #efede5; border-radius: 5px; overflow: hidden; margin-top: 5px; }
.macro-row .bar i { display: block; height: 100%; border-radius: 5px; }
.bar-protein { background: #467b5c; } .bar-fat { background: #d49a4e; } .bar-carb { background: #7d9db0; } .bar-fiber { background: #8a9f6b; }
.mini-stats { display: flex; gap: 22px; margin-top: 17px; padding-top: 16px; border-top: 1px dashed var(--line); }
.mini-stat strong { display: block; font-family: var(--serif); font-size: 19px; }
.mini-stat span { font-size: 10.5px; color: var(--muted); }
.dash-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dash-meal { padding: 13px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.dash-meal .meal-label { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 7px; }
.dash-meal ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.dash-meal li { font-size: 11.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-meal .meal-kcal { font-size: 10px; color: var(--muted); margin-top: 8px; }
.pagoda-mini { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 0 12px; }
.pagoda-tier { width: 100%; border-radius: 8px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fffdf7; font-size: 11px; }
.pagoda-tier:nth-child(1) { width: 52%; background: #b68a50; }
.pagoda-tier:nth-child(2) { width: 67%; background: #6c9a70; }
.pagoda-tier:nth-child(3) { width: 81%; background: #b86e5e; }
.pagoda-tier:nth-child(4) { width: 92%; background: #7e96ac; }
.pagoda-tier:nth-child(5) { width: 100%; background: #a88b52; }
.pagoda-tier b { font-weight: 600; white-space: nowrap; }
.pagoda-tier span { font-size: 10px; opacity: .8; white-space: nowrap; }
.pagoda-tier .ok { color: #f4e9c7; }
.guide-mini-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-top: 1px solid #f1eee5; font-size: 11px; }
.guide-mini-row:first-child { border-top: 0; }
.guide-mini-row .name { color: var(--muted); }
.guide-mini-row .num { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.guide-mini-row .num em { font-style: normal; color: var(--muted-2); font-size: 9.5px; margin-left: 2px; }
.member-strip { display: flex; align-items: center; gap: 7px; }
.member-strip .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -5px; }
.member-strip .avatar:first-child { margin-left: 0; }
.member-strip .more { font-size: 10px; color: var(--muted); margin-left: 3px; }
.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight { display: flex; align-items: flex-start; gap: 9px; padding: 10px 11px; border-radius: 10px; background: var(--surface-2); font-size: 11.5px; color: var(--ink-soft); }
.insight .icon { flex: 0 0 auto; margin-top: 1px; color: var(--gold); }
.insight.warn { background: #fbf3e5; color: #74562e; }
.insight.warn .icon { color: var(--accent-strong); }
.insight.good { background: var(--brand-mist); color: #315740; }
.insight.good .icon { color: var(--brand); }
.plan-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid #f0ede3; }
.plan-row:first-child { border-top: 0; }
.plan-date-block { width: 42px; flex: 0 0 auto; text-align: center; border-radius: 9px; padding: 4px 0; background: var(--surface-2); }
.plan-date-block b { display: block; font-size: 16px; font-family: var(--serif); line-height: 1.1; }
.plan-date-block span { font-size: 9px; color: var(--muted); }
.plan-row-info { flex: 1; min-width: 0; }
.plan-row-info strong { display: block; font-size: 12px; font-weight: 600; }
.plan-row-info span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.plan-row .plan-cost { font-size: 12px; font-weight: 700; color: var(--brand); }

/* ---------- Food library ---------- */
.food-summary-row { display: flex; align-items: center; gap: 17px; flex-wrap: wrap; margin-bottom: 15px; }
.food-summary-pill { display: flex; align-items: baseline; gap: 5px; font-size: 11px; color: var(--muted); }
.food-summary-pill b { font-family: var(--serif); font-size: 18px; color: var(--ink); }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11.5px; min-width: 1230px; }
.data-table thead th {
  position: sticky; top: 0; z-index: 3;
  text-align: center; font-weight: 600; font-size: 10.5px; color: #808a81;
  background: #f8f6ed; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.data-table thead th.num { text-align: center; }
.th-sort { display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; }
.th-sort:hover { color: var(--brand); }
.sort-mark { display: inline-block; min-width: 9px; color: var(--muted-2); font-size: 9px; line-height: 1; }
.sort-mark.active { color: var(--brand); }
.data-table tbody td { padding: 9px 10px; border-bottom: 1px solid #f0ede3; vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .14s; }
.data-table tbody tr:hover { background: #fbfaf4; }
.data-table tbody tr.selected { background: #f2f7f2; }
.data-table .sticky-col { position: sticky; left: 34px; z-index: 4; background: #fffdf8; box-shadow: 1px 0 0 var(--line), 7px 0 10px rgba(30, 45, 35, .035); }
.data-table thead .sticky-col { z-index: 6; background: #f8f6ed; }
.data-table tbody tr:hover .sticky-col { background: #fbfaf4; }
.data-table tbody tr.selected .sticky-col { background: #f2f7f2; }
.data-table .sticky-check, .data-table th:first-child:has(input[type="checkbox"]), .data-table td:first-child:has(input[type="checkbox"]) { position: sticky; left: 0; z-index: 5; background: #fffdf8; }
.data-table thead .sticky-check, .data-table thead th:first-child:has(input[type="checkbox"]) { z-index: 7; background: #f8f6ed; }
.data-table tbody tr:hover .sticky-check, .data-table tbody tr:hover td:first-child:has(input[type="checkbox"]) { background: #fbfaf4; }
.data-table tbody tr.selected .sticky-check, .data-table tbody tr.selected td:first-child:has(input[type="checkbox"]) { background: #f2f7f2; }
.data-table.food-table .sticky-col { left: 116px; z-index: 4; }
.data-table.food-table .sticky-code { position: sticky; left: 42px; z-index: 5; width: 74px; background: #fffdf8; box-shadow: 1px 0 0 var(--line); text-align: center; }
.data-table.food-table tbody td.num { text-align: center; }
.data-table.food-table thead .sticky-code { z-index: 6; background: #f8f6ed; }
.data-table.food-table tbody tr:hover .sticky-code { background: #fbfaf4; }
.data-table.food-table tbody tr.selected .sticky-code { background: #f2f7f2; }
.data-table th.action-cell, .data-table td.action-cell { position: sticky; right: 0; z-index: 3; background: #fffdf8; box-shadow: -8px 0 12px rgba(30, 45, 35, .04); }
.data-table thead th.action-cell { background: #f8f6ed; z-index: 4; }
.data-table tbody tr:hover td.action-cell { background: #fbfaf4; }
.data-table tbody tr.selected td.action-cell { background: #f2f7f2; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.food-name-cell { display: flex; align-items: center; min-width: 110px; }
.food-name-cell strong { display: block; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.food-name-cell span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price-cell { white-space: nowrap; }
.price-inline { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.price-inline strong { display: inline-block; font-size: 12px; color: var(--ink); white-space: nowrap; line-height: 18px; }
.price-inline .badge { flex: 0 0 auto; }
.price-inline .tiny { font-size: 8.5px; color: var(--muted); margin-left: 1px; }
.category-code { display: inline-grid; place-items: center; min-width: 26px; padding: 3px 5px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--brand); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 600; }
.food-category-cell { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.food-category-cell strong { display: inline; font-size: 10px; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.food-category-cell span { display: inline; font-size: 9.5px; color: var(--muted); margin-top: 0; white-space: nowrap; }
.th-unit { display: inline-block; margin-left: 3px; font-size: 8px; color: var(--muted-2); font-weight: 400; }
.chip-code { display: inline-block; margin-right: 4px; padding: 0 4px; border-radius: 4px; background: rgba(47, 107, 79, .1); color: var(--brand); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1px; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); background: rgba(255, 253, 248, .62); flex-wrap: wrap; }
.table-info { font-size: 11px; color: var(--muted); }
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 29px; height: 29px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 11px; }
.page-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-btn[disabled] { opacity: .4; cursor: not-allowed; }
.selection-bar { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border: 1px solid #cfe0d2; border-radius: 10px; background: var(--brand-mist); font-size: 11.5px; color: var(--brand); margin-bottom: 10px; }
.selection-bar .spacer { flex: 1; }
.nutrient-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.nutrient-tile { padding: 10px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid #eeeade; }
.nutrient-tile .label { font-size: 10px; color: var(--muted); white-space: nowrap; }
.nutrient-tile .value { margin-top: 2px; font-size: 15px; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.nutrient-tile .value em { font-style: normal; font-size: 9px; color: var(--muted); margin-left: 2px; }
.nutrient-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.nutrient-input { display: flex; flex-direction: column; gap: 3px; }
.nutrient-input label { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted); }
.nutrient-input label em { font-style: normal; color: var(--muted-2); }
.nutrient-input input { min-height: 31px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fffefa; font-size: 11.5px; width: 100%; }
.price-history { display: flex; align-items: center; gap: 10px; color: var(--brand); }
.data-table.price-table th, .data-table.price-table td { text-align: center; }
.data-table.price-table .sticky-check { width: 42px; }
.data-table.price-table .sticky-code { position: sticky; left: 42px; z-index: 5; width: 74px; background: #fffdf8; box-shadow: 1px 0 0 var(--line); text-align: center; }
.data-table.price-table thead .sticky-code { z-index: 6; background: #f8f6ed; }
.data-table.price-table tbody tr:hover .sticky-code { background: #fbfaf4; }
.data-table.price-table tbody tr.selected .sticky-code { background: #f2f7f2; }
.data-table.price-table .sticky-col { left: 116px; z-index: 4; }
.data-table.price-table .food-name-cell { justify-content: center; text-align: center; }
.data-table.price-table .price-source { justify-content: center; }
.data-table.price-table .col-history .price-history { justify-content: center; }
.data-table.price-table .col-actions .row-actions { justify-content: center; }
.data-table.price-table .price-now { display: inline-grid; grid-template-columns: 52px 13px 24px; align-items: baseline; justify-content: center; font-family: var(--serif); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.data-table.price-table .price-int { text-align: right; white-space: nowrap; }
.data-table.price-table .price-dec { text-align: left; }
.data-table.price-table .price-unit { text-align: left; font-family: var(--sans); font-size: 8.5px; color: var(--muted); }
.data-table.dishes-table th, .data-table.dishes-table td { text-align: center; }
.data-table.dishes-table .dish-name { text-align: center; }
.data-table.dishes-table td.dish-ingredients, .data-table.dishes-table td.dish-note { text-align: left; white-space: normal; line-height: 1.5; }
.data-table.dishes-table th .th-sort { justify-content: center; }
.data-table.dishes-table .row-actions { justify-content: center; }
.online-fill-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 15px; padding: 11px 13px; border: 1px solid #d8e3d7; border-radius: 10px; background: linear-gradient(120deg, var(--brand-mist), #fbfcf7); flex-wrap: wrap; }
.online-fill-copy { display: flex; align-items: flex-start; gap: 9px; color: var(--brand); }
.online-fill-copy > .icon { margin-top: 1px; flex: 0 0 auto; }
.online-fill-copy strong { display: block; font-size: 11.5px; color: var(--ink-soft); }
.online-fill-copy span { display: block; font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ---------- Calculator ---------- */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.calc-side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 14px; }
.calc-target-strip { display: flex; align-items: center; gap: 16px; padding: 15px 18px; background: linear-gradient(120deg, #f9f7ee, #fffdf8); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 15px; flex-wrap: wrap; }
.calc-target-strip .target-main strong { font-family: var(--serif); font-size: 23px; }
.calc-target-strip .target-main span { color: var(--muted); font-size: 11px; margin-left: 5px; }
.calc-target-strip .target-member { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.meal-builder { margin-bottom: 14px; overflow: hidden; }
.meal-builder-head { display: flex; align-items: center; gap: 10px; padding: 13px 17px; background: #fbf9f2; border-bottom: 1px solid var(--line); }
.meal-builder-head .meal-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.meal-builder-head .meal-icon.green { background: var(--brand-soft); color: var(--brand); }
.meal-builder-head .meal-icon.blue { background: var(--blue-soft); color: var(--blue); }
.meal-builder-head h3 { font-size: 13px; font-family: var(--sans); }
.meal-builder-head span { font-size: 10px; color: var(--muted); }
.meal-builder-head .meal-total { margin-left: auto; text-align: right; font-size: 10.5px; color: var(--muted); }
.meal-builder-head .meal-total b { display: block; font-size: 12px; color: var(--ink); }
.builder-rows { padding: 5px 17px 9px; }
.builder-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px 86px 55px 28px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #f2efe6; }
.builder-row:last-child { border-bottom: 0; }
.builder-row .food-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.builder-row .food-label .group-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--brand); }
.builder-row .food-label strong { font-size: 11.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builder-row .food-label > div > span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.builder-row .gram-input { display: flex; align-items: center; gap: 4px; }
.builder-row .gram-input input { width: 60px; min-height: 30px; padding: 3px 6px; text-align: right; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 11.5px; }
.builder-row .gram-input em { font-style: normal; font-size: 9px; color: var(--muted); }
.builder-row .food-kcal { text-align: right; font-size: 10.5px; color: var(--muted); }
.builder-row .food-cost { text-align: right; font-size: 10.5px; color: var(--brand); }
.builder-empty { padding: 13px 0; text-align: center; font-size: 11px; color: var(--muted-2); }
.add-food-row { display: flex; gap: 6px; padding: 9px 17px 13px; }
.add-food-row .btn { min-height: 29px; font-size: 10.5px; }
.calc-summary-card { padding: 20px; }
.calc-kcal-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.calc-kcal-row .big { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--brand-strong); }
.calc-kcal-row .unit { font-size: 11px; color: var(--muted); margin-left: 4px; }
.calc-kcal-row .target { text-align: right; font-size: 10px; color: var(--muted); }
.calc-kcal-row .target span { display: block; }
.calc-kcal-row .target b { display: block; font-size: 12px; color: var(--ink); }
.calc-macro-donut { width: 118px; height: 118px; border-radius: 50%; margin: 15px auto; position: relative; }
.calc-macro-donut::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--surface); }
.calc-macro-legend { display: flex; justify-content: center; gap: 13px; font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.calc-macro-legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.nutrient-bars { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.nutrient-bar-row .top { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.nutrient-bar-row .top b { color: var(--ink-soft); font-weight: 500; }
.nutrient-bar-row .top b.low { color: var(--red); }
.nutrient-bar-row .bar { height: 4px; background: #efede4; border-radius: 4px; overflow: hidden; }
.nutrient-bar-row .bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.nutrient-bar-row .bar i.low { background: var(--accent); }
.gap-list { display: flex; flex-direction: column; gap: 6px; }
.gap-item { display: flex; align-items: flex-start; gap: 7px; font-size: 10.5px; color: var(--muted); padding: 7px 8px; border-radius: 7px; background: var(--surface-2); }
.gap-item .icon { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }

/* ---------- Planner ---------- */
.plan-controls { padding: 17px 20px; margin-bottom: 18px; }
.plan-controls-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.plan-members-row { margin-bottom: 16px; }
.plan-members-row .field { width: 100%; }
.plan-controls-row .field { min-width: 150px; }
.plan-controls-row .field.grow { min-width: 190px; }
.plan-controls-row .plan-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.plan-summary-card { position: relative; overflow: hidden; padding: 22px 24px; margin-bottom: 16px; background: linear-gradient(115deg, #1d4b34, #2f6b4f 60%, #3e7d5b); color: #f8f3e4; border-radius: 18px; box-shadow: 0 15px 30px rgba(29, 75, 52, .16); }
.plan-summary-card::after { content: ""; position: absolute; width: 280px; height: 280px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; right: -70px; top: -140px; }
.plan-summary-grid { display: grid; grid-template-columns: 1.2fr repeat(4, minmax(80px, .7fr)) 130px; gap: 16px; align-items: center; position: relative; z-index: 1; }
.plan-summary-card .eyebrow { color: #d9c58f; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; }
.plan-summary-card h2 { color: #fff9e9; font-size: 24px; margin-top: 4px; }
.plan-summary-card .cost-value { font-family: var(--serif); font-size: 32px; line-height: 1.1; color: #fff6dd; }
.plan-summary-card .cost-value small { font-family: var(--sans); font-size: 11px; opacity: .65; margin-left: 3px; }
.plan-metric { padding-left: 16px; border-left: 1px solid rgba(255,255,255,.15); }
.plan-metric span { display: block; font-size: 10px; color: rgba(255, 249, 233, .6); }
.plan-metric strong { display: block; font-size: 18px; font-family: var(--serif); color: #fff8e7; margin-top: 3px; }
.plan-metric em { font-style: normal; font-size: 9.5px; color: rgba(255, 249, 233, .55); }
.plan-metric.is-over strong { color: #ffd2a6; }
.plan-metric.is-over span { color: #e9bd88; }
.plan-summary-card .score-ring { margin: 0 auto; }
.plan-summary-card .ring-track { stroke: rgba(255,255,255,.16); }
.plan-summary-card .ring-value { stroke: #e7cd92; }
.plan-summary-card .score-ring-label strong { color: #fff7df; }
.plan-summary-card .score-ring-label span { color: rgba(255, 249, 233, .58); }
.plan-body { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.plan-main { min-width: 0; }
.plan-side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 14px; }
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 3px 0 12px; scrollbar-width: thin; }
.day-tab { flex: 0 0 auto; min-width: 83px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: all .15s; }
.day-tab:hover { border-color: #b9cbbd; }
.day-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(47,107,79,.16); }
.day-tab .dow { display: block; font-size: 9px; color: var(--muted); letter-spacing: .08em; }
.day-tab .date { display: block; font-size: 12px; font-weight: 600; margin-top: 2px; }
.day-tab .energy { display: block; font-size: 9px; color: var(--muted); margin-top: 2px; }
.day-tab.active .dow, .day-tab.active .energy { color: rgba(255,255,255,.6); }
.meal-card { overflow: hidden; margin-bottom: 12px; }
.meal-card-head { display: flex; align-items: center; gap: 10px; padding: 13px 17px; border-bottom: 1px solid #f2efe6; background: #fcfaf4; }
.meal-card-head .meal-time { font-size: 9.5px; color: var(--muted); letter-spacing: .03em; }
.meal-card-head h3 { font-family: var(--sans); font-size: 13.5px; }
.meal-card-head .meal-meta { margin-left: auto; text-align: right; font-size: 10px; color: var(--muted); }
.meal-card-head .meal-meta b { display: block; color: var(--ink-soft); font-size: 11.5px; }
.meal-dish-count { display: block; font-size: 8.5px; color: var(--brand); margin-bottom: 2px; white-space: nowrap; }
.dish-list { padding: 5px 17px 12px; }
.dish-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 0; border-bottom: 1px solid #f4f1e9; }
.dish-row:last-child { border-bottom: 0; }
.dish-index { width: 20px; height: 20px; border-radius: 6px; flex: 0 0 auto; display: grid; place-items: center; font-size: 9px; color: var(--muted); background: var(--surface-2); }
.dish-main { flex: 1; min-width: 0; }
.dish-main strong { font-size: 12px; font-weight: 500; }
.dish-category { display: inline-block; margin-right: 6px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); color: var(--brand); font-size: 8.5px; font-weight: 500; vertical-align: 1px; }
.dish-category.cat-staple { background: #f5ecd9; color: #8e6a2a; }
.dish-category.cat-soup { background: #e8f0f3; color: #497887; }
.dish-category.cat-fruit { background: #f9eadc; color: #a86528; }
.dish-category.cat-dairy { background: #eaf0f6; color: #55718f; }
.dish-category.cat-soy { background: #eff1e4; color: #697345; }
.dish-category.cat-egg { background: #f6efd9; color: #8d6d2e; }
.dish-category.cat-nuts { background: #f1eadf; color: #81613d; }
.dish-main p { font-size: 10px; color: var(--muted); margin-top: 2px; }
.dish-main .ingredient-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.dish-main .ingredient-chips span { font-size: 9px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 1px 5px; }
.member-portions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.member-portions span { font-size: 8.5px; color: var(--brand); background: var(--brand-mist); border: 1px solid #dce9dd; border-radius: 4px; padding: 1px 5px; }
.dish-kcal { text-align: right; font-size: 10px; color: var(--muted); white-space: nowrap; }
.dish-kcal b { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.meal-seasoning { padding: 0 17px 13px; font-size: 9.5px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.meal-seasoning .tag { font-size: 8.5px; }
.shopping-card { padding: 18px; }
.shopping-list { max-height: 420px; overflow-y: auto; padding-right: 3px; margin-top: 3px; }
.shop-group { margin-bottom: 11px; }
.shop-group-title { display: flex; align-items: center; gap: 5px; font-size: 9.5px; letter-spacing: .05em; color: var(--muted); text-transform: uppercase; padding: 5px 0 3px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.shop-item { display: flex; align-items: center; gap: 7px; padding: 5px 0; font-size: 10.5px; }
.shop-item input { flex: 0 0 auto; }
.shop-item .name { flex: 1; min-width: 0; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-item .qty { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.shop-item .price { width: 48px; text-align: right; color: var(--brand); font-variant-numeric: tabular-nums; }
.shop-item.checked .name, .shop-item.checked .qty, .shop-item.checked .price { text-decoration: line-through; color: var(--muted-2); }
.shop-total { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 11px; padding-top: 12px; }
.shop-total span { color: var(--muted); font-size: 11px; }
.shop-total strong { font-family: var(--serif); font-size: 22px; color: var(--brand-strong); }
.plan-side-card { padding: 17px 18px; }
.guide-bar-row { padding: 7px 0; border-bottom: 1px solid #f2efe7; }
.guide-bar-row:last-child { border-bottom: 0; }
.guide-bar-row .top { display: flex; justify-content: space-between; font-size: 10.5px; }
.guide-bar-row .top span { color: var(--muted); }
.guide-bar-row .top b { font-weight: 500; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.guide-bar-row .bar { height: 4px; background: #efede4; border-radius: 4px; overflow: hidden; margin-top: 4px; position: relative; }
.guide-bar-row .bar i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.guide-bar-row .bar i.warn { background: var(--accent); }
.plan-warnings { display: flex; flex-direction: column; gap: 7px; }
.plan-warning { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border-radius: 8px; background: #fbf2e4; color: #7d5b2d; font-size: 10.5px; }
.plan-warning .icon { flex: 0 0 auto; margin-top: 1px; color: var(--accent-strong); }
.plan-warning.good { background: var(--brand-mist); color: #365a43; }
.plan-warning.good .icon { color: var(--brand); }
.plan-history { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #f1eee5; font-size: 10.5px; }
.history-item:first-child { border-top: 0; }
.history-item .date { width: 38px; color: var(--muted); }
.history-item .info { flex: 1; min-width: 0; }
.history-item .info strong { display: block; font-weight: 500; font-size: 11px; }
.history-item .info span { display: block; font-size: 9.5px; color: var(--muted); }
.plan-empty-hero { padding: 50px 30px; text-align: center; }
.plan-empty-hero .empty-icon { margin: 0 auto 16px; width: 70px; height: 70px; border-radius: 22px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.plan-empty-hero h2 { font-size: 25px; }
.plan-empty-hero p { color: var(--muted); max-width: 460px; margin: 8px auto 20px; font-size: 12.5px; }

/* ---------- Prices ---------- */
.market-selector { margin-bottom: 16px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.market-selector-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.market-selector-head strong { display: block; font-size: 13px; }
.market-selector-head span { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.market-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.market-option { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); text-align: left; transition: all .16s; }
.market-option:hover { border-color: #b8cbbd; background: #fff; }
.market-option.active { border-color: var(--market-color, var(--brand)); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--market-color, var(--brand)) 10%, transparent); }
.market-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--market-color, var(--brand)); }
.market-copy { flex: 1; min-width: 0; }
.market-copy strong { display: block; font-size: 11.5px; }
.market-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.market-check { display: flex; align-items: center; gap: 2px; color: var(--market-color, var(--brand)); font-size: 9.5px; white-space: nowrap; margin-top: 2px; }
.market-choose { color: var(--muted-2); font-size: 9.5px; white-space: nowrap; margin-top: 2px; }
.price-status-banner { display: flex; align-items: center; gap: 13px; padding: 15px 18px; border-radius: 14px; border: 1px solid #d7e3d8; background: linear-gradient(120deg, #f2f7f1, #fbfcf8); margin-bottom: 16px; flex-wrap: wrap; }
.price-status-banner.error { border-color: #edd7c4; background: #fdf7ef; }
.price-status-icon { width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.price-status-banner.error .price-status-icon { background: var(--accent-soft); color: var(--accent-strong); }
.price-status-banner .status-main { flex: 1; min-width: 220px; }
.price-status-banner .status-main strong { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.price-status-banner .status-main span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.price-status-banner .status-meta { display: flex; gap: 18px; font-size: 10px; color: var(--muted); }
.price-status-banner .status-meta b { display: block; color: var(--ink-soft); font-size: 13px; font-family: var(--serif); }
.price-search-card { padding: 18px 20px; margin-bottom: 16px; }
.price-search-row { display: flex; gap: 8px; align-items: center; }
.price-search-row .search-field { flex: 1; }
.price-results { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 13px; }
.price-result-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.price-result-table th { text-align: left; color: var(--muted); font-size: 9.5px; font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.price-result-table td { padding: 8px; border-bottom: 1px solid #f2efe7; }
.price-result-table tr:last-child td { border-bottom: 0; }
.price-table-hint { display: flex; align-items: flex-start; gap: 7px; font-size: 10px; color: var(--muted); padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-top: 10px; }
.price-table-hint .icon { flex: 0 0 auto; margin-top: 1px; color: var(--blue); }
.price-list-controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 11px; }
.price-diff { font-size: 10px; font-variant-numeric: tabular-nums; }
.price-diff.up { color: var(--red); } .price-diff.down { color: var(--brand); }
.price-food-row .price-now { font-family: var(--serif); font-size: 15px; color: var(--ink); }
.price-food-row .price-now small { font-family: var(--sans); font-size: 9px; color: var(--muted); margin-left: 2px; }
.price-source { font-size: 9.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.price-source .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.price-source .dot.reference { background: #c4a56a; }
.price-source .dot.manual { background: #b58a52; }
.price-refresh-overlay { display: flex; align-items: center; gap: 10px; }

/* ---------- Members ---------- */
.members-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.member-card { position: relative; overflow: hidden; padding: 21px; }
.member-card::before { content: ""; position: absolute; height: 4px; inset: 0 0 auto; background: var(--member-color, var(--brand)); }
.member-card-top { display: flex; align-items: flex-start; gap: 12px; }
.member-card .avatar { width: 46px; height: 46px; font-size: 18px; flex: 0 0 auto; }
.member-card-name { flex: 1; min-width: 0; }
.member-card-name h3 { font-family: var(--sans); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.member-card-name p { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.member-card .row-actions { margin-top: -3px; margin-right: -6px; }
.member-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 17px; padding-top: 14px; border-top: 1px dashed var(--line); }
.member-metric span { display: block; font-size: 9.5px; color: var(--muted); }
.member-metric strong { display: block; font-family: var(--serif); font-size: 17px; margin-top: 1px; }
.member-metric small { font-family: var(--sans); font-size: 9px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.member-goal { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 10px; color: var(--muted); }
.member-notes { margin-top: 11px; padding: 8px 9px; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 10px; display: flex; gap: 6px; align-items: flex-start; }
.member-notes .icon { flex: 0 0 auto; margin-top: 1px; }
.member-notes.member-likes { background: rgba(217, 141, 63, .09); color: #9a642a; }
.data-count { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.data-count span { display: block; font-size: 10px; color: var(--muted); }
.data-count strong { display: block; margin-top: 4px; font-family: var(--serif); font-size: 26px; color: var(--ink); }
.data-backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.data-backup-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 16px; padding: 10px 12px; border-radius: 9px; background: var(--brand-mist); color: var(--brand); font-size: 10.5px; line-height: 1.6; }
.data-backup-note .icon { flex: 0 0 auto; margin-top: 1px; }
.member-add-card { min-height: 250px; border: 1.5px dashed #cdd7ca; background: rgba(255, 253, 248, .5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); border-radius: var(--radius); transition: all .2s; }
.member-add-card:hover { border-color: var(--brand); background: var(--brand-mist); color: var(--brand); }
.member-add-card .plus-circle { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.member-add-card strong { font-size: 12.5px; }
.member-add-card span { font-size: 10.5px; }
.household-summary { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 0; margin-bottom: 20px; overflow: hidden; }
.household-summary .cell { padding: 20px 22px; border-left: 1px solid var(--line); }
.household-summary .cell:first-child { border-left: 0; }
.household-summary .cell .label { font-size: 10px; color: var(--muted); }
.household-summary .cell .big { font-family: var(--serif); font-size: 27px; margin-top: 4px; }
.household-summary .cell .big small { font-family: var(--sans); font-size: 10px; color: var(--muted); margin-left: 3px; }
.household-summary .cell .sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.household-summary .avatars { display: flex; gap: 5px; margin-top: 8px; }

/* ---------- Guide ---------- */
.guide-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; margin-bottom: 20px; align-items: stretch; }
.guide-hero-copy { padding: 28px; background: linear-gradient(130deg, #1d4a34, #2f6b4f); border-radius: 18px; color: #f8f3e4; position: relative; overflow: hidden; }
.guide-hero-copy::after { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); right: -90px; bottom: -120px; }
.guide-hero-copy .kicker { color: #d9c58f; letter-spacing: .15em; font-size: 9.5px; text-transform: uppercase; }
.guide-hero-copy h2 { color: #fff8e8; font-size: 27px; margin-top: 8px; line-height: 1.28; }
.guide-hero-copy p { color: rgba(248, 243, 228, .7); font-size: 12px; margin-top: 8px; max-width: 470px; }
.guide-hero-copy .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 17px; }
.guide-hero-copy .tags span { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #f3ecd9; border-radius: 20px; padding: 3px 9px; font-size: 9.5px; }
.pagoda-card { padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; }
.pagoda { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 4px; }
.pagoda-layer { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 7px; color: #fffdf5; padding: 7px 11px; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.pagoda-layer:nth-child(1) { width: 44%; background: #b29357; }
.pagoda-layer:nth-child(2) { width: 56%; background: #b18a4a; }
.pagoda-layer:nth-child(3) { width: 69%; background: #bd7b64; }
.pagoda-layer:nth-child(4) { width: 81%; background: #b99350; }
.pagoda-layer:nth-child(5) { width: 92%; background: #5e8f67; }
.pagoda-layer:nth-child(6) { width: 100%; background: #c2a25b; }
.pagoda-layer b { font-size: 10px; font-weight: 600; white-space: nowrap; }
.pagoda-layer span { font-size: 9px; opacity: .8; white-space: nowrap; }
.pagoda-base { margin-top: 5px; font-size: 8.5px; color: var(--muted); letter-spacing: .04em; }
.guide-rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.rule-card { padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.rule-card .rule-no { font-family: var(--serif); font-size: 17px; color: var(--brand); opacity: .55; }
.rule-card h3 { font-family: var(--sans); font-size: 12px; margin-top: 5px; }
.rule-card p { color: var(--muted); font-size: 10px; margin-top: 3px; line-height: 1.55; }
.guide-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.guide-table th { text-align: left; font-size: 10px; color: var(--muted); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--line-strong); }
.guide-table td { padding: 10px; border-bottom: 1px solid #f1eee5; }
.guide-table tr:last-child td { border-bottom: 0; }
.guide-table .amount { font-family: var(--serif); font-size: 13px; color: var(--brand-strong); white-space: nowrap; }
.guide-table .note { color: var(--muted); font-size: 10px; }
.family-guide-table .recommend { font-weight: 600; color: var(--ink-soft); }
.source-box { display: flex; align-items: flex-start; gap: 9px; padding: 13px 15px; border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 10.5px; }
.source-box .icon { flex: 0 0 auto; margin-top: 1px; color: var(--blue); }
.source-box a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Modal / toast / empty ---------- */
body.modal-open { overflow: hidden; }
.modal-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: opacity .18s; }
.modal-layer.is-open { opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 30, 23, .46); backdrop-filter: blur(2px); }
.modal { position: relative; width: min(620px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.985); transition: transform .2s; overflow: hidden; }
.modal-layer.is-open .modal { transform: translateY(0) scale(1); }
.modal-sm { width: min(430px, 100%); }
.modal-lg { width: min(860px, 100%); }
.modal-xl { width: min(1080px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 20px 23px 15px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-head h2 { font-family: var(--serif); font-size: 21px; line-height: 1.25; }
.modal-head p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.modal-body { padding: 20px 23px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 23px; border-top: 1px solid var(--line); background: #fdfbf5; flex: 0 0 auto; }
.confirm-message { color: var(--ink-soft); font-size: 12.5px; line-height: 1.7; }
.toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; max-width: 360px; padding: 10px 14px; border-radius: 10px; background: #203b2b; color: #f7f3e7; font-size: 11.5px; box-shadow: 0 10px 26px rgba(16, 32, 23, .22); opacity: 0; transform: translateY(8px); transition: all .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast .icon { color: #abd0b5; flex: 0 0 auto; }
.toast-error { background: #5a2d25; }
.toast-error .icon { color: #f0b3a4; }
.toast-warn { background: #5a4827; }
.toast-warn .icon { color: #efd496; }
.empty-state { padding: 34px 22px; text-align: center; border: 1px dashed #d6d6c7; border-radius: 14px; background: rgba(255,253,248,.52); }
.empty-icon { width: 55px; height: 55px; border-radius: 17px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--brand-soft); color: var(--brand); }
.empty-state h3 { font-family: var(--sans); font-size: 13px; }
.empty-state p { color: var(--muted); font-size: 11px; max-width: 400px; margin: 4px auto 12px; }
.spinner-wrap { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #d8ddd4; border-top-color: var(--brand); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.loading-brand { text-align: center; }
.loading-brand .brand-mark { margin: 0 auto 12px; }
.loading-brand h1 { font-size: 25px; font-family: var(--serif); }
.loading-brand p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.loading-dots { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.loading-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); opacity: .4; animation: pulse 1s infinite; }
.loading-dots i:nth-child(2) { animation-delay: .15s; } .loading-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: .9; transform: translateY(-2px); } }
.app-error { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.app-error .card { max-width: 460px; text-align: center; padding: 30px; }

/* ---------- Plan generation overlay ---------- */
.calc-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(30, 46, 36, .28); backdrop-filter: blur(3px); }
.calc-overlay-card { width: min(400px, calc(100vw - 40px)); background: var(--surface); border-radius: 18px; padding: 25px; box-shadow: var(--shadow-lg); }
.calc-overlay-card .overlay-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.calc-overlay-card h3 { font-size: 17px; font-family: var(--serif); }
.calc-overlay-card p { font-size: 11px; color: var(--muted); margin-top: 4px; }
.calc-steps { margin-top: 17px; display: flex; flex-direction: column; gap: 8px; }
.calc-step { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted-2); transition: color .3s; }
.calc-step .dot { width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 8px; }
.calc-step.active { color: var(--ink-soft); }
.calc-step.active .dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.calc-step.done { color: var(--brand); }
.calc-step.done .dot { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .plan-body { grid-template-columns: minmax(0, 1fr) 320px; }
  .calc-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .plan-summary-grid { grid-template-columns: 1.2fr repeat(2, minmax(90px, .7fr)) 115px; }
  .plan-summary-grid .plan-metric:nth-of-type(4), .plan-summary-grid .plan-metric:nth-of-type(5) { display: none; }
  .nutrient-detail-grid, .nutrient-form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .members-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-rules { grid-template-columns: repeat(2, 1fr); }
  .guide-hero { grid-template-columns: 1fr; }
  .dash-two { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .24s ease; width: 252px; box-shadow: 20px 0 50px rgba(0,0,0,.18); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(16, 29, 22, .36); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .sidebar-scrim.is-visible { opacity: 1; pointer-events: auto; }
  .sidebar-close { display: inline-grid !important; position: absolute; top: 20px; right: 12px; color: #e7eadd; }
  .main { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .topbar-menu { display: inline-grid !important; }
  .topbar-meta { display: none; }
  .page { padding: 25px 20px 60px; }
  .dash-grid, .plan-body, .calc-layout { grid-template-columns: 1fr; }
  .plan-side, .calc-side { position: static; }
  .dash-grid .dash-stack { order: -1; }
  .plan-summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  .plan-summary-grid .plan-score-wrap { grid-column: span 1; }
  .plan-summary-grid .plan-metric:nth-of-type(4) { display: block; }
  .plan-summary-grid .plan-metric:nth-of-type(5) { display: none; }
  .plan-summary-card .score-ring { width: 84px !important; height: 84px !important; }
  .plan-summary-card .score-ring svg { width: 84px !important; height: 84px !important; }
  .banner-side { display: none; }
  .food-summary-row { gap: 12px; }
}
@media (max-width: 720px) {
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 19px; }
  .page-head h1 { font-size: 28px; }
  .page-head-actions { width: 100%; justify-content: flex-start; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-value { font-size: 23px; }
  .dash-menu-grid { grid-template-columns: 1fr; }
  .score-panel { flex-direction: column; align-items: flex-start; gap: 15px; }
  .macro-list { width: 100%; }
  .mini-stats { gap: 14px; }
  .household-summary { grid-template-columns: 1fr; }
  .household-summary .cell { border-left: 0; border-top: 1px solid var(--line); }
  .household-summary .cell:first-child { border-top: 0; }
  .members-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .nutrient-detail-grid, .nutrient-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-row { grid-template-columns: minmax(0, 1fr) 65px 55px 26px; gap: 7px; }
  .builder-row .food-cost { display: none; }
  .builder-row .gram-input input { width: 47px; }
  .plan-controls-row .field, .plan-controls-row .field.grow { min-width: 100%; }
  .plan-controls-row .plan-actions { width: 100%; margin-left: 0; }
  .plan-controls-row .plan-actions .btn { flex: 1; }
  .header-regenerate { display: none !important; }
  .plan-summary-card { padding: 19px; }
  .plan-summary-grid { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 3px; }
  .plan-summary-grid .plan-summary-title { grid-column: 1 / -1; padding-right: 84px; }
  .plan-summary-grid .plan-score-wrap { position: absolute; right: 0; top: 2px; width: 76px; height: 76px; }
  .plan-summary-card .score-ring { width: 76px !important; height: 76px !important; }
  .plan-summary-card .score-ring svg { width: 76px !important; height: 76px !important; }
  .plan-summary-card .cost-value { font-size: 27px; }
  .plan-metric { padding-left: 10px; }
  .plan-metric span { font-size: 9px; }
  .plan-metric strong { font-size: 15px; }
  .plan-summary-grid .plan-metric:nth-of-type(4) { display: block; }
  .day-tabs { gap: 5px; }
  .day-tab { min-width: 75px; }
  .meal-card-head { padding: 11px 13px; }
  .dish-list { padding: 3px 13px 9px; }
  .meal-seasoning { padding: 0 13px 11px; }
  .modal-layer { padding: 0; align-items: flex-end; }
  .modal { width: 100% !important; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .modal-head { padding: 17px 18px 13px; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px; }
  .modal-foot .btn { flex: 1; }
  .toast-root { left: 15px; right: 15px; bottom: 15px; align-items: stretch; }
  .toast { max-width: none; }
  .price-search-row { flex-wrap: wrap; }
  .price-search-row .search-field { min-width: 100%; }
  .price-search-row .btn { flex: 1; }
  .market-options { grid-template-columns: 1fr; }
  .market-selector { padding: 14px; }
  .guide-rules { grid-template-columns: 1fr; }
  .nutrient-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-footer { flex-direction: column; align-items: flex-start; }
  .data-table th.action-cell, .data-table td.action-cell { position: static; box-shadow: none; }
  .data-table .sticky-col { left: 34px; }
  .data-table.food-table .sticky-col { left: 116px; }
  .data-table.price-table .sticky-col { left: 116px; }
  .welcome-banner { padding: 21px; }
  .welcome-banner h2 { font-size: 23px; }
  .welcome-banner .banner-actions { flex-wrap: wrap; }
  .banner-side { display: none; }
  .topbar { height: 58px; }
  .topbar-crumb { font-size: 11px; }
}
@media print {
  .sidebar, .topbar, .page-head-actions, .plan-controls, .day-tabs, .plan-side, .toolbar, .modal-layer, .toast-root, .no-print { display: none !important; }
  .main { margin: 0; }
  .page { padding: 0; max-width: none; }
  .app-shell { background: #fff; }
  body { background: #fff; }
  .card, .meal-card { box-shadow: none; break-inside: avoid; }
  .plan-body { display: block; }
  .plan-summary-card { color: #1b2a21; background: #fff; border: 1px solid #bbb; box-shadow: none; }
  .plan-summary-card h2, .plan-summary-card .cost-value, .plan-metric strong { color: #1b2a21; }
  .plan-summary-card .score-ring { display: none; }
}
