/* 肚饱 · 新食堂智能体
   颜色约定：--chart-line 只用于数据标记；状态色固定，且始终配文字标签。 */

/* 品牌深色主题（按 v0 设计方案固定为深色，不随系统切换） */
:root {
  color-scheme: dark;

  --bg: #141210;
  --surface: #1C1A17;
  --surface-2: #242019;
  --rail-bg: #181613;
  --line: #332E27;
  --line-strong: #433C32;

  --ink: #F2EDE5;
  --ink-2: #C7BFB3;
  --muted: #948A7C;

  --brand: #D95926;
  --brand-hover: #E4703F;
  --brand-ink: #F0B79F;
  --brand-soft: #35241C;

  --chart-line: #D95926;
  --chart-grid: #2F2A24;
  --chart-axis: #4B4438;
  --track: #2D2821;

  --good: #0CA30C;
  --warning: #FAB219;
  --serious: #EC835A;
  --critical: #D03B3B;

  --radius: 16px;
  --shadow: none;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon-lg { width: 28px; height: 28px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100dvh; }

.rail {
  width: 236px;
  flex: none;
  background: var(--rail-bg);
  border-right: 1px solid var(--line);
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #EE7A4B 0%, #D14E1E 100%);
  color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 19px; letter-spacing: .04em; }
.brand-text small { font-size: 11px; color: var(--muted); margin-top: 3px; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 0; border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.rail-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--line); }
.open-state { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.rail-foot p { margin: 6px 0 0; font-size: 11px; color: var(--muted); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot[data-status="good"] { background: var(--good); }
.status-dot[data-status="warning"] { background: var(--warning); }
.status-dot[data-status="serious"] { background: var(--serious); }
.status-dot[data-status="critical"] { background: var(--critical); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-brand { display: none; font-weight: 700; font-size: 17px; letter-spacing: .04em; }
.topbar-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.topbar-meta .icon { width: 15px; height: 15px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.badge-soft {
  font-size: 11.5px; color: var(--brand-ink);
  background: var(--brand-soft);
  padding: 4px 10px; border-radius: 999px;
}
.badge-demo {
  font-size: 11px; color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: 3px 8px; border-radius: 999px;
}

.views { padding: 6px 32px 56px; max-width: 1180px; width: 100%; margin: 0 auto; }

.view { display: none; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 40px 64px; animation: fade .25s ease; }
.view.is-active { display: block; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head { margin-bottom: 20px; }
.view-head h1 { margin: 0; font-size: 28px; letter-spacing: -.01em; line-height: 1.25; font-weight: 700; }
.view-head p { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); max-width: 660px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.card-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.muted { color: var(--muted); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.is-on { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px;
}
.ghost-btn:hover { border-color: var(--line-strong); color: var(--ink); }

.text-link {
  border: 0; background: none; padding: 0;
  color: var(--brand-ink); font-size: 12.5px;
}
.text-link:hover { text-decoration: underline; }

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0; background: transparent;
  color: var(--ink-2);
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
}
.segmented button.is-on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(35, 31, 27, .07);
}

.status-pill {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
}

.foot-note { font-size: 11.5px; color: var(--muted); margin: 14px 0 0; }

/* ---------- 问一问 ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 18px;
  align-items: start;
}

.chat-panel {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: min(660px, calc(100dvh - 220px));
  min-height: 460px;
  overflow: hidden;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

.msg { display: flex; }
.msg-user { justify-content: flex-end; }

.msg-bot { gap: 10px; align-items: flex-start; }
.msg-bot::before {
  content: "";
  width: 38px; height: 38px;
  flex: none;
  margin-top: 1px;
  border-radius: 50%;
  background: url("brand/mascot-avatar.png") center / cover no-repeat;
}
.msg-bot .msg-body { max-width: calc(84% - 48px); }

.msg-body {
  max-width: 84%;
  background: var(--surface-2);
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.65;
}
.msg-body.is-card { width: min(560px, 100%); }
.msg-body p { margin: 0 0 7px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-sub { font-size: 12.5px; color: var(--muted); margin-top: 10px !important; }

.msg-user .msg-body { background: var(--brand); color: #fff; }

.msg-time { font-size: 10.5px; color: var(--muted); margin-top: 5px; text-align: right; }

.msg-card { max-width: 92%; width: 100%; }

.typing-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.composer {
  display: flex; align-items: flex-end; gap: 7px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.composer textarea {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  resize: none;
  padding: 9px 4px;
  font-size: 14px;
  max-height: 120px;
  line-height: 1.5;
}
.composer textarea::placeholder { color: var(--muted); }

.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 10px;
  display: grid; place-items: center;
  flex: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn.is-listening { background: var(--critical); border-color: var(--critical); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(208, 59, 59, .35); } 50% { box-shadow: 0 0 0 6px rgba(208, 59, 59, 0); } }

.send-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 12px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.send-btn:hover { background: var(--brand-hover); }
.send-btn:disabled { opacity: .4; cursor: default; }

.chat-side { display: flex; flex-direction: column; gap: 12px; }
.side-card { padding: 16px; }
.side-card h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 650; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.side-head h3 { margin: 0; }

.side-num { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 10px; }
.side-num strong { font-size: 30px; line-height: 1; }
.side-num span { font-size: 11.5px; color: var(--muted); }

.mini-bars { margin-bottom: 8px; }
.bar-row {
  display: grid; grid-template-columns: 46px 1fr 30px;
  gap: 8px; align-items: center;
  font-size: 11.5px; color: var(--ink-2);
  margin-top: 8px;
}
.bar-track { height: 7px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--chart-line); transition: width .4s ease; }

.side-dish .dish-name { font-size: 14px; font-weight: 650; }
.side-dish .dish-meta-line { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.side-dish .dish-price-line { font-size: 12.5px; color: var(--brand-ink); margin-top: 6px; font-weight: 600; }
.side-dish + .text-link { margin-top: 10px; display: inline-block; }

.quiet { background: transparent; box-shadow: none; }
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); margin-top: 9px; }
.info-list .icon { width: 15px; height: 15px; color: var(--muted); }

/* ---------- 对话内的卡片 ---------- */
.chat-dishes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.chat-dish {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
}
.chat-dish-main strong { display: block; font-size: 13.5px; font-weight: 600; }
.chat-dish-main small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.chat-dish .btn-small { flex: none; width: auto; padding: 0 12px; height: 30px; font-size: 12px; }

.chat-bars { margin: 10px 0 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.chat-bars .bar-row { margin-top: 7px; }

.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-actions .btn-small { flex: none; width: auto; padding: 0 12px; height: 32px; }

/* ---------- 菜品 ---------- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 40px;
  padding: 0 12px;
}
.search-box .icon { color: var(--muted); width: 16px; height: 16px; }
.search-box input { border: 0; outline: 0; background: transparent; width: 230px; font-size: 13.5px; }

.floor-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.floor-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
}
.floor-tab.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .chip { height: 32px; display: inline-flex; align-items: center; padding: 0 12px; }
.cat-select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  padding: 0 10px;
  font-size: 12.5px;
  outline: 0;
}
.cat-select:focus { border-color: var(--brand); }

.stall-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  margin-bottom: 6px;
  scrollbar-width: thin;
}
.stall-chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  white-space: nowrap;
}
.stall-chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.stall-chip.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.stall-chip small { opacity: .7; margin-left: 4px; }

.stall-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.stall-section { margin-bottom: 28px; }
.stall-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.stall-section-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.stall-section-meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.stall-section-count {
  flex: none;
  margin-top: 2px;
  font-size: 12px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.stall-note { margin-top: 5px; font-size: 12px; color: var(--brand-ink); }

.grid-more { display: flex; justify-content: center; margin-top: 14px; }

.est-flag {
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 3px;
  margin-left: 2px;
}
.dish-note { font-size: 11.5px; color: var(--brand-ink); }

.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 14px; }

.dish-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 16px 14px;
  display: flex; flex-direction: column; gap: 9px;
  transition: border-color .15s, transform .15s;
}
.dish-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.dish-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.dish-name { font-size: 15.5px; font-weight: 650; }
.dish-price { font-size: 15px; font-weight: 700; color: var(--brand-ink); white-space: nowrap; }
.dish-price small { font-size: 11px; font-weight: 400; color: var(--muted); }
.dish-vendor { font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.dish-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--surface-2);
}
.tag-hot { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }

.dish-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 11.5px; color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.dish-meta strong { color: var(--ink); font-weight: 600; }

.dish-actions { margin-top: auto; display: flex; gap: 8px; }
.btn-small {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
}
.btn-small:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-small.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-small.primary:hover { background: var(--brand-hover); }

/* ---------- 人流 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat-value.small { font-size: 21px; font-weight: 650; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }

.chart-card { padding: 20px; }

.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chart-wrap { position: relative; margin-top: 14px; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart-tip {
  position: absolute;
  transform: translate(-50%, -130%);
  background: var(--ink);
  color: var(--surface);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 6;
}
.chart-tip.is-on { opacity: 1; }

.chart-note { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { width: 16px; height: 2px; background: var(--chart-line); border-radius: 2px; }
.legend-window { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--chart-line) 14%, transparent); }

.table-wrap { margin-top: 12px; max-height: 280px; overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td { font-size: 12px; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.table-wrap th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--surface); }
.table-wrap td { font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }

.floor-row {
  display: grid;
  grid-template-columns: 88px 1fr 88px;
  gap: 12px; align-items: center;
  margin-top: 16px;
}
.floor-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.floor-name small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.floor-state { font-size: 11.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; justify-content: flex-end; }

.advice-list { list-style: none; margin: 6px 0 0; padding: 0; }
.advice-list li { display: grid; grid-template-columns: 68px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.advice-list li:last-child { border-bottom: 0; }
.advice-time { font-size: 12.5px; font-weight: 650; color: var(--brand-ink); }
.advice-list p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }

/* ---------- 营养 ---------- */
.goal-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.goal-label { font-size: 12.5px; color: var(--muted); }

.hero-card { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; padding: 22px; }
.hero-value { font-size: 46px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.hero-value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.hero-meter { padding-top: 22px; }

.meter { height: 9px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--chart-line); width: 0; transition: width .45s ease, background .2s; }
.meter-lg { height: 14px; }
.meter-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 7px; font-variant-numeric: tabular-nums; }

.macro-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0; }
.macro { padding: 15px 16px; }
.macro-head { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.macro-head strong { font-size: 19px; color: var(--ink); font-weight: 650; margin-left: auto; }

.meal-list { list-style: none; margin: 8px 0 0; padding: 0; }
.meal-list li { display: grid; grid-template-columns: 46px 1fr auto 28px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meal-list li:last-child { border-bottom: 0; }
.meal-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meal-name { font-size: 13.5px; }
.meal-kcal { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meal-del { width: 26px; height: 26px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; display: grid; place-items: center; }
.meal-del:hover { background: var(--surface-2); color: var(--critical); }
.meal-del .icon { width: 15px; height: 15px; }

.capture-card .dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  padding: 30px 16px;
  margin-top: 12px;
  text-align: center;
  cursor: pointer;
  color: var(--ink-2);
}
.capture-card .dropzone:hover, .capture-card .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.capture-card .dropzone strong { font-size: 13.5px; }
.capture-card .dropzone span { font-size: 11.5px; color: var(--muted); }
.capture-card .dropzone .icon { color: var(--brand); margin-bottom: 2px; }

.advice-card { margin-top: 14px; }
.advice-body { margin-top: 12px; display: grid; gap: 10px; }
.advice-line { display: flex; gap: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.advice-line b { color: var(--ink); font-weight: 600; }
.advice-badge { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 2px; }

/* ---------- 营养子页 / 周报 / 开销 ---------- */
.subnav {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.subnav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 7px 16px;
  border-radius: 9px;
  font-size: 13px;
}
.subnav-btn.is-on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(35, 31, 27, .07);
}
.ntab[hidden] { display: none; }

.chart-table-bar { display: flex; justify-content: flex-end; margin: 8px 2px 0; }

.week-chart { margin-top: 10px; }
.week-chart svg { width: 100%; height: auto; display: block; overflow: visible; }

.spend-chart { margin-top: 10px; }
.spend-chart svg { width: 100%; height: auto; display: block; overflow: visible; }

.budget-card { margin-bottom: 14px; }
.budget-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.budget-value { display: flex; align-items: baseline; gap: 5px; margin-top: 4px; }
.budget-value strong { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.budget-value span { font-size: 13px; color: var(--muted); }

.budget-edit { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.budget-edit input {
  width: 104px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 0 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  outline: 0;
}
.budget-edit input:focus { border-color: var(--brand); }

.budget-alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
}
.budget-alert.is-ok { background: color-mix(in srgb, var(--good) 8%, transparent); color: var(--ink-2); }
.budget-alert.is-warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--ink-2); }
.budget-alert.is-over { background: color-mix(in srgb, var(--critical) 11%, transparent); color: var(--ink-2); }
.budget-alert b { color: var(--ink); }

.floor-spend { margin-top: 8px; }
.floor-spend .floor-row { grid-template-columns: 92px 1fr 74px; margin-top: 14px; }
.floor-spend .floor-state { font-variant-numeric: tabular-nums; }

.value-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.value-row {
  display: grid;
  grid-template-columns: 26px 1fr 92px 92px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.value-rank { font-size: 12px; color: var(--brand-ink); font-weight: 700; }
.value-name strong { font-size: 13.5px; display: block; }
.value-name small { font-size: 11px; color: var(--muted); }
.value-metric { font-size: 12px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.value-metric b { font-size: 13.5px; color: var(--ink); }

@media (max-width: 560px) {
  .subnav { width: 100%; display: flex; }
  .subnav-btn { flex: 1; padding: 8px 0; }
  .budget-head { align-items: flex-start; }
  .budget-value strong { font-size: 32px; }
  .value-row { grid-template-columns: 22px 1fr 68px; }
  .value-row .value-metric:last-child { display: none; }
}

/* ---------- 反馈 ---------- */
.small-stat .stat-value { font-size: 26px; }
.feedback-grid { display: grid; grid-template-columns: 1.02fr 1fr; gap: 14px; align-items: start; }

.field { margin-top: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.field select, .field input[type="text"], .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: 0;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.field select:focus, .field textarea:focus { border-color: var(--brand); }
.field-hint { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); }
.field.is-error textarea, .field.is-error select { border-color: var(--critical); }
.field.is-error .field-hint { color: var(--critical); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.upload-inline {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.upload-inline:hover { border-color: var(--brand); color: var(--brand-ink); }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin: 14px 0; }

.primary-btn {
  width: 100%;
  height: 42px;
  border: 0; border-radius: 10px;
  background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600;
}
.primary-btn:hover { background: var(--brand-hover); }

.feedback-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-height: 520px; overflow-y: auto; padding-right: 2px; }

.fb-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; }
.fb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fb-id { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.fb-type { font-size: 13px; font-weight: 650; margin-top: 3px; }
.fb-text { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 0; line-height: 1.55; }
.fb-reply { margin-top: 8px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.fb-reply b { color: var(--brand-ink); font-weight: 600; }

.timeline { display: flex; gap: 6px; margin-top: 10px; }
.timeline-step { flex: 1; }
.timeline-step i { display: block; height: 3px; border-radius: 2px; background: var(--track); }
.timeline-step.is-done i { background: var(--good); }
.timeline-step.is-now i { background: var(--warning); }
.timeline-step span { display: block; font-size: 10px; color: var(--muted); margin-top: 4px; }
.timeline-step.is-done span, .timeline-step.is-now span { color: var(--ink-2); }

.fb-advance {
  border: 0; background: none; padding: 0;
  font-size: 10.5px; color: var(--muted);
  margin-top: 8px;
}
.fb-advance:hover { color: var(--brand-ink); text-decoration: underline; }

/* ---------- 个人档案 ---------- */
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-2);
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.profile-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; padding: 14px 18px;
}
.profile-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; }
.profile-goal {
  font-size: 10.5px; font-weight: 500;
  color: var(--brand-ink); background: var(--brand-soft);
  padding: 2px 8px; border-radius: 999px;
}
.profile-metrics { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 7px; font-size: 12px; color: var(--muted); }
.profile-metrics b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.setup-root {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(24, 21, 18, .5);
  backdrop-filter: blur(4px);
}
.setup-root[hidden] { display: none; }
.setup-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 28px 22px;
  box-shadow: 0 24px 60px rgba(24, 21, 18, .24);
}
.setup-kicker { font-size: 10.5px; letter-spacing: .14em; color: var(--brand); font-weight: 600; }
.setup-card h2 { margin: 8px 0 6px; font-size: 23px; letter-spacing: -.01em; }
.setup-card > .setup-head > p { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.setup-field { display: block; font-size: 12.5px; color: var(--ink-2); }
.setup-field > span { display: block; margin-bottom: 6px; }
.setup-field input[type="number"],
.setup-field input[type="text"],
.setup-field select {
  width: 100%; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 12px;
  font-size: 14px;
  outline: 0;
}
.setup-field input:focus, .setup-field select:focus { border-color: var(--brand); }
.setup-field.wide { margin-top: 14px; }
.setup-field .segmented { margin-top: 2px; }
.setup-field .segmented button { min-width: 92px; padding: 7px 14px; font-size: 12.5px; }

.check-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.check-chip input { accent-color: var(--brand); }
.check-chip:has(input:checked) { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }

.setup-error { margin: 10px 0 0; font-size: 12px; color: var(--critical); }
.setup-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.setup-actions .primary-btn { width: auto; padding: 0 22px; height: 40px; }

.ai-note { margin-top: 8px; font-size: 10.5px; color: var(--muted); }

.share-btn { width: 34px; height: 34px; border-radius: 9px; }
.share-lead { margin: 0 0 4px; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.qr-wrap {
  width: fit-content;
  margin: 14px auto;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
}
.qr-wrap svg { width: 180px; height: 180px; display: block; }
.share-url { display: flex; gap: 8px; align-items: center; }
.share-url input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  padding: 0 10px;
  font-size: 12px;
  outline: 0;
}
.share-url .btn-small { flex: none; width: auto; padding: 0 14px; height: 38px; }

@media (max-width: 420px) {
  .badge-demo { display: none; }
}
.ai-review {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}
.ai-review p { margin: 0; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-root[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(24, 21, 18, .45); }
.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: 86vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(24, 21, 18, .22);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px; overflow-y: auto; }

.recog-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.recog-note { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }
.recog-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.recog-item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  text-align: left;
  width: 100%;
}
.recog-item.is-on { border-color: var(--brand); background: var(--brand-soft); }
.recog-item strong { font-size: 13.5px; font-weight: 600; }
.recog-item small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.recog-conf { font-size: 12px; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.recog-actions { display: flex; gap: 8px; margin-top: 14px; }
.recog-actions .primary-btn, .recog-actions .btn-small { width: auto; flex: 1; }

.toast {
  position: fixed;
  left: 50%; bottom: 88px;
  transform: translate(-50%, 10px);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 120;
  max-width: 86vw;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 移动端 ---------- */
.tabbar { display: none; }

@media (max-width: 1080px) {
  .rail { width: 208px; }
  .chat-layout { grid-template-columns: minmax(0, 1fr) 264px; }
  .views { padding-left: 22px; padding-right: 22px; }
  .topbar { padding: 0 30px; }
}

@media (max-width: 920px) {
  .rail { display: none; }
  .topbar { height: 56px; padding: 0 16px; }
  .mobile-brand { display: inline; }
  .topbar-meta { display: none; }
  .views { padding: 0 16px 84px; }
  .view { padding: 20px 16px 84px; }
  .view-head h1 { font-size: 24px; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .chat-panel { height: calc(100dvh - 278px); min-height: 360px; }
  /* iOS 只有输入框字号 ≥16px 才不会在聚焦时自动放大页面 */
  .composer textarea { font-size: 16px; }
  .composer { padding: 8px 10px 10px; gap: 6px; }
  .composer .icon-btn { width: 42px; height: 42px; }
  .composer .send-btn { width: 42px; height: 42px; }
  .icon-btn { touch-action: manipulation; }
  .stat-row { gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 24px; }
  .stat-value.small { font-size: 17px; }
  .two-col, .feedback-grid, .hero-card { grid-template-columns: 1fr; }
  .hero-card { gap: 14px; }
  .hero-value { font-size: 38px; }
  .macro-row { grid-template-columns: 1fr; gap: 10px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .search-box { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .chart-card { padding: 16px; }
  .card-actions { width: 100%; justify-content: space-between; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 50;
  }
  .tab-item {
    flex: 1;
    border: 0; background: none;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0;
    font-size: 10.5px;
    color: var(--muted);
    border-radius: 10px;
  }
  .tab-item .icon { width: 20px; height: 20px; }
  .tab-item.is-active { color: var(--brand-ink); }

  .toast { top: 64px; bottom: auto; transform: translate(-50%, -8px); }
  .toast.is-show { transform: translate(-50%, 0); }
}

@media (max-width: 560px) {
  .setup-grid { grid-template-columns: 1fr; gap: 10px; }
  .setup-card { padding: 20px 16px 12px; }
  .setup-card h2 { font-size: 20px; }
  .setup-field.wide { margin-top: 10px; }
  .setup-actions {
    position: sticky; bottom: -12px;
    margin-top: 12px; padding: 12px 0 6px;
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .profile-card { flex-direction: column; align-items: flex-start; }
  .profile-metrics { gap: 4px 14px; }
  .dish-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat-row .stat:last-child { grid-column: span 2; }
  .stat-row.three { grid-template-columns: 1fr 1fr; }
  .stat-row.three .stat:last-child { grid-column: span 2; }
  .view-head p { font-size: 12.5px; }
  .badge-soft { display: none; }
  .floor-row { grid-template-columns: 76px 1fr 74px; gap: 8px; }
  .recog-preview { max-height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

.dish-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}
.dish-empty p { margin: 0; font-size: 15px; color: var(--ink); font-weight: 600; }
.dish-empty span { font-size: 12.5px; }
.dish-empty .ghost-btn { margin-top: 4px; }

.share-select {
  width: 100%;
  height: 38px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  padding: 0 10px;
  font-size: 12px;
  outline: 0;
}

/* 对话内图片与识别结果 */
.msg-body.msg-media { background: transparent; border: 0; padding: 0; }
.msg-image {
  display: block;
  width: min(260px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line);
}
.plate-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.plate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--ink);
  cursor: pointer;
}
.plate-item:hover { border-color: var(--line-strong); }
.plate-item-main strong { display: block; font-size: 13.5px; font-weight: 600; }
.plate-item-main small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.plate-conf { font-size: 12px; color: var(--brand-ink); font-variant-numeric: tabular-nums; flex: none; }
.plate-item.is-picked { border-color: var(--brand); background: var(--brand-soft); }
.plate-item:disabled { cursor: default; opacity: .6; }

.file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  padding: 0;
  margin: -1px;
}

.photo-wrap { position: relative; overflow: hidden; }
.photo-wrap svg { pointer-events: none; }
.photo-wrap.is-busy { opacity: .55; pointer-events: none; }
.photo-wrap .file-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
  font-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
