:root {
  --ink: #13201d;
  --muted: #66736f;
  --line: #e3e8e3;
  --canvas: #f5f7f2;
  --surface: #fff;
  --green: #196849;
  --green-soft: #e5f1e8;
  --red: #c83d36;
  --red-soft: #feece8;
  --yellow: #cf9214;
  --yellow-soft: #fff4d7;
  --shadow: 0 12px 34px rgba(25, 42, 34, .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-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  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; }
.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:focus, select:focus { outline: 2px solid #a6ceb9; border-color: var(--green); }
.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(3, .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); }
.urgent { grid-column: 2 / 5; 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: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px;
}
.food-list-head > div:first-child { display: grid; gap: 6px; }
.food-list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.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: 190px; padding: 0 12px; }
.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; }
.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-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; }
.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: var(--surface); font-size: 26px; line-height: 1;
}
.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; }
.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-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-fieldset {
  margin: 2px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--line); border-radius: 17px;
}
.expiry-fieldset legend { color: var(--ink); font-size: 14px; }
.expiry-mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px;
  border-radius: 13px; background: #eaeee8;
}
.expiry-mode-switch button {
  min-height: 42px; padding: 0 8px; border: 0; border-radius: 9px;
  color: var(--muted); background: transparent; font-size: 13px; font-weight: 720;
}
.expiry-mode-switch button.active { color: var(--green); background: var(--surface); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.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-actions {
  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-actions button { height: var(--control-height-lg); border-radius: var(--control-radius-lg); font-weight: 720; }
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 button { justify-self: start; }
.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; }
  .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: 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: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .food-search { grid-column: 1 / -1; }
  .food-search input, .food-location-filter { 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-manage-toggle { width: 100%; min-width: 60px; padding: 0 10px; }
  .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-fieldset { padding: 14px; }
  .date-presets, .shelf-life-presets { gap: 6px; }
  .date-presets button, .shelf-life-presets button { min-height: 44px; padding-inline: 3px; }
  .food-editor-actions {
    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;
}
.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;
}
.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 1fr; gap: 14px; }
.ai-settings-form .ai-base-url { grid-column: 1 / -1; }
.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-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: 58px; height: 58px; margin: 0; pointer-events: none;
}
.quick-agent > * { pointer-events: auto; }
.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(150px, 1fr) auto auto;
  width: min(390px, calc(100vw - 32px)); max-height: min(62dvh, 560px);
  overflow: hidden; border: 1px solid rgba(218, 226, 219, .96); border-radius: 22px;
  background: rgba(255, 255, 255, .98); box-shadow: 0 22px 58px rgba(19, 32, 29, .22);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.quick-agent-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line);
}
.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: 40px; padding: 0; color: var(--muted); font-size: 25px; font-weight: 400; }
.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; }
.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-disabled { opacity: .58; }

@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 #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; }
}
