:root {
  /* 食光 FoodTime 品牌 VI */
  --green: #0E9F6E;
  --green-deep: #0C6C4C;
  --green-700: #0C6C4C;
  --green-800: #0A4A36;
  --green-soft: #EEF9F3;
  --green-50: #EEF9F3;
  --red: #DC3F45;
  --red-soft: #FDE7E7;
  --yellow: #E08A00;
  --yellow-soft: #FDF0D5;
  --cta: #F26B22;
  --ink: #12211B;
  --ink-700: #3A4B43;
  --ink-500: #5C6D64;
  --muted: #5C6D64;
  --line: #E6E3DA;
  --line-2: #F0EDE4;
  --canvas: #F7F4EC;
  --surface: #fff;
  /* 品牌别名（family-web 组件使用） */
  --brand: #0E9F6E;
  --brand-700: #0C6C4C;
  --brand-50: #EEF9F3;
  --brand-grad: linear-gradient(150deg, #0E9F6E, #0C6C4C);
  --fresh: #0E9F6E;
  --expiring: #E08A00;
  --expired: #DC3F45;
  --amber-100: #FDF0D5;
  --orange-100: #FFEBDF;
  --shadow: 0 12px 34px rgba(18, 33, 27, .06);
  --control-height-sm: 32px;
  --control-height-md: 44px;
  --control-height-lg: 48px;
  --control-radius-sm: 9px;
  --control-radius-md: 11px;
  --control-radius-lg: 13px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
button, input, select { font: inherit; }
button { appearance: none; cursor: pointer; }
.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;
}
.topbar {
  height: 72px;
  padding: 0 max(calc((100vw - 1200px) / 2), 24px);
  display: flex;
  align-items: center;
  gap: 42px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(245, 247, 242, .88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(227, 232, 227, .8);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; white-space: nowrap; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px;
  color: #fff; background: var(--green); font-weight: 800; font-size: 20px;
}
.brand strong { display: block; font-size: 19px; letter-spacing: 0; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.nav {
  display: flex; gap: 5px; padding: 5px; border-radius: 14px; background: #eaeee8;
}
.nav button {
  height: 40px; padding: 0 21px; border: 0; border-radius: 10px;
  color: var(--muted); background: transparent; font-weight: 650;
}
.nav-icon { display: none; }
.nav button.active { color: var(--green); background: var(--surface); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.session { display: flex; margin-left: auto; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.quiet {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  height: var(--control-height-md); border-radius: var(--control-radius-md); padding: 0 16px; font-weight: 650;
}
.link {
  display: inline-flex; align-items: center; min-height: var(--control-height-sm); height: auto;
  padding: 0 4px; border: 0; color: var(--green); background: transparent; font-size: 14px; font-weight: 650;
}
.shell { max-width: 1200px; margin: 0 auto; padding: 30px 24px 52px; }

/* 未登录时隐藏所有导航与助手入口，仅展示登录/注册面板 */
body:not(.is-logged-in) #appTopbar,
body:not(.is-logged-in) #mainNav,
body:not(.is-logged-in) #sessionActions,
body:not(.is-logged-in) #appBreadcrumb,
body:not(.is-logged-in) #mobileNav,
body:not(.is-logged-in) #quickAgentForm,
body:not(.is-logged-in) .quick-agent-fab {
  display: none !important;
}
body:not(.is-logged-in) .shell { padding-bottom: 16px; }

/* 面包屑导航：所有子页面顶部统一显示 */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.breadcrumb.hidden { display: none; }
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color .15s; }
.breadcrumb a:hover { color: var(--green); }
.breadcrumb .breadcrumb-current { color: var(--ink); font-weight: 700; }
.breadcrumb-sep { color: #b6c0b9; font-size: 11px; }
.eyebrow {
  color: var(--green); text-transform: uppercase; letter-spacing: 0; font-size: 12px;
  font-weight: 750; margin: 0 0 10px;
}
h1 { margin: 0; font-size: 43px; letter-spacing: 0; line-height: 1.1; }
h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.panel, .tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px; box-shadow: var(--shadow);
}
.login-layout { min-height: calc(100vh - 135px); display: grid; grid-template-columns: 1.1fr 430px; gap: 68px; align-items: center; }
.login-intro h1 { font-size: 68px; }
.login-intro p:not(.eyebrow) { color: var(--muted); max-width: 470px; font-size: 18px; line-height: 1.65; }
.login-card { padding: 34px; }
.login-card .muted { margin: 10px 0 27px; }
.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; margin-bottom: 22px;
  border-radius: 14px; background: #eaeee8;
}
.auth-switch button {
  height: 38px; border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-weight: 720;
}
.auth-switch button.active { color: var(--green); background: var(--surface); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.form { display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
input, select {
  height: 48px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line);
  color: var(--ink); background: #fbfcfa;
}
input[type="checkbox"], input[type="radio"] {
  height: auto; width: auto; padding: 0; margin: 0; border: 0; background: transparent;
}
input:focus, select:focus { outline: 2px solid #a6ceb9; border-color: var(--green); }
input[type="checkbox"]:focus, input[type="radio"]:focus { outline: none; }

/* 登录页：演示账号提示 / 记住我 / 忘记密码 */
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; padding: 2px 0; flex-wrap: wrap; row-gap: 6px; }
.login-remember { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.login-remember input { flex: none; width: 18px; height: 18px; accent-color: var(--green); }
.login-remember span { font-weight: 600; color: var(--ink); }
.login-switch { font-size: 13px; color: var(--muted); text-align: center; margin: 0; }
.login-switch a { color: var(--green); text-decoration: none; font-weight: 700; margin-left: 4px; }
.login-switch a:hover { text-decoration: underline; }
.login-demo {
  display: block; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px;
  background: rgba(14, 159, 110, 0.04); font-size: 13px; color: var(--muted); line-height: 1.7;
  margin: 0;
}
.login-demo code { font-size: 12.5px; color: var(--ink); background: rgba(14, 159, 110, 0.08); padding: 1px 6px; border-radius: 6px; font-weight: 700; }
.login-demo span + code { margin-left: 6px; }
.primary {
  height: var(--control-height-md); padding: 0 18px; border: 0; border-radius: var(--control-radius-md);
  color: white; background: var(--green); font-weight: 720;
}
.danger-button {
  height: var(--control-height-md); padding: 0 16px; border: 0; border-radius: var(--control-radius-md);
  color: var(--red); background: var(--red-soft); font-weight: 720;
}
.primary:hover { background: #135a3e; }
.quiet:hover { background: #f7f9f6; }
.danger-button:hover { background: #fbded9; }
.primary:focus-visible, .quiet:focus-visible, .danger-button:focus-visible {
  outline: 2px solid rgba(25, 104, 73, .25); outline-offset: 2px;
}
.danger-button:focus-visible { outline-color: rgba(200, 61, 54, .28); }
.primary.compact { margin-top: 28px; }
.login-form .primary { height: var(--control-height-lg); border-radius: var(--control-radius-lg); margin-top: 8px; }
.view { display: none; }
.view.active { display: block; }
.bento { display: grid; gap: 14px; }
.overview-grid { grid-template-columns: 1.45fr repeat(4, .62fr); }
.welcome { grid-row: span 2; min-height: 190px; background: linear-gradient(142deg, #e5f1e8, #fff 72%); }
.welcome-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.welcome-head .eyebrow { margin: 0; }
.welcome-display-launch { min-height: 38px; padding: 0 14px; font-size: 13px; }
.welcome h1 { font-size: 34px; margin: 3px 0 10px; }
.stat { min-height: 94px; display: flex; flex-direction: column; justify-content: center; padding: 15px 18px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat strong { font-size: 38px; line-height: 1.08; letter-spacing: 0; margin-top: 6px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.danger { background: var(--red-soft); }
.stat.danger strong { color: var(--red); }
.stat.warning { background: var(--yellow-soft); }
.stat.warning strong { color: var(--yellow); }
.stat.total { background: var(--green-soft); }
.stat.total strong { color: var(--green); }
.stat.spend { background: linear-gradient(135deg, #fdf6ec, #fff); }
.stat.spend strong { color: #c07b14; }
.stat.spend .trend-down { color: var(--green); font-style: normal; font-weight: 700; }
.stat.spend .trend-up { color: var(--red); font-style: normal; font-weight: 700; }
/* 首页：本周推荐菜谱 + 家人动态 */
.overview-recipes-head, .overview-activity-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.overview-recipes-head h3, .overview-activity-head h3 { font-size: 18px; margin: 0; }
.overview-activities { display: grid; gap: 10px; }
.overview-activities .activity-summary-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.activity-summary-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--green), #0c6c4c);
  font-size: 15px; font-weight: 800; line-height: 1;
  margin-top: 1px;
}
.activity-summary-copy { min-width: 0; }
.activity-summary-copy strong { display: block; font-size: 14px; color: var(--ink); }
.activity-summary-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.overview-activities .activity-empty {
  min-height: auto; padding: 34px 20px; grid-template-columns: 1fr;
  background: var(--surface); border: 1px dashed var(--line); border-radius: 16px;
}
.overview-activities .activity-empty strong { font-size: 15px; }
.overview-activities .activity-empty p { font-size: 12.5px; }
.urgent { grid-column: 2 / 6; min-height: 230px; }
.activity-summary { grid-column: 1 / 5; padding: 20px 24px; }
.activity-summary .tile-head { align-items: center; margin-bottom: 14px; }
.activity-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.activity-heading-icon {
  width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 13px; color: var(--green); background: var(--green-soft);
}
.activity-heading-icon svg { width: 21px; height: 21px; fill: currentColor; }
.activity-heading .eyebrow { margin-bottom: 4px; }
.activity-summary-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.activity-summary-item {
  min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px;
  padding: 14px 16px; border-left: 1px solid var(--line);
}
.activity-summary-item:first-child { padding-left: 0; border-left: 0; }
.activity-summary-item:last-child { padding-right: 0; }
.activity-summary-item .activity-type-icon { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; }
.activity-summary-copy { min-width: 0; display: grid; gap: 3px; }
.activity-summary-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.activity-summary-copy span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity-summary-empty { grid-column: 1 / -1; margin: 0; padding: 20px 0 6px; color: var(--muted); font-size: 13px; }
.screen-summary {
  grid-column: 1 / 5;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(240px, 270px);
  gap: 22px;
  align-items: center;
  padding: 20px 24px;
}
.screen-summary .tile-head { display: grid; gap: 8px; justify-content: start; margin: 0; }
.screen-summary .tile-head .link { justify-self: start; padding: 0; }
.display-launch {
  min-height: var(--control-height-md); padding: 0 16px; border: 0; border-radius: var(--control-radius-md);
  color: #fff; background: var(--green); font-size: 14px; font-weight: 720; white-space: nowrap;
}
.display-launch:hover { background: #135a3e; }
.display-launch:focus-visible { outline: 3px solid rgba(25, 104, 73, .2); outline-offset: 2px; }
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.tile-head .eyebrow { margin-bottom: 6px; }
.priority-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.priority-food {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px;
  background: #f8faf7; border-radius: 13px; padding: 11px 12px;
}
.priority-food strong { font-size: 16px; }
.priority-food small { color: var(--muted); font-size: 12px; }
.priority-food .tag { grid-row: 1 / 3; grid-column: 2; }
.screen-copy { color: var(--muted); margin: 0; line-height: 1.6; }
.sync-state {
  display: flex; flex-direction: column; gap: 4px; padding: 13px 15px;
  border-radius: 13px; background: #f8faf7; font-size: 13px;
}
.sync-state strong { font-size: 15px; }
.page-title {
  display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 8px 0 24px;
}
.page-title h1 { font-size: 37px; }
.pill { padding: 9px 15px; border-radius: 100px; background: var(--green-soft); color: var(--green); font-size: 14px; font-weight: 700; }
.page-title-actions { display: flex; align-items: center; gap: 10px; }
.activity-page-title { align-items: center; }
.activity-back { min-height: var(--control-height-md); padding: 0 15px; }
.activity-feed-panel { padding: 0; overflow: hidden; }
.activity-feed-header {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 24px; border-bottom: 1px solid var(--line);
}
.activity-feed-header h2 { font-size: 22px; }
.activity-feed-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.activity-feed { display: grid; }
.activity-day { display: grid; }
.activity-day + .activity-day { border-top: 8px solid var(--canvas); }
.activity-day-title {
  margin: 0; padding: 13px 24px; border-bottom: 1px solid var(--line);
  color: var(--muted); background: #fafbf9; font-size: 12px; font-weight: 750;
}
.activity-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start; gap: 14px;
  padding: 18px 24px; border-top: 1px solid var(--line);
}
.activity-day-title + .activity-item { border-top: 0; }
.activity-type-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px;
  color: var(--green); background: var(--green-soft); font-size: 20px; font-weight: 800;
}
.activity-type-icon.food_deleted, .activity-type-icon.household_member_removed, .activity-type-icon.household_member_left {
  color: var(--red); background: var(--red-soft);
}
.activity-type-icon.food_updated, .activity-type-icon.household_invite_created {
  color: #8a5c00; background: var(--yellow-soft);
}
.activity-type-icon.device_paired { color: #35698b; background: #e7f2f8; }
.activity-item-copy { min-width: 0; }
.activity-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 5px; }
.activity-item-meta strong { font-size: 14px; }
.activity-item-meta span { color: var(--muted); font-size: 12px; }
.activity-item h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.activity-item p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.activity-item time { padding-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity-empty { min-height: 310px; display: grid; place-items: center; padding: 40px 20px; text-align: center; }
.activity-empty > div { max-width: 360px; }
.activity-empty .activity-heading-icon { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 18px; }
.activity-empty strong { display: block; font-size: 18px; }
.activity-empty p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.activity-load-more { padding: 18px 24px; border-top: 1px solid var(--line); text-align: center; }
.activity-load-more button { min-height: var(--control-height-md); padding: 0 18px; }
.add-food-action { height: 44px; padding: 0 18px; }
.food-layout { display: grid; grid-template-columns: minmax(340px, 390px) minmax(0, 1fr); gap: 18px; align-items: start; }
.food-list-layout { grid-template-columns: minmax(0, 1fr); }
.entry { position: sticky; top: 96px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 1px solid var(--line); border-radius: 15px; padding: 14px; margin: 2px 0 0; display: flex; flex-direction: column; gap: 11px; }
legend { color: var(--muted); font-size: 13px; font-weight: 700; padding: 0 5px; }
.or { text-align: center; color: #99a49f; font-size: 12px; }
.collection { min-width: 0; padding: 22px 20px; }
.food-collection { position: relative; }
.food-list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap;
}
.food-list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.food-search { position: relative; display: inline-flex; align-items: center; }
.food-search-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.food-search input, .food-location-filter {
  height: var(--control-height-md); border: 1px solid var(--line); border-radius: var(--control-radius-md);
  color: var(--ink); background: #f8faf7; font-size: 13px;
}
.food-search input { width: 200px; padding: 0 12px 0 36px; }
.food-location-filter { width: 132px; padding: 0 10px; }
.food-search input:focus-visible, .food-location-filter:focus-visible {
  outline: 3px solid rgba(25, 104, 73, .18); outline-offset: 2px; border-color: #aacbb8;
}
.food-search input:disabled, .food-location-filter:disabled { cursor: default; opacity: .55; }

/* 5 个状态 chip tab */
.food-status-tabs {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px; border-radius: 999px; background: #eaeee8;
}
.food-status-tab {
  height: 36px; padding: 0 16px; border: 0; border-radius: 999px;
  background: transparent; color: #5a6661; font-size: 13px; font-weight: 650;
  cursor: pointer; transition: background .16s, color .16s;
}
.food-status-tab:hover { background: rgba(255,255,255,.7); color: var(--ink); }
.food-status-tab.active { background: var(--green); color: #fff; box-shadow: 0 1px 4px rgba(25,104,73,.22); }
.food-status-tab:focus-visible { outline: 3px solid rgba(25,104,73,.22); outline-offset: 2px; }
.food-list-summary { font-size: 13px; color: var(--muted); margin-left: auto; }

/* 保留旧下拉菜单的兼容样式（如果其他页面还在用） */
.food-list-menu { position: relative; }
.food-filter-trigger, .food-manage-toggle {
  height: var(--control-height-md); border: 1px solid var(--line); border-radius: var(--control-radius-md);
  color: var(--ink); background: #f8faf7; font-size: 13px; font-weight: 650;
}
.food-filter-trigger {
  min-width: 116px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px 0 14px; text-align: left;
}
.food-filter-trigger:hover, .food-filter-trigger[aria-expanded="true"] { border-color: #aacbb8; background: var(--green-soft); }
.food-filter-trigger:focus-visible, .food-filter-menu button:focus-visible { outline: 3px solid rgba(25, 104, 73, .18); outline-offset: 2px; }
.food-filter-chevron { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .16s ease; }
.food-filter-trigger[aria-expanded="true"] .food-filter-chevron { transform: translateY(2px) rotate(225deg); }
.food-filter-menu {
  position: absolute; top: calc(100% + 7px); left: 0; z-index: 12; min-width: 172px;
  display: grid; gap: 3px; padding: 6px; border: 1px solid var(--line); border-radius: 13px;
  background: rgba(255, 255, 255, .98); box-shadow: 0 14px 34px rgba(19, 32, 29, .16); backdrop-filter: blur(12px);
}
.food-list-menu[data-food-menu="sort"] .food-filter-menu { right: 0; left: auto; }
.food-filter-menu button {
  min-height: 40px; display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: center; gap: 10px;
  padding: 0 10px 0 12px; border: 0; border-radius: 9px; color: var(--ink); background: transparent;
  font-size: 13px; font-weight: 650; text-align: left;
}
.food-filter-menu button:hover { background: #f3f6f2; }
.food-filter-menu button[aria-selected="true"] { color: var(--green); background: var(--green-soft); }
.food-filter-menu button[aria-selected="true"]::after { content: "✓"; color: var(--green); font-size: 14px; font-weight: 800; text-align: center; }
.food-manage-toggle { min-width: 72px; padding: 0 14px; color: var(--green); background: var(--green-soft); }
.food-manage-toggle[aria-pressed="true"] { color: #fff; background: var(--green); border-color: var(--green); }
.food-filter-trigger:disabled { cursor: default; opacity: .55; }
.food-groups { display: grid; gap: 15px; }
.food-group { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfa; }
.food-group-label {
  display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px;
  color: var(--muted); background: #f4f7f3; font-size: 12px; font-weight: 720;
}
.food-group-label strong {
  display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px;
  border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 11px;
}
.food-group-rows { display: grid; }
.food-list-row { position: relative; background: var(--surface); border-top: 1px solid var(--line); }
.food-list-row:first-child { border-top: 0; }
.food-list-row.expired { box-shadow: inset 3px 0 0 var(--red); }
.food-list-row.expiring { box-shadow: inset 3px 0 0 var(--yellow); }
.food-list-row.normal { box-shadow: inset 3px 0 0 #7aaa8a; }
.food-row-toggle {
  width: 100%; min-height: 70px; display: grid; grid-template-columns: minmax(0, 1fr) auto 22px;
  align-items: center; gap: 12px; padding: 11px 13px 11px 16px; border: 0; color: inherit; background: transparent; text-align: left;
}
.food-row-toggle:hover { background: #fafbf9; }
.food-row-toggle:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(25, 104, 73, .2); outline-offset: -3px; }
.food-row-summary { min-width: 0; display: grid; gap: 4px; }
.food-row-primary { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.food-row-primary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 750; }
.food-row-primary span { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.food-row-meta { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.food-urgency {
  display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 99px; font-size: 12px; font-weight: 750; white-space: nowrap;
}
.food-urgency.expired { color: #fff; background: var(--red); border-color: var(--red); }
.food-urgency.expiring { color: #855600; background: var(--yellow-soft); border-color: #efd182; }
.food-urgency.normal { color: var(--green); background: var(--green-soft); border-color: #cfe4d5; }
.food-row-chevron { color: #8b9690; font-size: 18px; text-align: center; }
.food-row-details { padding: 0 14px 14px 16px; background: #fbfcfa; }
.food-row-details dl {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.food-row-details dl div { min-width: 0; display: grid; gap: 4px; }
.food-row-details dt { color: var(--muted); font-size: 11px; }
.food-row-details dd { overflow-wrap: anywhere; margin: 0; font-size: 13px; font-weight: 680; }
.food-detail-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 9px; }
.food-detail-actions button {
  min-width: 64px; height: var(--control-height-md); padding: 0 13px; border: 0; border-radius: 10px;
  color: var(--green); background: var(--green-soft); font-size: 13px; font-weight: 700;
}
.food-detail-actions .delete { color: var(--red); background: var(--red-soft); }
.food-groups.managing .food-list-row {
  min-height: 70px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; gap: 10px; padding: 11px 14px 11px 16px;
}
.food-groups.managing .food-list-row.selected { background: #f4faf6; }
.food-row-select { display: grid; place-items: center; width: 34px; height: 44px; cursor: pointer; }
.food-row-select input { width: 20px; height: 20px; margin: 0; accent-color: var(--green); }
.food-list-empty { padding: 44px 18px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.food-batch-bar {
  position: sticky; bottom: 12px; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 16px; padding: 10px 12px 10px 16px; border: 1px solid rgba(25, 104, 73, .18); border-radius: 15px;
  background: rgba(255, 255, 255, .97); box-shadow: 0 14px 34px rgba(19, 32, 29, .16); backdrop-filter: blur(12px);
}
.food-batch-bar > div { display: flex; gap: 8px; }
.food-batch-bar button { height: 42px; padding: 0 14px; border-radius: 10px; font-weight: 700; }
.food-batch-delete { border: 0; color: var(--red); background: var(--red-soft); }
.food-batch-bar button:disabled { cursor: default; opacity: .45; }
.batch-food-date-field { display: grid; gap: 7px; margin-top: 18px; color: var(--muted); font-size: 13px; font-weight: 680; }
.batch-food-date-field input { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }
.tag {
  display: inline-flex; border-radius: 100px; padding: 5px 10px; font-weight: 720;
  font-size: 12px; border: 1px solid var(--line); white-space: nowrap;
}
.tag.expired { color: #fff; background: var(--red); border-color: var(--red); }
.tag.expiring { color: #8a5a00; background: var(--yellow-soft); border-color: #efd182; }
.food-editor-overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  padding: 24px; background: rgba(19, 32, 29, .56);
}
.food-calendar-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 24px; background: rgba(19, 32, 29, .36);
}
.food-calendar-overlay.hidden { display: none; }
.food-editor {
  width: min(660px, 100%); max-height: calc(100dvh - 48px); overflow: hidden;
  display: flex; flex-direction: column; border: 1px solid rgba(227, 232, 227, .94);
  border-radius: 24px; background: var(--surface); box-shadow: 0 28px 86px rgba(19, 32, 29, .28);
}
.food-editor-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: #fbfcfa;
}
.food-editor-header .eyebrow { margin-bottom: 6px; }
.food-editor-header h2 { font-size: 24px; letter-spacing: -0.2px; }
.food-editor-header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.icon-button {
  flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px;
  color: var(--muted); background: #f8faf7; font-size: 26px; line-height: 1;
  transition: background .15s, color .15s;
}
.icon-button:hover { background: var(--green-soft); color: var(--green); }
.food-editor-form { min-height: 0; display: flex; flex: 1; flex-direction: column; }
.food-editor-body { min-height: 0; overflow-y: auto; padding: 20px 24px 24px; }
.required-hint { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.required-hint span, .required-mark { color: var(--red); font-weight: 800; }
.optional-mark {
  margin-left: 5px; padding: 2px 6px; border-radius: 6px;
  color: var(--muted); background: #eef1ed; font-size: 10px; font-weight: 700;
}
.food-basic-grid, .calculated-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.food-basic-grid .field-group-full { grid-column: 1 / -1; }
.field-group { min-width: 0; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.field-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.field-group input[type="text"],
.field-group input[type="number"],
.field-group input[type="password"],
.field-group input[type="email"],
.field-group input[type="url"],
.field-group input[type="search"],
.field-group textarea {
  width: 100%; min-height: var(--control-height-lg); padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfcfa;
  font: inherit; font-weight: 500; transition: border-color .15s, box-shadow .15s;
}
.field-group textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.field-group input::placeholder,
.field-group textarea::placeholder { color: #9aa6a0; }
.field-group input:focus,
.field-group textarea:focus,
.field-group .select-control:focus,
.field-group .date-control:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(14, 159, 110, .12);
}
.field-error { min-height: 0; color: var(--red); font-size: 12px; line-height: 1.4; }
.field-error:empty { display: none; }
.field-group.invalid input, .field-group.invalid .select-control, .expiry-panel.invalid .date-control {
  border-color: var(--red); box-shadow: 0 0 0 2px rgba(200, 61, 54, .1);
}
.select-control, .date-control {
  width: 100%; min-height: var(--control-height-lg); display: grid; align-items: center;
  border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfcfa;
  text-align: left; font-weight: 650;
}
.select-control { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 14px; }
.select-control-icon {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
  color: var(--green); background: var(--green-soft); font-size: 17px;
}
.select-chevron { color: var(--muted); font-size: 18px; }
.category-picker {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf7;
}
.category-option {
  min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; padding: 6px 3px; border: 1px solid transparent;
  border-radius: 11px; color: var(--muted); background: var(--surface); font-size: 11px; font-weight: 700;
}
.category-option span:first-child { font-size: 18px; }
.category-option.selected { color: var(--green); border-color: #9bcbb2; background: var(--green-soft); }
.expiry-mode {
  margin: 2px 0 16px; padding: 14px 16px 16px;
  border: 1px solid var(--line); border-radius: 17px;
}
.expiry-mode legend {
  padding: 0 4px; color: var(--ink); font-size: 14px; font-weight: 650;
}
.expiry-mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px;
  border-radius: 13px; background: #eaeee8;
}
.expiry-mode-btn {
  min-height: 42px; padding: 0 8px; border: 0; border-radius: 9px;
  color: var(--muted); background: transparent; font-size: 13px; font-weight: 720;
  cursor: pointer; transition: background .16s, color .16s, box-shadow .16s;
}
.expiry-mode-btn.active {
  color: var(--green); background: var(--surface);
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
}
.expiry-mode-btn:focus-visible { outline: 2px solid rgba(14,159,110,.25); outline-offset: 2px; }
.expiry-panel { display: flex; flex-direction: column; gap: 10px; }
.date-presets, .shelf-life-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.date-presets button, .shelf-life-presets button {
  min-height: 42px; padding: 0 6px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--green); background: var(--surface); font-size: 12px; font-weight: 700;
}
.date-presets button.selected, .shelf-life-presets button.selected { color: #fff; border-color: var(--green); background: var(--green); }
.date-control { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 14px; }
.date-control span:first-child { color: var(--green); }
.date-control span:last-child { color: var(--muted); font-size: 20px; }
.calculated-grid .field-group { margin-bottom: 0; }
.calculated-expiry {
  margin: 0; padding: 12px 13px; border-radius: 11px;
  color: var(--muted); background: #f8faf7; font-size: 13px; line-height: 1.5;
}
.calculated-expiry.ready { color: var(--green); background: var(--green-soft); font-weight: 700; }
.calendar-panel { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.calendar-head { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; margin-bottom: 9px; }
.calendar-head strong { text-align: center; font-size: 15px; }
.calendar-head button {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: #f8faf7; font-size: 24px;
}
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-weekdays span { padding: 5px 0; color: var(--muted); text-align: center; font-size: 11px; font-weight: 700; }
.calendar-day {
  aspect-ratio: 1; min-height: 36px; border: 0; border-radius: 10px;
  color: var(--ink); background: transparent; font-size: 12px;
}
.calendar-day:hover { background: #f0f4ef; }
.calendar-day.today { color: var(--green); box-shadow: inset 0 0 0 1px #9bcbb2; font-weight: 800; }
.calendar-day.selected { color: #fff; background: var(--green); box-shadow: none; font-weight: 800; }
.calendar-spacer { aspect-ratio: 1; }
.food-editor-footer {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px;
  padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--surface);
}
.food-editor-footer button { height: var(--control-height-lg); border-radius: var(--control-radius-lg); font-weight: 720; }
.food-editor-footer .quiet { border: 1px solid var(--line); background: #fff; }
.food-editor-footer .primary { box-shadow: 0 6px 16px rgba(14, 159, 110, .22); }
body.modal-open { overflow: hidden; }
.preview-tools { display: flex; align-items: end; gap: 10px; }
.inline-select { flex-direction: row; align-items: center; gap: 8px; }
.inline-select select { height: var(--control-height-md); }
#refreshPreview { min-width: 96px; white-space: nowrap; }
.display-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 18px; }
.display-layout > * { min-width: 0; }
.display-card { padding: 18px; }
.screen {
  --screen-native-width: 480px;
  --screen-native-height: 800px;
  --screen-scaled-width: 480px;
  --screen-scaled-height: 800px;
  --screen-scale: 1;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background: #eceeea;
  padding: 18px;
  border-radius: 17px;
  overflow: hidden;
}
.screen-scale-frame {
  position: relative;
  width: var(--screen-scaled-width);
  height: var(--screen-scaled-height);
  margin: 0 auto;
}
.screen iframe {
  position: absolute;
  inset: 0 auto auto 0;
  display: block;
  width: var(--screen-native-width);
  height: var(--screen-native-height);
  border: 1px solid #d4dbd2;
  background: white;
  transform: scale(var(--screen-scale));
  transform-origin: top left;
}
.display-notes h2 { margin-bottom: 19px; }
.note { display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 0 16px; margin-bottom: 16px; }
.note strong { font-size: 28px; letter-spacing: 0; color: var(--green); }
.note span { font-size: 13px; color: var(--muted); }
.device-layout { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
.device-preview-section { margin-top: 34px; scroll-margin-top: 96px; }
.device-section-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.device-section-title .eyebrow { margin-bottom: 6px; }
.pairing-action { margin-top: 23px; }
.pairing-code {
  display: grid; gap: 6px; margin-top: 16px; padding: 15px;
  background: #f8faf7; border: 1px solid var(--line); border-radius: 13px;
}
.pairing-code span { color: var(--muted); font-size: 12px; font-weight: 720; }
.pairing-code strong { font-size: 30px; letter-spacing: 0; color: var(--green); }
.pairing-code small { color: var(--muted); font-size: 12px; }
.devices { color: var(--muted); font-size: 14px; }
.device {
  display: flex; flex-direction: column; gap: 6px; padding: 15px; margin-bottom: 10px;
  background: #f8faf7; border-radius: 15px;
}
.device strong { color: var(--ink); }
.status-dot { color: var(--green); font-size: 13px; }
.status-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; background: #45b676; border-radius: 50%; margin-right: 7px; }
.user-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: stretch; }
.account-summary { display: grid; gap: 12px; }
.account-line {
  display: grid; gap: 4px; padding: 13px 14px; border-radius: 13px; background: #f8faf7;
}
.account-line span { color: var(--muted); font-size: 12px; font-weight: 680; }
.account-line strong { font-size: 15px; overflow-wrap: anywhere; }
.role-pill {
  display: inline-flex; align-items: center; border-radius: 100px; padding: 5px 10px;
  color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 720; white-space: nowrap;
}
.role-pill.member { color: var(--muted); background: #f8faf7; border: 1px solid var(--line); }
.user-list { display: grid; gap: 10px; }
.user-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px;
  padding: 14px; border-radius: 14px; background: #f8faf7;
}
.user-card strong { font-size: 15px; overflow-wrap: anywhere; }
.user-card small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.user-card .role-pill { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.user-meta {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px;
}
.user-meta span {
  padding: 4px 8px; border-radius: 8px; color: var(--muted); background: var(--surface);
  font-size: 12px; font-weight: 650;
}
.quota-form {
  grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end; gap: 9px; margin-top: 7px; padding-top: 12px; border-top: 1px solid var(--line);
}
.quota-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 680; }
.quota-form input { min-width: 0; width: 100%; height: var(--control-height-sm); padding: 0 10px; }
.quota-form > span {
  display: flex; align-items: center; align-self: end; height: var(--control-height-sm);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.quota-form button { align-self: end; height: var(--control-height-sm); padding-inline: 12px; white-space: nowrap; }
.household-members { display: grid; gap: 9px; margin-top: 14px; }
.household-card, .household-card .section-head, #householdName { min-width: 0; }
#householdName { overflow-wrap: anywhere; }
.household-member {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px;
  padding: 12px 13px; border-radius: 13px; background: #f8faf7;
}
.household-member strong, .household-member small { overflow-wrap: anywhere; }
.household-member small { color: var(--muted); font-size: 12px; }
.household-member .role-pill { grid-column: 2; grid-row: 1; }
.household-member button {
  grid-column: 2; grid-row: 2; justify-self: end; height: var(--control-height-sm); min-width: 64px;
  padding: 0 12px; border: 0; border-radius: var(--control-radius-sm);
  color: var(--red); background: var(--red-soft); font-size: 12px; font-weight: 720;
  transition: background-color .18s, transform .18s;
}
.household-member button:hover { background: #fbded9; }
.household-member button:active { transform: translateY(1px); }
.household-member button:focus-visible { outline: 2px solid rgba(200, 61, 54, .28); outline-offset: 2px; }
.household-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.household-invite {
  display: grid; gap: 6px; margin-top: 14px; padding: 14px;
  border: 1px solid var(--line); border-radius: 13px; background: #f8faf7;
}
.household-invite span, .household-invite small { color: var(--muted); font-size: 12px; }
.household-invite strong { color: var(--green); font-size: 24px; letter-spacing: .08em; }
.household-invite .household-invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.household-invite .invite-help { color: var(--muted-2); font-size: 12px; line-height: 1.4; margin: 2px 0 0; }
.message {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  margin: 0; background: var(--ink); color: white; border-radius: 12px; padding: 12px 18px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20;
}
.message.show { opacity: 1; }
.dialog-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  padding: 24px; background: rgba(19, 32, 29, .54); backdrop-filter: blur(5px);
}
.dialog-card {
  width: min(460px, 100%); padding: 25px; border: 1px solid rgba(227, 232, 227, .92);
  border-radius: 22px; background: var(--surface); box-shadow: 0 24px 72px rgba(19, 32, 29, .24);
}
.dialog-card h2 { font-size: 22px; line-height: 1.25; }
.dialog-eyebrow {
  margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 750;
}
.dialog-body {
  margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65;
}
.dialog-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px;
}
.dialog-actions button {
  height: var(--control-height-md); min-width: 92px; padding: 0 18px; border-radius: var(--control-radius-md); font-weight: 720;
}
.dialog-cancel {
  border: 1px solid var(--line); background: #f8faf7; color: var(--ink);
}
.dialog-confirm {
  border: 0; background: var(--green); color: #fff;
}
.dialog-confirm.danger { background: var(--red); }
.dialog-actions button:focus-visible {
  outline: 3px solid #a6ceb9; outline-offset: 2px;
}
@media (max-width: 960px) {
  .topbar { height: auto; min-height: 68px; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav button { flex: 1; padding: 0 13px; }
  .shell { padding: 20px 16px 40px; }
  h1 { font-size: 38px; }
  .login-intro h1 { font-size: 48px; }
  .login-layout, .food-layout, .display-layout, .device-layout, .user-layout { grid-template-columns: 1fr; gap: 16px; }
  .page-title { align-items: flex-start; }
  .device-section-title { flex-direction: column; align-items: flex-start; gap: 14px; }
  .device-section-title .preview-tools { width: 100%; justify-content: flex-start; }
  .overview-grid { grid-template-columns: repeat(3, 1fr); }
  .welcome { grid-column: 1 / -1; grid-row: auto; }
  .urgent, .activity-summary, .screen-summary { grid-column: 1 / -1; }
  .overview-grid .stat { grid-column: span 1; }
  .screen-summary { grid-template-columns: 1fr; gap: 14px; }
  .screen-summary .tile-head { display: flex; align-items: center; justify-content: space-between; }
  .entry { position: static; }
  .collection { order: -1; }
}
@media (max-width: 768px) {
  /* 移动端：顶栏整体隐藏，导航移到底部 Tab Bar */
  header.topbar { display: none !important; }
  .shell { padding: 16px 16px 96px; }
  body:not(.is-logged-in) .shell { padding-bottom: 16px; }
  main { padding-top: 0; }
  .mobile-bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(227, 232, 227, 0.9);
    padding: 6px 6px max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(19, 32, 29, 0.08);
  }
  .mobile-bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 6px 4px;
    border: 0; background: transparent; color: #6e7a73;
    font-size: 11px; font-weight: 600; cursor: pointer;
    border-radius: 12px;
    transition: color .2s, background .2s;
  }
  .mobile-bottom-nav button svg { width: 22px; height: 22px; fill: currentColor; }
  .mobile-bottom-nav button.active { color: var(--green); background: rgba(14, 159, 110, 0.08); }
  .quick-agent-fab { bottom: max(80px, env(safe-area-inset-bottom)) !important; right: 16px !important; }
  .quick-agent { bottom: max(80px, env(safe-area-inset-bottom)) !important; right: 16px !important; }

  /* 移动端菜谱卡片：紧凑布局，图片不被遮挡 */
  .recipe { border-radius: 12px; }
  .recipe-img { aspect-ratio: 16/9; min-height: 0; }
  .recipe-b { padding: 10px 12px !important; gap: 4px !important; }
  .recipe-b b { font-size: 14px; }
  .recipe-b .small.muted-2 { font-size: 11px; }
  .chip { font-size: 10.5px; padding: 2px 7px; }
  .kpi { padding: 14px; }
  .kpi-n { font-size: 24px; }
  .kpi-l { font-size: 12px; }
  .kpi-sub { font-size: 11px; }
}
@media (max-width: 640px) {
  .session span {
    max-width: min(28vw, 112px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar {
    min-height: 60px;
    padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    flex-wrap: nowrap;
    gap: 8px;
    backdrop-filter: none;
  }
  .brand { gap: 9px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; font-size: 19px; }
  .brand strong { font-size: 18px; }
  .brand small { display: none; }
  .session { gap: 8px; font-size: 13px; }
  .session .quiet { height: 44px; padding: 0 13px; border-radius: 11px; }
  .nav {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 15;
    width: auto;
    height: 64px;
    gap: 2px;
    padding: 6px;
    overflow: visible;
    border: 1px solid rgba(227, 232, 227, .92);
    border-radius: 18px;
    background: rgba(245, 247, 242, .98);
    box-shadow: 0 14px 34px rgba(19, 32, 29, .16);
  }
  .nav button {
    flex: 1 1 0;
    min-width: 0;
    height: 52px;
    padding: 4px 2px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    line-height: 1;
  }
  .nav-icon { display: block; width: 21px; height: 21px; fill: currentColor; }
  .shell { padding: 14px 16px 32px; }
  #workspace { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .panel, .tile { border-radius: 18px; padding: 18px; }
  h1, .page-title h1 { font-size: 34px; line-height: 1.1; }
  .welcome {
    grid-column: 1 / -1;
    min-height: auto;
    padding: 16px;
  }
  .welcome h1 { margin: 2px 0 0; font-size: 29px; overflow-wrap: anywhere; }
  .welcome .muted { margin: 8px 0 0; line-height: 1.45; }
  .primary.compact { height: 44px; margin-top: 14px; }
  .page-title { flex-direction: column; align-items: flex-start; gap: 14px; margin: 18px 0 18px; }
  .page-title-actions { width: 100%; justify-content: space-between; }
  .add-food-action { min-width: 112px; }
  .pill { padding: 8px 13px; }
  .overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .stat {
    grid-column: auto;
    min-width: 0;
    min-height: 96px;
    padding: 12px 10px;
    border-radius: 16px;
  }
  .stat span { min-height: 27px; font-size: 11px; line-height: 1.25; }
  .stat strong { margin-top: 3px; font-size: 30px; }
  .stat small { font-size: 11px; white-space: nowrap; }
  .urgent, .activity-summary, .screen-summary { grid-column: 1 / -1; padding: 16px; }
  .tile-head { margin-bottom: 14px; }
  .tile-head .link, .section-head .link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
  }
  .priority-list { grid-template-columns: 1fr; gap: 8px; }
  .priority-food { min-height: 62px; padding: 10px 11px; }
  .activity-summary-list { grid-template-columns: 1fr; }
  .activity-summary-item, .activity-summary-item:first-child, .activity-summary-item:last-child {
    min-height: 58px; padding: 11px 0; border-top: 1px solid var(--line); border-left: 0;
  }
  .activity-summary-item:first-child { border-top: 0; }
  .activity-page-title { flex-direction: row; align-items: center; }
  .activity-page-title .activity-back { flex: 0 0 auto; }
  .activity-feed-header { align-items: flex-start; padding: 18px 16px; }
  .activity-feed-header .activity-heading-icon { display: none; }
  .activity-feed-header .pill { flex: 0 0 auto; padding: 7px 10px; font-size: 12px; }
  .activity-day-title { padding: 11px 16px; }
  .activity-item { grid-template-columns: 38px minmax(0, 1fr); gap: 11px; padding: 15px 16px; }
  .activity-type-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
  .activity-item time { grid-column: 2; padding: 0; }
  .screen-summary { gap: 10px; }
  .screen-summary .tile-head { min-height: 44px; margin-bottom: 0; }
  .message {
    bottom: calc(88px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100vw - 32px);
    text-align: center;
  }
  .form-grid { grid-template-columns: 1fr; }
  .collection { padding: 16px 12px; }
  .food-list-head { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; margin-bottom: 14px; }
  .food-list-head > div:first-child { padding: 3px 2px 0; }
  .food-list-head h2 { font-size: 22px; }
  .food-list-tools {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
  }
  .food-search { grid-column: 1 / -1; }
  /* 搜索框独占一行；状态 tab 独占一行并可横向滚动，确保 5 个 tab 全部可见不遮挡 */
  .food-status-tabs {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding: 4px;
    transform: none;
  }
  .food-status-tab { flex: 0 0 auto; white-space: nowrap; }
  .food-location-filter { width: 100%; min-width: 0; }
  .food-list-summary { grid-column: 1 / 2; margin-left: 0; justify-self: start; font-size: 12px; }
  .food-manage-toggle { grid-column: 2 / 3; width: 100%; min-width: 60px; padding: 0 10px; }
  .food-search input, .food-location-filter, .food-manage-toggle { width: 100%; height: 42px; min-width: 0; }
  .food-filter-trigger, .food-manage-toggle { height: 42px; }
  .food-filter-trigger { width: 100%; min-width: 0; gap: 7px; padding: 0 10px 0 11px; }
  .food-filter-trigger > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .food-filter-menu { width: max(100%, 160px); min-width: 0; }
  .food-groups { gap: 12px; }
  .food-group { border-radius: 14px; }
  .food-group-label { min-height: 34px; padding: 6px 10px; }
  .food-row-toggle { min-height: 68px; grid-template-columns: minmax(0, 1fr) auto 18px; gap: 8px; padding: 10px 9px 10px 13px; }
  .food-row-primary { gap: 6px; }
  .food-row-primary strong { font-size: 15px; }
  .food-urgency { min-height: 28px; padding: 4px 8px; }
  .food-row-chevron { font-size: 16px; }
  .food-row-details { padding: 0 10px 11px 13px; }
  .food-row-details dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px; }
  .food-detail-actions button { min-width: 70px; height: 44px; }
  .food-groups.managing .food-list-row { min-height: 68px; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 7px; padding: 10px 10px 10px 13px; }
  .food-row-select { width: 32px; }
  .food-batch-bar { bottom: calc(82px + env(safe-area-inset-bottom)); margin-top: 12px; padding: 9px 9px 9px 13px; }
  .food-batch-bar strong { font-size: 13px; white-space: nowrap; }
  .food-batch-bar button { height: 44px; padding: 0 11px; font-size: 13px; }
  .food-editor-overlay { place-items: end center; padding: 0; }
  .food-editor {
    width: 100%; max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    border-width: 1px 0 0; border-radius: 24px 24px 0 0;
  }
  .food-editor-header { padding: 18px 16px 14px; }
  .food-editor-header h2 { font-size: 22px; }
  .food-editor-body { padding: 16px; }
  .food-basic-grid, .calculated-grid { grid-template-columns: 1fr; gap: 0; }
  .category-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .expiry-mode { padding: 12px 14px 14px; }
  .expiry-radio { padding: 8px 0; }
  .date-presets, .shelf-life-presets { gap: 6px; }
  .date-presets button, .shelf-life-presets button { min-height: 44px; padding-inline: 3px; }
  .food-editor-footer {
    grid-template-columns: 1fr 1.5fr; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .user-card { grid-template-columns: 1fr; }
  .user-card .role-pill { grid-column: auto; grid-row: auto; justify-self: start; }
  .preview-tools {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
  }
  .inline-select {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }
  .inline-select select { min-width: 0; width: 100%; }
  #refreshPreview { grid-column: 1 / -1; width: 100%; min-width: 92px; padding: 0 12px; }
  .display-layout .panel { padding: 12px; }
  .display-notes { padding: 20px !important; }
  .device-preview-section { margin-top: 28px; scroll-margin-top: 80px; }
  .note { margin-bottom: 13px; padding-bottom: 13px; }
  .dialog-overlay { align-items: end; padding: 16px; }
  .dialog-card { padding: 21px; border-radius: 20px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-actions button { min-width: 0; }
}
@media (max-width: 380px) {
  .session { gap: 6px; }
  .session .quiet { padding: 0 11px; }
  .stat { padding-inline: 8px; }
  .stat span, .stat small { font-size: 10px; }
  .preview-tools { grid-template-columns: 1fr; }
  #refreshPreview { grid-column: auto; width: 100%; }
}

.token-card { grid-column: 1 / -1; }
.token-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.token-form .primary { height: var(--control-height-lg); border-radius: var(--control-radius-lg); }
.new-token { display: grid; gap: 10px; margin: 16px 0; padding: 14px; border-radius: 14px; background: var(--yellow-soft); }
.new-token code { padding: 10px; overflow-wrap: anywhere; border-radius: 9px; background: #fff; user-select: all; }
.token-copy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-setup-hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.new-token .agent-setup-prompt { color: var(--muted); font-family: inherit; font-size: 12px; line-height: 1.55; }
.token-list { display: grid; gap: 9px; margin-top: 16px; }
.token-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: center; padding: 12px; border-radius: 13px; background: #f8faf7; }
.token-row div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.token-row code, .token-row small { color: var(--muted); font-size: 12px; }
.token-row small { grid-column: 1; }
.token-row button {
  grid-column: 2; grid-row: 1 / 3; height: var(--control-height-sm); padding: 0 11px;
  border: 0; border-radius: var(--control-radius-sm); color: var(--red); background: var(--red-soft);
  font-size: 12px; font-weight: 700;
}
.mcp-config { margin-top: 18px; color: var(--muted); font-size: 13px; }
.mcp-config summary { cursor: pointer; font-weight: 700; }
.mcp-config pre { overflow-x: auto; padding: 13px; border-radius: 12px; color: var(--ink); background: #f3f5f1; line-height: 1.55; }
.agent-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; min-height: 640px; }
.conversation-panel, .chat-panel { min-height: 0; }
.conversation-panel { align-self: start; }
.conversation-toggle { display: none; }
.conversation-list { display: grid; gap: 7px; }
.conversation-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 14px; }
.conversation-head h2 { white-space: nowrap; }
.conversation-head > .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.conversation-row { position: relative; min-width: 0; }
.conversation-item { display: grid; gap: 4px; width: 100%; padding: 11px 34px 11px 11px; text-align: left; border: 0; border-radius: 12px; color: var(--ink); background: #f8faf7; }
.conversation-item.active { color: var(--green); background: var(--green-soft); }
.conversation-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item small { color: var(--muted); font-size: 11px; }
.conversation-delete {
  position: absolute; top: 7px; right: 7px; z-index: 1; display: grid; place-items: center;
  width: 24px; height: 24px; min-height: 0; padding: 0; border: 0; border-radius: 999px;
  color: var(--muted); background: transparent; opacity: .58; font-size: 19px; line-height: 1;
  transition: opacity .15s, color .15s, background-color .15s;
}
.conversation-row:hover .conversation-delete, .conversation-delete:focus-visible { opacity: 1; }
.conversation-delete:hover, .conversation-delete:focus-visible { color: var(--red); background: var(--red-soft); }
.chat-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; padding: 0; overflow: hidden; }
.agent-messages { display: flex; flex-direction: column; gap: 12px; min-height: 480px; max-height: 620px; padding: 22px; overflow-y: auto; }
.agent-empty { display: grid; place-items: center; align-content: center; gap: 8px; flex: 1; min-height: 360px; color: var(--muted); text-align: center; }
.agent-empty strong { color: var(--ink); font-size: 18px; }
.agent-message { min-width: 0; max-width: 82%; }
.agent-message > div:first-child, .agent-message > .agent-message-body { min-width: 0; max-width: 100%; padding: 12px 14px; border-radius: 15px; line-height: 1.6; background: #f1f4ef; }
.agent-message.user { align-self: flex-end; }
.agent-message.user > div:first-child, .agent-message.user > .agent-message-body { color: #fff; background: var(--green); border-bottom-right-radius: 4px; }
.agent-message.assistant { align-self: flex-start; }
.agent-message.assistant > div:first-child, .agent-message.assistant > .agent-message-body { border-bottom-left-radius: 4px; }
.agent-message.thinking { color: var(--muted); }
.agent-message.streaming { display: grid; gap: 7px; }
.agent-stream-status {
  width: fit-content; padding: 9px 12px; border-radius: 14px; border-bottom-left-radius: 4px;
  color: var(--muted); background: #f1f4ef; font-size: 13px;
}
.agent-reasoning { width: min(100%, 560px); color: #8b8f9e; }
.agent-reasoning summary {
  display: inline-flex; align-items: center; gap: 9px; min-height: 34px; padding: 3px 2px;
  cursor: pointer; color: inherit; font-size: 14px; font-weight: 560; list-style: none;
}
.agent-reasoning summary::-webkit-details-marker { display: none; }
.agent-reasoning summary::marker { content: ""; }
.agent-reasoning-bulb, .agent-reasoning-chevron { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.agent-reasoning-bulb { width: 20px; height: 20px; }
.agent-reasoning-chevron { width: 17px; height: 17px; margin-left: 2px; transition: transform .16s ease; }
.agent-reasoning[open] .agent-reasoning-chevron { transform: rotate(90deg); }
.agent-reasoning.is-thinking .agent-reasoning-bulb { animation: agent-reasoning-pulse 1.4s ease-in-out infinite; }
.agent-reasoning > div {
  margin: 3px 0 3px 10px; padding: 8px 12px; border-left: 2px solid #e1e3e8;
  color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6;
}
@keyframes agent-reasoning-pulse { 50% { opacity: .48; } }
.agent-stream-events:empty { display: none; }
.agent-markdown { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.agent-markdown > :first-child { margin-top: 0; }
.agent-markdown > :last-child { margin-bottom: 0; }
.agent-markdown p { margin: 0 0 10px; }
.agent-markdown h1, .agent-markdown h2, .agent-markdown h3, .agent-markdown h4 { margin: 14px 0 8px; line-height: 1.3; }
.agent-markdown h1 { font-size: 21px; }
.agent-markdown h2 { font-size: 19px; }
.agent-markdown h3, .agent-markdown h4 { font-size: 16px; }
.agent-markdown ul, .agent-markdown ol { margin: 8px 0 10px; padding-left: 24px; }
.agent-markdown li + li { margin-top: 4px; }
.agent-markdown blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--green); color: var(--muted); background: rgba(255,255,255,.55); }
.agent-markdown code { padding: 1px 5px; border-radius: 5px; background: #e4e9e2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.agent-markdown pre { overflow-x: auto; margin: 10px 0; padding: 11px; border-radius: 9px; background: #e4e9e2; }
.agent-markdown pre code { padding: 0; background: transparent; }
.agent-markdown a { color: var(--green); text-decoration: underline; }
.markdown-table-wrap { width: 100%; min-width: 0; max-width: 100%; margin: 10px 0; overflow-x: auto; }
.agent-markdown table { width: 100%; border-collapse: collapse; font-size: 13px; }
.agent-markdown th, .agent-markdown td { padding: 7px 9px; border: 1px solid var(--line); text-align: left; white-space: nowrap; }
.agent-markdown th { background: #e7ece5; }
.agent-compose {
  position: relative; display: flex; align-items: flex-end; gap: 8px; margin: 14px 16px 16px; padding: 7px 8px 7px 14px;
  border: 1px solid var(--line); border-radius: 27px; background: #fbfcfa; box-shadow: 0 5px 18px rgba(19, 32, 29, .07);
}
.agent-compose:focus-within { border-color: #7aae94; box-shadow: 0 0 0 3px rgba(34, 120, 79, .12); }
.agent-input-surface { flex: 1; min-width: 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.agent-compose.is-long-press-pending { border-color: #78a98d; background: #f2f8f3; }
.agent-compose textarea {
  flex: 1; width: 100%; height: 40px; min-height: 40px; max-height: 128px; padding: 9px 0;
  resize: none; overflow-y: auto; border: 0; outline: 0; color: var(--ink); background: transparent;
  font: inherit; line-height: 22px; user-select: text; -webkit-user-select: text;
}
.agent-compose textarea::placeholder { color: #8b938e; }
.agent-voice-pad {
  display: none; align-items: center; justify-content: center; gap: 8px; flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  border: 0; border-radius: 20px; color: var(--ink); background: transparent; font: inherit; font-weight: 700;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: color .16s ease, background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.agent-compose[data-input-mode="voice"] .agent-input-surface,
.agent-compose[data-input-mode="voice"] .agent-send { display: none; }
.agent-compose[data-input-mode="voice"] .agent-voice-pad { display: flex; }
.agent-voice-pad:hover:not(:disabled) { background: var(--green-soft); }
.agent-voice-pad:focus-visible, .agent-mode-toggle:focus-visible { outline: 3px solid rgba(25, 104, 73, .22); outline-offset: 2px; }
.agent-voice-pad:disabled { cursor: default; color: #8b938e; transform: none; }
.agent-voice-pad[aria-pressed="true"], .quick-agent-voice[aria-pressed="true"] {
  color: #fff; background: var(--green); box-shadow: 0 0 0 5px rgba(25, 104, 73, .13);
  animation: voice-listening 1.4s ease-in-out infinite;
}
/* 桌面端隐藏移动底部 Tab Bar，移动端在 @media 内显示（顺序保证移动端规则胜出） */
.mobile-bottom-nav { display: none; }
.agent-voice-pad.is-processing { color: #8a5a00; background: var(--yellow-soft); }
.agent-voice-pad svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
/* 小食 AI 弹窗内：文本模式 mic 按钮 + 语音模式键盘切换按钮 */
.agent-compose .agent-voice-btn {
  display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px;
  border: 0; border-radius: 50%; color: #fff;
  background: var(--green-soft); color: var(--green);
  transition: background .16s, color .16s;
}
.agent-compose .agent-voice-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.agent-compose .agent-voice-btn:hover:not(:disabled) { background: var(--green); color: #fff; }
.agent-compose .agent-voice-btn:disabled { opacity: .42; cursor: default; }
.agent-compose .agent-voice-btn[aria-pressed="true"] { background: var(--green); color: #fff; box-shadow: 0 0 0 4px rgba(14, 159, 110, .22); }
/* 语音录制中的视觉反馈：变红 + 呼吸光晕 + 按下缩放 */
.agent-compose .agent-voice-btn:active:not(:disabled) { transform: scale(.88); }
.agent-compose .agent-voice-btn.is-recording,
.agent-compose.is-recording .agent-voice-btn {
  background: var(--red, #c83d36); color: #fff; border-color: var(--red, #c83d36);
  box-shadow: 0 0 0 4px rgba(200, 61, 54, .22);
  animation: agent-voice-recording 1.2s ease-in-out infinite;
}
@keyframes agent-voice-recording {
  0%, 100% { box-shadow: 0 0 0 3px rgba(200, 61, 54, .12); }
  50% { box-shadow: 0 0 0 9px rgba(200, 61, 54, .2); }
}
/* 拍照识别返回的图片预览气泡 */
.agent-message-image { margin: 0 0 8px; max-width: 220px; }
.agent-message-image img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid rgba(25, 104, 73, .18); }

.agent-compose .agent-keyboard-toggle {
  display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: var(--green-soft); color: var(--green);
}
.agent-compose .agent-keyboard-toggle:hover:not(:disabled) { background: var(--green); color: #fff; }
.agent-compose .agent-keyboard-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 文本模式：compact mic 显示 + send 显示 + voice-pad/keyboard-toggle/mode-toggle 隐藏 */
.quick-agent-compose[data-input-mode="text"] .agent-voice-pad,
.quick-agent-compose[data-input-mode="text"] .agent-keyboard-toggle,
.quick-agent-compose[data-input-mode="text"] .agent-mode-toggle { display: none; }
.quick-agent-compose[data-input-mode="text"] .agent-input-surface { display: block; flex: 1; min-width: 0; }
.quick-agent-compose[data-input-mode="text"] .agent-voice-status:empty { display: none; }

/* 语音模式：textarea + send + 紧凑 mic 隐藏，显示 voice-pad + keyboard-toggle */
.quick-agent-compose[data-input-mode="voice"] .agent-input-surface,
.quick-agent-compose[data-input-mode="voice"] .agent-send,
.quick-agent-compose[data-input-mode="voice"] .agent-voice-btn,
.quick-agent-compose[data-input-mode="voice"] .agent-mode-toggle { display: none !important; }
.quick-agent-compose[data-input-mode="voice"] .agent-voice-pad { display: flex !important; }
.quick-agent-compose[data-input-mode="voice"] .agent-keyboard-toggle { display: grid !important; }
.quick-agent-compose[data-input-mode="voice"] .agent-voice-pad { flex: 1; }

.agent-voice-pad .voice-pad-label { font-size: 14px; font-weight: 700; }

.agent-mode-toggle {
  display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; color: var(--green); background: var(--green-soft);
}
.agent-mode-toggle:hover:not(:disabled) { background: #d9ebdf; transform: translateY(-1px); }
.agent-mode-toggle:disabled { cursor: default; color: #8b938e; background: #e8ebe8; transform: none; }
.agent-mode-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agent-mode-toggle .mode-icon-text { display: none; }
.agent-compose[data-input-mode="voice"] .agent-mode-toggle .mode-icon-voice { display: none; }
.agent-compose[data-input-mode="voice"] .agent-mode-toggle .mode-icon-text { display: block; }
.agent-voice-status { color: var(--green); font-size: 12px; line-height: 1.4; }
.agent-voice-status:empty { display: none; }
.agent-voice-status.error { color: var(--red); }
.agent-compose .agent-voice-status {
  position: absolute; right: 54px; bottom: calc(100% + 8px); z-index: 2; max-width: min(340px, calc(100vw - 48px));
  padding: 7px 10px; border: 1px solid rgba(25, 104, 73, .16); border-radius: 10px;
  background: rgba(255, 255, 255, .97); box-shadow: 0 8px 24px rgba(19, 32, 29, .12);
}
.agent-compose .agent-voice-status.error { border-color: rgba(200, 61, 54, .18); }
@keyframes voice-listening {
  0%, 100% { box-shadow: 0 0 0 3px rgba(25, 104, 73, .11); }
  50% { box-shadow: 0 0 0 7px rgba(25, 104, 73, .18); }
}
@media (prefers-reduced-motion: reduce) {
  .agent-voice-pad[aria-pressed="true"], .quick-agent-voice[aria-pressed="true"], .voice-recording-wave span { animation: none; }
}
.agent-send {
  display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 4px 10px rgba(27, 111, 75, .2);
}
.agent-send:hover:not(:disabled) { background: #145f42; transform: translateY(-1px); }
.agent-send:disabled { color: #8b938e; background: #d8ddd9; box-shadow: none; }
.agent-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.agent-compose.agent-disabled { opacity: .6; }
.voice-recording-overlay {
  position: fixed; inset: 0; z-index: 1500; display: grid; align-items: end; pointer-events: none;
  color: #fff; background: rgba(4, 12, 18, .66); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.voice-recording-overlay.hidden { display: none; }
.voice-recording-panel {
  display: grid; justify-items: center; align-content: end; gap: 18px; width: 100%; min-height: min(46svh, 430px);
  padding: 56px max(24px, env(safe-area-inset-right)) calc(46px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: radial-gradient(ellipse 90% 105% at 50% 105%, rgba(70, 202, 255, .98) 0%, rgba(28, 137, 255, .93) 36%, rgba(14, 80, 170, .62) 64%, rgba(4, 12, 18, 0) 82%);
  transition: background .18s ease;
}
.voice-recording-state { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.voice-recording-state span { width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px rgba(255,255,255,.14); }
.voice-recording-state strong { font-size: 16px; letter-spacing: .02em; }
.voice-recording-panel p { margin: 0; color: rgba(255,255,255,.92); font-size: 17px; }
.voice-recording-wave { display: flex; align-items: center; justify-content: center; gap: 3px; width: min(520px, 78vw); height: 46px; }
.voice-recording-wave span { width: 4px; min-height: 5px; border-radius: 99px; background: rgba(255,255,255,.94); animation: voice-wave 760ms ease-in-out infinite alternate; }
.voice-recording-wave span:nth-child(3n) { animation-delay: -180ms; }
.voice-recording-wave span:nth-child(4n) { animation-delay: -360ms; }
.voice-recording-wave span:nth-child(5n) { animation-delay: -520ms; }
.voice-recording-overlay.is-cancelling .voice-recording-panel {
  background: radial-gradient(ellipse 90% 105% at 50% 105%, rgba(255, 112, 105, .98) 0%, rgba(211, 58, 62, .92) 38%, rgba(111, 25, 42, .58) 66%, rgba(4, 12, 18, 0) 82%);
}
.voice-recording-overlay.is-cancelling .voice-recording-state span { background: #ffe0dd; }
body.voice-recording-open { overflow: hidden; }
@keyframes voice-wave {
  from { height: 6px; opacity: .6; }
  to { height: var(--voice-bar-height, 34px); opacity: 1; }
}
.pending-action { display: grid; gap: 7px; margin-top: 8px; padding: 13px; border: 1px solid #efd182; border-radius: 13px; background: var(--yellow-soft); }
.pending-action[aria-busy="true"] { opacity: .78; }
.pending-action[aria-busy="true"] button { cursor: wait; }
.pending-action small { color: var(--muted); }
.pending-action > div { display: flex; gap: 8px; }
.pending-action button { height: 38px; border-radius: 10px; }
.pending-details { display: grid; gap: 7px; margin: 3px 0; padding: 0; list-style: none; }
.pending-details li { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid rgba(194, 151, 45, .34); border-radius: 9px; background: rgba(255,255,255,.5); }
.pending-details span { color: var(--muted); font-size: 12px; }
.agent-result { margin-top: 7px; color: var(--green); font-size: 13px; font-weight: 700; }
.agent-result.cancelled { color: var(--muted); }
.user-layout {
  grid-template-columns: minmax(320px, .8fr) minmax(460px, 1.2fr);
  grid-template-areas:
    "account household"
    "personal personal"
    "token token";
}
.user-layout.is-admin {
  grid-template-areas:
    "account household"
    "users users"
    "system personal"
    "token token";
}
.user-layout > .account-card { grid-area: account; }
.user-layout > .household-card { grid-area: household; }
.user-layout > .collection { grid-area: users; }
.user-layout > .system-ai-settings-card { grid-area: system; }
.user-layout > .personal-ai-settings-card { grid-area: personal; }
.user-layout > .token-card { grid-area: token; }
.ai-settings-form { display: grid; grid-template-columns: 1fr; gap: 14px; }
.ai-settings-form .ai-base-url { grid-column: auto; }
.ai-settings-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.ai-settings-actions button { min-width: 130px; }
.ai-provider-guide {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 18px;
  align-items: center; margin: 16px 0; padding: 14px 15px;
  border: 1px solid #d8e9de; border-radius: 14px; background: var(--green-soft);
}
.ai-provider-guide > div:first-child { display: grid; gap: 4px; min-width: 0; }
.ai-provider-guide strong { font-size: 14px; }
.ai-provider-guide span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.ai-provider-guide > a { color: var(--green); font-size: 13px; font-weight: 720; white-space: nowrap; }
.ai-provider-preset {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding-top: 11px; border-top: 1px solid rgba(27, 111, 75, .14);
}
.ai-preset-tip {
  grid-column: 1 / -1;
  display: grid; gap: 10px;
  margin: 4px 0 6px; padding: 14px 16px;
  border: 1px solid #d8e9de; border-radius: 14px; background: var(--green-soft);
}
.ai-preset-tip-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ai-preset-tip-head strong { font-size: 14px; color: var(--ink); }
.ai-preset-link { color: var(--green); font-size: 13px; font-weight: 720; white-space: nowrap; }
.ai-preset-link:hover { text-decoration: underline; }
.ai-preset-desc { margin: 0; line-height: 1.5; }
.ai-preset-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding-top: 10px; border-top: 1px solid rgba(27, 111, 75, .14);
}
.ai-preset-meta span { font-size: 12.5px; color: var(--ink); }
.ai-preset-meta b { color: var(--muted); font-weight: 600; margin-right: 2px; }
.ai-preset-btn { margin-left: auto; }
.ai-preset-btn { padding: 6px 14px; border-radius: 999px; background: #fff; }
.ai-preset-btn:hover { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.ai-provider-preset code {
  padding: 6px 8px; border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.72);
  font-size: 12px; overflow-wrap: anywhere;
}
.ai-provider-preset button { margin-left: auto; }
.welcome { min-width: 0; }
.overview-agent-hint {
  display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; margin: 14px 0 0; padding: 8px 11px;
  border: 1px solid rgba(25, 104, 73, .14); border-radius: 11px; color: #40594b; background: rgba(238, 247, 241, .82);
  font-size: 12px; line-height: 1.5;
}
.overview-agent-hint > span:first-child { flex: 0 0 auto; color: var(--green); font-size: 15px; }
.overview-agent-hint strong { color: var(--green); }
.overview-agent-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.overview-agent-shortcuts button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 11px;
  border: 1px solid rgba(25, 104, 73, .17); border-radius: 999px;
  color: #40594b; background: rgba(255,255,255,.76); font-size: 12px; font-weight: 680;
}
.overview-agent-shortcuts button span { color: var(--green); font-size: 15px; line-height: 1; }
.overview-agent-shortcuts button:hover:not(:disabled) { border-color: rgba(25, 104, 73, .38); color: var(--green); background: var(--green-soft); transform: translateY(-1px); }
.overview-agent-shortcuts button:disabled { cursor: default; opacity: .48; }
.welcome-manual-add { justify-self: start; margin-top: 12px; padding: 0; }
.agent-quick-error { color: var(--red); font-size: 13px; }

.quick-agent {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  width: 60px; height: 60px; margin: 0; pointer-events: none;
}
.quick-agent > * { pointer-events: auto; }
.quick-agent-fab {
  position: absolute; right: 0; bottom: 0; display: grid; place-items: center;
  width: 60px; height: 60px; padding: 0; border: 0; border-radius: 50%;
  background: linear-gradient(135deg, #0E9F6E 0%, #0C6C4C 100%);
  box-shadow: 0 12px 28px rgba(14, 159, 110, .38), 0 0 0 4px rgba(255, 255, 255, .94);
  cursor: pointer; overflow: visible;
  transition: transform .2s ease, box-shadow .2s ease;
}
.quick-agent-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 16px 32px rgba(14, 159, 110, .45), 0 0 0 4px rgba(255, 255, 255, .94); }
.quick-agent-fab:active { transform: translateY(0) scale(0.96); }
.quick-agent-fab-icon { position: relative; display: grid; place-items: center; }
.quick-agent-fab-icon svg { width: 36px; height: 36px; }
.quick-agent-fab-pulse { position: absolute; inset: -2px; border-radius: 50%; background: linear-gradient(135deg, #6FE3B0, #0E9F6E); opacity: .42; animation: fab-pulse 2.6s ease-in-out infinite; }
@keyframes fab-pulse {
  0%, 100% { transform: scale(1); opacity: .32; }
  50% { transform: scale(1.32); opacity: 0; }
}
@media (max-width: 768px) {
  .quick-agent { right: 14px; bottom: 14px; width: 56px; height: 56px; }
  .quick-agent-fab { width: 56px; height: 56px; }
  .quick-agent-fab-icon svg { width: 32px; height: 32px; }
  .quick-agent-fab { bottom: max(80px, env(safe-area-inset-bottom)) !important; right: 16px !important; }
  .quick-agent { bottom: max(80px, env(safe-area-inset-bottom)) !important; right: 16px !important; }
}
.quick-agent-voice { position: absolute; right: 0; bottom: 0; display: grid; place-items: center;
  width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%;
  color: #fff; background: var(--green); box-shadow: 0 12px 28px rgba(19, 77, 55, .3);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.quick-agent-voice:hover { background: #135a3e; transform: translateY(-2px); }
.quick-agent-voice:focus-visible { outline: 4px solid rgba(25, 104, 73, .24); outline-offset: 3px; }
.quick-agent-voice:disabled { cursor: default; color: #7e8983; background: #d8ddd9; box-shadow: 0 8px 20px rgba(19, 32, 29, .14); transform: none; }
.quick-agent-voice.is-processing { color: #76520d; background: #f7d986; }
.quick-agent-voice svg {
  width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.quick-agent-dialog {
  position: absolute; right: 0; bottom: 72px; display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto auto;
  width: min(360px, calc(100vw - 32px)); max-height: min(82dvh, 720px);
  overflow: hidden; border: 1px solid rgba(218, 226, 219, .96); border-radius: 24px;
  background: #fff; box-shadow: 0 22px 58px rgba(19, 32, 29, .22);
}
.quick-agent-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 70px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #EEF2FB 0%, #F6F2FA 100%);
  border-radius: 18px 18px 0 0;
}
.quick-agent-header > div:first-child { display: grid; gap: 2px; min-width: 0; }
.quick-agent-header span { color: var(--muted); font-size: 11px; font-weight: 650; }
.quick-agent-header strong { font-size: 16px; }
.quick-agent-header-actions { display: flex; align-items: center; gap: 5px; }
.quick-agent-header-actions button {
  min-height: 40px; padding: 0 9px; border: 0; border-radius: 10px;
  color: var(--green); background: transparent; font-size: 12px; font-weight: 700;
}
.quick-agent-header-actions button:hover { background: var(--green-soft); }
.quick-agent-header-actions .quick-agent-close {
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--muted); background: #f8faf7;
  display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.quick-agent-header-actions .quick-agent-close:hover {
  background: var(--green-soft); color: var(--green); border-color: #9bcbb2;
}
.quick-agent-header-actions .quick-agent-close svg {
  width: 18px; height: 18px; stroke-width: 2.2;
}
.quick-agent-messages {
  display: flex; flex-direction: column; gap: 10px; min-height: 150px; padding: 14px;
  overflow-y: auto; overscroll-behavior: contain;
}
.quick-agent-messages .agent-empty { min-height: 150px; }
.quick-agent-messages .agent-empty strong { font-size: 16px; }
.quick-agent-messages .agent-empty span { font-size: 13px; }
.quick-agent-messages .agent-message { max-width: 92%; }
.quick-agent-messages .agent-message > div:first-child, .quick-agent-messages .agent-message > .agent-message-body { padding: 10px 12px; font-size: 14px; }

/* AI 消息气泡：浅灰背景 + 左对齐 */
.agent-bubble {
  align-self: flex-start; max-width: 88%;
  padding: 11px 14px; border-radius: 4px 16px 16px 16px;
  background: #F2F4F3; color: var(--ink-700);
  font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.agent-bubble.user {
  align-self: flex-end; border-radius: 16px 4px 16px 16px;
  background: var(--green); color: #fff;
}
.quick-agent-availability { padding: 0 16px; font-size: 12px; }
.quick-agent-availability:empty { display: none; }
.quick-agent-compose.agent-compose { margin: 10px 12px 12px; }
.quick-agent-compose.agent-compose { border: 1.5px solid #0E9F6E; background: #fff; border-radius: 32px; padding: 5px 6px 5px 16px; }
.quick-agent-compose.agent-compose:focus-within { border-color: #0E9F6E; box-shadow: 0 0 0 3px rgba(14, 159, 110, .18); }
.quick-agent-compose.agent-compose .agent-send { background: linear-gradient(135deg, #1DBE83, #0E9F6E); color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(14, 159, 110, .32); }
.quick-agent-compose.agent-compose .agent-send:hover:not(:disabled) { background: linear-gradient(135deg, #0E9F6E, #0C6C4C); transform: translateY(-1px); }

/* 4 个快捷入口 2x2 网格 */
.quick-agent-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px 4px; }
.quick-agent-shortcuts button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 64px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 14px;
  background: #fbfcfa; color: var(--ink); font-size: 12px; font-weight: 650;
  cursor: pointer; transition: background .16s, border-color .16s;
}
.quick-agent-shortcuts button:hover { background: var(--green-soft); border-color: #9bcbb2; }
.quick-agent-shortcuts .qa-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 10px; background: var(--green-soft); color: var(--green); }
.quick-agent-shortcuts .qa-ico svg { width: 18px; height: 18px; }
.quick-agent-shortcuts button:hover .qa-ico { background: var(--green); color: #fff; }

@media (max-width: 960px) {
  .user-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "account" "household" "personal" "token";
  }
  .user-layout.is-admin {
    grid-template-areas: "account" "household" "users" "system" "personal" "token";
  }
  .agent-layout { grid-template-columns: 1fr; min-height: 0; }
  .conversation-panel { max-height: 230px; overflow-y: auto; }
}

@media (max-width: 640px) {
  .token-form { grid-template-columns: 1fr; }
  .ai-settings-form { grid-template-columns: 1fr; }
  .ai-settings-form .ai-base-url, .ai-settings-actions { grid-column: 1; }
  .ai-settings-actions { display: grid; grid-template-columns: 1fr 1.4fr; }
  .ai-settings-actions button { min-width: 0; }
  .ai-provider-guide { grid-template-columns: 1fr; }
  .ai-provider-guide > a { justify-self: start; }
  .ai-provider-preset { grid-column: 1; display: grid; }
  .ai-provider-preset button { width: 100%; margin-left: 0; }
  [data-view-panel="users"] .page-title { gap: 10px; margin: 14px 0 16px; }
  [data-view-panel="users"] .page-title h1 { font-size: 30px; }
  .user-layout { gap: 12px; }
  .user-layout > .panel {
    min-width: 0; max-width: 100%; padding: 16px; overflow: hidden;
  }
  .user-layout .section-head {
    align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 14px;
  }
  .account-summary { gap: 8px; }
  .account-line { padding: 10px 12px; }
  .quota-form {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "limit limit" "usage save";
    align-items: center;
  }
  .quota-form label { grid-area: limit; }
  .quota-form > span { grid-area: usage; align-self: center; height: var(--control-height-md); }
  .quota-form button { grid-area: save; align-self: center; height: var(--control-height-md); }
  .household-members { gap: 8px; margin-top: 12px; }
  .household-member {
    grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 11px 12px;
  }
  .household-member strong { grid-column: 1 / -1; grid-row: 1; }
  .household-member small { grid-column: 1 / -1; grid-row: 2; }
  .household-member .role-pill { grid-column: 1; grid-row: 3; justify-self: start; margin-top: 3px; }
  .household-member button { grid-column: 2; grid-row: 3; margin-top: 3px; }
  .household-actions { display: grid; grid-template-columns: 1fr; }
  .household-actions button, .household-invite button { width: 100%; }
  .ai-settings-form input, .token-form input { min-width: 0; width: 100%; }
  .token-copy-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .token-copy-actions button { min-width: 0; padding-inline: 10px; }
  .token-row div { flex-wrap: wrap; gap: 4px 8px; }
  .token-row code { max-width: 100%; overflow-wrap: anywhere; }
  .mcp-config { min-width: 0; max-width: 100%; }
  .mcp-config pre {
    max-width: 100%; margin-bottom: 0; font-size: 11px; overscroll-behavior-inline: contain;
  }
  body.agent-view-active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
  }
  .agent-view-active .shell {
    height: auto;
    min-height: 0;
    padding: 8px 12px calc(84px + env(safe-area-inset-bottom));
  }
  .agent-view-active #workspace { height: 100%; padding-bottom: 0; }
  [data-view-panel="agent"].active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }
  [data-view-panel="agent"] .page-title {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 0 2px 8px;
  }
  [data-view-panel="agent"] .page-title .eyebrow { display: none; }
  [data-view-panel="agent"] .page-title h1 { font-size: 26px; }
  [data-view-panel="agent"] #newConversation { height: var(--control-height-md); padding: 0 15px; }
  .agent-layout {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    height: 100%;
  }
  .conversation-panel {
    position: relative;
    z-index: 4;
    max-height: none;
    padding: 0;
    overflow: visible;
    border-radius: 16px;
  }
  .conversation-head { grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 54px; margin: 0; padding: 6px 12px; }
  .conversation-head h2 { display: none; }
  .conversation-head > .muted { max-width: 44vw; font-size: 12px; white-space: nowrap; }
  .conversation-toggle {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    text-align: left;
  }
  .conversation-toggle span { display: grid; min-width: 0; gap: 1px; }
  .conversation-toggle small { color: var(--muted); font-size: 10px; font-weight: 650; }
  .conversation-toggle strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .conversation-toggle svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
  }
  .conversation-panel.mobile-open .conversation-toggle svg { transform: rotate(180deg); }
  .conversation-list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(46dvh, 340px);
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(19, 32, 29, .18);
  }
  .conversation-panel.mobile-open .conversation-list { display: grid; }
  .conversation-delete { opacity: 1; }
  .chat-panel { height: 100%; border-radius: 18px; }
  .agent-compose { margin: 8px 10px 10px; }
  .agent-messages { min-height: 0; max-height: none; padding: 14px; }
  .agent-empty { min-height: 0; }
  .agent-message { max-width: 92%; }
  .token-row { grid-template-columns: 1fr auto; }
}
@media (max-width: 640px) {
  .quick-agent {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .quick-agent-dialog {
    right: 0; bottom: 70px;
    width: min(390px, calc(100vw - max(32px, env(safe-area-inset-left) + env(safe-area-inset-right) + 20px)));
    max-height: min(58dvh, 440px); border-radius: 20px;
  }
  .quick-agent-header { min-height: 58px; padding-left: 14px; }
  .quick-agent-header-actions button:first-child { padding-inline: 7px; font-size: 11px; }
  .quick-agent-messages { padding: 12px; }
  .quick-agent-compose.agent-compose { margin: 8px 10px 10px; }
}
@media (max-width: 380px) {
  .ai-settings-actions, .token-copy-actions { grid-template-columns: 1fr; }
  .quick-agent-dialog { max-height: min(56dvh, 390px); }
}

/* 手机与平板常亮展示模式 */
body.presentation-view-active {
  min-height: 100dvh;
  overflow: auto;
  color: #17362b;
  background: #f3efe2;
}
body.presentation-view-active .topbar { display: none; }
body.presentation-view-active .shell { max-width: none; margin: 0; padding: 0; }
body.presentation-view-active #quickAgentFab { display: none !important; }

/* ============================================================
   食光 FoodTime · 品牌组件（参考 family-web 原型）
   仅追加/覆盖视觉，不删除原有 food-editor / voice / dialog /
   agent-layout 等功能性样式。
   ============================================================ */
:root {
  --ink-900: #12211B;
  --ink-400: #5E6E66;
  --ink-300: #B3BFB8;
  --sh-1: 0 1px 2px rgba(18,33,27,.04), 0 4px 16px rgba(18,33,27,.05);
  --sh-2: 0 8px 28px rgba(18,33,27,.10);
  --sh-3: 0 24px 64px rgba(18,33,27,.18);
}

/* 工具类 */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.small { font-size: 12.5px; line-height: 1.6; }
.muted-2 { color: var(--ink-400); }
.row { display: flex; align-items: center; }
.gap2 { gap: 8px; } .gap3 { gap: 12px; } .gap4 { gap: 16px; } .gap5 { gap: 20px; } .gap6 { gap: 24px; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; }
.sr-only-account, .sr-only-logout {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* 线性图标 */
.ic { width: 24px; height: 24px; flex: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ic-16 { width: 16px; height: 16px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-28 { width: 28px; height: 28px; }
.ic-48 { width: 48px; height: 48px; }

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; user-select: none; text-decoration: none; color: inherit; }
.logo-mark { width: 36px; height: 36px; flex: none; display: block; border-radius: 12px; }
.logo-txt { display: flex; flex-direction: column; line-height: 1.05; }
.logo-cn { font-size: 17px; font-weight: 800; letter-spacing: .06em; color: var(--ink-900); }
.logo-en { font-size: 9.5px; font-weight: 700; letter-spacing: .24em; color: var(--ink-400); text-transform: uppercase; }
.ambient-brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; }

/* 顶栏（family-web 风格） */
.topbar {
  height: 64px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
  display: flex; padding: 0;
}
.topbar-in { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; gap: 24px; }
.nav { display: flex; align-items: center; gap: 4px; background: transparent; padding: 0; border-radius: 0; }
.nav button {
  height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent;
  color: var(--ink-500); font-size: 13.5px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background var(--t-base, .24s) ease, color var(--t-base, .24s) ease;
}
.nav button:hover { color: var(--ink-900); background: var(--line-2); }
.nav button.active { color: #fff; background: var(--green-700); box-shadow: 0 4px 14px rgba(14,159,110,.26); }
.nav-icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.session { display: flex; align-items: center; gap: 12px; margin-left: auto; position: relative; color: var(--ink-500); font-size: 14px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-700); cursor: pointer; position: relative;
  transition: all var(--t-base, .24s) ease;
}
.icon-btn:hover { border-color: var(--ink-300); color: var(--ink-900); }
.badge-dot {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--expired); color: #fff; font-size: 10.5px; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.user-chip {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: all var(--t-base, .24s) ease;
}
.user-chip:hover { border-color: var(--ink-300); }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.user-chip span { font-size: 13px; font-weight: 700; padding-right: 4px; }
.menu {
  position: absolute; top: calc(100% + 10px); right: 0; width: 216px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-2); padding: 8px; z-index: 60;
}
.menu-h { padding: 12px 12px 8px; border-bottom: 1px solid var(--line-2); margin-bottom: 8px; }
.menu-i {
  width: 100%; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px;
  border: 0; background: transparent; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-700); text-align: left;
  transition: background var(--t-fast, .14s) ease;
}
.menu-i:hover { background: var(--line-2); color: var(--ink-900); }
.menu-i.danger { color: var(--expired); }
.menu-i.danger:hover { background: var(--red-soft); }

/* 通用按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; background: transparent;
  font-size: 14.5px; font-weight: 700; color: var(--ink-900); cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast, .14s) ease, background var(--t-base, .24s) ease, box-shadow var(--t-base, .24s) ease, border-color var(--t-base, .24s) ease;
}
.btn:active { transform: scale(.975); }
.btn-lg { height: 52px; padding: 0 32px; font-size: 15.5px; }
.btn-sm { height: 34px; padding: 0 16px; font-size: 12.5px; font-weight: 700; }
.btn-primary { background: var(--green-700); color: #fff; box-shadow: 0 6px 18px rgba(14,159,110,.26); }
.btn-primary:hover { background: var(--green-800); box-shadow: 0 10px 24px rgba(14,159,110,.32); }
.btn-cta { background: var(--cta); color: #fff; box-shadow: 0 6px 18px rgba(242,107,34,.28); }
.btn-cta:hover { filter: brightness(.96); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink-700); }
.btn-ghost:hover { border-color: var(--ink-300); background: var(--line-2); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-soft:hover { background: #E2F4EB; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 卡片 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-1); transition: transform var(--t-base, .24s) ease, box-shadow var(--t-base, .24s) ease; }
.card-pad { padding: 24px; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.card-xl { border-radius: 24px; }

/* Pill 变体 */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.pill i { width: 6px; height: 6px; border-radius: 999px; background: currentColor; display: block; }
.pill-fresh { background: var(--green-50); color: var(--green-700); }
.pill-expiring { background: var(--amber-100); color: #9A6200; }
.pill-expired { background: var(--red-soft); color: #B32A30; }
.pill-handled { background: #ecf0ee; color: #6a7670; }
.pill-eaten { background: #E6F6EE; color: #0E9F6E; }
.pill-cooked { background: #EEF1FB; color: #4A5B9A; }
.pill-discarded { background: #FDE9EA; color: #B32A30; }
.pill-ghost { background: var(--line-2); color: var(--ink-500); }
.pill-info { background: #EAF1FE; color: #2455B8; }

/* 输入 */
.input {
  width: 100%; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  padding: 0 16px; font-family: inherit; font-size: 14.5px; color: var(--ink-900); outline: none;
  transition: box-shadow var(--t-fast, .14s) ease, border-color var(--t-fast, .14s) ease;
}
.input::placeholder { color: var(--ink-400); }
.input:focus { border-color: transparent; box-shadow: 0 0 0 3px var(--green-50), 0 0 0 1px var(--brand); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7C73' 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 14px center; padding-right: 38px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 12.5px; font-weight: 700; color: var(--ink-700); }

/* 页面标题 / 栅格 */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 22px 64px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.view-head h2, .view-head h1 { font-size: 32px; line-height: 1.22; font-weight: 800; color: var(--ink-900); }
.view-head .sub { color: var(--ink-500); font-size: 13.5px; margin-top: 6px; }
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.grid12 > .recipe-empty,
.grid12 > .alert-empty,
.grid12 > .ledger-empty-state,
.grid12 > .empty { grid-column: 1 / -1; }
.sec-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sec-title h3 { font-size: 19px; font-weight: 720; color: var(--ink-900); }
.link { background: none; border: 0; color: var(--brand-700); font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 0; }
.link:hover { text-decoration: underline; }

/* KPI */
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; }
.kpi-n { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi-l { font-size: 12.5px; color: var(--ink-500); font-weight: 600; }
.kpi-trend { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-500); }

/* 快捷入口 */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.quick-i { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; cursor: pointer; text-align: left; box-shadow: var(--sh-1); transition: transform var(--t-base, .24s) ease, box-shadow var(--t-base, .24s) ease; }
.quick-i:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.quick-ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.quick-i b { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.quick-i span { font-size: 11.5px; color: var(--ink-400); }

/* 菜谱卡 */
.recipe { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: transform .15s ease, box-shadow .15s ease; }
.recipe:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.10); }
.recipe-img { aspect-ratio: 16/9; position: relative; display: grid; place-items: center; color: rgba(255,255,255,.92); background: linear-gradient(150deg,#0E9F6E,#0C6C4C); overflow: hidden; }
.recipe-img .tag { position: absolute; left: 12px; top: 12px; z-index: 2; background: rgba(255,255,255,.94); color: var(--ink-900); font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.recipe-b { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; font-weight: 600; color: var(--ink-500); background: var(--line-2); padding: 3px 9px; border-radius: 999px; }
.recipe-hero { aspect-ratio: 16/9; border-radius: 16px; margin-bottom: 20px; position: relative; display: grid; place-items: center; color: #fff; overflow: hidden; box-shadow: 0 8px 24px rgba(199, 78, 51, .18); }
.recipe-hero .ic { width: 64px; height: 64px; stroke-width: 2; opacity: .88; }
.recipe-hero .recipe-hero-name { margin: 12px 0 0; font-size: 22px; font-weight: 800; letter-spacing: .04em; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.18); }
.recipe-hero .recipe-hero-tag { position: absolute; left: 16px; top: 16px; background: rgba(255,255,255,.94); color: var(--ink-900); font-size: 12px; font-weight: 800; padding: 5px 14px; border-radius: 999px; }

/* 菜谱卡片真实封面图 */
.recipe-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recipe-img-fallback { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; }

/* 菜谱详情页 Hero 真实图片 */
.recipe-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.recipe-step { font-size: 13.5px; color: var(--ink-700); line-height: 1.85; background: var(--line-2); border-radius: 14px; padding: 16px 20px; white-space: pre-line; }

/* 菜谱详情页面：分步骤卡片 + 食材清单 + 元信息 */
.recipe-detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.recipe-hero-section { display: flex; flex-direction: column; gap: 14px; }
.recipe-aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.section-title { margin: 4px 0 12px; font-size: 15px; font-weight: 700; color: var(--ink-900); }
.recipe-meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.recipe-tag { padding: 4px 12px; border-radius: 999px; background: var(--amber-100); color: #9A6200; font-size: 12px; font-weight: 700; }
.recipe-meta-pill { padding: 4px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green-700); font-size: 12px; font-weight: 700; }
.recipe-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: step; }
.recipe-step-item { position: relative; padding: 14px 18px 14px 56px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; font-size: 13.5px; color: var(--ink-700); line-height: 1.7; counter-increment: step; }
.recipe-step-item::before { content: counter(step); position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 800; border-radius: 50%; font-size: 13px; }
.recipe-ingredient-card, .recipe-expiring-card { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.recipe-ingredient-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.recipe-ingredient-item { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed rgba(36,95,69,.12); font-size: 13.5px; color: var(--ink-700); }
.recipe-ingredient-item:last-child { border-bottom: 0; }
.recipe-ingredient-item strong { color: var(--green-700); font-weight: 700; }
.recipe-ingredient-item.muted { color: var(--muted); }
.recipe-add-btn { height: 48px; font-size: 14px; gap: 6px; }

@media (max-width: 960px) {
  .recipe-detail-grid { grid-template-columns: 1fr; }
}

/* 动态流 */
.feed-i { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.feed-i:last-child { border-bottom: 0; }
.feed-t { font-size: 13.5px; color: var(--ink-700); }
.feed-t b { color: var(--ink-900); font-weight: 700; }

/* 表格 */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-400); padding: 0 16px 12px; border-bottom: 1px solid var(--line); letter-spacing: .03em; }
.table td { padding: 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-700); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast, .14s) ease; }
.table tbody tr:hover { background: #FBFAF6; }
.table tbody tr:last-child td { border-bottom: 0; }
.t-name { display: flex; align-items: center; gap: 12px; }
.t-thumb { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); flex: none; }
.t-name b { color: var(--ink-900); font-weight: 700; font-size: 13.5px; }
.t-name span { display: block; font-size: 11.5px; color: var(--ink-400); line-height: 1.3; }
.t-actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; justify-content: flex-end; white-space: nowrap; }

/* 家庭 web 端保质期列：日期 + 进度条 + 文字 */
.t-expiry-date { font-size: 13px; color: var(--ink-900); font-weight: 600; }
.t-expiry-remaining { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 130px; }
.t-expiry-track { flex: 1; max-width: 110px; height: 6px; border-radius: 999px; background: rgba(232,148,0,.12); overflow: hidden; }
.t-expiry-track span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #E08A00 0%, #F26B22 100%); transition: width .25s; }
.t-expiry-track.fresh span { background: linear-gradient(90deg, #6FE3B0 0%, #0E9F6E 100%); }
.t-expiry-track.warning span { background: linear-gradient(90deg, #E08A00 0%, #F26B22 100%); }
.t-expiry-track.danger span { background: linear-gradient(90deg, #DC3F45 0%, #b21d22 100%); }
.t-expiry-track.handled span { background: linear-gradient(90deg, #c2cbc6 0%, #8b938e 100%); }
.t-expiry-text { font-size: 11.5px; color: #E08A00; white-space: nowrap; font-weight: 600; }
.t-expiry-track.fresh + .t-expiry-text { color: #0E9F6E; }
.t-expiry-track.danger + .t-expiry-text { color: #DC3F45; }

/* 家庭 web 端操作按钮：吃掉（绿色）/ 做菜（浅色）/ 编辑（文字） */
.t-actions .btn-eat { background: var(--green) !important; color: #fff !important; border-color: var(--green) !important; }
.t-actions .btn-cook { background: var(--green-soft) !important; color: var(--green-700, #0c6c4c) !important; border-color: transparent !important; }
.t-actions .btn-discard { background: rgba(220, 63, 69, .08) !important; color: #B32A30 !important; border-color: transparent !important; }
.t-actions .btn-discard:hover { background: var(--red-soft) !important; }
.t-actions .btn-restore { background: var(--green-soft) !important; color: var(--green-700, #0c6c4c) !important; border-color: transparent !important; }
.t-actions .btn-edit { background: transparent !important; border: 0 !important; color: var(--muted) !important; padding: 0 6px !important; }
.t-actions .btn-edit:hover { color: var(--ink) !important; }
.t-actions .btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* 筛选条 */
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search-wrap { position: relative; width: 260px; }
.search-wrap .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-400); }
.search-wrap .input { padding-left: 42px; }
.segment { display: flex; gap: 2px; background: var(--line-2); padding: 4px; border-radius: 999px; }
.seg { height: 34px; padding: 0 16px; border: 0; background: transparent; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--ink-500); cursor: pointer; transition: all var(--t-base, .24s) ease; }
.seg.on { background: var(--surface); color: var(--brand-700); box-shadow: var(--sh-1); }

/* 预警分组 */
.alert-group { margin-bottom: 24px; }
.ag-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ag-head h3 { font-size: 19px; font-weight: 720; color: var(--ink-900); }
.ag-bar { width: 4px; height: 20px; border-radius: 999px; }
/* 菜谱详情：用掉的临期食材容器（垂直堆叠子 alert-row） */
.recipe-expiring-card #recipeDetailExpiring { display: flex; flex-direction: column; gap: 0; }
.recipe-expiring-card .alert-row { margin-bottom: 8px; }
.recipe-expiring-card .alert-row:last-child { margin-bottom: 0; }

/* 菜谱详情临期食材：圆形图标 + 名称 + 副文本 + 日期右对齐 */
.recipe-expiring-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; }
.recipe-expiring-row .recipe-expiring-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--amber-100); color: #9A6200; display: grid; place-items: center; }
.recipe-expiring-row .recipe-expiring-ico svg { width: 18px; height: 18px; }
.recipe-expiring-row .recipe-expiring-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recipe-expiring-row .recipe-expiring-info .ar-name { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.recipe-expiring-row .recipe-expiring-info .ar-meta { font-size: 12.5px; color: var(--muted); }
.recipe-expiring-row .recipe-expiring-date { text-align: right; min-width: 92px; }
.recipe-expiring-row .recipe-expiring-date b { display: block; font-size: 17px; font-weight: 800; color: var(--ink-900); line-height: 1.2; }
.recipe-expiring-row .recipe-expiring-date span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.alert-row:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.alert-row.done { opacity: .55; }
.alert-row.done .ar-name { text-decoration: line-through; color: var(--ink-400); }
.ar-ico { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.ar-name { font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.ar-meta { font-size: 12px; color: var(--ink-400); }
.ar-left { margin-left: auto; text-align: right; }
.ar-left b { font-size: 19px; font-weight: 800; line-height: 1.2; display: block; }
.ar-left span { font-size: 11px; color: var(--ink-400); }

/* 图表 */
.chart {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 32px;
  height: 220px; padding: 10px 8px 0; position: relative;
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(to top, var(--line-2) 1px, transparent 1px);
  background-size: 100% 25%; background-repeat: repeat-y;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-bars { display: flex; gap: 10px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: 22px; border-radius: 10px 10px 4px 4px; transition: height .42s ease, transform .16s; position: relative; min-height: 4px; }
.chart-bar:hover { transform: scaleY(1.04) scaleX(1.05); }
.chart-bar-wrap { position: relative; height: 100%; display: flex; align-items: flex-end; }
.chart-bar-tip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--ink-900); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 2;
}
.chart-bar-wrap:hover .chart-bar-tip { opacity: 1; }
.legend { display: flex; gap: 20px; align-items: center; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

/* 消费台账：空状态 / 空行 */
.ledger-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 38px 24px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: 18px;
}
.ledger-empty-state svg { color: var(--green); opacity: .6; }
.ledger-empty-state strong { color: var(--ink-700); font-size: 16px; }
.ledger-empty-state span { font-size: 13px; line-height: 1.55; max-width: 320px; }
.ledger-empty-row { text-align: center; color: var(--muted); padding: 24px !important; font-size: 13px; }

/* 消费台账：图表卡片 */
.ledger-chart-card { padding: 26px 28px 28px; }
.ledger-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.ledger-chart-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.ledger-chart-legend { display: flex; gap: 18px; align-items: center; flex-shrink: 0; }
.ledger-chart-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.ledger-chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ledger-chart .chart-col > .muted { font-size: 12px; color: var(--ink-500); }
@media (max-width: 760px) {
  .chart { gap: 14px; height: 190px; padding: 10px 0 0; }
  .chart-bars { gap: 6px; }
  .chart-bar { width: 16px; border-radius: 8px 8px 3px 3px; }
  .ledger-chart-head { flex-direction: column; gap: 12px; }
  .ledger-chart-legend { align-self: flex-start; }
}

/* 成员 */
.member { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.perm { display: flex; flex-wrap: wrap; gap: 6px; }

/* 设置 */
.set-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: 0; }
.switch { width: 46px; height: 27px; border-radius: 999px; background: var(--ink-300); border: 0; position: relative; cursor: pointer; flex: none; transition: background var(--t-base, .24s) ease; }
.switch i { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform var(--t-base, .24s) ease; }
.switch.on { background: var(--brand); }
.switch.on i { transform: translateX(19px); }

/* 通知 */
.noti { display: flex; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background var(--t-fast, .14s) ease; }
.noti:last-child { border-bottom: 0; }
.noti:hover { background: #FBFAF6; }
.noti-ico { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.noti-t { font-size: 14px; color: var(--ink-700); }
.noti.unread { background: #FCFBF7; }
.noti.unread .noti-t::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cta); display: inline-block; margin-left: 7px; vertical-align: middle; }

/* 小食 Copilot */
.copilot-fab { position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: #F7F4EC; cursor: pointer; z-index: 110; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(14,159,110,.28), 0 0 0 4px rgba(115,87,230,.18); transition: transform var(--t-fast, .14s) ease; }
.copilot-fab:hover { transform: scale(1.06); }
.copilot-ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; background: linear-gradient(135deg, #7357E6, #2F6FED) border-box; -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0); -webkit-mask-composite: destination-out; mask-composite: exclude; opacity: .8; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.08); opacity: .35; } }
.copilot { position: fixed; right: 24px; bottom: 96px; width: 360px; height: 520px; background: var(--surface); border-radius: 32px; box-shadow: 0 20px 60px rgba(18,33,27,.22); border: 1px solid var(--line); z-index: 111; display: flex; flex-direction: column; overflow: hidden; animation: pop var(--t-base, .24s) ease; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.copilot-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); background: linear-gradient(135deg, #F7F4EC, #EFEBFB); }
.copilot-h b { font-size: 15px; font-weight: 800; color: var(--ink-900); }
.copilot-h .icon-btn { margin-left: auto; color: var(--ink-500); width: 32px; height: 32px; }
.copilot-av { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: 0 0 0 2px rgba(115,87,230,.15); }

/* 菜谱管理：AI 生成按钮 + AI 建议卡片 */
.ai-generate-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 22px; border: 0; border-radius: 22px;
  background: linear-gradient(135deg, #F26B22, #E08A00); color: #fff;
  font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px rgba(242, 107, 34, .22);
}
.ai-generate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 22px rgba(242, 107, 34, .28); }
.ai-generate-btn:disabled { opacity: .55; cursor: default; transform: none; }

/* 消费台账：3 个 KPI 卡片副信息 + 点击跳转 */
.kpi-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }
.ledger-kpi-clickable { cursor: pointer; transition: transform .16s, box-shadow .16s; }
.ledger-kpi-clickable:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(19, 32, 29, .12); }
.ledger-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ledger-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ledger-legend:first-of-type i { background: var(--fresh); }
.ledger-legend:last-of-type i { background: var(--red); }
.recipe-advice {
  display: block; padding: 20px 24px; margin-bottom: 24px; border-radius: 18px;
  background: linear-gradient(135deg, #F7F4FB 0%, #EEF2FB 100%);
  border: 1px solid #E5DEF1; box-shadow: 0 6px 18px rgba(180, 162, 218, .14);
}
.recipe-advice-head { display: flex; align-items: center; gap: 12px; }
.recipe-advice-avatar {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; background: #fff; overflow: hidden; flex: none;
}
.recipe-advice-meta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.recipe-advice-meta strong { font-size: 16px; color: var(--ink-900); }
.recipe-advice-tag {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 999px;
  background: #FBE9EA; color: #B32A30; font-size: 12px; font-weight: 700;
}
.recipe-advice-body {
  margin: 12px 0 0 56px;
  font-size: 14.5px; color: var(--ink-700); line-height: 1.75;
}
.copilot-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #FCFBF7; }
.bubble { max-width: 86%; padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.6; }
.bubble.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--ink-900); border-bottom-left-radius: 6px; }
.bubble.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.copilot-quick { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--surface); }
.copilot-quick button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: #FCFBF7; color: var(--ink-700); font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--t-fast, .14s) ease; }
.copilot-quick button:hover { border-color: var(--brand); background: var(--green-50); color: var(--brand); }
.copilot-quick button .ic { color: var(--brand); }
.copilot-in { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-2); background: var(--surface); }
.copilot-in input { flex: 1; height: 42px; border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; font-size: 14px; background: #FCFBF7; outline: none; }
.copilot-in input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--green-50); }
.copilot-in .send { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer; }
.copilot-in .send:hover { background: var(--green-700); }

/* 模态 / Toast（占位组件，保持品牌一致性） */
.mask { position: fixed; inset: 0; background: rgba(10,35,26,.42); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 32px; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 24px; box-shadow: var(--sh-3); overflow: hidden; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line-2); }
.modal-b { padding: 24px; display: flex; flex-direction: column; gap: 16px; max-height: 480px; overflow: auto; }
.modal-f { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 12px; background: #FCFBF7; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.toasts { position: fixed; left: 0; right: 0; bottom: 32px; z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink-900); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 13.5px; font-weight: 600; box-shadow: var(--sh-2); }

/* 会员 */
.grid2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.plan-card { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 16px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-1); transition: transform var(--t-fast, .14s) ease; }
.plan-card:hover { transform: translateY(-3px); }
.plan-card.current { opacity: .92; border-style: dashed; }
.plan-card.featured { border-color: var(--brand); box-shadow: 0 8px 28px rgba(14,159,110,.14); }
.plan-card.ai { border-color: #7357E6; box-shadow: 0 8px 28px rgba(115,87,230,.12); }
.plan-badge { position: absolute; right: 16px; top: 16px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--line-2); color: var(--ink-500); }
.plan-badge.hot { background: var(--brand); color: #fff; }
.plan-badge.ai { background: linear-gradient(135deg, #7357E6, #2F6FED); color: #fff; }
.plan-title { font-size: 22px; font-weight: 800; color: var(--ink-900); }
.plan-price { font-size: 38px; font-weight: 800; color: var(--ink-900); letter-spacing: -.02em; }
.plan-price span { font-size: 15px; font-weight: 500; color: var(--ink-500); margin-left: 4px; }
.plan-bill { font-size: 13px; color: var(--ink-500); margin-top: -8px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.plan-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-700); }
.plan-list li .ic { color: var(--brand); flex: none; margin-top: 2px; }
.plan-card.ai .plan-list li .ic { color: #7357E6; }
.plan-card .btn { margin-top: auto; }

/* 空态 / 标题块 */
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 20px; }
.empty-ico { width: 66px; height: 66px; border-radius: 50%; background: var(--line-2); display: grid; place-items: center; color: var(--ink-300); }
.empty b { font-size: 15px; font-weight: 700; color: var(--ink-900); }
.empty p { font-size: 13px; color: var(--ink-400); max-width: 320px; }
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 32px; background: var(--brand-grad); color: #fff; }
.hero h2 { color: #fff; font-size: 28px; line-height: 1.25; }
.hero p { color: rgba(255,255,255,.76); font-size: 14px; margin-top: 8px; max-width: 460px; }
.hero-stats { display: flex; gap: 32px; margin-top: 16px; }
.hero-stats b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; }
.hero-stats span { font-size: 12px; color: rgba(255,255,255,.66); }

/* 登录页（family-web 风格） */
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; gap: 0; align-items: stretch; }
.login-brand { background: var(--brand-grad); color: #fff; padding: 56px 60px; display: flex; flex-direction: column; justify-content: center; gap: 32px; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; right: -140px; bottom: -160px; width: 460px; height: 460px; border-radius: 50%; background: rgba(255,255,255,.06); }
.login-brand::before { content: ""; position: absolute; right: 60px; top: -90px; width: 230px; height: 230px; border-radius: 50%; background: rgba(255,255,255,.05); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand .logo-cn, .login-brand .logo-en { color: #fff; }
.login-brand .logo-en { color: rgba(255,255,255,.62); }
.lb-logo { display: flex; align-items: center; }
.logo-h { width: auto; height: 56px; display: block; }
.lb-slogan { color: #fff; font-size: 46px; line-height: 1.14; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.lb-sub { font-size: 15px; line-height: 1.75; color: rgba(255,255,255,.78); max-width: 400px; }
.lb-values { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.lb-value { display: flex; gap: 12px; align-items: flex-start; }
.lb-ico { width: 38px; height: 38px; flex: none; border-radius: 14px; background: rgba(255,255,255,.14); display: grid; place-items: center; color: #fff; border: 1px solid rgba(255,255,255,.16); }
.lb-value b { display: block; font-size: 14.5px; font-weight: 700; color: #fff; }
.lb-value span { font-size: 12.5px; color: rgba(255,255,255,.66); line-height: 1.6; }
.lb-tag { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; border-radius: 999px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); font-size: 12.5px; font-weight: 700; color: #fff; width: max-content; }
.login-form-wrap { background: var(--surface); display: grid; place-items: center; padding: 56px; }
.login-card.login-form-wrap { border: 0; box-shadow: none; background: var(--surface); }
.login-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login-form h2 { font-size: 26px; font-weight: 800; color: var(--ink-900); margin: 0; }
.login-form .muted { margin: 0; }

/* 焦点可见性 */
:where(a, button, input, textarea, select, [tabindex], [role="button"]):focus-visible { outline: 2px solid var(--fresh); outline-offset: 2px; border-radius: 4px; }

/* ===== 响应式：980px / 560px（食光新增组件） ===== */
@media (max-width: 980px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; padding: 40px 24px; }
  .logo-h { height: 48px; }
  .login-form-wrap { padding: 32px 24px; }
  .grid12 > .card.kpi, .grid12 > .kpi { grid-column: span 6 !important; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .copilot { width: calc(100% - 48px); right: 24px; left: 24px; height: 460px; }
  .view-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .view-head .btn { width: 100%; }
}
@media (max-width: 560px) {
  .lb-slogan { font-size: 34px; }
  .login-brand { padding: 32px 20px; }
  .login-form-wrap { padding: 24px 18px; }
  .grid12 > .card.kpi, .grid12 > .kpi { grid-column: span 6 !important; }
  .quick { grid-template-columns: 1fr 1fr; }
  .grid12 { gap: 12px; }
  .sec-title { margin-bottom: 12px; }
  .kpi { padding: 14px; }
  .kpi-n { font-size: 26px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 4px; margin-bottom: 10px; }
  .table td { border: 0; padding: 8px 14px; }
  .table .t-actions { padding-top: 0; }
  .filters { gap: 8px; }
  .search-wrap { width: 100%; }
  .copilot { height: 70dvh; bottom: 80px; }
  .copilot-fab { right: 16px; bottom: 16px; }
  .card.member { grid-column: span 12 !important; }
}
/* 窄屏手机：菜谱/台账 KPI 卡片强制一行两列，覆盖 980px/560px 的 span 6 */
@media (max-width: 768px) {
  .grid12 { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .grid12 > .card.recipe,
  .grid12 > .card.kpi { grid-column: span 1 !important; }
  .grid12 > .recipe-empty,
  .grid12 > .alert-empty,
  .grid12 > .ledger-empty-state,
  .grid12 > .empty { grid-column: 1 / -1 !important; width: 100%; }
}
body.presentation-view-active #workspace { padding: 0; }
body.presentation-view-active .quick-agent {
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
}
.presentation-view.active { min-height: 100dvh; }
.ambient-display {
  --ambient-ink: #17362b;
  --ambient-green: #245f45;
  --ambient-green-soft: #dcebd8;
  --ambient-red: #cf5549;
  --ambient-red-soft: #f8ddd2;
  --ambient-yellow: #d7952d;
  --ambient-yellow-soft: #f9e4a9;
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(14px, 2vw, 26px);
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  color: var(--ambient-ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(255,255,255,.92) 0 11%, transparent 35%),
    radial-gradient(circle at 92% 100%, rgba(220,235,216,.8) 0 10%, transparent 36%),
    linear-gradient(138deg, #f8f4e8 0%, #efe9d8 100%);
}
.ambient-display::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: repeating-linear-gradient(0deg, rgba(23,54,43,.06) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply;
}
.ambient-header, .ambient-grid, .ambient-footer { position: relative; z-index: 1; }
.ambient-header {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
  align-items: center;
  gap: 22px;
}
.ambient-brand { display: flex; align-items: center; gap: 12px; }
.ambient-brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px;
  color: #f9f5e8; background: var(--ambient-green); font-size: 23px; font-weight: 850;
  box-shadow: 0 8px 20px rgba(36,95,69,.18);
}
.ambient-brand strong, .ambient-brand small { display: block; }
.ambient-brand strong { font-size: 20px; }
.ambient-brand small { margin-top: 2px; color: #668075; font-size: 12px; }
.ambient-clock { display: grid; justify-items: center; }
.ambient-clock strong { font-size: clamp(30px, 4vw, 52px); line-height: .95; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.ambient-clock span { margin-top: 5px; color: #61786f; font-size: 12px; font-weight: 650; }
.ambient-controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ambient-controls button {
  min-height: 40px; padding: 0 14px; border: 1px solid rgba(36,95,69,.2); border-radius: 12px;
  color: var(--ambient-green); background: rgba(255,255,255,.58); font-size: 12px; font-weight: 760;
  backdrop-filter: blur(8px);
}
.ambient-controls button:hover { background: rgba(255,255,255,.9); }
.ambient-controls button:focus-visible { outline: 3px solid rgba(36,95,69,.22); outline-offset: 2px; }
.ambient-wake-status { color: #668075; font-size: 11px; font-weight: 700; white-space: nowrap; }
.ambient-wake-status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%;
  background: #8aa499; box-shadow: 0 0 0 4px rgba(138,164,153,.12);
}
.ambient-wake-status.active::before { background: #4da271; box-shadow: 0 0 0 4px rgba(77,162,113,.14); }
.ambient-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, .88fr) minmax(430px, 1.45fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(12px, 1.5vw, 20px);
}
.ambient-hero, .ambient-priority, .ambient-details > section {
  border: 1px solid rgba(36,95,69,.12);
  box-shadow: 0 18px 48px rgba(48,62,52,.08);
}
.ambient-hero {
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(22px, 3vw, 40px);
  border-radius: 28px;
  background: rgba(255,253,246,.82);
}
.ambient-kicker, .ambient-section-head p {
  margin: 0 0 7px; color: var(--ambient-green); font-size: 11px; font-weight: 820; letter-spacing: .14em;
}
.ambient-hero h1 { max-width: 610px; font-size: clamp(35px, 4.2vw, 68px); line-height: 1.02; letter-spacing: -.04em; }
.ambient-hero > p:not(.ambient-kicker) { max-width: 550px; margin: 16px 0 0; color: #60746c; font-size: clamp(14px, 1.4vw, 19px); line-height: 1.6; }
.ambient-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: auto; padding-top: 24px; }
.ambient-metrics article { min-width: 0; padding: 14px; border-radius: 18px; background: var(--ambient-green-soft); }
.ambient-metrics article.expired { background: var(--ambient-red-soft); }
.ambient-metrics article.expiring { background: var(--ambient-yellow-soft); }
.ambient-metrics span { display: block; min-height: 28px; color: #557066; font-size: 11px; font-weight: 700; }
.ambient-metrics strong { font-size: clamp(28px, 3vw, 46px); line-height: 1; letter-spacing: -.04em; }
.ambient-metrics small { margin-left: 3px; color: #60746c; font-size: 11px; }
.ambient-metrics .expired strong { color: var(--ambient-red); }
.ambient-metrics .expiring strong { color: #a66c13; }
.ambient-freshness { margin-top: 18px; padding-top: 17px; border-top: 1px solid rgba(36,95,69,.12); }
.ambient-freshness > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; }
.ambient-freshness strong { color: var(--ambient-green); }
.ambient-freshness-track { height: 8px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #dedfce; }
.ambient-freshness-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d3a23e, #4b9b70); transition: width .4s ease; }
.ambient-priority {
  min-height: 0;
  padding: clamp(18px, 2.4vw, 28px);
  border-radius: 28px;
  background: rgba(255,253,246,.82);
}
.ambient-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.ambient-section-head h2 { font-size: clamp(21px, 2vw, 29px); }
.ambient-section-head > span { color: #73877e; font-size: 11px; }
.ambient-food-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ambient-food {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 12px;
  overflow: hidden;
  border-radius: 17px;
  background: #edf3e9;
}
.ambient-food.expired { background: var(--ambient-red-soft); }
.ambient-food.expiring { background: var(--ambient-yellow-soft); }
.ambient-food-glyph { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.64); font-size: 22px; }
.ambient-food-copy { min-width: 0; }
.ambient-food-copy strong, .ambient-food-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ambient-food-copy strong { font-size: 15px; }
.ambient-food-copy span { margin-top: 4px; color: #64766f; font-size: 10px; }
.ambient-food-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.ambient-food-status { color: var(--ambient-green); font-size: 11px; font-weight: 820; white-space: nowrap; }
.ambient-food.expired .ambient-food-status { color: var(--ambient-red); }
.ambient-food.expiring .ambient-food-status { color: #9c6612; }
.ambient-food-handle {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(36,95,69,.16);
  border-radius: 999px;
  color: var(--ambient-green);
  background: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.ambient-food-handle:hover { border-color: rgba(36,95,69,.34); background: #fff; }
.ambient-food-handle:focus-visible { outline: 3px solid rgba(36,95,69,.2); outline-offset: 2px; }
.ambient-food-empty { grid-column: 1 / -1; min-height: 150px; display: grid; place-items: center; border: 1px dashed rgba(36,95,69,.2); border-radius: 18px; color: #71847c; text-align: center; }
.ambient-details { display: grid; grid-template-columns: minmax(250px, 1.25fr) minmax(0, 1fr) minmax(190px, .75fr); gap: clamp(10px, 1.2vw, 16px); }
.ambient-details > section { min-width: 0; padding: 17px 20px; border-radius: 22px; background: rgba(255,253,246,.78); }
.ambient-details .ambient-section-head { margin-bottom: 10px; }
.ambient-details .ambient-section-head h2 { font-size: 18px; }
.ambient-details .ambient-section-head > span { align-self: center; }
.ambient-activity-list { display: grid; gap: 5px; }
.ambient-activity {
  min-width: 0; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center; gap: 8px; min-height: 36px; padding: 4px 7px;
  border-radius: 11px; background: #edf3e9;
}
.ambient-activity-icon {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px;
  color: var(--ambient-green); background: rgba(255,255,255,.68); font-size: 14px; font-weight: 850;
}
.ambient-activity-icon.food_deleted, .ambient-activity-icon.household_member_removed, .ambient-activity-icon.household_member_left { color: var(--ambient-red); background: rgba(255,255,255,.62); }
.ambient-activity-icon.food_updated, .ambient-activity-icon.household_invite_created { color: #916112; }
.ambient-activity-copy { min-width: 0; }
.ambient-activity-copy strong, .ambient-activity-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ambient-activity-copy strong { font-size: 11px; }
.ambient-activity-copy small { margin-top: 2px; color: #697b73; font-size: 9px; }
.ambient-activity time { color: #71847c; font-size: 9px; white-space: nowrap; }
.ambient-activity-empty { min-height: 54px; display: grid; place-items: center; border: 1px dashed rgba(36,95,69,.18); border-radius: 12px; color: #71847c; font-size: 10px; }
.ambient-categories { display: flex; flex-wrap: wrap; gap: 7px; }
.ambient-category { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 9px; border-radius: 999px; color: #4f685e; background: #e8eee4; font-size: 11px; font-weight: 700; }
.ambient-category strong { color: var(--ambient-ink); }
.ambient-next-card { display: flex; flex-direction: column; justify-content: center; background: #f3dca9 !important; color: #513b17; }
.ambient-next-card span { color: #87672d; font-size: 10px; font-weight: 780; letter-spacing: .1em; }
.ambient-next-card strong { margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 21px; }
.ambient-next-card p { margin: 6px 0 0; color: #735727; font-size: 11px; line-height: 1.45; }
.ambient-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #637a70; font-size: 11px; }
.ambient-footer span { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.ambient-footer i { width: 7px; height: 7px; border-radius: 50%; background: #4da271; box-shadow: 0 0 0 4px rgba(77,162,113,.14); }
.ambient-footer small { font-size: 10px; }

@media (max-width: 900px) {
  .ambient-display { overflow: auto; }
  .ambient-header { grid-template-columns: minmax(0, 1fr) auto; }
  .ambient-clock { grid-column: 1 / -1; grid-row: 2; }
  .ambient-controls { grid-column: 2; grid-row: 1; }
  .ambient-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .ambient-hero { grid-row: auto; }
}

@media (max-width: 640px) {
  body.presentation-view-active { display: block; height: auto; overflow: auto; }
  .ambient-display { gap: 8px; min-height: 100dvh; padding: max(8px, env(safe-area-inset-top)) 9px max(8px, env(safe-area-inset-bottom)); }
  .ambient-header { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 9px; }
  .ambient-brand { gap: 9px; }
  .ambient-brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 17px; }
  .ambient-brand strong { font-size: 16px; }
  .ambient-brand small { margin-top: 0; font-size: 10px; }
  .ambient-clock { display: flex; grid-column: 1 / -1; justify-content: space-between; align-items: baseline; padding: 0 4px; }
  .ambient-clock strong { font-size: 26px; }
  .ambient-clock span { margin: 0; }
  .ambient-controls { gap: 5px; }
  .ambient-controls button { min-height: 36px; padding: 0 9px; border-radius: 10px; }
  .ambient-wake-status { display: none; }
  .ambient-grid { gap: 8px; }
  .ambient-hero, .ambient-priority { padding: 13px 14px; border-radius: 19px; }
  .ambient-kicker, .ambient-section-head p { margin-bottom: 4px; font-size: 9px; }
  .ambient-hero h1 { font-size: clamp(30px, 9vw, 38px); line-height: 1.02; }
  .ambient-hero > p:not(.ambient-kicker) { display: none; }
  .ambient-metrics { gap: 6px; padding-top: 13px; }
  .ambient-metrics article { padding: 9px 8px; border-radius: 13px; }
  .ambient-metrics span { min-height: 20px; font-size: 9px; }
  .ambient-metrics strong { font-size: 27px; }
  .ambient-freshness { margin-top: 11px; padding-top: 10px; }
  .ambient-freshness-track { height: 6px; margin-top: 6px; }
  .ambient-section-head { margin-bottom: 9px; }
  .ambient-section-head h2 { font-size: 20px; }
  .ambient-food-list { grid-template-columns: 1fr; }
  .ambient-food-list { gap: 6px; }
  .ambient-food { min-height: 56px; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 8px; padding: 7px 9px; border-radius: 14px; }
  .ambient-food-glyph { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
  .ambient-food-copy strong { font-size: 14px; }
  .ambient-food-copy span { margin-top: 2px; }
  .ambient-food-actions { gap: 3px; }
  .ambient-food-handle { min-height: 22px; padding: 2px 7px; font-size: 9px; }
  .ambient-food:nth-child(n+5) { display: none; }
  .ambient-details { grid-template-columns: 1fr; gap: 10px; }
  .ambient-details > section { padding: 16px 18px; border-radius: 19px; }
  .ambient-activity { min-height: 42px; grid-template-columns: 32px minmax(0, 1fr) auto; }
  .ambient-activity-icon { width: 32px; height: 32px; }
  .ambient-activity-copy strong { font-size: 12px; }
  .ambient-activity-copy small, .ambient-activity time { font-size: 10px; }
  .ambient-footer small { display: none; }
  .welcome-head { align-items: flex-start; }
  .welcome-display-launch { flex: 0 0 auto; min-height: 36px; padding: 0 12px; }
  #devicePreviewSection .display-launch { grid-column: 1 / -1; width: 100%; }
}

@media (orientation: landscape) and (min-width: 600px) and (max-width: 1000px) {
  .ambient-display {
    gap: 8px;
    min-height: 100dvh;
    height: 100dvh;
    padding: max(10px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left));
    overflow: hidden;
  }
  .ambient-header { grid-template-columns: minmax(150px, 1fr) auto minmax(210px, 1fr); gap: 10px; }
  .ambient-brand { gap: 9px; }
  .ambient-brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; }
  .ambient-brand strong { font-size: 16px; }
  .ambient-brand small { margin-top: 0; font-size: 10px; }
  .ambient-clock { display: grid; grid-column: 2; grid-row: 1; padding: 0; }
  .ambient-clock strong { font-size: 28px; }
  .ambient-clock span { margin-top: 2px; font-size: 9px; }
  .ambient-controls { grid-column: 3; grid-row: 1; gap: 5px; }
  .ambient-controls button { min-height: 36px; padding: 0 10px; border-radius: 10px; }
  .ambient-wake-status { display: none; }
  .ambient-grid {
    grid-template-columns: minmax(230px, .82fr) minmax(340px, 1.5fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .ambient-hero { grid-row: 1 / 3; padding: 17px; border-radius: 20px; }
  .ambient-kicker, .ambient-section-head p { margin-bottom: 4px; font-size: 9px; }
  .ambient-hero h1 { font-size: clamp(29px, 4.2vw, 40px); }
  .ambient-hero > p:not(.ambient-kicker) { display: block; margin-top: 9px; font-size: 11px; line-height: 1.45; }
  .ambient-metrics { gap: 6px; padding-top: 12px; }
  .ambient-metrics article { padding: 9px 8px; border-radius: 13px; }
  .ambient-metrics span { min-height: 20px; font-size: 8px; }
  .ambient-metrics strong { font-size: 26px; }
  .ambient-freshness { margin-top: 10px; padding-top: 9px; }
  .ambient-freshness-track { height: 6px; margin-top: 5px; }
  .ambient-priority { overflow: hidden; padding: 13px 15px; border-radius: 20px; }
  .ambient-section-head { margin-bottom: 8px; }
  .ambient-section-head h2 { font-size: 19px; }
  .ambient-food-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .ambient-food {
    display: grid;
    min-height: 49px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 6px 8px;
    border-radius: 12px;
  }
  .ambient-food:nth-child(n+5) { display: none; }
  .ambient-food-glyph { width: 34px; height: 34px; border-radius: 9px; font-size: 18px; }
  .ambient-food-copy strong { font-size: 12px; }
  .ambient-food-copy span, .ambient-food-status { font-size: 9px; }
  .ambient-food-actions { gap: 2px; }
  .ambient-food-handle { min-height: 19px; padding: 1px 6px; font-size: 8px; }
  .ambient-details { grid-template-columns: minmax(0, 1.3fr) minmax(150px, .75fr); gap: 8px; }
  .ambient-categories-card { display: none; }
  .ambient-details > section { padding: 10px 13px; border-radius: 15px; }
  .ambient-details .ambient-section-head { margin-bottom: 6px; }
  .ambient-details .ambient-section-head h2 { font-size: 14px; }
  .ambient-category { min-height: 24px; padding: 3px 7px; font-size: 9px; }
  .ambient-activity-list { gap: 3px; }
  .ambient-activity { min-height: 30px; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px; padding: 3px 6px; border-radius: 9px; }
  .ambient-activity:nth-child(n+3) { display: none; }
  .ambient-activity-icon { width: 24px; height: 24px; border-radius: 7px; font-size: 11px; }
  .ambient-activity-copy strong { font-size: 9px; }
  .ambient-activity-copy small { display: none; }
  .ambient-activity time { font-size: 8px; }
  .ambient-next-card strong { margin-top: 4px; font-size: 16px; }
  .ambient-next-card p { margin-top: 3px; font-size: 9px; }
  .ambient-footer { display: none; }
}

@media (orientation: landscape) and (min-width: 600px) and (max-width: 1000px) and (max-height: 420px) {
  .ambient-food:nth-child(n+3) { display: none; }
}
