:root {
  color-scheme: light;
  --ink: #19332f;
  --muted: #66736f;
  --paper: #fffdf8;
  --canvas: #f3efe6;
  --line: #dcd9cf;
  --teal: #176c61;
  --teal-deep: #173f3a;
  --teal-soft: #dbece7;
  --coral: #df745d;
  --coral-soft: #f8dfd7;
  --yellow: #efc75e;
  --shadow: 0 18px 60px rgba(28, 55, 49, .09);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 6%, rgba(239, 199, 94, .22), transparent 25rem),
    radial-gradient(circle at 94% 30%, rgba(23, 108, 97, .10), transparent 28rem),
    var(--canvas);
  overflow-x: hidden;
}

button, select, input { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  background: var(--teal-deep);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(23, 63, 58, .18);
}

.brand-mark svg { width: 29px; fill: none; stroke: #fffdf8; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1; }
.brand small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.install-button, .copy-button {
  border: 1px solid var(--teal-deep);
  background: var(--teal-deep);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 750;
}

#app { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  padding: 54px 0 42px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 40px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font: 500 clamp(42px, 6vw, 78px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}

.hero h1 em { color: var(--coral); font-weight: 500; }
.hero-copy { margin: 0 0 6px; max-width: 390px; color: var(--muted); font-size: 17px; line-height: 1.65; }

.step-section { margin-bottom: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 13px; }
.section-heading h2, .panel-title h2 { margin: 0; font: 600 25px/1.1 Georgia, "Times New Roman", serif; }
.section-hint { margin: 0; color: var(--muted); font-size: 13px; }

.meal-tab, .option-card, .segmented button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .74);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.meal-tab:hover, .option-card:hover { transform: translateY(-2px); border-color: #aebbb6; }

.meal-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.meal-tab { min-height: 64px; padding: 12px 8px; border-radius: 16px; display: grid; place-items: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 750; }
.meal-tab .meal-icon { font-size: 18px; line-height: 1; filter: grayscale(.2); }
.meal-tab.active { color: white; background: var(--teal-deep); border-color: var(--teal-deep); box-shadow: 0 10px 24px rgba(23, 63, 58, .16); }

.context-bar {
  background: rgba(255, 253, 248, .76);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
}
.context-group { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.context-group > span { font-size: 12px; font-weight: 800; color: var(--muted); }
.segmented { display: inline-flex; background: #ebe8df; padding: 3px; border-radius: 11px; }
.segmented button { border: 0; border-radius: 8px; padding: 7px 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.segmented button.active { background: var(--paper); color: var(--ink); box-shadow: 0 2px 7px rgba(27, 45, 41, .10); }

.planner-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 22px; align-items: start; margin: 32px 0 64px; }
.panel { background: var(--paper); border: 1px solid rgba(218, 215, 205, .9); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 25px 26px 20px; border-bottom: 1px solid #ebe8df; }
.panel-title { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.panel-title > div { min-width: 0; }
.panel-title p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.common-badge { flex: 0 0 auto; border-radius: 999px; padding: 7px 10px; background: var(--coral-soft); color: #8c4436; font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.panel-body { padding: 22px 26px 27px; }

.field-block + .field-block { margin-top: 19px; padding-top: 19px; border-top: 1px solid #eeece5; }
.field-block label { display: block; margin-bottom: 9px; }
.field-block label small { display: block; margin-bottom: 5px; color: var(--teal); font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.field-block label strong { font-size: 15px; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 15px; top: 50%; transform: translateY(-57%); pointer-events: none; color: var(--teal); font-weight: 900; }
select { width: 100%; min-height: 50px; appearance: none; border: 1px solid var(--line); border-radius: 13px; background: #faf8f2; color: var(--ink); padding: 0 44px 0 14px; font-weight: 650; }
select:focus, input:focus, button:focus-visible { outline: 3px solid rgba(23, 108, 97, .22); outline-offset: 2px; }

.option-list { display: grid; gap: 10px; }
.option-card { width: 100%; border-radius: 15px; padding: 15px; text-align: left; display: flex; align-items: center; gap: 12px; }
.radio-dot { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid #a8b2ae; border-radius: 50%; position: relative; }
.option-card.active { border-color: var(--teal); background: #f1f8f5; }
.option-card.active .radio-dot { border-color: var(--teal); }
.option-card.active .radio-dot::after { content: ""; position: absolute; inset: 3px; background: var(--teal); border-radius: 50%; }
.option-card strong { display: block; font-size: 14px; }
.option-card small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }

.micro-note { margin: 17px 0 0; padding: 12px 13px; border-left: 3px solid var(--yellow); background: #fff9e9; color: #6d6248; font-size: 12px; line-height: 1.55; }

.results-panel { position: sticky; top: 14px; }
.results-panel .panel-head { color: white; background: var(--teal-deep); border: 0; }
.results-panel .panel-title p { color: rgba(255,255,255,.7); }
.copy-button { background: transparent; border-color: rgba(255,255,255,.42); padding: 8px 12px; font-size: 12px; }

.person-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.person-card { border-radius: 18px; padding: 17px; border: 1px solid var(--line); }
.person-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.person-card-head h3 { margin: 0; font: 600 20px/1 Georgia, serif; }
.person-card-head span { font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.portion-list { list-style: none; padding: 0; margin: 0; }
.portion-list li { padding: 10px 0; border-top: 1px solid rgba(111, 120, 116, .16); }
.portion-list li:first-child { border: 0; padding-top: 0; }
.portion-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.portion-line strong { font-size: 12px; }
.portion-line b { font-size: 12px; white-space: nowrap; }
.cooked { margin-top: 4px; color: var(--muted); font-size: 10px; }
.item-note { margin-top: 4px; color: #806d51; font-size: 9px; line-height: 1.35; }

.alternatives { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.alternatives h3 { margin: 0 0 11px; font: 600 18px/1 Georgia, serif; }
.alternative-person + .alternative-person { margin-top: 14px; }
.alternative-person > strong { display: block; margin-bottom: 7px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.alt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.alt-chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; background: #faf8f2; color: var(--muted); font-size: 9px; line-height: 1.25; }
.alt-chip b { color: var(--ink); }

.plan-notes { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-notes p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.plan-notes b { color: var(--ink); }

.site-footer { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 calc(30px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(106, 117, 112, .22); display: flex; justify-content: space-between; gap: 30px; color: var(--muted); font-size: 11px; }
.site-footer p { max-width: 520px; margin: 0; line-height: 1.5; }

.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px); background: var(--ink); color: white; border-radius: 999px; padding: 10px 16px; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-state { padding: 20px; border-radius: 14px; background: #fff7e1; color: #705f36; font-size: 13px; line-height: 1.5; }
.empty-state p { margin: 7px 0 14px; }

.view-nav {
  width: fit-content;
  margin: 10px 0 0;
  padding: 4px;
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .72);
}
.view-nav button { border: 0; border-radius: 999px; padding: 9px 14px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.view-nav button.active { background: var(--teal-deep); color: white; box-shadow: 0 5px 14px rgba(23, 63, 58, .16); }
.view-nav button span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: white; font-size: 9px; }

.primary-action, .secondary-action, .text-button, .back-button, .add-ingredient-button, .icon-action {
  border-radius: 12px;
  font-weight: 800;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.primary-action:hover, .secondary-action:hover, .add-ingredient-button:hover { transform: translateY(-1px); }
.primary-action { border: 1px solid var(--teal-deep); background: var(--teal-deep); color: white; padding: 12px 17px; }
.primary-action.small { padding: 9px 13px; font-size: 11px; }
.primary-action:disabled { cursor: not-allowed; opacity: .36; transform: none; }
.secondary-action { border: 1px solid #bfc8c4; background: var(--paper); color: var(--teal-deep); padding: 11px 15px; }
.text-button, .back-button { border: 0; background: transparent; color: var(--teal); padding: 7px 0; }
.icon-action { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border: 1px solid var(--line); background: white; font-size: 20px; }
.icon-action.danger { color: #a45241; }

.management-hero {
  padding: 52px 0 35px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
}
.management-hero h1, .editor-head h1, .custom-hero h1 { margin: 0; font: 500 clamp(39px, 5vw, 65px)/1 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.management-hero h1 em { color: var(--coral); font-weight: 500; }
.management-hero p:not(.eyebrow), .editor-head > div > p:not(.eyebrow), .custom-hero > div > p:not(.eyebrow) { max-width: 650px; margin: 14px 0 0; color: var(--muted); line-height: 1.55; }
.hero-actions { display: flex; gap: 9px; }

.transfer-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 20px;
  border: 1px solid #c7dcd6;
  border-radius: 17px;
  background: var(--teal-soft);
}
.transfer-callout > span { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 12px; background: var(--paper); color: var(--teal); font-size: 20px; }
.transfer-callout strong { font: 600 17px Georgia, serif; }
.transfer-callout p { margin: 4px 0 0; color: #4e6962; font-size: 12px; }
.users-section { margin: 39px 0 70px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.profile-card { padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 12px 38px rgba(28, 55, 49, .06); }
.profile-card-top { display: flex; align-items: center; gap: 12px; }
.profile-avatar { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-soft); color: var(--teal-deep); font: 700 22px Georgia, serif; }
.profile-avatar.large { width: 68px; height: 68px; flex-basis: 68px; font-size: 31px; }
.profile-card h3 { margin: 0; font: 600 20px Georgia, serif; }
.profile-card-top p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.profile-stats span { padding: 10px; border-radius: 11px; background: #f3f0e8; color: var(--muted); font-size: 10px; }
.profile-stats b { display: block; color: var(--teal); font: 700 20px Georgia, serif; }
.profile-goal { min-height: 34px; margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.profile-goal b { color: var(--ink); }
.profile-actions { display: flex; align-items: center; gap: 7px; }
.profile-actions .secondary-action { flex: 1; padding: 9px 10px; font-size: 11px; }
.profile-actions-generic { flex-wrap: wrap; }
.profile-actions-generic .export-action { color: var(--teal); }
.empty-actions { display: flex; gap: 8px; }
.empty-profiles { padding: 58px 24px; display: grid; justify-items: center; text-align: center; border: 1px dashed #bfc8c4; border-radius: 22px; background: rgba(255, 253, 248, .58); }
.empty-profiles > span { font-size: 34px; color: var(--teal); }
.empty-profiles h3 { margin: 10px 0 4px; font: 600 23px Georgia, serif; }
.empty-profiles p { max-width: 460px; margin: 0 0 19px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.editor-head { padding: 38px 0 25px; display: grid; grid-template-columns: 110px 1fr; align-items: start; gap: 20px; }
.editor-head h1 { font-size: clamp(38px, 4vw, 55px); }
.form-errors { margin: 0 0 18px; padding: 16px 20px; border: 1px solid #df9a89; border-radius: 15px; background: #fff1ec; color: #7d3b2e; font-size: 12px; }
.form-errors ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.55; }
.profile-form-panel { margin-bottom: 39px; }
.profile-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.form-field, .category-editor label, .ingredient-editor label, .meal-editor-summary label { min-width: 0; display: block; }
.form-field > span, .category-editor label > span, .ingredient-editor label > span, .meal-editor-summary label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
.form-field input, .form-field select, .form-field textarea, .category-editor input, .category-editor select, .ingredient-editor input, .ingredient-editor select, .meal-editor-summary textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #faf8f2;
  color: var(--ink);
  padding: 9px 11px;
}
textarea { resize: vertical; font: inherit; }
.span-2 { grid-column: span 2; }
.input-suffix { position: relative; }
.input-suffix small { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 10px; }
.input-suffix:has(small) input { padding-right: 42px; }

.diet-editor-section { margin-bottom: 105px; }
.editor-meal-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 17px; }
.editor-meal-tabs .meal-tab { position: relative; }
.editor-meal-tabs .meal-tab b { position: absolute; top: 6px; right: 7px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 999px; background: var(--coral); color: white; font-size: 8px; }
.meal-editor-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 17px; align-items: start; }
.meal-editor-summary { position: sticky; top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.meal-editor-summary h3 { margin: 0; font: 600 22px Georgia, serif; }
.meal-editor-summary > p:not(.eyebrow) { margin: 6px 0 20px; color: var(--muted); font-size: 11px; }
.meal-editor-summary textarea { min-height: 115px; }
.category-editor-list { display: grid; gap: 13px; }
.category-editor { border: 1px solid var(--line); border-radius: 19px; background: var(--paper); overflow: hidden; }
.category-editor-head { padding: 15px 17px; display: flex; align-items: end; gap: 11px; background: #f7f4ed; border-bottom: 1px solid var(--line); }
.category-title-fields { flex: 1; display: grid; grid-template-columns: 1fr 210px; gap: 11px; }
.ingredient-editor-list { padding: 14px 17px 0; display: grid; gap: 9px; }
.ingredient-editor { padding: 12px; display: grid; grid-template-columns: minmax(150px, 1.4fr) minmax(105px, .7fr) 100px minmax(105px, .7fr) minmax(170px, 1.2fr) 36px; gap: 8px; align-items: end; border: 1px solid #e8e4da; border-radius: 13px; background: #fdfbf6; }
.ingredient-editor input, .ingredient-editor select { min-height: 40px; padding: 7px 9px; }
.add-ingredient-button { width: calc(100% - 34px); margin: 12px 17px 16px; padding: 10px; border: 1px dashed #9eb3ac; background: #f2f8f6; color: var(--teal); }
.no-ingredients { margin: 3px 0 0; padding: 12px; border-radius: 10px; background: #f7f4ed; color: var(--muted); font-size: 11px; }
.empty-meal { padding: 40px 24px; text-align: center; border: 1px dashed #bfc8c4; border-radius: 18px; background: rgba(255, 253, 248, .55); }
.empty-meal h3 { margin: 0; font: 600 20px Georgia, serif; }
.empty-meal p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.add-category-row { padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 253, 248, .65); }
.add-category-row select { min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); padding: 0 12px; }
.editor-savebar { position: fixed; z-index: 6; left: 50%; bottom: 15px; transform: translateX(-50%); width: min(860px, calc(100% - 26px)); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 13px 11px 17px; border: 1px solid rgba(255,255,255,.25); border-radius: 17px; background: rgba(23, 63, 58, .96); color: white; box-shadow: 0 16px 50px rgba(22, 45, 40, .3); backdrop-filter: blur(12px); }
.editor-savebar > div { display: flex; align-items: center; gap: 9px; }
.editor-savebar span { color: rgba(255,255,255,.65); font-size: 10px; }

.custom-hero { padding: 39px 0 28px; display: grid; grid-template-columns: auto 1fr auto; gap: 17px; align-items: center; }
.planner-back { margin-top: 27px; }
.custom-hero h1 { font-size: clamp(38px, 4vw, 56px); }
.custom-planner-grid { margin-top: 18px; }
.required-items { display: flex; flex-wrap: wrap; gap: 7px; }
.required-items span { padding: 8px 10px; border-radius: 10px; background: #eef5f2; color: var(--muted); font-size: 10px; }
.required-items b { color: var(--ink); }
.generic-profile-result { background: #f4faf8; border-color: #cfe1dc; }
.item-category { margin-top: 4px; color: var(--teal); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 18px; padding-top: 36px; }
  .hero-copy { max-width: 680px; }
  .planner-grid { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meal-editor-layout { grid-template-columns: 1fr; }
  .meal-editor-summary { position: static; }
  .ingredient-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ingredient-editor .icon-action { align-self: end; }
}

@media (max-width: 640px) {
  .site-header, #app, .site-footer { width: min(100% - 22px, 1180px); }
  .site-header { min-height: 70px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .brand strong { font-size: 19px; }
  .install-button { padding: 8px 12px; font-size: 11px; }
  .hero { padding: 31px 3px 31px; }
  .hero h1 { font-size: clamp(38px, 10.8vw, 48px); overflow-wrap: anywhere; }
  .hero h1 em { display: block; }
  .hero-copy { font-size: 15px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .meal-tabs { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 4px; scrollbar-width: none; }
  .meal-tabs::-webkit-scrollbar { display: none; }
  .meal-tab { min-width: 96px; min-height: 58px; }
  .context-bar { align-items: stretch; gap: 12px; }
  .context-group { width: 100%; min-width: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr); justify-content: initial; }
  .segmented { min-width: 0; width: 100%; }
  .segmented button { min-width: 0; flex: 1; padding: 7px 5px; white-space: normal; line-height: 1.2; font-size: 10px; }
  .planner-grid { margin-top: 23px; gap: 15px; }
  .panel-head, .panel-body { padding-left: 18px; padding-right: 18px; }
  .panel-title { align-items: start; flex-wrap: wrap; }
  .common-badge { order: 2; }
  .person-results { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; gap: 10px; }
  .view-nav { width: 100%; }
  .view-nav button { flex: 1; min-width: 0; padding: 9px 7px; font-size: 10px; }
  .management-hero { padding-top: 35px; align-items: stretch; flex-direction: column; }
  .management-hero h1 { font-size: 43px; }
  .management-hero .primary-action { width: 100%; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .primary-action { width: auto; }
  .transfer-callout { align-items: flex-start; }
  .empty-actions { width: 100%; flex-direction: column; }
  .empty-actions button { width: 100%; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .editor-head { grid-template-columns: 1fr; gap: 8px; padding-top: 28px; }
  .editor-head h1 { font-size: 40px; }
  .category-title-fields { grid-template-columns: 1fr; }
  .ingredient-editor { grid-template-columns: 1fr 1fr; }
  .ingredient-name, .ingredient-notes { grid-column: 1 / -1; }
  .ingredient-editor .icon-action { grid-column: 2; justify-self: end; }
  .add-category-row { grid-template-columns: 1fr; }
  .editor-savebar { align-items: stretch; flex-direction: column; bottom: 8px; }
  .editor-savebar > div { justify-content: space-between; }
  .editor-savebar > div:last-child button { flex: 1; }
  .custom-hero { grid-template-columns: auto 1fr; }
  .custom-hero .secondary-action { grid-column: 1 / -1; }
}

@media (display-mode: standalone) {
  .site-header { padding-top: env(safe-area-inset-top); }
}

@media print {
  body { background: white; }
  .site-header, .hero, .step-section, .controls-panel, .copy-button, .site-footer { display: none !important; }
  #app { width: 100%; }
  .planner-grid { display: block; margin: 0; }
  .results-panel { box-shadow: none; border: 0; }
}

/* Dashboard ComboDiet */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 100vh;
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  background: #153d38;
  color: white;
  box-shadow: 12px 0 45px rgba(21, 61, 56, .12);
}
.sidebar-brand { padding: 0 7px 23px; color: white; border-bottom: 1px solid rgba(255,255,255,.11); }
.sidebar-brand .brand-mark { background: var(--yellow); box-shadow: none; }
.sidebar-brand .brand-mark svg { stroke: var(--teal-deep); }
.sidebar-brand small { color: rgba(255,255,255,.55); }
.sidebar-nav { margin-top: 20px; display: grid; gap: 5px; }
.sidebar-nav p { margin: 17px 11px 4px; color: rgba(255,255,255,.38); font-size: 9px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.sidebar-nav p:first-child { margin-top: 0; }
.sidebar-nav button { width: 100%; padding: 10px 11px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.68); text-align: left; }
.sidebar-nav button span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.07); font-size: 15px; }
.sidebar-nav button b { font-size: 12px; }
.sidebar-nav button:hover { color: white; background: rgba(255,255,255,.06); }
.sidebar-nav button.active { color: var(--teal-deep); background: var(--yellow); box-shadow: 0 9px 20px rgba(0,0,0,.13); }
.sidebar-nav button.active span { background: rgba(23,63,58,.1); }
.sidebar-foot { margin-top: auto; padding: 16px 7px 0; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar-foot .install-button { width: 100%; border-color: var(--yellow); background: var(--yellow); color: var(--teal-deep); }
.sidebar-foot p { margin: 11px 2px 0; color: rgba(255,255,255,.42); font-size: 9px; line-height: 1.5; }
.sidebar-backdrop { display: none; }
.main-column { min-width: 0; }
.mobile-header { display: none; }
#app { width: min(1120px, calc(100% - 50px)); min-height: calc(100vh - 90px); }
.site-footer { width: min(1120px, calc(100% - 50px)); }

.dashboard-hero, .page-hero {
  padding: 44px 0 34px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 28px;
}
.dashboard-hero h1, .page-hero h1 { margin: 0; font: 500 clamp(38px, 4.8vw, 66px)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.dashboard-hero h1 em { color: var(--coral); font-weight: 500; }
.dashboard-hero p:not(.eyebrow), .page-hero p:not(.eyebrow) { max-width: 680px; margin: 14px 0 0; color: var(--muted); line-height: 1.55; }
.page-hero h1 { font-size: clamp(38px, 4vw, 56px); }
.home-picker { margin-bottom: 28px; }
.entity-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.entity-card { min-width: 238px; padding: 12px; display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,248,.76); text-align: left; transition: transform .16s, border-color .16s, background .16s; }
.entity-card:hover { transform: translateY(-2px); border-color: #9db2ab; }
.entity-card > span:nth-child(2) { min-width: 0; }
.entity-card strong, .entity-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-card strong { font-size: 12px; }
.entity-card small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.entity-card > b { align-self: start; color: var(--muted); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.entity-card.active { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 10px 28px rgba(23,108,97,.1); }
.entity-card.active > b { color: var(--teal); }
.entity-card:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.entity-card .profile-avatar { width: 43px; height: 43px; flex-basis: 43px; font-size: 17px; }
.group-avatar { background: var(--coral-soft); color: #914737; }
.add-entity { min-width: 150px; grid-template-columns: 33px 1fr; border-style: dashed; color: var(--teal); }
.add-entity > span { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; background: var(--teal-soft); font-size: 18px; }
.compact-empty { padding: 30px; }
.home-empty { margin: 20px 0 70px; padding: 45px; text-align: center; }
.home-empty h2 { margin: 0; font: 600 28px Georgia, serif; }
.home-empty p { color: var(--muted); }
.home-planner-grid { margin-top: 22px; }
.result-eyebrow { color: var(--yellow) !important; }
.common-intro { margin-bottom: 20px; padding: 13px; display: flex; align-items: center; gap: 11px; border-radius: 13px; background: var(--teal-soft); color: #42675f; font-size: 11px; line-height: 1.45; }
.common-intro > span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: white; }
.common-intro p { margin: 0; }
.result-section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 10px; }
.result-section-title span { font: 600 18px Georgia, serif; }
.result-section-title b { padding: 5px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.batch-card { margin-bottom: 12px; padding: 16px; border: 1px solid #cbded8; border-radius: 17px; background: #f1f8f5; }
.batch-card-head { display: flex; justify-content: space-between; gap: 12px; }
.batch-card-head small { color: var(--teal); font-size: 8px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.batch-card-head h3 { margin: 4px 0 0; font: 600 19px Georgia, serif; }
.batch-total { text-align: right; color: var(--muted); font-size: 9px; }
.batch-total b { display: block; color: var(--teal-deep); font: 700 21px Georgia, serif; }
.batch-portions { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.batch-portions span { padding: 8px; border-radius: 9px; background: rgba(255,255,255,.72); color: var(--muted); font-size: 9px; }
.batch-portions b { display: block; margin-bottom: 2px; color: var(--ink); }
.batch-summary { margin-top: 10px; padding: 10px 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #d1e2dd; border-bottom: 1px solid #d1e2dd; }
.batch-summary span + span { padding-left: 12px; border-left: 1px solid #d1e2dd; }
.batch-summary small, .batch-summary b { display: block; }
.batch-summary small { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.batch-summary b { margin-top: 2px; font-size: 12px; }
.actual-weight { margin-top: 12px; display: grid; grid-template-columns: 1fr 145px; align-items: center; gap: 12px; }
.actual-weight > span { font-size: 10px; font-weight: 750; }
.actual-weight > div { position: relative; }
.actual-weight input { width: 100%; min-height: 40px; padding: 8px 35px 8px 10px; border: 1px solid #a8c6bd; border-radius: 10px; background: white; }
.actual-weight small { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.allocation { margin-top: 10px; padding: 11px; border-radius: 10px; background: var(--teal-deep); color: white; }
.allocation > p { margin: 0; color: rgba(255,255,255,.65); font-size: 9px; line-height: 1.45; }
.allocation > strong { display: block; margin-bottom: 8px; font-size: 10px; }
.allocation > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.allocation span { display: flex; justify-content: space-between; gap: 6px; padding: 7px; border-radius: 7px; background: rgba(255,255,255,.09); font-size: 9px; }
.individual-section { margin-top: 22px; }
.individual-section .person-results { margin-top: 0; }
.individual-section .person-card { padding: 13px; }

.warning-callout { border-color: #e6cea0; background: #fff6dc; }
.warning-callout > span { color: #8b6723; }
.member-chips { margin: 17px 0 13px; display: flex; flex-wrap: wrap; gap: 5px; }
.member-chips span { padding: 6px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-size: 9px; }
.group-form { margin-bottom: 100px; }
.group-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.member-heading { margin-top: 32px; }
.member-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.member-option { padding: 12px; display: grid; grid-template-columns: 43px minmax(0, 1fr) 22px; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 15px; background: #faf8f2; cursor: pointer; }
.member-option input { position: absolute; opacity: 0; pointer-events: none; }
.member-option span:nth-of-type(2) { min-width: 0; }
.member-option strong, .member-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-option strong { font-size: 11px; }
.member-option small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.member-option > b { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: transparent; }
.member-option.selected { border-color: var(--teal); background: var(--teal-soft); }
.member-option.selected > b { border-color: var(--teal); background: var(--teal); color: white; }

.admin-grid { margin: 10px 0 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.admin-card { padding: 27px; }
.admin-icon { width: 48px; height: 48px; margin-bottom: 22px; display: grid; place-items: center; border-radius: 14px; background: var(--teal-soft); color: var(--teal); font-size: 22px; }
.admin-card h2 { margin: 0; font: 600 27px Georgia, serif; }
.admin-card > p:not(.eyebrow) { min-height: 57px; margin: 9px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.admin-card .form-field { margin-bottom: 12px; }
.admin-card .primary-action, .admin-card .secondary-action { width: 100%; margin-top: 8px; }
.admin-card > small { display: block; margin-top: 13px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.featured-admin { border-color: #b8d4cc; background: linear-gradient(145deg, #fffdf8, #eef7f4); }
.danger-admin { border-color: #e4c6bf; }
.danger-admin .admin-icon { background: var(--coral-soft); color: #9c4d3c; }

.help-hero { padding-bottom: 28px; }
.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.help-card { min-height: 185px; padding: 21px; display: grid; grid-template-columns: 37px 1fr; gap: 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.help-card > span { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--teal-soft); color: var(--teal); font-size: 10px; font-weight: 900; }
.help-card h2 { margin: 5px 0 9px; font: 600 20px Georgia, serif; }
.help-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.help-note { margin: 22px 0 65px; padding: 26px; display: flex; align-items: center; justify-content: space-between; gap: 25px; border-radius: 20px; background: var(--teal-deep); color: white; }
.help-note h2 { margin: 0; font: 600 25px Georgia, serif; }
.help-note p:not(.eyebrow) { max-width: 670px; margin: 8px 0 0; color: rgba(255,255,255,.65); font-size: 11px; line-height: 1.55; }
.help-note .eyebrow { color: var(--yellow); }
.help-note .primary-action { flex: 0 0 auto; border-color: var(--yellow); background: var(--yellow); color: var(--teal-deep); }

.editor-savebar { left: calc(50% + 126px); }
.toast { z-index: 40; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .editor-savebar { left: calc(50% + 110px); }
  .profile-grid, .member-selector, .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(286px, 84vw); padding-top: calc(20px + env(safe-area-inset-top)); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 19; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(10,32,29,.46); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .mobile-header { position: sticky; z-index: 12; top: 0; min-height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; display: grid; grid-template-columns: 40px 1fr 38px; align-items: center; gap: 10px; border-bottom: 1px solid rgba(220,217,207,.8); background: rgba(243,239,230,.92); backdrop-filter: blur(15px); }
  .mobile-header > div { text-align: center; }
  .mobile-header strong, .mobile-header small { display: block; }
  .mobile-header strong { font: 600 16px Georgia, serif; }
  .mobile-header small { margin-top: 2px; color: var(--muted); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }
  .menu-toggle { width: 40px; height: 40px; padding: 10px; display: grid; align-content: center; gap: 4px; border: 0; border-radius: 11px; background: var(--teal-deep); }
  .menu-toggle span { height: 2px; border-radius: 2px; background: white; }
  .mobile-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--yellow); color: var(--teal-deep); font: 800 10px Georgia, serif; }
  #app, .site-footer { width: min(100% - 24px, 1120px); }
  .dashboard-hero, .page-hero { padding-top: 32px; align-items: stretch; flex-direction: column; gap: 16px; }
  .dashboard-hero h1, .page-hero h1 { font-size: 42px; }
  .dashboard-hero .secondary-action, .page-hero .primary-action { width: 100%; }
  .entity-card { min-width: 218px; }
  .editor-savebar { left: 50%; }
  .admin-grid { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .help-card { min-height: 0; }
  .help-note { align-items: stretch; flex-direction: column; }
}

@media (max-width: 640px) {
  .profile-grid, .member-selector, .group-fields { grid-template-columns: 1fr; }
  .home-planner-grid { margin-top: 17px; }
  .batch-portions, .allocation > div { grid-template-columns: 1fr; }
  .actual-weight { grid-template-columns: 1fr; }
  .person-results { grid-template-columns: 1fr; }
  .page-hero h1, .dashboard-hero h1 { font-size: 39px; }
}

@media print {
  .sidebar, .mobile-header, .sidebar-backdrop { display: none !important; }
  .app-shell { display: block; }
  #app { width: 100%; }
}
