* {
  box-sizing: border-box;
}

/* Photo memories stay inline: one name, a short question, optional examples. */
.dish-memory-section > details > summary,
.photo-dish-picker > summary {
  min-height: 44px;
  align-content: center;
  cursor: pointer;
  font-weight: 650;
}

.dish-memory-hint,
.dish-memory-status,
.dish-memory-copy p,
.dish-memory-copy small,
.dish-memory-form small {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.dish-memory-status:empty { display: none; }
.dish-memory-status.is-error { color: var(--danger); }
.dish-memory-list { display: grid; gap: 0.8rem; margin: 0.8rem 0; }
.dish-memory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface-soft);
  min-width: 0;
}
.dish-memory-card p { margin: 0.25rem 0 0; }
.dish-memory-copy { overflow-wrap: anywhere; }
.dish-memory-photos { display: flex; gap: 0.4rem; overflow-x: auto; }
.dish-memory-photos img {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--surface-muted);
  font-size: 0.65rem;
}
.dish-memory-form,
.photo-dish-answer { display: grid; gap: 0.6rem; }
.dish-memory-form { max-width: 36rem; padding-top: 0.75rem; }
.dish-memory-form label { font-size: 0.9rem; font-weight: 600; }
.dish-memory-form input,
.dish-memory-form textarea,
.photo-dish-answer input { width: 100%; min-width: 0; font-size: 1rem; }
.dish-memory-description summary { min-height: 44px; align-content: center; cursor: pointer; }
.dish-memory-description label { display: block; margin: 0.4rem 0; }
.photo-dish-prompt {
  margin-top: 0.8rem;
  padding: 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface);
  min-width: 0;
}
.photo-dish-prompt .photo-dish-question { margin: 0 0 0.7rem; font-weight: 650; }
.photo-dish-actions,
.photo-dish-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.photo-dish-choices { margin-top: 0.6rem; }
.photo-dish-actions button,
.photo-dish-choices button,
.dish-memory-section button,
.dish-memory-section input,
.photo-dish-answer input { min-height: 44px; }
.photo-dish-actions button,
.photo-dish-choices button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.photo-dish-example-option {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-height: 44px;
  margin: 0.5rem 0;
  font-size: 0.82rem;
}
.photo-dish-example-option input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; }
.photo-dish-prompt.is-done { color: var(--muted); font-size: 0.85rem; }
.photo-dish-picker { font-size: 0.82rem; margin: 0 0 0.6rem; }
.photo-dish-picker .photo-dish-choices { max-height: 170px; overflow-y: auto; }
.photo-dish-prompt button:disabled,
.dish-memory-section button:disabled { opacity: 0.6; cursor: wait; }

@media (min-width: 900px) {
  .dish-memory-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-accent: #e7e9ec;
  --surface: #fffcf7;
  --surface-strong: #ffffff;
  --surface-soft: #faf7f1;
  --surface-muted: #ede7dd;
  --surface-glass: rgba(255, 252, 247, 0.96);
  --workspace: #fffcf7;
  --canvas: #efebe4;
  --border: #81796d;
  --border-subtle: rgba(34, 43, 58, 0.1);
  --border-soft: #81796d;
  --border-accent: #5f6b75;
  --text: #222b3a;
  --heading: #151c28;
  --muted: #625f5a;
  --muted-soft: #686762;
  --primary: #254e70;
  --primary-strong: #254e70;
  --primary-hover: #204461;
  --primary-soft: #e0e6ec;
  --primary-tint: rgba(37, 78, 112, 0.1);
  --meal-eaten-surface: #e9ecec;
  --meal-eaten-text: #222b3a;
  --meal-eaten-muted: #53565a;
  --meal-eaten-action: #254e70;
  --meal-eaten-danger: #8a2b17;
  --meal-eaten-border: #587262;
  --chart-primary: #254e70;
  --chart-secondary: #23394d;
  --on-primary: #ffffff;
  --secondary: #204461;
  --chat-user: #e2e7ec;
  --chat-agent: #f4f1ec;
  --success: #1f533a;
  --success-action: #277052;
  --success-soft: #dfeedd;
  --success-border: #a9cdb9;
  --warning: #7a5137;
  --warning-soft: #fff1c7;
  --warning-border: #e0bd86;
  --danger: #8a2b17;
  --danger-action: #a93f35;
  --danger-soft: #f1d8cf;
  --danger-border: #ddb1a5;
  --progress-track: #e7ece9;
  --progress-planned: #a9bac8;
  --progress-eaten: #254e70;
  --risk-good: #6fa876;
  --risk-watch: #d69b42;
  --risk-reduce: #bf614f;
  --nutrition-day: #f2c94c;
  --nutrition-low: #b85f35;
  --status-success-tint: rgba(36, 102, 73, 0.08);
  --status-success-tint-soft: rgba(36, 102, 73, 0.06);
  --status-danger-tint: rgba(168, 55, 36, 0.08);
  --status-warning-tint: rgba(183, 135, 44, 0.1);
  --focus-ring: #254e70;
  --handle: #d0c8bc;
  --overlay: rgba(34, 29, 21, 0.45);
  --overlay-control: rgba(48, 40, 31, 0.82);
  --overlay-control-border: rgba(255, 250, 243, 0.45);
  --sidebar: #232f44;
  --sidebar-active: #244760;
  --sidebar-active-text: #ffffff;
  --sidebar-text: #ffffff;
  --sidebar-muted: #b9c0ca;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-submenu: rgba(174, 198, 186, 0.24);
  --sidebar-control-border: rgba(255, 255, 255, 0.16);
  --sidebar-control-border-hover: rgba(255, 255, 255, 0.32);
  --body-accent: rgba(37, 78, 112, 0.13);
  --body-gradient-end: #eeeae4;
  --auth-primary-glow: rgba(37, 78, 112, 0.16);
  --auth-secondary-glow: rgba(37, 78, 112, 0.08);
  --auth-gradient-mid: #faf7f1;
  --auth-field-line: #6c6b6b;
  --auth-section-line: rgba(34, 43, 58, 0.12);
  --shadow: 0 18px 50px rgba(88, 61, 29, 0.08);
  --shadow-soft: 0 8px 22px rgba(42, 36, 29, 0.06);
  --shadow-raised: 0 16px 36px rgba(24, 31, 27, 0.2);
  --shadow-launcher: 0 12px 28px rgba(24, 60, 44, 0.24);
  --shadow-sheet: 0 -14px 44px rgba(20, 28, 23, 0.22);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081426;
  --bg-accent: #0e293f;
  --surface: #101f35;
  --surface-strong: #18273c;
  --surface-soft: #0c1a2d;
  --surface-muted: #1e3149;
  --surface-glass: rgba(16, 31, 53, 0.96);
  --workspace: #101f35;
  --canvas: #101b2d;
  --border: #566e8e;
  --border-subtle: rgba(237, 244, 255, 0.14);
  --border-soft: #566e8e;
  --border-accent: #4b83a8;
  --text: #edf4ff;
  --heading: #f7faff;
  --muted: #aabad0;
  --muted-soft: #a4b2c5;
  --primary: #38bdf8;
  --primary-strong: #38bdf8;
  --primary-hover: #48c2f9;
  --primary-soft: #1a465e;
  --primary-tint: rgba(56, 189, 248, 0.16);
  --meal-eaten-surface: #1a3e5a;
  --meal-eaten-text: #edf4ff;
  --meal-eaten-muted: #c1ccda;
  --meal-eaten-action: #58c7f8;
  --meal-eaten-danger: #f0a08e;
  --meal-eaten-border: #6ca37e;
  --chart-primary: #38bdf8;
  --chart-secondary: #8ecbe6;
  --on-primary: #07121f;
  --secondary: #48c2f9;
  --chat-user: #193e58;
  --chat-agent: #222f42;
  --success: #8bd0a5;
  --success-action: #2d7153;
  --success-soft: #203b2d;
  --success-border: #3f7658;
  --warning: #e2bd82;
  --warning-soft: #44371f;
  --warning-border: #8e6a2e;
  --danger: #f0a08e;
  --danger-action: #a84738;
  --danger-soft: #472a25;
  --danger-border: #9e4f46;
  --progress-track: #111b17;
  --progress-planned: #216583;
  --progress-eaten: #38bdf8;
  --risk-good: #78bd85;
  --risk-watch: #e0aa55;
  --risk-reduce: #d97968;
  --nutrition-day: #dec050;
  --nutrition-low: #d37852;
  --status-success-tint: rgba(91, 175, 127, 0.14);
  --status-success-tint-soft: rgba(91, 175, 127, 0.1);
  --status-danger-tint: rgba(224, 112, 91, 0.14);
  --status-warning-tint: rgba(217, 166, 72, 0.14);
  --focus-ring: #38bdf8;
  --handle: #62736b;
  --overlay: rgba(2, 8, 5, 0.72);
  --overlay-control: rgba(3, 9, 6, 0.86);
  --overlay-control-border: rgba(239, 246, 242, 0.4);
  --sidebar: #06101e;
  --sidebar-active: #17465f;
  --sidebar-active-text: #ffffff;
  --sidebar-text: #edf4ff;
  --sidebar-muted: #a3b0c3;
  --sidebar-border: rgba(255, 255, 255, 0.1);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-submenu: rgba(174, 198, 186, 0.3);
  --sidebar-control-border: rgba(255, 255, 255, 0.2);
  --sidebar-control-border-hover: rgba(255, 255, 255, 0.38);
  --body-accent: rgba(56, 189, 248, 0.14);
  --body-gradient-end: #0b1a30;
  --auth-primary-glow: rgba(56, 189, 248, 0.18);
  --auth-secondary-glow: rgba(56, 189, 248, 0.1);
  --auth-gradient-mid: #0c1b30;
  --auth-field-line: #657b99;
  --auth-section-line: rgba(237, 244, 255, 0.17);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.22);
  --shadow-raised: 0 16px 36px rgba(0, 0, 0, 0.42);
  --shadow-launcher: 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-sheet: 0 -14px 44px rgba(0, 0, 0, 0.48);
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, var(--body-accent), transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--body-gradient-end) 100%);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  gap: 1.25rem;
}

.page-header h1 {
  margin-bottom: 0.35rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.page-header-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: space-between;
}

.page-header-text {
  flex: 1 1 16rem;
  min-width: 0;
}

.user-bar-card {
  flex: 0 1 auto;
  min-width: 12rem;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.user-bar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.auth-user-email {
  font-size: 0.95rem;
  word-break: break-all;
}

.user-plan-date {
  display: grid;
  gap: 0.3rem;
  width: 100%;
  margin-top: 0.2rem;
}

.user-plan-date label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.user-plan-date-controls {
  display: grid;
  grid-template-columns: 2rem minmax(8.2rem, 1fr) 2rem auto;
  gap: 0.35rem;
  align-items: center;
  width: 100%;
}

.user-plan-date-controls input[type="date"] {
  width: 100%;
  min-width: 0;
}

.user-plan-date-controls .ghost-button {
  min-height: 2.15rem;
  padding: 0.42rem 0.55rem;
}

.auth-gate {
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(1.25rem, 5vw, 3rem);
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 65% 75% at 10% 5%, var(--auth-primary-glow), transparent 70%),
    radial-gradient(circle at 95% 95%, var(--auth-secondary-glow), transparent 42%),
    linear-gradient(145deg, var(--bg) 0%, var(--auth-gradient-mid) 58%, var(--bg-accent) 100%);
}

.auth-gate.hidden {
  display: none;
}

.auth-gate-inner {
  width: min(100%, 28rem);
  min-width: 0;
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

.auth-brand {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--heading);
}

.auth-brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
}

.auth-brand strong {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.auth-login {
  min-width: 0;
  width: 100%;
  padding: clamp(1.5rem, 5vw, 2rem);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  background: var(--surface-glass);
  box-shadow: var(--shadow);
}

.auth-login h1 {
  margin: 0 0 1.5rem;
  color: var(--heading);
  font-size: clamp(1.65rem, 5vw, 2rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
  text-align: center;
}

.theme-settings-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-settings-fieldset legend {
  margin-bottom: 0.65rem;
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 800;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
}

.theme-option {
  position: relative;
  min-width: 0;
  min-height: 9rem;
  padding: 1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 0.8rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.theme-option:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.theme-option:focus-within {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

.theme-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.theme-option input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.15rem 0 0;
  padding: 0;
  accent-color: var(--primary);
}

.theme-option-copy {
  grid-column: 1 / -1;
}

.theme-option-copy strong,
.theme-option-copy small {
  display: block;
}

.theme-option-copy strong {
  color: var(--heading);
  font-size: 0.95rem;
}

.theme-option-copy small {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
}

.theme-option-preview {
  --theme-preview-bg: #f4efe6;
  --theme-preview-surface: #fffcf7;
  --theme-preview-accent: #254e70;
  width: 4.2rem;
  height: 3rem;
  justify-self: end;
  display: grid;
  grid-template-columns: 0.9rem minmax(0, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.24rem;
  padding: 0.3rem;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--theme-preview-bg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.theme-option-preview > span:first-child {
  grid-row: 1 / -1;
  border-radius: 4px;
  background: var(--theme-preview-accent);
}

.theme-option-preview > span:nth-child(2) {
  border-radius: 4px;
  background: var(--theme-preview-surface);
}

.theme-option-preview > span:last-child {
  width: 68%;
  border-radius: 999px;
  background: var(--theme-preview-accent);
}

.theme-option-preview-system {
  --theme-preview-bg: linear-gradient(90deg, #f4efe6 0 50%, #081426 50% 100%);
  --theme-preview-surface: linear-gradient(90deg, #fffcf7 0 50%, #101f35 50% 100%);
  --theme-preview-accent: linear-gradient(90deg, #254e70 0 50%, #38bdf8 50% 100%);
}

.theme-option-preview-sand {
  --theme-preview-bg: #f4efe6;
  --theme-preview-surface: #fffcf7;
  --theme-preview-accent: #254e70;
}

.theme-option-preview-blue {
  --theme-preview-bg: #f3f7fc;
  --theme-preview-surface: #ffffff;
  --theme-preview-accent: #1d4ed8;
}

.theme-option-preview-berry {
  --theme-preview-bg: #fff6ed;
  --theme-preview-surface: #fffcf8;
  --theme-preview-accent: #8a275d;
}

.theme-option-preview-graphite {
  --theme-preview-bg: #17191d;
  --theme-preview-surface: #202329;
  --theme-preview-accent: #a78bfa;
}

.theme-option-preview-midnight {
  --theme-preview-bg: #081426;
  --theme-preview-surface: #101f35;
  --theme-preview-accent: #38bdf8;
}

.theme-preference-status {
  min-height: 1.25rem;
  margin: -0.25rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.custom-theme-editor {
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.custom-theme-editor.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.custom-theme-editor.has-unsaved-changes {
  border-style: dashed;
}

.custom-theme-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.custom-theme-heading .eyebrow {
  margin-bottom: 0.25rem;
}

.custom-theme-heading h3 {
  margin: 0;
  color: var(--heading);
  font-size: 1.1rem;
}

.custom-theme-heading p:last-child {
  max-width: 42rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.custom-theme-active-badge {
  flex: 0 0 auto;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.72rem;
  font-weight: 800;
}

.custom-theme-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(15rem, 0.95fr);
  gap: 1rem;
  align-items: stretch;
}

.custom-theme-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.custom-theme-color-field {
  min-width: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-strong);
}

.custom-theme-color-field label {
  color: var(--heading);
  font-size: 0.8rem;
  font-weight: 800;
}

.custom-theme-color-field small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.custom-theme-color-inputs {
  min-width: 0;
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.custom-theme-color-inputs input[type="color"] {
  width: 2.8rem;
  height: 2.8rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.custom-theme-color-inputs input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-theme-color-inputs input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.custom-theme-color-inputs input[type="text"] {
  width: 100%;
  min-width: 0;
  min-height: 2.8rem;
  font: 700 1rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.custom-theme-color-inputs input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}

.custom-theme-preview {
  --custom-preview-bg: #f4efe6;
  --custom-preview-text: #222b3a;
  --custom-preview-accent: #254e70;
  --custom-preview-border: #81796d;
  --custom-preview-surface: #fffcf7;
  --custom-preview-sidebar: #232f44;
  --custom-preview-on-accent: #ffffff;
  min-height: 13rem;
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--custom-preview-border);
  border-radius: 14px;
  background: var(--custom-preview-bg);
  color: var(--custom-preview-text);
}

.custom-theme-preview-sidebar {
  padding: 0.7rem 0.55rem;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  background: var(--custom-preview-sidebar);
}

.custom-theme-preview-sidebar span {
  height: 0.36rem;
  border-radius: 999px;
  background: var(--custom-preview-accent);
}

.custom-theme-preview-sidebar span:not(:first-child) {
  background: var(--custom-preview-bg);
  opacity: 0.58;
}

.custom-theme-preview-main {
  min-width: 0;
  padding: 0.75rem;
}

.custom-theme-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--custom-preview-text);
  font-size: 0.78rem;
}

.custom-theme-preview-top span {
  width: 2.2rem;
  height: 0.42rem;
  border-radius: 999px;
  background: var(--custom-preview-accent);
}

.custom-theme-preview-card {
  margin-top: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--custom-preview-border);
  border-radius: 10px;
  background: var(--custom-preview-surface);
  color: var(--custom-preview-text);
}

.custom-theme-preview-card strong {
  font-size: 0.76rem;
}

.custom-theme-preview-card p {
  margin: 0.35rem 0 0.75rem;
  color: inherit;
  font-size: 0.66rem;
  line-height: 1.45;
  opacity: 0.8;
}

.custom-theme-preview-action {
  width: fit-content;
  min-height: 1.85rem;
  padding: 0.35rem 0.65rem;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: var(--custom-preview-accent);
  color: var(--custom-preview-on-accent);
  font-size: 0.68rem;
}

.custom-theme-contrast,
.custom-theme-message {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.custom-theme-contrast {
  color: var(--muted);
}

.custom-theme-contrast.is-valid {
  color: var(--success);
}

.custom-theme-contrast.is-error,
.custom-theme-message.is-error {
  color: var(--danger);
}

.custom-theme-message {
  color: var(--primary-strong);
}

.custom-theme-actions {
  padding-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  border-top: 1px solid var(--border-soft);
}

.custom-theme-actions button {
  min-height: 2.65rem;
  font-weight: 750;
}

.custom-theme-actions .theme-editor-secondary {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
}

.custom-theme-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.auth-password-block {
  margin: 0;
}

.auth-password-content {
  margin: 0;
  padding: 0;
  border: 0;
}

.auth-form,
.auth-reset-form {
  display: grid;
  gap: 1.25rem;
}

.auth-form .field,
.auth-reset-form .field {
  margin: 0;
}

.auth-form label,
.auth-reset-form label {
  display: block;
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-form input,
.auth-reset-form input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0;
  border: 0;
  border-bottom: 1px solid var(--auth-field-line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.auth-form input:focus,
.auth-reset-form input:focus {
  border-bottom-color: var(--primary-strong);
}

.auth-actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.auth-actions .auth-primary {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.7rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 750;
}

.auth-actions .auth-primary:hover {
  background: var(--primary-hover);
}

.auth-link-button {
  min-height: 2rem;
  padding: 0.2rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--primary-strong);
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.auth-link-button:hover {
  color: var(--primary-strong);
  text-decoration-thickness: 2px;
}

.auth-register-prompt {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.auth-actions .auth-link-button {
  justify-self: center;
}

.auth-reset-form {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--auth-section-line);
}

.auth-reset-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.auth-reset-notice {
  margin: 0.75rem 0 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--muted);
}

.auth-reset-notice.error {
  color: var(--danger);
}

.auth-divider {
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1 1 auto;
  background: var(--auth-section-line);
  content: "";
}

.auth-google {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #ffffff;
  color: #1f1f1f;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.auth-google:hover {
  border-color: #5f6368;
  background: #f8faff;
  color: #1f1f1f;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.2);
}

.auth-google-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.auth-oauth-notice {
  margin: 1rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--warning-soft);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.45;
}

.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;
}

.explore-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.align-center {
  align-items: center;
}

.recipe-management-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  max-width: 24rem;
  margin: 0 0 0.75rem;
  padding: 0.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
}

.recipe-management-switch button {
  min-height: 2.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.recipe-management-switch button.active {
  background: var(--surface-strong);
  color: var(--primary-strong);
  box-shadow: var(--shadow-soft);
}

input,
textarea,
select,
button {
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

input[type="text"],
textarea {
  flex: 1;
}

input,
textarea,
select {
  background: var(--surface-strong);
  color: var(--text);
}

button {
  cursor: pointer;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
}

button.secondary {
  background: var(--secondary);
}

.chat-card {
  min-height: min(78vh, 52rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-card .section-head,
.chat-card .quick-actions {
  flex: 0 0 auto;
}

.chat-log {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  flex: 1 1 auto;
  min-height: 18rem;
  max-height: none;
  overflow-y: auto;
  padding: 0 0.25rem 1rem 0;
}

#chat-form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  flex: 0 0 auto;
  margin: 0 -0.2rem -0.2rem;
  padding: 0.65rem 0.2rem 0.2rem;
  background: linear-gradient(180deg, var(--surface-glass), var(--surface) 38%);
}

#chat-form .row {
  flex-wrap: nowrap;
  align-items: center;
}

.chat-composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
}

.chat-category-field {
  grid-column: 1 / -1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.chat-category-field select {
  width: 9.5rem;
  max-width: 34vw;
}

.chat-input-wrap {
  position: relative;
  grid-column: 1;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}

#chat-form .chat-composer-row > button[type="submit"] {
  grid-column: 2;
  align-self: center;
}

#chat-input {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 4.7rem;
  max-height: 12rem;
  padding-right: 5.3rem;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
}

.chat-input-wrap.has-speech-input #chat-input {
  padding-right: 8.25rem;
}

#chat-form .chat-inline-icon-button,
#chat-form .chat-photo-icon-button {
  position: absolute;
  top: 50%;
  width: 2.25rem;
  height: 2.25rem;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent !important;
  color: var(--primary-strong) !important;
  box-shadow: none;
  cursor: pointer;
  z-index: 2;
}

#chat-form .chat-file-icon-button {
  right: 2.8rem;
}

#chat-form .chat-mic-icon-button {
  right: 5.2rem;
}

#chat-form .chat-photo-icon-button {
  right: 0.38rem;
}

#chat-form .chat-inline-icon-button:hover,
#chat-form .chat-inline-icon-button:focus-visible,
#chat-form .chat-photo-icon-button:hover,
#chat-form .chat-photo-icon-button:focus-visible {
  background: var(--primary-tint) !important;
  outline: none;
}

#chat-form .chat-mic-icon-button.is-recording {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

#chat-form .chat-inline-icon-button svg,
#chat-form .chat-photo-icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.chat-hidden-file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  inset: auto auto 0 0;
}

.chat-photo-preview,
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chat-photo-preview {
  margin: 0.35rem 0 0.65rem;
}

.chat-composer-status {
  margin: 0.15rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chat-composer-status.hidden {
  display: none;
}

.chat-composer-status.is-error {
  color: var(--danger);
}

.chat-photo-preview.hidden {
  display: none;
}

.chat-photo-preview-item {
  position: relative;
  width: 5.25rem;
  height: 5.25rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.chat-photo-preview-item img,
.message-attachments img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.chat-photo-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border-radius: 999px;
  background: var(--overlay-control);
  color: var(--on-primary);
  border: 1px solid var(--overlay-control-border);
  font-size: 0.85rem;
  line-height: 1;
}

.message-attachments {
  margin-top: 0.5rem;
}

.message-attachments img {
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-strong);
}

.chat-msg {
  padding: 0.6rem;
  border-radius: 12px;
  background: var(--chat-agent);
  border: 1px solid var(--border-subtle);
}

.chat-msg .chat-msg-bubble {
  display: block;
}

.chat-response-meta {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.chat-followup {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

.chat-followup-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chat-followup-option {
  padding: 0.36rem 0.68rem;
}

.chat-followup-custom {
  display: flex;
  gap: 0.4rem;
}

.chat-followup-input {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-msg.user {
  background: var(--chat-user);
}

.chat-msg.is-streaming .chat-msg-text::after {
  content: "";
  display: inline-block;
  width: 0.42rem;
  height: 1em;
  margin-left: 0.2rem;
  border-radius: 2px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: chat-stream-caret 0.85s steps(2, jump-none) infinite;
}

.chat-msg.is-error {
  border-color: var(--danger);
  background: var(--danger-soft);
}

@keyframes chat-stream-caret {
  50% {
    opacity: 0.15;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-msg.is-streaming .chat-msg-text::after {
    animation: none;
  }
}

.logged-meal-card {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.logged-meal-card h3,
.logged-meal-card p {
  margin: 0;
}

.logged-meal-actions {
  margin-top: 0.35rem;
}

.quick-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.quick-action {
  background: var(--surface-glass);
  color: var(--primary-strong);
  border: 1px solid var(--border);
}

.mobile-day-app,
.mobile-chat-backdrop,
.mobile-chat-sheet-head,
.mobile-settings-launcher,
.mobile-settings-menu,
.mobile-secondary-header {
  display: none;
}

@media (max-width: 720px) {
  body {
    background: var(--canvas);
  }

  body.mobile-chat-visible {
    overflow: hidden;
  }

  #app-shell.container {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    display: block;
  }

  #app-shell.hidden {
    display: none;
  }

  #app-shell > .page-header {
    display: none !important;
  }

  #app-shell.mobile-secondary-open > .mobile-day-app {
    display: none;
  }

  .mobile-secondary-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
    margin: 0 -0.75rem;
    padding: max(0.65rem, env(safe-area-inset-top)) 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-glass);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
  }

  .mobile-secondary-header strong {
    display: block;
    font-size: 1.15rem;
  }

  #app-shell.mobile-secondary-open .recipe-management-switch {
    order: 1;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  #app-shell.mobile-secondary-open .recipe-history-card {
    order: 2;
  }

  #app-shell.mobile-secondary-open .dish-memory-section {
    order: 2;
  }

  #app-shell.mobile-secondary-open .recipe-library-card {
    order: 2;
  }

  #app-shell.mobile-secondary-open .recipe-community-card {
    order: 3;
  }

  .mobile-secondary-back {
    min-height: 2.6rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
  }

  .mobile-day-app {
    display: flex;
    min-height: 100dvh;
    flex-direction: column;
    background: var(--canvas);
  }

  .mobile-day-header {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    padding-right: var(--mobile-day-content-right, 0.85rem);
    padding-bottom: 0.75rem;
    padding-left: var(--mobile-day-content-left, 0.85rem);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-glass);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
  }

  .mobile-date-navigation {
    position: relative;
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
    align-items: center;
    gap: 0.35rem;
  }

  .mobile-date-arrow,
  .mobile-date-label {
    min-height: 2.6rem;
    border: 0;
    background: transparent;
    color: var(--text);
  }

  .mobile-date-arrow {
    padding: 0;
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
  }

  .mobile-date-label {
    overflow: hidden;
    padding: 0.3rem;
    font-size: 1rem;
    font-weight: 750;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-native-date-input {
    position: absolute;
    top: 0;
    right: 3.1rem;
    bottom: 0;
    left: 3.1rem;
    z-index: 2;
    width: auto;
    min-width: 0;
    opacity: 0.001;
    cursor: pointer;
  }

  .mobile-day-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.2rem;
    margin-top: 0.55rem;
    padding: 0.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--surface-muted);
  }

  .mobile-day-switch button {
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.42rem 0.3rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
  }

  .mobile-day-switch button.active {
    background: var(--surface-strong);
    color: var(--primary-strong);
    box-shadow: var(--shadow-soft);
  }

  .mobile-day-scroll {
    flex: 1;
    padding-top: 0.9rem;
    padding-right: var(--mobile-day-content-right, 0.85rem);
    padding-bottom: calc(6.4rem + env(safe-area-inset-bottom));
    padding-left: var(--mobile-day-content-left, 0.85rem);
  }

  .mobile-day-view {
    display: none;
  }

  .mobile-day-view.active {
    display: block;
  }

  .mobile-meal-list {
    display: grid;
    gap: 0.75rem;
  }

  .mobile-swipe-hint {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
  }

  .mobile-swipe-shell {
    position: relative;
    overflow: hidden;
    border-radius: 17px;
    background: var(--danger-action);
  }

  .mobile-swipe-action {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    width: 48%;
    padding: 1rem;
    color: var(--on-primary);
    font-size: 0.84rem;
    font-weight: 800;
    opacity: 0;
    transition: opacity 120ms ease;
  }

  .mobile-swipe-action-right {
    left: 0;
    justify-content: flex-start;
    background: var(--success-action);
  }

  .mobile-swipe-action-left {
    right: 0;
    justify-content: flex-end;
    background: var(--danger-action);
  }

  .mobile-swipe-shell.swiping-right .mobile-swipe-action-right,
  .mobile-swipe-shell.swiping-left .mobile-swipe-action-left {
    opacity: 1;
  }

  .mobile-meal-card {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    min-height: 7.2rem;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 17px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    text-align: left;
    touch-action: pan-y;
    transition: transform 140ms ease, border-color 140ms ease;
  }

  .mobile-meal-card.is-eaten {
    border-color: var(--meal-eaten-border);
    background: var(--meal-eaten-surface);
    color: var(--meal-eaten-text);
  }

  .mobile-meal-card.is-eaten .mobile-meal-title {
    color: var(--meal-eaten-text);
  }

  .mobile-meal-card.is-eaten :is(.mobile-meal-type, p, small) {
    color: var(--meal-eaten-muted);
  }

  .mobile-meal-card.is-eaten .ghost-button:not(.mobile-entry-delete) {
    border-color: var(--meal-eaten-border);
    color: var(--meal-eaten-action);
  }

  .mobile-meal-card.is-eaten .mobile-entry-delete {
    border-color: var(--meal-eaten-border);
    color: var(--meal-eaten-danger);
  }

  .mobile-meal-card.is-eaten .energy-badge:not(.is-partial):not(.is-unknown) {
    border-color: var(--meal-eaten-border);
    background: var(--surface-strong);
    color: var(--meal-eaten-action);
  }

  .mobile-meal-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
  }

  .mobile-meal-type {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .mobile-meal-status {
    padding: 0.25rem 0.48rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
  }

  .mobile-meal-status.is-eaten {
    background: var(--success-soft);
    color: var(--success);
  }

  .mobile-meal-title {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 780;
    line-height: 1.25;
    text-align: left;
  }

  .mobile-meal-card p,
  .mobile-meal-card small {
    display: block;
    margin: 0.5rem 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.42;
  }

  .mobile-meal-card-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.8rem;
  }

  .mobile-meal-card-actions button {
    min-height: 2.1rem;
    padding: 0.4rem 0.62rem;
    font-size: 0.78rem;
    font-weight: 700;
  }

  .mobile-entry-delete,
  .mobile-suggestion-reject {
    margin-left: auto;
    color: var(--danger);
  }

  .mobile-add-meal {
    min-height: 0;
    margin-top: 0.75rem;
    border: 1.5px dashed var(--primary);
    background: var(--surface);
    color: var(--primary-strong);
    touch-action: auto;
  }

  .mobile-shopping-list {
    display: grid;
    gap: 0.85rem;
    min-height: 0;
    margin-top: 0.75rem;
    border-color: var(--border-accent);
    background: var(--primary-tint);
  }

  .mobile-shopping-list strong,
  .mobile-shopping-list small {
    display: block;
  }

  .mobile-shopping-list small {
    margin-top: 0.25rem;
    color: var(--muted);
  }

  .mobile-add-meal-heading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
  }

  .mobile-add-meal-icon {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    font-size: 1.65rem;
    font-weight: 400;
  }

  .mobile-add-meal strong,
  .mobile-add-meal small {
    display: block;
    margin: 0;
    color: inherit;
  }

  .mobile-add-meal small {
    margin-top: 0.25rem;
    color: var(--muted);
    font-weight: 500;
  }

  .mobile-add-meal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.9rem;
  }

  .mobile-add-meal-actions button {
    min-height: 2.6rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 750;
  }

  .mobile-add-meal-actions .ghost-button {
    background: var(--surface-strong);
    color: var(--primary-strong);
  }

  .mobile-quick-add-list {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
  }

  .mobile-quick-add-list > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
  }

  .mobile-quick-add-title {
    margin-bottom: 0.15rem;
    color: var(--muted) !important;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .mobile-quick-add-recipe {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    min-height: 3rem;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 11px;
    background: var(--surface-strong);
    color: var(--text);
    text-align: left;
  }

  .mobile-quick-add-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    gap: 0.35rem;
  }

  .mobile-quick-add-remove {
    min-height: 3rem;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 1.3rem;
    line-height: 1;
  }

  .mobile-quick-add-recipe > span:first-child {
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-quick-add-recipe small {
    margin: 0;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .mobile-quick-add-plus {
    display: grid !important;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-strong) !important;
    font-size: 1.1rem;
    line-height: 1;
  }

  .mobile-empty-day {
    display: grid;
    min-height: 8rem;
    place-content: center;
    gap: 0.35rem;
    padding: 1.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 17px;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
  }

  .mobile-empty-day strong {
    color: var(--text);
  }

  .mobile-planning-actions {
    margin-bottom: 0.75rem;
  }

  .mobile-planning-actions p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
  }

  .mobile-replan-button {
    width: 100%;
    min-height: 2.8rem;
    border-radius: 13px;
    font-weight: 750;
  }

  .mobile-analysis-summary {
    display: grid;
    gap: 1rem;
  }

  .mobile-analysis-period {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.2rem;
    width: 100%;
    max-width: none;
    margin: 0 auto 0.85rem;
    padding: 0.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 11px;
    background: var(--surface-muted);
  }

  .mobile-analysis-period button {
    min-height: 2.15rem;
    padding: 0.38rem 0.8rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
  }

  .mobile-analysis-period button.active {
    background: var(--surface-strong);
    color: var(--primary-strong);
    box-shadow: var(--shadow-soft);
  }

  .mobile-analysis-range {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
  }

  .mobile-analysis-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .mobile-analysis-cards > div {
    display: grid;
    min-height: 5.1rem;
    place-content: center;
    padding: 0.65rem;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: var(--surface-strong);
    text-align: center;
  }

  .mobile-analysis-cards strong {
    color: var(--primary-strong);
    font-size: 1.45rem;
  }

  .mobile-analysis-cards span {
    color: var(--muted);
    font-size: 0.72rem;
  }

  .mobile-analysis-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.75rem;
  }

  .mobile-analysis-legend span {
    width: 0.75rem;
    height: 0.35rem;
    margin-left: 0.35rem;
    border-radius: 99px;
    background: var(--progress-eaten);
  }

  .mobile-analysis-legend span + span {
    background: var(--progress-planned);
  }

  .mobile-analysis-rows {
    display: grid;
    gap: 0.55rem;
    padding: 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: 17px;
    background: var(--surface-strong);
  }

  .mobile-analysis-row > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-width: 0;
    margin-bottom: 0.25rem;
  }

  .mobile-analysis-row strong,
  .mobile-analysis-row span {
    font-size: 0.76rem;
  }

  .mobile-analysis-row > div:first-child span {
    margin-left: auto;
    max-width: 100%;
    color: var(--muted);
    overflow-wrap: anywhere;
    text-align: right;
  }

  .mobile-analysis-bar {
    position: relative;
    height: 0.46rem;
    overflow: hidden;
    border-radius: 99px;
    background: var(--progress-track);
  }

  .mobile-analysis-bar span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
  }

  .mobile-analysis-projected {
    background: var(--progress-planned);
  }

  .mobile-analysis-eaten {
    background: var(--progress-eaten);
  }

  .mobile-chat-launcher {
    position: fixed;
    right: 4.65rem;
    bottom: max(0.8rem, env(safe-area-inset-bottom));
    left: 0.9rem;
    z-index: 45;
    display: flex;
    min-height: 3.25rem;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border-radius: 16px;
    box-shadow: var(--shadow-launcher);
    font-size: 0.96rem;
    font-weight: 800;
  }

  .mobile-settings-launcher {
    position: fixed;
    right: 0.9rem;
    bottom: max(0.8rem, env(safe-area-inset-bottom));
    z-index: 46;
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    min-height: 3.25rem;
    padding: 0;
    place-items: center;
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--primary-strong);
    box-shadow: var(--shadow-launcher);
  }

  .mobile-settings-launcher svg {
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
  }

  .mobile-settings-launcher[aria-expanded="true"] {
    background: var(--primary-hover);
    color: var(--on-primary);
  }

  .mobile-settings-menu {
    position: fixed;
    right: 0.9rem;
    bottom: calc(max(0.8rem, env(safe-area-inset-bottom)) + 3.75rem);
    z-index: 47;
    display: grid;
    width: min(12rem, calc(100vw - 1.8rem));
    gap: 0.35rem;
    padding: 0.45rem;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-raised);
  }

  .mobile-settings-menu button {
    min-height: 2.75rem;
    justify-content: flex-start;
    padding: 0.65rem 0.8rem;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font-size: 0.9rem;
    font-weight: 750;
  }

  .mobile-settings-menu button:hover,
  .mobile-settings-menu button:focus-visible {
    background: var(--surface);
  }

  .mobile-chat-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  #app-shell.mobile-chat-open > .mobile-chat-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  #app-shell.mobile-chat-open .mobile-chat-launcher,
  #app-shell.mobile-chat-open .mobile-settings-launcher,
  #app-shell.mobile-chat-open .mobile-settings-menu {
    visibility: hidden;
  }

  #mobile-chat-sheet.chat-card {
    width: 100%;
    height: min(88dvh, 48rem);
    min-height: 0;
    padding: 0.65rem 0.8rem max(0.7rem, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    background: var(--surface-strong);
    box-shadow: var(--shadow-sheet);
  }

  .mobile-chat-sheet-head {
    position: relative;
    display: flex;
    min-height: 2.35rem;
    align-items: center;
    justify-content: center;
    padding-top: 0.3rem;
  }

  .mobile-chat-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2.8rem;
    height: 0.25rem;
    border-radius: 99px;
    background: var(--handle);
    transform: translateX(-50%);
  }

  #mobile-chat-close {
    position: absolute;
    top: 0.2rem;
    right: 0;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0;
    border: 0;
    font-size: 1.5rem;
  }

  #mobile-chat-sheet > .section-head,
  #mobile-chat-sheet .chat-category-field {
    display: none !important;
  }

  #mobile-chat-sheet .chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1.4rem;
  }

  #mobile-chat-sheet .quick-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  #mobile-chat-sheet #chat-form {
    flex: 0 0 auto;
  }

  #mobile-chat-sheet #chat-input {
    min-height: 5.6rem;
    max-height: 32dvh;
    padding-top: 0.75rem;
    padding-bottom: 2.75rem;
  }

  #mobile-chat-sheet .chat-composer-row {
    align-items: end;
  }

  #mobile-chat-sheet #chat-form .chat-inline-icon-button,
  #mobile-chat-sheet #chat-form .chat-photo-icon-button {
    top: auto;
    bottom: 0.45rem;
    transform: none;
  }

  #mobile-chat-sheet #chat-form .chat-composer-row > button[type="submit"] {
    align-self: end;
  }
}

/* Rotations-Review, atomare Vorlieben und Energieprofil. */
.energy-profile-settings {
  margin-top: 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-soft);
}

.energy-profile-grid,
.onboarding-energy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.energy-profile-grid > label,
.onboarding-energy-grid > label {
  min-width: 0;
  display: grid;
  gap: 0.36rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.energy-profile-grid :is(input, select),
.onboarding-energy-grid :is(input, select) {
  width: 100%;
  min-height: 2.8rem;
}

.onboarding-energy-grid > label > div {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.onboarding-energy-grid > label > div input {
  min-width: 0;
}

.energy-target-mode {
  margin: 0.9rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  border: 0;
}

.energy-target-mode legend {
  width: 100%;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.energy-target-mode label,
.energy-special-needs {
  padding: 0.55rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
}

.energy-special-needs {
  margin-top: 0.65rem;
}

.energy-target-mode input,
.energy-special-needs input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.energy-manual-target {
  width: min(20rem, 100%);
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.energy-manual-target > span:first-child {
  grid-column: 1 / -1;
}

.energy-manual-target > label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
}

.energy-manual-target > label > span:first-child {
  grid-column: 1 / -1;
}

.energy-manual-target.hidden {
  display: none;
}

.energy-target-preview {
  margin-top: 0.75rem;
  padding: 0.72rem 0.82rem;
  display: grid;
  gap: 0.18rem;
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  background: var(--primary-tint);
}

.energy-target-preview strong {
  color: var(--heading);
  font-size: 1rem;
}

.energy-target-preview span {
  color: var(--muted);
  font-size: 0.76rem;
}

.onboarding-energy-grid {
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.energy-supplement-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.energy-supplement-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.energy-supplement-shell {
  padding: clamp(1rem, 4vw, 1.8rem);
  display: grid;
  gap: 0.9rem;
}

.energy-supplement-head h2 {
  margin: 0.2rem 0 0;
  color: var(--heading);
}

.energy-supplement-head > p:last-child {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.energy-supplement-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.energy-supplement-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.energy-badge {
  width: max-content;
  max-width: 100%;
  padding: 0.28rem 0.58rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.energy-badge.is-compact {
  padding: 0.22rem 0.45rem;
  font-size: 0.68rem;
}

.energy-badge.is-partial {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.energy-badge.is-unknown {
  border-color: var(--border-soft);
  background: var(--surface-muted);
  color: var(--muted);
}

.meal-energy-row {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.energy-details {
  margin-top: 0.5rem;
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.energy-details.is-partial {
  background: var(--warning-soft);
  color: var(--warning);
}

.calorie-balance {
  margin: 0.9rem 0 1rem;
  padding: 0.82rem;
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  background: var(--primary-tint);
}

.calorie-balance.is-rotation {
  margin: 0 var(--rotation-arrow-rail);
  padding: 0.5rem 0.62rem;
  gap: 0.38rem;
}

.calorie-balance.is-rotation .calorie-balance-heading strong {
  font-size: 0.86rem;
}

.calorie-balance.is-rotation .calorie-balance-values > div {
  padding: 0.34rem 0.4rem;
}

.calorie-balance.is-rotation .calorie-balance-values strong {
  font-size: 0.76rem;
}

.calorie-balance-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.calorie-balance-heading > div {
  display: grid;
  gap: 0.08rem;
}

.calorie-balance-heading span,
.calorie-balance p,
.calorie-balance-values span,
.calorie-balance-values small {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.calorie-balance-heading strong {
  color: var(--heading);
  font-size: 1rem;
}

.calorie-balance-state {
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--warning) !important;
  font-weight: 800;
}

.calorie-balance-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.calorie-balance-values > div {
  min-width: 0;
  padding: 0.48rem;
  display: grid;
  gap: 0.12rem;
  border-radius: 9px;
  background: var(--surface-strong);
}

.calorie-balance-values strong {
  color: var(--heading);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.calorie-balance.is-partial {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.calorie-balance.is-compact {
  margin-block: 0.7rem;
  padding: 0.68rem;
}

.onboarding-preference-questions {
  display: grid;
  gap: 1rem;
}

.onboarding-preference-group {
  display: grid;
  gap: 0.55rem;
}

.onboarding-preference-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-preference-question {
  padding: 0.72rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-strong);
}

.onboarding-preference-question > div:first-child {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.onboarding-preference-question strong {
  color: var(--heading);
  font-size: 0.88rem;
}

.onboarding-preference-question small {
  color: var(--muted);
  font-size: 0.7rem;
}

.onboarding-preference-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.onboarding-preference-options button,
.rotation-followup-options button {
  min-height: 2.2rem;
  padding: 0.4rem 0.58rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 800;
}

.onboarding-preference-options button.is-selected,
.rotation-followup-options button.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--button-text);
}

.onboarding-question-loading,
.onboarding-question-error {
  padding: 1rem;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
}

.rotation-review-shell {
  --rotation-review-edge-inset: var(--rotation-arrow-rail, clamp(0.85rem, 2vw, 1.25rem));
  --rotation-review-card-inset: clamp(0.85rem, 1.6vw, 1rem);
  width: min(52rem, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(0.4rem, 1.5vw, 1rem) var(--rotation-review-edge-inset);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.rotation-review-shell > * {
  width: 100%;
  min-width: 0;
}

.rotation-review-head,
.rotation-review-head-actions,
.rotation-review-card-index,
.rotation-review-card-nav,
.rotation-review-progress-copy,
.rotation-review-metrics,
.rotation-review-decisions,
.rotation-top-up-head,
.rotation-energy-summary-main,
.rotation-energy-facts,
.analysis-energy-heading,
.analysis-energy-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.rotation-review-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.rotation-review-head > div:first-child {
  min-width: 0;
  flex: 1 1 14rem;
}

.rotation-review-head h2,
.rotation-review-head p {
  margin: 0;
}

.rotation-review-head-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rotation-review-discard {
  color: var(--danger, #a33d3d);
}

.rotation-review-progress-copy {
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.rotation-review-progress-copy strong {
  color: var(--primary);
  font-size: 1.05rem;
}

.rotation-review-progress {
  height: 0.46rem;
  margin: 0.38rem 0 1rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.rotation-review-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

.rotation-review-card,
.rotation-review-followup,
.rotation-review-complete {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0 auto;
  padding: var(--rotation-review-card-inset);
}

.rotation-review-card-index {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.72rem;
}

.rotation-review-card-index strong {
  min-width: 0;
  margin-left: auto;
  text-align: right;
}

.rotation-review-card h2,
.rotation-review-followup h2,
.rotation-review-complete h2 {
  margin: 0.65rem 0 0.4rem;
  color: var(--heading);
  font-size: clamp(1.3rem, 4vw, 2rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.rotation-review-rationale {
  margin: 0.35rem 0;
  color: var(--muted);
}

.rotation-review-metrics {
  margin: 0.85rem 0;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.rotation-review-metrics span {
  padding: 0.34rem 0.55rem;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 850;
}

.rotation-review-energy-warning {
  margin: 0.45rem 0;
  color: var(--warning);
  font-size: 0.76rem;
}

.rotation-review-details {
  width: 100%;
  max-width: 100%;
  margin: 0.7rem 0;
  padding: 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}

.rotation-review-details summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 850;
}

.rotation-review-details p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.rotation-review-open-details {
  width: 100%;
  max-width: 100%;
  min-height: 2rem;
  padding: 0.55rem 0.7rem;
  text-align: left;
  white-space: normal;
}

.rotation-review-decisions {
  width: 100%;
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rotation-review-decisions button {
  min-width: 0;
  max-width: 100%;
  min-height: 3.1rem;
  border-radius: 14px;
  font-weight: 850;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rotation-review-dislike {
  border: 1px solid var(--border-soft);
  background: var(--surface-soft);
  color: var(--text);
}

.rotation-review-dislike.is-selected {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

.rotation-review-like {
  border: 1px solid var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.rotation-review-like.is-selected {
  outline: 2px solid var(--success);
  outline-offset: 1px;
}

.rotation-review-card-nav {
  width: 100%;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.rotation-review-card-nav button {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}

.rotation-review-followup {
  display: grid;
  gap: 0.8rem;
}

.rotation-followup-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.5rem;
}

.rotation-followup-options button {
  min-height: 2.8rem;
  border-radius: 12px;
}

.rotation-review-complete {
  text-align: center;
}

.rotation-review-complete > span {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.6rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.5rem;
  font-weight: 900;
}

.rotation-draft-banner {
  min-width: 0;
  margin: 0 var(--rotation-arrow-rail) 0.35rem;
  padding: 0.45rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  background: var(--primary-tint);
}

.rotation-draft-banner > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rotation-draft-banner > div:first-child {
  flex: 1 1 20rem;
  display: grid;
  align-items: start;
  gap: 0.08rem;
}

.rotation-draft-banner > div:last-child {
  flex: 0 1 auto;
  max-width: 100%;
  margin-inline-start: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rotation-draft-banner strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rotation-draft-banner span {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-draft-banner button {
  min-width: 0;
  max-width: 100%;
  min-height: 1.9rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
  white-space: normal;
}

.rotation-energy-summary,
.rotation-protein-top-up {
  margin-inline: var(--rotation-arrow-rail);
  padding: 0.42rem 0.62rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-strong);
}

.rotation-energy-summary-main > div {
  display: grid;
  gap: 0.03rem;
}

.rotation-energy-summary-main > div:last-child {
  text-align: right;
}

.rotation-energy-summary span,
.rotation-energy-summary p,
.rotation-protein-top-up p {
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
}

.rotation-energy-summary strong {
  color: var(--heading);
  font-size: 0.86rem;
}

.rotation-energy-summary.is-in-range {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.rotation-energy-summary.is-partial {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.rotation-energy-facts {
  margin-top: 0.18rem;
}

.rotation-protein-top-up {
  display: grid;
  gap: 0.26rem;
  padding: 0.3rem 0.5rem;
}

.rotation-top-up-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.rotation-top-up-head > div:first-child {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  white-space: nowrap;
}

.rotation-top-up-head h3,
.rotation-top-up-head p,
.rotation-top-up-head small {
  margin: 0;
}

.rotation-top-up-head h3 {
  color: var(--heading);
  font-size: 0.78rem;
  line-height: 1.1;
}

.rotation-top-up-head .eyebrow {
  font-size: 0.5rem;
  letter-spacing: 0.055em;
}

.rotation-top-up-selected,
.rotation-top-up-hint {
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-top-up-selected span {
  color: var(--muted);
  font-size: 0.53rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rotation-top-up-selected strong {
  min-width: 0;
  overflow: hidden;
  color: var(--heading);
  font-size: 0.64rem;
  text-overflow: ellipsis;
}

.rotation-top-up-selected small,
.rotation-top-up-hint {
  color: var(--muted);
  font-size: 0.56rem;
}

.rotation-top-up-options {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  overflow: hidden;
}

.rotation-top-up-options[data-option-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.rotation-top-up-options[data-option-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rotation-top-up-option {
  min-width: 0;
  padding: 0.24rem 0.32rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--surface-soft);
  overflow: hidden;
}

.rotation-top-up-option > div {
  min-width: 0;
  display: grid;
  gap: 0.02rem;
}

.rotation-top-up-option span {
  display: none;
}

.rotation-top-up-option small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.53rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-top-up-option strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 0.64rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-top-up-option button,
.rotation-top-up-head button {
  min-height: 1.8rem;
  padding: 0.2rem 0.4rem;
  flex: 0 0 auto;
  font-size: 0.6rem;
  white-space: nowrap;
}

.rotation-top-up-option.is-selected {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.analysis-energy-card {
  margin: 0.9rem 0 1rem;
  padding: 0.85rem;
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  background: var(--primary-tint);
}

.analysis-energy-heading > div {
  display: grid;
  gap: 0.1rem;
}

.analysis-energy-heading span,
.analysis-energy-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.analysis-energy-heading strong {
  color: var(--heading);
  font-size: 1.05rem;
}

.analysis-energy-status {
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary) !important;
  font-weight: 850;
}

.analysis-energy-values {
  align-items: stretch;
}

.analysis-energy-values > span {
  flex: 1 1 0;
  padding: 0.45rem;
  display: grid;
  gap: 0.08rem;
  border-radius: 9px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.68rem;
}

.analysis-energy-values strong {
  color: var(--heading);
  font-size: 0.9rem;
}

.analysis-energy-card.is-in-range {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.analysis-energy-card.is-partial {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.mobile-meal-card.is-protein-top-up {
  border-style: dashed;
  border-color: var(--border-accent);
}

.rotation-app:has(.rotation-protein-top-up-slot),
.rotation-app:has(.rotation-draft-banner),
.rotation-app:has(.calorie-balance) {
  overflow-y: auto;
}

@media (max-width: 720px) {
  .energy-profile-grid,
  .onboarding-energy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .onboarding-preference-question {
    grid-template-columns: minmax(0, 1fr);
  }

  .onboarding-preference-options {
    justify-content: flex-start;
  }

  .rotation-review-shell {
    padding: 0.55rem max(var(--rotation-review-edge-inset), env(safe-area-inset-right)) max(0.8rem, env(safe-area-inset-bottom)) max(var(--rotation-review-edge-inset), env(safe-area-inset-left));
  }

  .rotation-review-head {
    align-items: center;
  }

  .rotation-review-head > div:first-child .eyebrow {
    display: none;
  }

  .rotation-review-head h2 {
    font-size: 1rem;
  }

  .rotation-review-head-actions button {
    min-height: 2rem;
    padding: 0.28rem 0.42rem;
    font-size: 0.68rem;
  }

  .rotation-review-card,
  .rotation-review-followup,
  .rotation-review-complete {
    padding: var(--rotation-review-card-inset);
  }

  .rotation-draft-banner {
    margin-inline: var(--mobile-day-content-left) var(--mobile-day-content-right);
  }

  .rotation-draft-banner span {
    display: none;
  }

  .rotation-energy-summary,
  .rotation-protein-top-up,
  .calorie-balance.is-rotation {
    margin-inline: var(--mobile-day-content-left) var(--mobile-day-content-right);
  }

  .rotation-energy-facts {
    display: none;
  }

  .analysis-energy-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calorie-balance-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .energy-profile-grid,
  .onboarding-energy-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .energy-target-mode {
    display: grid;
  }

  .calorie-balance-heading,
  .energy-details {
    align-items: stretch;
    flex-direction: column;
  }

  .calorie-balance-state {
    width: fit-content;
  }

  .mobile-quick-add-recipe {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mobile-quick-add-recipe > :is(span:first-child, small, .energy-badge) {
    grid-column: 1;
  }

  .mobile-quick-add-recipe > .mobile-quick-add-plus {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .rotation-review-head-actions {
    gap: 0.22rem;
  }

  .rotation-review-discard {
    max-width: 5.2rem;
    white-space: normal;
  }

  .rotation-review-decisions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .rotation-review-card-nav button {
    max-width: 48%;
    padding-inline: 0.25rem;
    font-size: 0.68rem;
  }

  .rotation-draft-banner {
    align-items: flex-start;
  }

  .rotation-draft-banner > div:first-child strong {
    font-size: 0.72rem;
  }

  .rotation-draft-banner > div:first-child,
  .rotation-draft-banner > div:last-child {
    width: 100%;
    flex-basis: 100%;
  }

  .rotation-draft-banner > div:last-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-inline-start: 0;
  }

  .rotation-draft-banner button {
    width: 100%;
  }

  .rotation-energy-summary-main {
    align-items: flex-end;
  }

  .analysis-energy-heading {
    align-items: flex-start;
  }
}

/* Guided first-run setup -------------------------------------------------- */

.onboarding-reopen-card {
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}

.onboarding-reopen-card strong,
.onboarding-reopen-card p {
  display: block;
}

.onboarding-reopen-card p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.onboarding-reopen-card button {
  flex: 0 0 auto;
}

.onboarding-dialog {
  width: min(68rem, calc(100vw - 2rem));
  height: min(48rem, calc(100dvh - 2rem));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.onboarding-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.onboarding-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
}

.onboarding-sidebar {
  min-width: 0;
  padding: 1.6rem 1.35rem;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 4%, var(--primary-tint), transparent 30%),
    var(--sidebar);
  color: var(--sidebar-text);
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.onboarding-brand img {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 12px;
}

.onboarding-brand strong,
.onboarding-brand span {
  display: block;
}

.onboarding-brand strong {
  font-size: 1rem;
}

.onboarding-brand span {
  margin-top: 0.1rem;
  color: var(--sidebar-muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.onboarding-step-list {
  margin: 2.3rem 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  list-style: none;
}

.onboarding-step-list li {
  position: relative;
  min-height: 3.8rem;
  padding: 0.6rem 0.65rem;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  border-radius: 12px;
  color: var(--sidebar-muted);
  transition: background 180ms ease, color 180ms ease;
}

.onboarding-step-list li > span {
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--sidebar-control-border);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 850;
}

.onboarding-step-list li strong,
.onboarding-step-list li small {
  display: block;
}

.onboarding-step-list li strong {
  font-size: 0.78rem;
}

.onboarding-step-list li small {
  margin-top: 0.1rem;
  color: inherit;
  font-size: 0.66rem;
}

.onboarding-step-list li.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}

.onboarding-step-list li.is-active > span {
  border-color: var(--sidebar-active-text);
  background: var(--sidebar-hover);
}

.onboarding-step-list li.is-complete > span {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.onboarding-step-list li.is-complete > span::before {
  content: "✓";
}

.onboarding-step-list li.is-complete > span {
  font-size: 0;
}

.onboarding-step-list li.is-complete > span::before {
  font-size: 0.82rem;
}

.onboarding-sidebar-note {
  margin: auto 0 0;
  padding: 0.9rem 0.7rem 0;
  border-top: 1px solid var(--sidebar-border);
  color: var(--sidebar-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.onboarding-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--workspace);
}

.onboarding-mobile-progress {
  flex: 0 0 auto;
  padding: 1rem 1.6rem 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.onboarding-progress-track {
  height: 0.35rem;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.onboarding-progress-track span {
  display: block;
  width: 16.67%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 220ms ease;
}

.onboarding-content {
  min-height: 0;
  padding: 1.45rem clamp(1.5rem, 4vw, 3.8rem) 1.2rem;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.onboarding-panel {
  width: min(100%, 44rem);
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  justify-content: center;
}

.onboarding-panel.hidden {
  display: none;
}

.onboarding-panel > .eyebrow {
  margin: 0 0 0.45rem;
  color: var(--primary-strong);
}

.onboarding-panel h1,
.onboarding-panel h2 {
  max-width: 39rem;
  margin: 0;
  color: var(--heading);
  font-size: clamp(1.65rem, 3.5vw, 2.4rem);
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.onboarding-panel :is(h1, h2)[tabindex="-1"]:focus {
  outline: none !important;
  box-shadow: none;
}

.onboarding-lead {
  max-width: 41rem;
  margin: 0.75rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.58;
}

.onboarding-welcome {
  align-items: center;
  text-align: center;
}

.onboarding-welcome-mark {
  width: 5.2rem;
  height: 5.2rem;
  margin-bottom: 1.3rem;
  padding: 0.85rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-accent);
  border-radius: 23px;
  background: var(--primary-soft);
  box-shadow: var(--shadow-soft);
  transform: rotate(-2deg);
}

.onboarding-welcome-mark img {
  width: 100%;
  height: 100%;
}

.onboarding-welcome .onboarding-lead {
  max-width: 36rem;
}

.onboarding-benefits {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  text-align: left;
}

.onboarding-benefits article {
  min-height: 10rem;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: var(--surface-soft);
}

.onboarding-benefits article > span {
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.onboarding-benefits strong {
  display: block;
  margin-top: 1.4rem;
  color: var(--heading);
  font-size: 0.86rem;
}

.onboarding-benefits p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.48;
}

.onboarding-measure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.onboarding-measure-card {
  padding: 1rem 1.1rem;
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: var(--surface-soft);
  color: var(--heading);
  font-size: 0.78rem;
  font-weight: 850;
}

.onboarding-measure-card > div {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.onboarding-measure-card input {
  min-width: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--heading);
  font-size: 2rem;
  font-weight: 850;
}

.onboarding-measure-card input:focus {
  border-color: var(--primary);
  box-shadow: none;
}

.onboarding-measure-card > div strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.onboarding-measure-card small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 550;
}

.onboarding-factor-presets {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.onboarding-factor-presets button {
  min-height: 3.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  color: var(--text);
}

.onboarding-factor-presets button strong,
.onboarding-factor-presets button small {
  display: block;
}

.onboarding-factor-presets button strong {
  font-size: 0.8rem;
}

.onboarding-factor-presets button small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.onboarding-factor-presets button.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.onboarding-callout {
  margin: 0.85rem 0 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  background: var(--primary-tint);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 750;
}

.onboarding-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.onboarding-choice-grid label,
.onboarding-toggle-list label,
.onboarding-focus-grid label {
  cursor: pointer;
}

.onboarding-choice-grid label {
  min-height: 5rem;
  padding: 0.85rem 0.95rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}

.onboarding-choice-grid label:has(input:checked),
.onboarding-focus-grid label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.onboarding-choice-grid input,
.onboarding-toggle-list input,
.onboarding-focus-grid input {
  margin-top: 0.12rem;
  accent-color: var(--primary);
}

.onboarding-choice-grid strong,
.onboarding-choice-grid small {
  display: block;
}

.onboarding-choice-grid strong {
  color: var(--heading);
  font-size: 0.82rem;
}

.onboarding-choice-grid small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.onboarding-choice-grid label.is-implied {
  opacity: 0.65;
}

.onboarding-toggle-list {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.onboarding-toggle-list label {
  padding: 0.8rem 0.9rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.7rem;
  border-bottom: 1px solid var(--border-soft);
}

.onboarding-toggle-list strong,
.onboarding-toggle-list small {
  display: block;
}

.onboarding-toggle-list strong {
  color: var(--heading);
  font-size: 0.8rem;
}

.onboarding-toggle-list small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.42;
}

.onboarding-taste-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.onboarding-taste-grid > label {
  padding: 1rem;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 15px;
  background: var(--surface-soft);
}

.onboarding-field-icon {
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 900;
}

.onboarding-field-icon.is-like {
  background: var(--success-soft);
  color: var(--success);
}

.onboarding-field-icon.is-avoid {
  background: var(--danger-soft);
  color: var(--danger);
}

.onboarding-taste-grid strong,
.onboarding-taste-grid small {
  display: block;
}

.onboarding-taste-grid strong {
  color: var(--heading);
  font-size: 0.84rem;
}

.onboarding-taste-grid small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.onboarding-taste-grid textarea {
  min-height: 7rem;
  margin-top: 0.5rem;
  grid-column: 1 / -1;
  resize: vertical;
  background: var(--surface-strong);
  font-size: 0.8rem;
}

.onboarding-privacy-note,
.onboarding-next-steps {
  margin-top: 0.8rem;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: var(--surface-soft);
}

.onboarding-privacy-note strong,
.onboarding-next-steps strong {
  color: var(--heading);
  font-size: 0.76rem;
}

.onboarding-privacy-note p,
.onboarding-next-steps p {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.onboarding-focus-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.onboarding-focus-grid label {
  min-height: 3.25rem;
  padding: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.onboarding-custom-focus {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.35rem;
  color: var(--heading);
  font-size: 0.75rem;
  font-weight: 800;
}

.onboarding-custom-focus input {
  min-height: 2.7rem;
  background: var(--surface-strong);
  font-size: 0.8rem;
}

.onboarding-theme-fieldset {
  min-width: 0;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.onboarding-theme-fieldset > label {
  color: var(--heading);
  font-size: 0.75rem;
  font-weight: 850;
}

.onboarding-theme-fieldset select {
  width: 100%;
  min-height: 2.8rem;
  background: var(--surface-strong);
}

.onboarding-theme-fieldset > small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.onboarding-finish-mark {
  width: 3.8rem;
  height: 3.8rem;
  margin-bottom: 1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.45rem;
  font-weight: 900;
}

.onboarding-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.onboarding-summary article {
  min-height: 5.5rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: var(--surface-soft);
}

.onboarding-summary article span,
.onboarding-summary article strong {
  display: block;
}

.onboarding-summary article span {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.onboarding-summary article strong {
  color: var(--heading);
  font-size: 0.8rem;
  line-height: 1.45;
}

.onboarding-footer {
  min-height: 5.15rem;
  padding: 0.9rem 1.6rem;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-glass);
}

.onboarding-skip {
  padding-inline: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
}

.onboarding-skip:hover {
  color: var(--primary-strong);
  background: transparent;
}

.onboarding-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.onboarding-status.is-error {
  color: var(--danger);
  font-weight: 750;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.onboarding-actions button {
  min-width: 6.8rem;
}

.onboarding-actions button:last-child {
  min-width: 8.5rem;
}

@media (max-width: 760px) {
  .onboarding-reopen-card {
    align-items: stretch;
    flex-direction: column;
  }

  .onboarding-reopen-card button {
    width: 100%;
  }

  .onboarding-dialog {
    width: 100vw;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .onboarding-shell {
    display: block;
  }

  .onboarding-sidebar {
    display: none;
  }

  .onboarding-main {
    height: 100dvh;
  }

  .onboarding-mobile-progress {
    padding: max(0.85rem, env(safe-area-inset-top)) 1rem 0;
  }

  .onboarding-content {
    padding: 1.15rem 1rem 1rem;
  }

  .onboarding-panel {
    min-height: auto;
    justify-content: flex-start;
  }

  .onboarding-panel h1,
  .onboarding-panel h2 {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }

  .onboarding-lead {
    margin-bottom: 1.15rem;
    font-size: 0.88rem;
  }

  .onboarding-welcome-mark {
    width: 4.2rem;
    height: 4.2rem;
    margin-top: 0.35rem;
    margin-bottom: 0.9rem;
  }

  .onboarding-benefits,
  .onboarding-measure-grid,
  .onboarding-choice-grid,
  .onboarding-taste-grid,
  .onboarding-summary {
    grid-template-columns: 1fr;
  }

  .onboarding-benefits article {
    min-height: auto;
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.65rem;
  }

  .onboarding-benefits strong {
    margin-top: 0;
  }

  .onboarding-benefits p {
    grid-column: 2;
  }

  .onboarding-factor-presets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .onboarding-focus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .onboarding-footer {
    min-height: auto;
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.55rem;
  }

  .onboarding-status {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .onboarding-skip {
    grid-column: 1;
    grid-row: 2;
  }

  .onboarding-actions {
    grid-column: 2;
    grid-row: 2;
  }

  .onboarding-actions button {
    min-width: 0;
    padding-inline: 0.85rem;
  }

  .onboarding-actions button:last-child {
    min-width: 0;
  }
}

@media (max-width: 380px) {
  .onboarding-factor-presets,
  .onboarding-theme-options {
    grid-template-columns: 1fr;
  }

  .onboarding-footer {
    grid-template-columns: 1fr;
  }

  .onboarding-skip,
  .onboarding-actions,
  .onboarding-status {
    grid-column: 1;
  }

  .onboarding-skip {
    grid-row: 3;
    justify-self: center;
  }

  .onboarding-actions {
    grid-row: 2;
  }

  .onboarding-actions button {
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding-progress-track span,
  .onboarding-step-list li {
    transition: none;
  }
}

.suggestions,
#plan-entries,
#recipe-history-list,
#recipe-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-strong);
}

.tags {
  color: var(--primary-strong);
  font-size: 0.88rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
  color: inherit;
  opacity: 0.82;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0.1rem 0 0;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.chat-focus-indicator {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: var(--primary-strong);
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.tracking-level-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.tracking-level-fieldset > legend {
  margin-bottom: 0.55rem;
  color: var(--heading);
  font-size: 0.84rem;
  font-weight: 850;
}

.tracking-level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.tracking-level-grid label {
  min-width: 0;
  padding: 0.85rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
  cursor: pointer;
}

.tracking-level-grid label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.tracking-level-grid input {
  margin-top: 0.12rem;
  accent-color: var(--primary);
}

.tracking-level-grid strong,
.tracking-level-grid small {
  display: block;
}

.tracking-level-grid strong {
  color: var(--heading);
  font-size: 0.84rem;
  line-height: 1.3;
}

.tracking-level-grid small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.tracking-level-micro-note {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.tracking-level-micro-note.is-active {
  color: var(--primary-strong);
}

.tracking-level-summary {
  padding: 0.7rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  background: var(--primary-tint);
  color: var(--primary-strong);
  font-size: 0.78rem;
  line-height: 1.4;
}

.tracking-level-summary strong {
  white-space: nowrap;
}

.tracking-level-summary span {
  color: var(--text);
}

.options-focus-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.65rem;
}

.options-focus-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.options-focus-item input {
  width: 1rem;
  height: 1rem;
}

.options-implied {
  color: var(--muted);
}

.options-implied input {
  opacity: 0.65;
}

.options-forbidden-form {
  display: flex;
  gap: 0.5rem;
}

.options-forbidden-form input {
  flex: 1;
}

.options-forbidden-list {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-height: 1.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.forbidden-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: inherit;
}

.forbidden-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.field-inline {
  min-width: 12rem;
}

.field-submit {
  align-self: end;
}

.supplement-card {
  max-width: 72rem;
}

.supplement-form {
  display: grid;
  grid-template-columns: 13rem minmax(16rem, 1fr) 12rem 12rem auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.supplement-form .field {
  min-width: 0;
}

.supplement-dose-row {
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) minmax(0, 5rem);
  gap: 0.45rem;
}

.supplement-form input,
.supplement-form select,
.supplement-picker-button,
.custom-select-button {
  width: 100%;
  height: 2.6rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
}

.supplement-form button[type="submit"] {
  width: auto;
  min-width: 7.5rem;
  height: 2.6rem;
  min-height: 2.6rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  white-space: nowrap;
}

.supplement-picker {
  position: relative;
}

.custom-select,
.supplement-picker {
  position: relative;
}

.custom-select-native {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.custom-select-button,
.supplement-picker-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  text-align: left;
}

.custom-select-button::after,
.supplement-picker-button::after {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-0.1rem);
  opacity: 0.72;
  flex: 0 0 auto;
}

.custom-select-list,
.supplement-picker-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  display: grid;
  gap: 0.15rem;
  max-height: 16rem;
  overflow: auto;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.custom-select-list {
  right: auto;
  width: max-content;
  min-width: max(100%, 12rem);
  max-width: min(18rem, calc(100vw - 2rem));
  max-height: 18rem;
}

.custom-select-list.hidden,
.supplement-picker-list.hidden {
  display: none;
}

.custom-select-option,
.supplement-picker-option {
  width: 100%;
  min-height: 2.2rem;
  padding: 0.45rem 0.55rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
}

.custom-select-option:hover,
.custom-select-option.is-selected,
.supplement-picker-option:hover,
.supplement-picker-option.is-selected {
  background: var(--primary-tint);
  color: var(--primary-strong);
}

.custom-select-option.is-selected,
.supplement-picker-option.is-selected {
  font-weight: 700;
}

.supplement-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.25rem;
}

.supplement-item {
  max-width: none;
}

.supplement-item .item-head {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.supplement-item .item-head strong {
  margin-right: 0.15rem;
}

.supplement-form .field-submit label {
  visibility: hidden;
}

.selected-recipe-context {
  display: grid;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.selected-recipe-context.hidden {
  display: none;
}

.context-source {
  color: var(--muted);
  font-size: 0.9rem;
}

.pinned-recipe-head,
.pinned-recipe-meta,
.pinned-recipe-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.pinned-recipe-head h3 {
  margin: 0;
}

.pinned-recipe-meta {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 0.9rem;
}

.pinned-recipe-grid {
  display: grid;
  gap: 0.25rem;
}

.pinned-recipe-grid p,
.pinned-instructions,
.pinned-instructions p {
  margin: 0;
}

.pinned-instructions summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 600;
}

.results-meta {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.item-head h3 {
  margin: 0;
}

.pill-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: end;
}

.card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.plan-save-native {
  display: inline-flex;
}

.plan-save-native.plan-save-direct {
  display: inline-grid;
  gap: 0.4rem;
  justify-items: start;
}

.plan-save-feedback {
  max-width: 24rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.plan-save-feedback[data-state="success"] {
  color: var(--success);
  font-weight: 700;
}

.plan-save-feedback[data-state="error"] {
  color: var(--danger);
  font-weight: 700;
}

.plan-save-direct[data-save-state="success"] > button {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.plan-save-native-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.recipe-link {
  background: transparent;
  color: var(--primary-strong);
  border: 1px dashed var(--border);
  padding: 0.35rem 0.65rem;
}

.message-recipe-ref {
  margin-top: 0.55rem;
}

.display-recipe-button {
  margin-top: 0.7rem;
}

.nutrient-reflection {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.78;
}

.nutrition-card {
  background: var(--surface);
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: var(--primary-strong);
}

.toggle-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.chat-mode-picker {
  display: grid;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.chat-mode-picker-head {
  display: grid;
  gap: 0.2rem;
}

.chat-mode-picker-head strong,
.chat-mode-status strong {
  color: var(--primary-strong);
}

.chat-mode-picker-head span,
.chat-mode-option span,
.chat-mode-status span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.chat-mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.chat-mode-option {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  min-height: 7.2rem;
  padding: 0.75rem;
  text-align: left;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
}

.chat-mode-option:hover,
.chat-mode-option:focus-visible {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--text);
  outline: none;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.chat-mode-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--primary-tint);
}

.chat-mode-status > div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.nutrition-summary {
  display: grid;
  gap: 0.8rem;
}

.nutrition-settings {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.options-nutrition-settings {
  margin-bottom: 0;
}

.options-protein-heading {
  margin-top: 0.2rem;
}

.options-protein-heading p,
.protein-target-preview {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.protein-target-preview {
  margin: 0.55rem 0 0.9rem;
  color: var(--primary-strong);
  font-weight: 750;
}

.nutrition-settings label {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.nutrition-settings input {
  width: 7rem;
}

.nutrient-target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.55rem;
}

.nutrient-target-field {
  display: grid;
  gap: 0.25rem;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nutrient-target-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.nutrient-target-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.nutrient-target-input-row input {
  width: 100%;
}

.nutrient-target-unit {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.nutrition-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  flex-wrap: wrap;
}

.nutrition-summary-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.nutrition-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nutrition-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.plan-nutrition-details {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.plan-nutrition-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-strong);
}

.plan-nutrition-details p {
  margin: 0.5rem 0;
  color: var(--muted);
}

.nutrition-confidence {
  color: var(--warning);
}

.nutrition-estimate-warnings {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.65rem;
  color: var(--warning);
}

.nutrition-estimate-warnings span {
  display: block;
  font-size: 0.85rem;
}

.plan-nutrition-details ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.plan-nutrition-details li {
  margin: 0.3rem 0;
}

.plan-nutrition-details li span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.plan-nutrition-details li em {
  display: inline-flex;
  margin-left: 0.35rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
}

.nutrition-unmatched {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.nutrition-unmatched span {
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
}

.nutrition-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
}

.nutrition-chip-good,
.nutrition-apob-pill {
  background: var(--success-soft);
  color: var(--success);
}

.nutrition-group,
.nutrition-risk-section {
  display: grid;
  gap: 0.55rem;
}

.nutrition-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.nutrition-group-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
}

.nutrition-group-head span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
}

.nutrition-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.9rem;
}

.nutrition-row {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.nutrition-row-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.nutrition-row-meta span:first-child {
  color: var(--text);
  font-weight: 700;
}

.nutrition-row-meta span:last-child {
  margin-left: auto;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: right;
}

.nutrition-risk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.nutrition-risk-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nutrition-risk-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.nutrition-risk-card strong {
  color: var(--text);
  font-size: 0.86rem;
}

.nutrition-risk-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.nutrition-risk-card span,
.nutrition-risk-card p {
  color: var(--muted);
  font-size: 0.78rem;
}

.nutrition-risk-card span {
  font-weight: 800;
  text-align: right;
}

.nutrition-risk-card p {
  margin: 0;
}

.nutrition-risk-meter span {
  background: var(--risk-good);
}

.nutrition-risk-meter-watch span {
  background: var(--risk-watch);
}

.nutrition-risk-meter-reduce span {
  background: var(--risk-reduce);
}

.nutrition-score-line {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nutrition-score-line strong {
  color: var(--text);
}

.nutrition-risk-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--primary-strong);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  text-align: center;
}

.nutrition-risk-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  display: none;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-raised);
  color: var(--text);
  text-align: left;
}

.nutrition-risk-info:hover .nutrition-risk-tooltip,
.nutrition-risk-info:focus .nutrition-risk-tooltip,
.nutrition-risk-info:focus-within .nutrition-risk-tooltip {
  display: grid;
  gap: 0.35rem;
}

.nutrition-risk-source-row {
  display: block;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: left;
}

.nutrition-risk-source-row small {
  display: block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.nutrition-risk-watch {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.nutrition-risk-reduce {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.nutrition-bar {
  display: flex;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--bg-accent);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.nutrition-bar span {
  display: block;
  height: 100%;
}

.nutrition-bar span:first-child {
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
}

.nutrition-bar span:last-child {
  border-top-right-radius: inherit;
  border-bottom-right-radius: inherit;
}

.nutrition-bar-rest {
  background: var(--chart-primary);
}

.nutrition-bar-day {
  background: var(--nutrition-day);
}

.nutrition-low .nutrition-bar-rest {
  background: var(--nutrition-low);
}

.nutrition-ok .nutrition-bar-rest {
  background: var(--chart-secondary);
}

.nutrition-highlight-line {
  margin: 0.35rem 0;
  color: var(--primary-strong);
  font-size: 0.9rem;
}

.plan-date-hint {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--primary-strong);
  background: var(--bg-accent);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  display: inline-block;
}

.plan-date-hint.plan-auto-saved {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.plan-auto-saved-prominent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 100%;
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 0.5rem 0.65rem;
  border-left: 4px solid var(--success);
}

.plan-saved-ico {
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1.2;
}

.app-toast-host {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
  pointer-events: none;
}

.app-toast-host .app-toast {
  pointer-events: auto;
}

.app-toast {
  width: min(100%, 34rem);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  box-shadow: var(--shadow-raised);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  animation: toast-in 0.35s ease-out;
}

.app-toast-compact {
  width: fit-content;
  max-width: min(100%, 28rem);
  padding: 0.55rem 0.75rem;
}

.app-toast-fade {
  animation: toast-out 0.4s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.app-toast-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.app-toast-text p {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
}

.app-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.app-toast .toast-goto-plan {
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--primary);
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
}

.app-toast .toast-goto-plan:hover {
  filter: brightness(1.05);
}

.item.item-plan-done {
  background: var(--surface-glass);
}

.plan-saved-inline {
  font-size: 0.9rem;
  color: var(--primary-strong);
  margin: 0.4rem 0 0.2rem;
}

.item.locked {
  opacity: 0.85;
  border-style: dashed;
}

.item.locked .item-head strong {
  text-decoration: line-through dotted;
  text-decoration-thickness: 1px;
}

.pill.lock-pill {
  background: var(--primary-hover);
  color: var(--on-primary);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--primary-strong);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill-negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill-positive {
  background: var(--success-soft);
  color: var(--success);
}

.preference-list {
  display: grid;
  gap: 0.75rem;
}

.preference-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-strong);
}

#medical-local {
  display: grid;
  gap: 20px;
  min-width: 0;
}

#medical-local .card {
  min-width: 0;
}

#medical-local h2 {
  margin: 0 0 12px;
}

#medical-local p {
  line-height: 1.6;
}

#medical-local label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

#medical-local input,
#medical-local textarea {
  width: 100%;
  min-width: 0;
}

.medical-local-unlock,
.medical-local-restore {
  display: grid;
  gap: 16px;
  max-width: 520px;
  margin: 24px 0;
}

.medical-local-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
}

.medical-local-file {
  flex: 1 1 280px;
}

.medical-local-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.medical-local-wide {
  grid-column: 1 / -1;
}

.medical-local-document {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}

.medical-local-document > div:first-child {
  display: grid;
  gap: 6px;
}

.medical-local-storage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}

.medical-local-storage > div {
  display: grid;
  gap: 6px;
}

.medical-local-legacy {
  padding: 16px;
  margin: 20px 0;
  border-radius: 12px;
  background: var(--primary-tint);
}

.medical-local-document .medical-local-actions {
  margin: 0;
}

.medical-local-manual {
  padding: 16px 0;
}

#medical-local summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
}

.medical-local-review {
  border-color: var(--primary);
}

.medical-local-review-row {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin: 24px 0;
  padding: 16px;
}

#medical-local .medical-local-review-row legend label {
  display: flex;
  align-items: center;
}

#medical-local input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.medical-local-evidence {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}

.medical-local-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

.medical-local-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.medical-local-table th,
.medical-local-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 105px;
  vertical-align: top;
}

.medical-local-table thead {
  color: var(--muted);
}

.medical-local-notice {
  position: sticky;
  top: 12px;
  z-index: 2;
  margin: 0;
  padding: 14px 18px;
  border: 1px solid var(--success-border);
  border-radius: 12px;
  background: var(--success-soft);
  color: var(--success);
}

.medical-local-error {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-soft);
}

.medical-local-note {
  margin: 20px 0;
}

.medical-local-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.medical-local-preview {
  width: 100%;
  max-height: 70vh;
  min-height: 300px;
  border: 0;
  object-fit: contain;
  margin-top: 16px;
}

iframe.medical-local-preview {
  height: 65vh;
}

@media (max-width: 640px) {
  .medical-local-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .medical-local-document,
  .medical-local-preview-head {
    flex-direction: column;
    align-items: start;
  }

  .medical-local-actions > button {
    flex: 1 1 auto;
  }
}

.medical-route {
  --medical-green: var(--success);
  --medical-green-soft: var(--success-soft);
  --medical-amber: var(--warning);
  --medical-amber-soft: var(--warning-soft);
  --medical-red: var(--danger);
  --medical-red-soft: var(--danger-soft);
  --medical-line: var(--border-soft);
}

.medical-section-head {
  margin-bottom: 1.15rem;
}

.medical-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
}

.medical-section-icon {
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--medical-green-soft);
  color: var(--primary-strong);
}

.medical-section-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.medical-section-heading .eyebrow,
.medical-values-title .eyebrow {
  margin-bottom: 0.25rem;
  color: var(--medical-green);
}

.medical-section-heading h2,
.medical-values-title h2 {
  letter-spacing: -0.025em;
}

.medical-section-copy {
  max-width: 34rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.medical-upload-card {
  background: linear-gradient(135deg, var(--surface-strong) 0%, var(--surface-soft) 100%);
}

.medical-upload-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.medical-file-field,
.medical-file-field input {
  min-width: 0;
  width: 100%;
}

.medical-file-field input[type="file"] {
  padding: 0.38rem;
  border-color: var(--medical-line);
}

.medical-file-field input[type="file"]::file-selector-button {
  margin-right: 0.65rem;
  padding: 0.48rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: var(--medical-green-soft);
  color: var(--primary-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.medical-upload-form button[type="submit"] {
  min-height: 2.65rem;
  padding-inline: 1rem;
  font-weight: 750;
}

.medical-list {
  display: grid;
  gap: 0.75rem;
}

.medical-import-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.medical-import-panel {
  display: grid;
  gap: 0.75rem;
}

.medical-upload-status {
  margin: 0.75rem 0;
  border: 1px solid var(--medical-line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  background: var(--surface-strong);
  overflow-wrap: anywhere;
}

.medical-upload-status-busy {
  border-color: var(--success-border);
  background: var(--status-success-tint);
}

.medical-upload-status-success {
  border-color: var(--success-border);
  background: var(--status-success-tint);
}

.medical-upload-status-error {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.medical-marker-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.medical-sex-toggle {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--medical-line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.medical-sex-toggle .ghost-button {
  min-height: 2.35rem;
  border: 0;
  background: transparent;
}

.medical-sex-toggle .active {
  color: var(--primary-strong);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.medical-sort-control {
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.medical-sort-control select {
  min-width: 12rem;
  min-height: 2.75rem;
  border-color: var(--medical-line);
}

.medical-item {
  border: 1px solid var(--medical-line);
  border-radius: 14px;
  padding: 0.75rem;
  background: var(--surface-strong);
}

.medical-import-item {
  padding: 0.55rem 0.65rem;
}

.medical-document-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.medical-import-title {
  min-width: 0;
  flex: 1 1 auto;
}

.medical-import-title strong {
  overflow-wrap: anywhere;
}

.medical-import-date {
  margin-left: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.medical-import-detail {
  margin-top: 0.25rem;
}

.medical-delete-button {
  flex: 0 0 auto;
}

.medical-item p {
  margin: 0.35rem 0 0;
}

.medical-warning {
  color: var(--danger);
  font-weight: 700;
}

.medical-table {
  min-width: 0;
  overflow: visible;
}

.medical-marker-list-head,
.medical-marker-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(7rem, 0.65fr);
  gap: 0.85rem;
  align-items: center;
}

.medical-marker-list-head {
  padding: 0 0.9rem 0.25rem 1.05rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.medical-marker-list {
  display: grid;
  gap: 0.55rem;
}

.medical-marker-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--medical-line);
  border-left: 4px solid var(--border-accent);
  border-radius: 14px;
  background: var(--surface-strong);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.medical-marker-card.medical-marker-ok {
  border-left-color: var(--medical-green);
}

.medical-marker-card.medical-marker-high {
  border-left-color: var(--medical-red);
}

.medical-marker-card.medical-marker-low {
  border-left-color: var(--medical-amber);
}

.medical-marker-row {
  width: 100%;
  min-width: 0;
  padding: 0.8rem 0.8rem 0.8rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  outline: none;
}

.medical-marker-card:hover,
.medical-marker-card:focus-within {
  box-shadow: var(--shadow-soft);
}

.medical-marker-row:hover,
.medical-marker-row.selected,
.medical-marker-row:focus-visible {
  background: var(--primary-tint);
}

.medical-marker-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

.medical-marker-name strong,
.medical-marker-name span {
  display: block;
  overflow-wrap: anywhere;
}

.medical-marker-name span,
.medical-marker-date > span:first-child {
  color: var(--muted);
  font-size: 0.84rem;
}

.medical-marker-value strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.medical-marker-target {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.medical-marker-date {
  white-space: nowrap;
}

.medical-status-pill {
  margin: 0;
  padding: 0.23rem 0.5rem;
  font-size: 0.72rem;
}

.medical-status-pill.medical-status-ok {
  background: var(--success-soft);
  color: var(--success);
}

.medical-status-pill.medical-status-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.medical-status-pill.medical-status-low {
  background: var(--warning-soft);
  color: var(--warning);
}

.medical-status-pill.medical-status-missing,
.medical-status-pill.medical-status-unknown {
  background: var(--surface-muted);
  color: var(--muted);
}

.medical-row-disclosure {
  width: 1.55rem;
  height: 1.55rem;
  display: inline-grid;
  place-items: center;
  margin-left: 0.2rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--primary-strong);
  vertical-align: middle;
  transition: transform 0.18s ease;
}

.medical-row-disclosure svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.medical-marker-row.selected .medical-row-disclosure {
  transform: rotate(180deg);
}

.medical-history-panel {
  padding: 0.7rem 0.85rem 0.85rem;
  border-top: 1px solid var(--medical-line);
  background: var(--surface-soft);
}

.medical-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.2rem 0.45rem;
}

.medical-history-list {
  display: grid;
  gap: 0.5rem;
}

.medical-history-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 0.75fr) auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.7rem;
  border: 1px solid var(--medical-line);
  border-radius: 11px;
  background: var(--surface-strong);
}

.medical-history-field {
  min-width: 0;
}

.medical-history-field > span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.medical-history-field strong,
.medical-history-field p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.35;
}

.medical-history-head span,
.medical-table-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.medical-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.medical-overview-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--medical-line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.medical-overview-item span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.medical-overview-item strong {
  color: var(--text);
  font-size: 1.15rem;
}

.medical-overview-item small {
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 650;
}

.medical-overview-ok {
  border-color: var(--success-border);
  background: var(--medical-green-soft);
}

.medical-overview-ok strong {
  color: var(--success);
}

.medical-overview-alert {
  border-color: var(--danger-border);
  background: var(--medical-red-soft);
}

.medical-overview-alert strong {
  color: var(--danger);
}

.medical-table-hint {
  margin: 0.8rem 0 0.2rem;
}

.medical-observation-delete {
  white-space: nowrap;
}

.target-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.target-form textarea {
  width: 100%;
  resize: vertical;
}

.confidence-low,
.reminder-due,
.reminder-never {
  background: var(--danger-soft);
}

.confidence-medium,
.reminder-soon {
  background: var(--warning-soft);
}

.confidence-high,
.reminder-ok {
  background: var(--success-soft);
}

.ghost-button {
  background: transparent;
  color: var(--primary-strong);
  border: 1px solid var(--border);
}

.zubereitung-block {
  margin: 0.25rem 0 0.5rem;
}

.instruction-lines {
  display: block;
  margin-top: 0.2rem;
  white-space: pre-line;
  line-height: 1.45;
}

.recipe-dialog {
  width: min(760px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.recipe-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.recipe-dialog-shell {
  padding: 1rem;
}

.recipe-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.9rem;
}

.recipe-dialog-head h2 {
  margin: 0.1rem 0 0;
}

.recipe-dialog-body {
  display: grid;
  gap: 0.9rem;
}

.recipe-dialog-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recipe-dialog-rationale {
  margin: 0;
}

.recipe-dialog-section {
  display: grid;
  gap: 0.3rem;
}

.recipe-dialog-section p {
  margin: 0;
}

.recipe-dialog-actions {
  padding-top: 0.35rem;
}

@media (max-width: 1100px) {
  .supplement-form {
    grid-template-columns: minmax(11rem, 13rem) minmax(14rem, 1fr) minmax(10rem, 12rem);
  }

  .supplement-form .field-submit {
    justify-self: start;
  }

  .medical-history-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .medical-history-source,
  .medical-history-item .medical-observation-delete {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .medical-upload-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .medical-upload-form .field-submit label {
    display: none;
  }

  .medical-upload-form button[type="submit"] {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 1rem 0.9rem 2rem;
  }

  #chat-form .chat-composer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
  }

  .chat-mode-options {
    grid-template-columns: 1fr;
  }

  .chat-mode-option {
    min-height: auto;
  }

  .chat-mode-status {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-category-field {
    grid-column: 1 / -1;
    justify-content: space-between;
    width: 100%;
  }

  .chat-category-field select {
    width: min(12rem, 62vw);
    max-width: none;
  }

  .chat-input-wrap {
    grid-column: 1;
  }

  #chat-form .chat-composer-row > button[type="submit"] {
    grid-column: 2;
    align-self: center;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .supplement-form {
    grid-template-columns: 1fr;
  }

  .supplement-dose-row {
    grid-template-columns: minmax(0, 1fr) minmax(5rem, 6rem);
  }

  .supplement-form .field-submit,
  .supplement-form button[type="submit"] {
    justify-self: stretch;
    width: 100%;
  }

  .medical-document-head {
    align-items: stretch;
    flex-direction: column;
  }

  .medical-import-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .medical-import-summary button {
    width: 100%;
  }

  .medical-marker-controls,
  .medical-sex-toggle {
    justify-content: stretch;
    width: 100%;
  }

  .medical-sex-toggle button,
  .medical-sort-control,
  .medical-sort-control select {
    flex: 1 1 8rem;
    width: 100%;
  }

  .medical-delete-button {
    width: 100%;
  }

  .nutrition-bars,
  .nutrition-risk-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
  }

  .recipe-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .recipe-dialog-shell {
    padding: 0.85rem;
  }

}

/* Intuitive day workspace -------------------------------------------------- */
.route-panel,
.route-companion,
.desktop-sidebar { display: none; }

.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;
}

.planner-intro,
.planner-section,
.analysis-head,
.settings-intro,
.day-overview-head { border-bottom: 1px solid var(--border-soft); }

.planner-intro h2,
.analysis-head h2,
.settings-intro h2,
.day-overview-head h2,
.planner-section h3 {
  margin: 0.2rem 0 0;
  color: var(--heading);
  letter-spacing: -0.035em;
}

.planner-intro p,
.analysis-head p,
.settings-intro p,
.day-overview-head p,
.desktop-day-add p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.planner-instruction,
.mobile-planner-instruction { display: grid; gap: 0.45rem; }
.planner-instruction > span,
.mobile-planner-instruction > span { color: var(--text); font-size: 0.82rem; font-weight: 800; }
.planner-instruction small,
.mobile-planner-instruction small { color: var(--muted); font-weight: 600; }
.planner-instruction textarea,
.mobile-planner-instruction textarea {
  width: 100%;
  resize: vertical;
  border-color: var(--border);
  background: var(--surface-soft);
  line-height: 1.45;
}

.planner-primary-action,
.planner-result-actions,
.planner-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }

.planner-section-head,
.analysis-head,
.day-overview-head,
.desktop-day-add {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.planner-meal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 0.85rem;
}

.planner-meal-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-strong);
}
.planner-meal-card.is-eaten { background: var(--surface-soft); }
.planner-meal-card.is-suggestion { border-color: var(--border-accent); background: var(--primary-tint); }
.planner-meal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.planner-meal-title,
.day-entry-title {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}
.planner-meal-title { margin-top: 0.75rem; }
.planner-meal-title:hover,
.day-entry-title:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 0.18em; }
.planner-meal-card p { margin: 0.55rem 0; color: var(--muted); line-height: 1.45; }
.planner-meal-card small { display: block; margin: 0.6rem 0 0.85rem; color: var(--muted-soft); line-height: 1.45; }
.planner-card-error { color: var(--danger) !important; font-weight: 750; }

.planner-empty,
.planner-empty-intro,
.desktop-day-empty { grid-column: 1 / -1; padding: 1.4rem 0; color: var(--muted); }
.planner-empty strong,
.planner-empty span,
.desktop-day-empty strong { display: block; }
.planner-status:empty { display: none; }
.planner-loading,
.planner-error,
.planner-complete,
.planner-result-message,
.planner-empty-intro {
  margin: 0;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--muted-soft);
  background: var(--surface-soft);
}
.planner-loading { display: flex; align-items: center; gap: 0.8rem; }
.planner-loading > span {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 2px solid var(--border-accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: planner-spin 700ms linear infinite;
}
.planner-loading p,
.planner-error p,
.planner-complete p,
.planner-empty-intro p { margin: 0.25rem 0 0; color: var(--muted); }
.planner-error { border-left-color: var(--danger); background: var(--danger-soft); }
.planner-complete { border-left-color: var(--success); background: var(--success-soft); }
@keyframes planner-spin { to { transform: rotate(360deg); } }

.day-entry-row { padding: 1rem 0; border-bottom: 1px solid var(--border-soft); }
.day-entry-row:last-child { border-bottom: 0; }
.day-entry-main { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto; align-items: center; gap: 0.85rem; }
.day-entry-meal-type { color: var(--muted-soft); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.day-entry-row > p { margin: 0.5rem 0 0 6.85rem; color: var(--muted); }
.day-entry-row .card-actions,
.day-entry-nutrition { margin-left: 6.85rem; }
.desktop-day-add { margin-top: auto; padding-top: 1.1rem; border-top: 1px solid var(--border-soft); }
.desktop-shopping-list {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}
.desktop-shopping-list p { margin: 0.3rem 0 0; color: var(--muted); }
.shopping-list-controls { display: flex; align-items: flex-end; gap: 0.55rem; }
.shopping-list-controls label { color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.shopping-list-controls select { min-width: 7rem; }

@media (max-width: 720px) {
  .shopping-list-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .shopping-list-controls label { grid-column: 1 / -1; }
  .shopping-list-controls select { min-width: 0; width: 100%; }
}

.analysis-period {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-soft);
}
.analysis-period button { min-height: 2.2rem; padding: 0.35rem 0.9rem; border: 0; background: transparent; color: var(--muted); }
.analysis-period button.active { background: var(--surface-strong); color: var(--primary-strong); box-shadow: var(--shadow-soft); }
.analysis-nutrition-bar { position: relative; height: 0.55rem; overflow: hidden; border-radius: 99px; background: var(--progress-track); }
.analysis-nutrition-bar span { position: absolute; inset-block: 0; left: 0; border-radius: inherit; }
.analysis-projected { background: var(--progress-planned); }
.analysis-eaten { background: var(--progress-eaten); }
.analysis-legend { display: flex; align-items: center; gap: 0.4rem; margin: 0.55rem 0 1.1rem; color: var(--muted); font-size: 0.78rem; }
.analysis-legend span { width: 1.25rem; height: 0.45rem; border-radius: 99px; }
.analysis-legend .is-eaten { background: var(--progress-eaten); }
.analysis-legend .is-planned { margin-left: 0.6rem; background: var(--progress-planned); }
.settings-surface { display: grid; gap: 1.25rem; }
.settings-actions { padding-top: 1rem; border-top: 1px solid var(--border-soft); }

@media (min-width: 721px) {
  body {
    min-height: 100vh;
    overflow: hidden;
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }
  #app-shell.container {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 248px minmax(0, 1.6fr) minmax(340px, 0.9fr);
    grid-template-rows: 84px minmax(0, 1fr);
    gap: 0;
  }
  #app-shell.hidden { display: none; }
  .desktop-sidebar {
    grid-column: 1;
    grid-row: 1 / -1;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-text);
  }
  .desktop-sidebar-brand {
    min-height: 84px;
    padding: 0 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .desktop-sidebar-brand img { width: 2.35rem; height: 2.35rem; border-radius: 10px; }
  .desktop-sidebar-brand strong,
  .desktop-sidebar-brand span,
  .desktop-sidebar-foot span,
  .desktop-sidebar-foot strong { display: block; }
  .desktop-sidebar-brand span,
  .desktop-sidebar-foot span { margin-top: 0.12rem; color: var(--sidebar-muted); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; }
  .desktop-sidebar-nav { display: grid; gap: 1.15rem; padding: 1.25rem 0.9rem; }
  .desktop-nav-section { display: grid; gap: 0.25rem; }
  .desktop-nav-heading {
    width: 100%;
    min-height: 2rem;
    padding: 0.25rem 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    color: var(--sidebar-text);
    font-size: 0.76rem;
    font-weight: 800;
    text-align: left;
  }
  .desktop-nav-heading:hover,
  .desktop-nav-heading:focus-visible { color: var(--sidebar-text); outline: none; }
  .desktop-nav-section:not(.is-open) .desktop-nav-submenu { display: none; }
  .desktop-nav-section:not(.is-open) .desktop-nav-heading span:last-child { transform: rotate(180deg); }
  .desktop-nav-submenu { margin-left: 0.45rem; padding-left: 0.72rem; display: grid; gap: 0.08rem; border-left: 1px solid var(--sidebar-submenu); }
  .desktop-nav-item {
    width: 100%;
    min-height: 2.3rem;
    padding: 0.45rem 0.65rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--sidebar-muted);
    font-size: 0.76rem;
    font-weight: 650;
    text-align: left;
  }
  .desktop-nav-item:hover,
  .desktop-nav-item:focus-visible { background: var(--sidebar-hover); color: var(--sidebar-text); outline: none; }
  .desktop-nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); }
  .desktop-sidebar-foot { margin-top: auto; padding: 1rem 1.2rem 1.25rem; border-top: 1px solid var(--sidebar-border); }
  .desktop-sidebar-foot strong { margin-top: 0.35rem; overflow: hidden; color: var(--sidebar-text); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-logout { width: 100%; margin-top: 0.75rem; padding: 0.5rem 0.65rem; border: 1px solid var(--sidebar-control-border); background: transparent; color: var(--sidebar-muted); text-align: left; }
  .desktop-logout:hover { border-color: var(--sidebar-control-border-hover); color: var(--sidebar-text); }
  #app-shell > .page-header {
    grid-column: 2 / -1;
    grid-row: 1;
    min-width: 0;
    padding: 0 1.65rem;
    border-bottom: 1px solid var(--border-soft);
    background: var(--surface-glass);
  }
  .page-header-top { height: 100%; flex-wrap: nowrap; align-items: center; }
  .page-header-text .eyebrow { color: var(--muted-soft); font-size: 0.62rem; }
  .page-header h1 { margin: 0.12rem 0 0; color: var(--heading); font-size: 1.4rem; letter-spacing: -0.035em; }
  .page-header p,
  .date-toolbar > .user-bar-label { display: none; }
  .date-toolbar { display: flex; align-items: center; }
  .user-plan-date { width: auto; margin: 0; }
  .user-plan-date-controls { grid-template-columns: 2.35rem minmax(9.5rem, 11rem) 2.35rem auto; }
  .user-plan-date-controls input,
  .user-plan-date-controls .ghost-button { min-height: 2.35rem; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-strong); color: var(--text); box-shadow: none; }
  #app-shell > .mobile-day-app,
  #app-shell > .mobile-chat-backdrop,
  .mobile-secondary-header,
  .recipe-management-switch { display: none !important; }
  #app-shell > .desktop-day-overview.active {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    padding: 1.55rem 1.7rem 1.4rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: var(--workspace);
  }
  #app-shell > .chat-workspace.active {
    grid-column: 3;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: block;
    overflow: hidden;
    border-left: 1px solid var(--border-soft);
    background: var(--workspace);
  }
  #mobile-chat-sheet.chat-card {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 1.35rem 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    background: var(--workspace);
    box-shadow: none;
  }
  #mobile-chat-sheet > .section-head { flex: 0 0 auto; padding-bottom: 0.85rem; border-bottom: 1px solid var(--border-soft); }
  #mobile-chat-sheet > .section-head h2 { margin-top: 0.12rem; font-size: 1.12rem; }
  #mobile-chat-sheet .chat-log { min-height: 0; flex: 1 1 auto; overflow-y: auto; }
  #mobile-chat-sheet #chat-form { flex: 0 0 auto; padding-top: 0.75rem; border-top: 1px solid var(--border-soft); background: var(--workspace); }
  #app-shell > .planner-workspace.active,
  #app-shell > .analysis-workspace.active,
  #app-shell > .content-route.active {
    grid-column: 2 / -1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 0;
    overflow-y: auto;
    background: var(--workspace);
  }
  .planner-intro,
  .planner-section,
  .analysis-head { padding: 1.5rem 2rem; }
  .planner-intro { display: grid; grid-template-columns: minmax(15rem,0.8fr) minmax(20rem,1.35fr) auto; align-items: end; gap: 1.4rem; }
  .planner-section { display: grid; gap: 1rem; }
  .analysis-workspace > .nutrition-summary { padding: 1.35rem 2rem 2.5rem; }
  .content-route { padding: 1.5rem 1.75rem 2.5rem; }
  .content-route > .card { border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; box-shadow: none; }
  .settings-route { padding: 0 !important; }
  .settings-surface { width: min(100%,54rem); padding: 1.8rem 2rem 3rem; }
  .settings-intro { padding-bottom: 1.1rem; }
}

@media (min-width: 721px) and (max-width: 1100px) {
  body { overflow: auto; }
  #app-shell.container { height: auto; grid-template-columns: 220px minmax(0,1fr); grid-template-rows: 84px auto auto; }
  .desktop-sidebar { position: sticky; top: 0; height: 100vh; }
  #app-shell > .page-header { grid-column: 2; }
  #app-shell > .desktop-day-overview.active { grid-column: 2; grid-row: 2; min-height: 32rem; overflow: visible; }
  #app-shell > .chat-workspace.active { grid-column: 2; grid-row: 3; min-height: 36rem; border-top: 1px solid var(--border-soft); border-left: 0; }
  #app-shell > .planner-workspace.active,
  #app-shell > .analysis-workspace.active,
  #app-shell > .content-route.active { grid-column: 2; grid-row: 2 / span 2; min-height: calc(100vh - 84px); overflow: visible; }
  .planner-intro { grid-template-columns: 1fr; align-items: stretch; }
  .custom-theme-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  #app-shell > .page-header,
  #app-shell > .desktop-sidebar,
  #app-shell > .route-panel,
  #app-shell > .chat-workspace { display: none !important; }
  #app-shell.mobile-secondary-open > .route-panel.active {
    min-height: 100dvh;
    padding: 0 0.75rem max(1rem, env(safe-area-inset-bottom));
    display: grid !important;
    align-content: start;
    gap: 0.75rem;
    background: var(--canvas);
  }
  #app-shell.mobile-chat-open > .chat-workspace {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    display: block !important;
    padding: 0;
  }
  #app-shell.mobile-secondary-open > .mobile-day-app { display: none; }
  .settings-surface { padding: 0.9rem 0.15rem 1.5rem; }
  .settings-intro { padding-bottom: 0.9rem; }
  .tracking-level-grid { grid-template-columns: 1fr; }
  .tracking-level-grid label { padding: 0.75rem 0.8rem; }
  .tracking-level-summary { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
  .mobile-settings-menu { width: min(19rem,calc(100vw - 1.8rem)); max-height: min(70dvh,34rem); overflow-y: auto; gap: 0; padding: 0.55rem; }
  .mobile-menu-group { display: grid; gap: 0.05rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border-subtle); }
  .mobile-menu-group > span { padding: 0.35rem 0.8rem 0.2rem; color: var(--muted); font-size: 0.66rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
  .mobile-menu-logout { margin-top: 0.35rem; color: var(--danger) !important; }
  .mobile-planner-instruction { margin-bottom: 0.7rem; text-align: left; }
  .mobile-planner-actions-row { display: grid; grid-template-columns: 1fr; gap: 0.45rem; }
  .mobile-planner-actions-row button { width: 100%; }
  .mobile-planner-error { color: var(--danger); font-weight: 750; }
  .mobile-planner-complete { color: var(--success); font-weight: 750; }
  .content-route > .card,
  .settings-route .settings-surface { border: 0; border-radius: 0; box-shadow: none; }

  .theme-options {
    grid-template-columns: 1fr;
  }

  .theme-option {
    min-height: 0;
    grid-template-columns: auto 4.2rem minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
  }

  .theme-option-copy {
    grid-column: 3;
  }

  .custom-theme-layout,
  .custom-theme-fields {
    grid-template-columns: 1fr;
  }

  .custom-theme-preview {
    min-height: 11.5rem;
  }

  .custom-theme-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .custom-theme-actions button {
    width: 100%;
  }
}

::placeholder {
  color: var(--muted-soft);
  opacity: 1;
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring) !important;
  outline-offset: 2px;
}

@media (max-width: 800px) {
  .auth-gate {
    padding: 1.25rem;
  }

  .auth-gate-inner {
    gap: 1rem;
  }
}

@media (max-width: 420px) {
  .auth-gate {
    padding: 1rem;
  }

  .auth-login {
    padding: 1.25rem;
  }
}

@media (max-height: 650px) {
  .auth-gate {
    padding: 0.75rem 1rem;
    place-items: start center;
  }

  .auth-gate-inner {
    gap: 0.5rem;
  }

  .auth-brand-logo {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.4rem;
  }

  .auth-brand strong {
    font-size: 0.95rem;
  }

  .auth-login {
    padding: 1rem;
  }

  .auth-login h1 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
  }

  .auth-form,
  .auth-reset-form {
    gap: 0.65rem;
  }

  .auth-form label,
  .auth-reset-form label {
    margin-bottom: 0;
    font-size: 0.7rem;
  }

  .auth-form input,
  .auth-reset-form input {
    min-height: 2.35rem;
    padding: 0.35rem 0;
  }

  .auth-actions {
    margin-top: 0.2rem;
  }

  .auth-actions .auth-primary,
  .auth-google {
    min-height: 2.75rem;
  }

  .auth-register-prompt {
    margin-top: -0.1rem;
    font-size: 0.78rem;
  }

  .auth-divider {
    margin: 0.75rem 0;
  }
}

@media (max-width: 720px) {
  #app-shell.mobile-secondary-open > .route-panel.medical-route {
    gap: 0.85rem;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    background: var(--canvas);
  }

  .content-route.medical-route > .card {
    padding: 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-soft);
  }

  .content-route.medical-route > .medical-upload-card {
    background: linear-gradient(145deg, var(--surface-strong) 0%, var(--surface-soft) 100%);
  }

  .medical-section-head,
  .medical-values-head {
    margin-bottom: 0.9rem;
  }

  .medical-section-heading {
    gap: 0.7rem;
  }

  .medical-section-icon {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 12px;
  }

  .medical-section-heading h2,
  .medical-values-title h2 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .medical-section-copy,
  .medical-values-title p {
    font-size: 0.88rem;
    line-height: 1.42;
  }

  .medical-upload-form {
    gap: 0.65rem;
    margin-bottom: 0.8rem;
  }

  .medical-upload-form .field-submit label {
    display: none;
  }

  .medical-upload-form button[type="submit"] {
    width: 100%;
    min-height: 2.8rem;
  }

  .medical-file-field input[type="file"] {
    min-height: 2.8rem;
    font-size: 0.83rem;
  }

  .medical-import-date {
    display: block;
    margin: 0.25rem 0 0;
  }

  .medical-values-head {
    display: grid;
    gap: 0.85rem;
  }

  .medical-marker-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .medical-sex-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .medical-sex-toggle button,
  .medical-sort-control,
  .medical-sort-control select {
    min-width: 0;
    width: 100%;
  }

  .medical-overview {
    gap: 0.4rem;
    margin: 0.1rem 0 0.8rem;
  }

  .medical-overview-item {
    display: grid;
    justify-items: start;
    gap: 0.15rem;
    padding: 0.6rem;
    border-radius: 12px;
  }

  .medical-overview-item span {
    font-size: 0.7rem;
  }

  .medical-overview-item strong {
    font-size: 1.05rem;
  }

  .medical-table-hint {
    margin: 0 0 0.55rem;
  }

  .medical-marker-list-head {
    display: none;
  }

  .medical-marker-list {
    gap: 0.65rem;
  }

  .medical-marker-card {
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
  }

  .medical-marker-row {
    grid-template-columns: minmax(0, 1fr) minmax(7.2rem, auto);
    gap: 0.75rem 0.8rem;
    padding: 0.9rem;
    border-radius: 12px;
  }

  .medical-marker-name {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .medical-marker-name strong {
    font-size: 0.98rem;
    line-height: 1.25;
  }

  .medical-marker-name span {
    margin-top: 0.2rem;
    font-size: 0.72rem;
  }

  .medical-marker-value {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    text-align: right;
  }

  .medical-marker-value strong {
    margin: 0 0 0.3rem;
    font-size: 1.08rem;
    line-height: 1.2;
  }

  .medical-marker-target,
  .medical-marker-date {
    min-width: 0;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border-soft);
    font-size: 0.82rem;
  }

  .medical-marker-target {
    grid-column: 1;
    grid-row: 2;
  }

  .medical-marker-date {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
    white-space: nowrap;
  }

  .medical-marker-target::before,
  .medical-marker-date::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.2rem;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .medical-row-disclosure {
    width: 1.35rem;
    height: 1.35rem;
    margin-left: 0.1rem;
  }

  .medical-history-panel {
    padding: 0.8rem;
  }

  .medical-history-head {
    padding: 0 0 0.65rem;
  }

  .medical-history-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.8rem;
    padding: 0.75rem;
    border-radius: 12px;
  }

  .medical-history-source,
  .medical-history-item .medical-observation-delete {
    grid-column: 1 / -1;
  }

  .medical-observation-delete {
    width: 100%;
  }
}

@media (min-width: 721px) {
  .content-route.medical-route > .medical-upload-card {
    background: linear-gradient(135deg, var(--surface-strong) 0%, var(--surface-soft) 100%);
  }
}

/* Gerichte-Rotation */
.rotation-workspace {
  --rotation-high: var(--success-action);
  --rotation-medium: var(--risk-watch);
  --rotation-low: var(--muted-soft);
}

.rotation-app {
  width: min(100%, 64rem);
  margin: 0 auto;
}

.rotation-app h2,
.rotation-app p {
  margin-top: 0;
}

.rotation-app button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.rotation-loading-state {
  min-height: 15rem;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  color: var(--text);
}

.rotation-loading-state p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.rotation-spinner {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  border: 2px solid var(--border-accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: rotation-spin 700ms linear infinite;
}

@keyframes rotation-spin {
  to {
    transform: rotate(360deg);
  }
}

.rotation-empty-state {
  width: min(100%, 42rem);
  min-height: 27rem;
  margin: clamp(0.5rem, 5vh, 3rem) auto;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  border-color: var(--border-accent);
  background:
    radial-gradient(circle at 50% 0%, var(--primary-tint), transparent 54%),
    var(--surface-strong);
}

.rotation-empty-state h2 {
  max-width: 30rem;
  margin-bottom: 0.75rem;
  color: var(--heading);
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.1;
}

.rotation-empty-state > p:not(.eyebrow, .rotation-inline-error) {
  max-width: 34rem;
  margin-bottom: 1.35rem;
  color: var(--muted);
  line-height: 1.55;
}

.rotation-empty-state small {
  max-width: 32rem;
  margin-top: 1rem;
  color: var(--muted);
  line-height: 1.45;
}

.rotation-empty-icon {
  width: 4.3rem;
  height: 4.3rem;
  margin-bottom: 1.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 2.15rem;
  font-weight: 300;
}

.rotation-start-button {
  min-height: 3rem;
  padding-inline: 1.35rem;
  font-weight: 800;
}

.rotation-setup-shell {
  width: min(100%, 48rem);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.rotation-setup-top {
  min-height: 3.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.rotation-setup-top .eyebrow {
  margin: 0 0 0.2rem;
  color: var(--primary-strong);
}

.rotation-setup-top h2 {
  margin: 0;
}

.rotation-wizard-progress {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.rotation-wizard-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 220ms ease;
}

.rotation-question-card {
  position: relative;
  min-height: 25rem;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  border-color: var(--border-accent);
  background: var(--surface-strong);
}

.rotation-question-number {
  position: absolute;
  top: 0.7rem;
  right: 1.1rem;
  margin: 0;
  color: var(--surface-muted);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  user-select: none;
}

.rotation-question-card h2 {
  position: relative;
  max-width: 34rem;
  margin-bottom: 0.65rem;
  color: var(--heading);
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  line-height: 1.15;
}

.rotation-question-card > p:not(.rotation-question-number) {
  position: relative;
  max-width: 32rem;
  margin-bottom: 0.9rem;
  color: var(--muted);
}

.rotation-question-ingredients {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rotation-question-ingredients span {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.rotation-answer-options {
  position: relative;
  width: 100%;
  margin-top: 1.6rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.rotation-answer-option {
  min-height: 7.4rem;
  padding: 1rem 0.7rem;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid var(--border-soft);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
}

.rotation-answer-option:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.rotation-answer-option.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.rotation-answer-symbol {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  font-size: 1.2rem;
  line-height: 1;
}

.rotation-wizard-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
}

.rotation-question-skip {
  justify-self: center;
  border-color: transparent;
}

.rotation-name-card {
  min-height: 17rem;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  display: flex;
  justify-content: center;
  flex-direction: column;
  border-color: var(--border-accent);
  background: var(--surface-strong);
}

.rotation-name-card label {
  margin-bottom: 0.45rem;
  color: var(--heading);
  font-weight: 800;
}

.rotation-name-card input {
  min-height: 3.15rem;
  font-size: 1.05rem;
}

.rotation-name-card p {
  margin: 1rem 0 0.35rem;
  color: var(--primary-strong);
  font-weight: 800;
}

.rotation-name-card small,
.rotation-generation-note {
  color: var(--muted);
}

.rotation-generation-note {
  margin: -2.5rem auto 0;
  text-align: center;
}

.rotation-error-state,
.rotation-no-results {
  min-height: 13rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  border: 1px solid var(--danger-border);
  border-radius: 16px;
  background: var(--danger-soft);
}

.rotation-error-state p,
.rotation-no-results p {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
}

.rotation-inline-error {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 750;
}

.rotation-dashboard {
  display: grid;
  gap: 1rem;
}

.rotation-toolbar {
  padding-bottom: 1rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.rotation-toolbar > label {
  min-width: min(100%, 17rem);
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rotation-toolbar select {
  min-height: 2.65rem;
  font-weight: 750;
  letter-spacing: normal;
  text-transform: none;
}

.rotation-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rotation-active-badge {
  min-height: 2.45rem;
  padding: 0.45rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--success-border);
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 850;
}

.rotation-delete-button {
  color: var(--danger);
}

.rotation-pool-header {
  padding: 0.65rem 0 0.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
}

.rotation-pool-header h2 {
  margin-bottom: 0.5rem;
  color: var(--heading);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.rotation-pool-header p:not(.eyebrow) {
  max-width: 45rem;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.rotation-context-strip {
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: minmax(12rem, 0.65fr) minmax(18rem, 1.35fr);
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  background: var(--primary-tint);
}

.rotation-context-strip div > span,
.rotation-context-strip div > strong {
  display: block;
}

.rotation-context-strip div > span {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rotation-context-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.rotation-meal-grid {
  display: grid;
  gap: 0.9rem;
}

.rotation-meal-card {
  --rotation-match-color: var(--rotation-low);
  padding: clamp(1rem, 2.5vw, 1.35rem);
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.rotation-meal-card:hover,
.rotation-meal-card:focus-visible {
  border-color: var(--rotation-match-color);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.rotation-meal-card.rotation-match-high {
  --rotation-match-color: var(--rotation-high);
}

.rotation-meal-card.rotation-match-medium {
  --rotation-match-color: var(--rotation-medium);
}

.rotation-match-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.rotation-match-head > div:first-child {
  display: grid;
}

.rotation-match-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.rotation-match-head strong {
  margin-top: -0.1rem;
  color: var(--rotation-match-color);
  font-size: 2.25rem;
  line-height: 1;
}

.rotation-match-head strong small {
  font-size: 1rem;
}

.rotation-meal-meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rotation-meal-meta span {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.rotation-match-progress {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.rotation-match-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--rotation-match-color);
}

.rotation-meal-title {
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 0;
  background: transparent;
  color: var(--heading);
  font-size: clamp(1.1rem, 2vw, 1.32rem);
  font-weight: 850;
  text-align: left;
}

.rotation-meal-title span:last-child {
  color: var(--muted);
  font-size: 1.7rem;
  font-weight: 300;
}

.rotation-meal-rationale,
.rotation-no-signals {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.rotation-match-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rotation-match-signals > span {
  padding: 0.35rem 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.rotation-reason {
  background: var(--success-soft);
  color: var(--success);
}

.rotation-caution {
  background: var(--warning-soft);
  color: var(--warning);
}

.rotation-meal-actions {
  padding-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.rotation-select-meal {
  min-height: 2.7rem;
  font-weight: 800;
}

.rotation-pool-footer {
  padding: 0.5rem 0 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.recipe-dialog-instructions {
  white-space: pre-line;
  line-height: 1.5;
}

@media (min-width: 721px) {
  .rotation-workspace {
    padding: 1.5rem 2rem 3rem !important;
  }
}

@media (max-width: 720px) {
  #app-shell.mobile-secondary-open > .rotation-workspace.active {
    padding-inline: 0.75rem;
  }

  .rotation-app {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .rotation-empty-state {
    min-height: calc(100dvh - 7.5rem);
    margin: 0;
    padding: 1.5rem 1.1rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .rotation-setup-shell,
  .rotation-dashboard {
    padding-top: 0.2rem;
  }

  .rotation-setup-top {
    align-items: center;
  }

  .rotation-setup-top h2 {
    font-size: 1.35rem;
  }

  .rotation-question-card {
    min-height: 0;
    padding: 1.35rem 1rem;
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
  }

  .rotation-question-number {
    font-size: 3rem;
  }

  .rotation-question-card h2 {
    max-width: calc(100% - 2rem);
    font-size: 1.45rem;
  }

  .rotation-answer-options {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .rotation-answer-option {
    min-height: 4.3rem;
    padding: 0.7rem 0.9rem;
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }

  .rotation-wizard-actions {
    grid-template-columns: 1fr 1fr;
  }

  .rotation-question-back {
    grid-column: 1;
  }

  .rotation-question-skip {
    grid-column: 2;
    justify-self: stretch;
  }

  .rotation-question-next,
  .rotation-generate-button {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 2.9rem;
  }

  .rotation-name-card {
    min-height: 14rem;
    padding: 1.25rem 1rem;
    border: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
  }

  .rotation-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .rotation-toolbar > label,
  .rotation-toolbar select {
    width: 100%;
  }

  .rotation-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rotation-toolbar-actions > * {
    justify-content: center;
  }

  .rotation-new-button {
    grid-column: 1;
  }

  .rotation-delete-button {
    grid-column: 2;
  }

  .rotation-pool-header {
    grid-template-columns: 1fr;
  }

  .rotation-refresh-button {
    justify-self: start;
  }

  .rotation-context-strip {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .rotation-meal-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .rotation-match-head {
    align-items: center;
  }

  .rotation-meal-meta {
    max-width: 60%;
  }

  .rotation-meal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rotation-meal-actions button {
    width: 100%;
  }

  .rotation-pool-footer {
    flex-direction: column;
  }
}

/* Kompakte Rotations-Slate: drei unabhaengige Slots statt langer Empfehlungsliste. */
.options-meals-per-day {
  max-width: 22rem;
}

.options-meals-per-day select {
  width: 100%;
}

.options-meals-per-day small {
  color: var(--muted);
  line-height: 1.4;
}

.rotation-workspace.active {
  overflow: hidden !important;
}

.rotation-app {
  width: 100%;
  max-width: 72rem;
  min-height: 0;
}

.rotation-slate-dashboard {
  height: 100%;
  min-height: 0;
  display: flex;
  gap: 0.65rem;
  flex-direction: column;
}

.rotation-slate-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rotation-slate-toolbar .eyebrow {
  margin-bottom: 0.14rem;
}

.rotation-slate-toolbar h2 {
  max-width: min(64vw, 42rem);
  margin: 0;
  overflow: hidden;
  color: var(--heading);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-slate-tools {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rotation-slate-tools > .rotation-refresh-button,
.rotation-management-menu > summary {
  width: 2.35rem;
  height: 2.35rem;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  box-shadow: none;
}

.rotation-management-menu {
  position: relative;
}

.rotation-management-menu > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.rotation-management-menu > summary::-webkit-details-marker {
  display: none;
}

.rotation-management-menu > div {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 40;
  width: max-content;
  min-width: 10.5rem;
  padding: 0.4rem;
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.rotation-management-menu > div button {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.45rem 0.65rem;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.rotation-management-menu > div .rotation-delete-button {
  color: var(--danger);
}

.rotation-swipe-hint {
  margin: 0 !important;
  color: var(--muted);
  font-size: 0.73rem;
  text-align: center;
}

.rotation-slate-error {
  margin: 0 !important;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
}

.rotation-slot-grid {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.55rem, 1.2vw, 0.9rem);
}

.rotation-slot-swipe-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 18px;
  background: var(--surface-soft);
}

.rotation-slot-swipe-shell > .mobile-swipe-action {
  gap: 0.32rem;
}

.rotation-slot-card {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.85rem, 2vh, 1.15rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.45rem, 1vh, 0.72rem);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  touch-action: pan-y;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.rotation-slot-card:hover,
.rotation-slot-card:focus-visible {
  border-color: var(--border-accent);
  box-shadow: var(--shadow);
}

.rotation-slot-card-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.rotation-slot-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.rotation-slot-title {
  width: 100%;
  min-height: 0;
  padding: 0;
  display: -webkit-box;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--heading);
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  font-weight: 850;
  line-height: 1.22;
  text-align: left;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rotation-focus-summary {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.rotation-focus-summary > span:not(.rotation-focus-more) {
  max-width: 100%;
  padding: 0.25rem 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-focus-empty {
  align-self: flex-start;
  min-height: 1.7rem;
  padding: 0.2rem 0.48rem;
  border: 1px dashed var(--border-accent);
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.15;
}

.rotation-focus-more {
  position: relative;
  z-index: 15;
}

.rotation-focus-more > button {
  min-width: 2rem;
  min-height: 1.7rem;
  padding: 0.18rem 0.42rem;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 850;
}

.rotation-focus-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.38rem);
  z-index: 50;
  width: max-content;
  max-width: min(17rem, calc(100vw - 2rem));
  max-height: 10rem;
  padding: 0.55rem;
  overflow-y: auto;
  display: grid;
  gap: 0.32rem;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.2rem);
  visibility: hidden;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.rotation-focus-more:hover .rotation-focus-popover,
.rotation-focus-more:focus-within .rotation-focus-popover,
.rotation-focus-more.is-open .rotation-focus-popover {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  visibility: visible;
}

.rotation-slot-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.rotation-slot-icon {
  width: 2.25rem;
  height: 2.25rem;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.rotation-slot-next {
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--muted);
}

.rotation-slot-plan {
  border: 1px solid var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.rotation-slot-empty .rotation-slot-card {
  justify-content: center;
  cursor: default;
}

.rotation-slot-empty strong {
  color: var(--heading);
}

.rotation-slot-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (min-width: 721px) {
  .rotation-workspace.active {
    padding: 1rem 1.25rem 1.25rem !important;
    align-content: stretch !important;
    grid-template-rows: minmax(0, 1fr);
  }

  .rotation-app {
    height: 100%;
  }

  .rotation-slot-grid {
    min-height: 12rem;
    flex: 0 0 auto;
    align-items: stretch;
  }

  .rotation-slot-swipe-shell,
  .rotation-slot-card {
    height: auto;
    min-height: 12rem;
  }

  .rotation-slot-swipe-shell > .mobile-swipe-action {
    display: none;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  #app-shell > .rotation-workspace.active {
    height: calc(100vh - 84px);
    min-height: 0;
    overflow: hidden !important;
  }
}

@media (max-width: 720px) {
  html:has(#app-shell[data-active-route="rotation"]:not(.hidden)),
  body:has(#app-shell[data-active-route="rotation"]:not(.hidden)) {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  #app-shell[data-active-route="rotation"] {
    height: 100dvh;
    overflow: hidden;
  }

  #app-shell.mobile-secondary-open > .rotation-workspace.active {
    position: fixed;
    inset: 0;
    z-index: 45;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    padding: 0 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    gap: 0;
    overflow: hidden !important;
    background: var(--canvas);
  }

  .rotation-workspace > .mobile-secondary-header {
    position: relative;
    margin: 0;
    padding: max(0.32rem, env(safe-area-inset-top)) 0.55rem 0.38rem;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    box-shadow: none;
  }

  .rotation-workspace > .mobile-secondary-header .eyebrow {
    font-size: 0.55rem;
  }

  .rotation-workspace > .mobile-secondary-header strong {
    font-size: 0.96rem;
  }

  .rotation-workspace .mobile-secondary-back {
    min-height: 2.15rem;
    font-size: 1.7rem;
  }

  .rotation-app {
    height: 100%;
    min-height: 0;
    padding: 0.48rem max(0.5rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
    overflow-y: auto;
  }

  .rotation-app:has(.rotation-slate-dashboard) {
    overflow: hidden;
  }

  .rotation-slate-dashboard {
    gap: 0.4rem;
    padding: 0 !important;
  }

  .rotation-slate-toolbar {
    min-height: 2.25rem;
  }

  .rotation-slate-toolbar .eyebrow {
    font-size: 0.56rem;
  }

  .rotation-slate-toolbar h2 {
    max-width: 58vw;
    font-size: 1rem;
  }

  .rotation-slate-tools > .rotation-refresh-button,
  .rotation-management-menu > summary {
    width: 2.05rem;
    height: 2.05rem;
  }

  .rotation-swipe-hint {
    font-size: 0.65rem;
    line-height: 1.15;
  }

  .rotation-slot-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 0.42rem;
  }

  .rotation-slot-swipe-shell {
    overflow: visible;
    border-radius: 15px;
  }

  .rotation-slot-swipe-shell > .mobile-swipe-action {
    border-radius: 15px;
  }

  .rotation-slot-swipe-shell > .mobile-swipe-action-left {
    background: var(--primary);
  }

  .rotation-slot-card {
    padding: clamp(0.58rem, 1.35vh, 0.78rem) 0.72rem;
    gap: clamp(0.25rem, 0.75vh, 0.42rem);
    border-radius: 15px;
  }

  .rotation-slot-label {
    font-size: 0.63rem;
  }

  .rotation-slot-title {
    font-size: clamp(0.94rem, 4.5vw, 1.08rem);
    line-height: 1.16;
  }

  .rotation-focus-summary {
    flex-wrap: nowrap;
  }

  .rotation-focus-summary > span:not(.rotation-focus-more) {
    min-width: 0;
    padding: 0.2rem 0.36rem;
    font-size: 0.64rem;
  }

  .rotation-focus-empty {
    min-height: 1.5rem;
    padding: 0.16rem 0.38rem;
    font-size: 0.62rem;
  }

  .rotation-focus-more {
    flex: 0 0 auto;
  }

  .rotation-focus-more > button {
    min-width: 1.8rem;
    min-height: 1.5rem;
    font-size: 0.65rem;
  }

  .rotation-slot-swipe-shell:first-child .rotation-focus-popover {
    top: calc(100% + 0.3rem);
    bottom: auto;
  }

  .rotation-slot-icon {
    width: 1.95rem;
    height: 1.95rem;
    font-size: 0.86rem;
  }
}

@media (max-width: 360px), (max-width: 390px) and (max-height: 700px), (max-height: 620px) and (max-width: 720px) {
  .rotation-app {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }

  .rotation-slate-dashboard {
    gap: 0.3rem;
  }

  .rotation-swipe-hint {
    display: none;
  }

  .rotation-slot-grid {
    gap: 0.32rem;
  }

  .rotation-slot-card {
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
    gap: 0.2rem;
  }

  .rotation-focus-summary > span:not(.rotation-focus-more) {
    max-width: calc(50% - 0.9rem);
  }

  .rotation-slot-icon {
    width: 1.8rem;
    height: 1.8rem;
  }
}

/* Einheitliche Rotationsplanung: 1–4 feste Slot-Zeilen mit echten Karten-Peeks. */
#app-shell[data-active-route="rotation"] {
  --rotation-arrow-rail: 2.35rem;
}

.rotation-workspace.active,
.rotation-app,
.rotation-slate-dashboard {
  min-height: 0;
  overflow: hidden;
}

.rotation-slate-dashboard {
  gap: clamp(0.28rem, 0.8vh, 0.55rem);
}

.rotation-slate-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-inline: var(--rotation-arrow-rail);
}

.rotation-meal-count-control {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
}

.rotation-meal-count-label,
.rotation-meal-count-source {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

.rotation-meal-count-source {
  padding: 0.16rem 0.36rem;
  border-radius: 999px;
  background: var(--surface-soft);
}

.rotation-meal-stepper {
  display: grid;
  grid-template-columns: 2rem 2.4rem 2rem;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--surface-strong);
}

.rotation-meal-stepper button,
.rotation-meal-stepper input {
  width: 100%;
  height: 2rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  box-shadow: none;
}

.rotation-meal-stepper button {
  color: var(--primary);
  font-size: 1.15rem;
}

.rotation-meal-stepper input {
  appearance: textfield;
  border-inline: 1px solid var(--border-soft);
  font-size: 0.88rem;
  font-weight: 900;
}

.rotation-meal-stepper input::-webkit-inner-spin-button,
.rotation-meal-stepper input::-webkit-outer-spin-button {
  appearance: none;
}

.rotation-day-summary {
  margin-inline: var(--rotation-arrow-rail);
  padding: 0.48rem 0.65rem;
  gap: 0.25rem;
}

.rotation-swipe-hint,
.rotation-slate-error {
  margin-inline: var(--rotation-arrow-rail) !important;
}

.rotation-day-summary-main > div:first-child > strong {
  font-size: clamp(0.98rem, 2vw, 1.28rem);
}

.rotation-day-target-percent strong {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.rotation-day-protein-progress,
.rotation-day-calorie-progress {
  height: 0.3rem;
}

.rotation-feasibility-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rotation-feasibility-warning button {
  min-height: 1.65rem;
  padding: 0.22rem 0.48rem;
  flex: 0 0 auto;
  border: 1px solid var(--warning-border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--warning);
  font-size: 0.67rem;
  font-weight: 850;
}

.rotation-estimate-warning {
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
}

.rotation-slot-grid,
.rotation-slate-dashboard[data-slot-count="4"] .rotation-slot-grid {
  --rotation-card-height: clamp(5.8rem, 13vh, 7.5rem);
  min-height: 0;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: clamp(0.28rem, 0.8vh, 0.55rem);
}

.rotation-slate-dashboard[data-slot-count="1"] .rotation-slot-grid {
  grid-template-rows: var(--rotation-card-height);
}

.rotation-slate-dashboard[data-slot-count="2"] .rotation-slot-grid {
  grid-template-rows: repeat(2, var(--rotation-card-height));
}

.rotation-slate-dashboard[data-slot-count="3"] .rotation-slot-grid {
  grid-template-rows: repeat(3, var(--rotation-card-height));
}

.rotation-slate-dashboard[data-slot-count="4"] .rotation-slot-grid {
  grid-template-rows: repeat(4, var(--rotation-card-height));
}

.rotation-slot-deck {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding-inline: var(--rotation-arrow-rail);
  display: block;
}

.rotation-carousel-arrow {
  position: absolute;
  top: 50%;
  z-index: 25;
  width: 1.9rem;
  height: 2.7rem;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  color: var(--primary);
  font-size: 1.55rem;
  line-height: 1;
  box-shadow: var(--shadow-soft);
  transform: translateY(-50%);
}

.rotation-carousel-arrow-previous {
  left: 0;
}

.rotation-carousel-arrow-next {
  right: 0;
}

.rotation-carousel-arrow:disabled {
  opacity: 0.25;
}

.rotation-carousel-viewport {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 16px;
  outline: none;
  touch-action: none;
  overscroll-behavior-x: contain;
  -webkit-user-select: none;
  user-select: none;
}

.rotation-carousel-viewport .rotation-slot-card {
  touch-action: none;
}

.rotation-carousel-viewport:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 38%, transparent);
}

.rotation-carousel-track {
  --rotation-peek: 0px;
  --rotation-gap: 0.38rem;
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  display: block;
  transform: translate3d(var(--rotation-drag-x, 0px), 0, 0);
  transition: transform 300ms cubic-bezier(0.22, 0.72, 0.2, 1);
  will-change: transform;
}

.rotation-carousel-viewport.is-dragging .rotation-carousel-track {
  transition: none;
}

.rotation-carousel-track > .rotation-carousel-slide {
  position: absolute;
  inset-block: 0;
  left: var(--rotation-peek);
  width: calc(100% - var(--rotation-peek) - var(--rotation-peek));
  height: 100%;
}

.rotation-carousel-viewport.is-fixed {
  width: 100%;
}

.rotation-carousel-viewport.is-fixed .rotation-slot-card {
  width: 100%;
}

.rotation-card-peek {
  overflow: hidden;
  background: var(--surface-soft);
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
  opacity: 0.68;
  pointer-events: auto;
}

.rotation-card-peek:hover {
  opacity: 0.82;
}

.rotation-card-peek-previous {
  transform: translate3d(calc(-100% - var(--rotation-gap)), 0, 0);
}

.rotation-card-peek-next {
  transform: translate3d(calc(100% + var(--rotation-gap)), 0, 0);
}

.rotation-card-peek.is-empty {
  pointer-events: none;
  opacity: 0.18;
}

.rotation-slot-card {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: clamp(0.48rem, 1.2vh, 0.72rem) clamp(0.55rem, 1vw, 0.82rem);
  padding-inline: clamp(0.65rem, 1vw, 0.82rem);
  gap: clamp(0.18rem, 0.55vh, 0.38rem);
  cursor: default;
}

.rotation-slot-title-row {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.rotation-card-metrics {
  width: 100%;
  min-width: 0;
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.55rem;
}

.rotation-card-metrics > :first-child {
  min-width: 0;
}

[data-rotation-current-card] {
  cursor: grab;
}

.rotation-carousel-viewport.is-dragging [data-rotation-current-card] {
  cursor: grabbing;
}

.rotation-slot-card.is-accepted {
  background: linear-gradient(115deg, var(--success-soft), var(--surface-strong));
}

.rotation-slot-title {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  font-size: clamp(0.9rem, 1.55vw, 1.14rem);
  line-height: 1.08;
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  -webkit-line-clamp: unset;
}

.rotation-title-button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-family: inherit;
  font-weight: 800;
  text-align: left;
}

.rotation-title-button:hover,
.rotation-title-button:focus-visible {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.rotation-overall-fit-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.22rem;
  color: var(--primary);
  font-size: clamp(0.7rem, 1.2vw, 0.86rem);
  font-weight: 800;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.rotation-overall-fit-badge strong {
  color: inherit;
  font: inherit;
}

.rotation-focus-summary {
  flex-wrap: nowrap;
}

.rotation-primary-focus {
  min-width: 0;
  max-width: none !important;
  padding: 0 !important;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  background: transparent !important;
  color: var(--primary) !important;
}

.rotation-primary-focus strong {
  flex: 0 0 auto;
  overflow: hidden;
  color: var(--primary);
  font-family: inherit;
  font-size: clamp(0.7rem, 1.2vw, 0.86rem);
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-primary-focus > span {
  color: var(--muted);
  font-size: 0.64rem;
  white-space: nowrap;
}

.rotation-focus-popover {
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 1000;
}

.rotation-slot-title-row > .rotation-fix-button {
  flex: 0 0 auto;
  min-height: 1.75rem;
  padding: 0.24rem 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
}

.rotation-fix-button {
  border: 1px solid var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.rotation-fix-button.is-unfix {
  border: 1px solid var(--success-border);
  background: var(--surface-strong);
  color: var(--success);
}

.rotation-card-metrics .rotation-add-quantities-button,
.rotation-card-metrics .rotation-quantity-prompt {
  min-height: 1.55rem;
  padding: 0.18rem 0.42rem;
  border: 1px dashed var(--border-accent);
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-family: inherit;
  font-size: clamp(0.7rem, 1.2vw, 0.86rem);
  font-weight: 800;
  line-height: 1.15;
}

.rotation-quantity-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 720px) {
  #app-shell {
    --mobile-day-outer-left: max(0.25rem, env(safe-area-inset-left));
    --mobile-day-outer-right: max(0.25rem, env(safe-area-inset-right));
    --mobile-day-arrow-rail: 1.75rem;
    --mobile-day-content-left: calc(var(--mobile-day-outer-left) + var(--mobile-day-arrow-rail));
    --mobile-day-content-right: calc(var(--mobile-day-outer-right) + var(--mobile-day-arrow-rail));
  }

  #app-shell[data-active-route="rotation"] {
    --rotation-arrow-rail: var(--mobile-day-arrow-rail);
  }

  .rotation-app {
    padding: 0.32rem var(--mobile-day-outer-right) max(0.35rem, env(safe-area-inset-bottom)) var(--mobile-day-outer-left);
  }

  .rotation-slate-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
  }

  .rotation-slate-toolbar > div:first-child {
    display: none;
  }

  .rotation-meal-count-control {
    justify-content: flex-start;
  }

  .rotation-meal-count-label {
    display: none;
  }

  .rotation-meal-stepper {
    grid-template-columns: 1.75rem 2.15rem 1.75rem;
  }

  .rotation-meal-stepper button,
  .rotation-meal-stepper input {
    height: 1.8rem;
  }

  .rotation-day-summary {
    padding: 0.3rem 0.48rem;
  }

  .rotation-day-summary-detail {
    font-size: 0.61rem;
  }

  .rotation-day-summary-main > div:first-child > span,
  .rotation-day-target-percent span {
    font-size: 0.54rem;
  }

  .rotation-day-summary-main > div:first-child > strong,
  .rotation-day-target-percent strong {
    font-size: 0.9rem;
  }

  .rotation-feasibility-warning {
    font-size: 0.61rem;
    line-height: 1.15;
  }

  .rotation-swipe-hint {
    display: none;
  }

  .rotation-slot-deck {
    display: block;
  }

  .rotation-carousel-arrow {
    width: 1.55rem;
    height: 2.2rem;
    border-radius: 999px;
    font-size: 1.15rem;
  }

  .rotation-carousel-arrow-previous {
    left: 0;
  }

  .rotation-carousel-arrow-next {
    right: 0;
  }

  .rotation-carousel-viewport {
    border-radius: 12px;
  }

  .rotation-carousel-track {
    --rotation-peek: 0px;
    --rotation-gap: 0.22rem;
  }

  .rotation-slot-card {
    padding: clamp(0.3rem, 0.75vh, 0.48rem) 0.48rem;
    display: flex;
    gap: clamp(0.18rem, 0.55vh, 0.3rem);
    border-radius: 12px;
  }

  .rotation-slot-title {
    display: block;
    font-size: clamp(0.76rem, 3.5vw, 0.94rem);
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
    -webkit-line-clamp: unset;
  }

  .rotation-slot-title-row > .rotation-fix-button {
    min-height: 1.42rem;
    padding: 0.12rem 0.36rem;
    font-size: 0.57rem;
  }

  .rotation-primary-focus strong {
    font-size: 0.62rem;
  }

  .rotation-primary-focus > span {
    font-size: 0.54rem;
  }

  .rotation-focus-more > button {
    min-width: 1.5rem;
    min-height: 1.3rem;
    padding: 0.08rem 0.28rem;
    font-size: 0.56rem;
  }

  .rotation-overall-fit-badge,
  .rotation-card-metrics .rotation-add-quantities-button,
  .rotation-card-metrics .rotation-quantity-prompt {
    font-size: 0.62rem;
  }

  .rotation-overall-fit-badge strong {
    font: inherit;
  }

  .rotation-card-peek {
    border-radius: 10px;
  }
}

@media (max-width: 390px) and (max-height: 700px) {
  .rotation-estimate-warning,
  .rotation-meal-count-source {
    display: none;
  }

  .rotation-day-protein-progress {
    display: none;
  }

  .rotation-slot-grid {
    gap: 0.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rotation-carousel-track {
    transition-duration: 1ms;
  }
}

.rotation-day-summary {
  display: grid;
  border: 1px solid var(--border-accent);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-tint), var(--surface-strong));
}

.rotation-day-summary-main,
.rotation-day-summary-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.rotation-day-summary-main > div:first-child,
.rotation-day-target-percent {
  min-width: 0;
  display: grid;
  gap: 0.04rem;
}

.rotation-day-target-percent {
  flex: 0 0 auto;
  text-align: right;
}

.rotation-day-summary-main > div:first-child > span,
.rotation-day-target-percent span {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rotation-day-summary-main > div:first-child > strong {
  color: var(--heading);
}

.rotation-day-target-percent strong {
  color: var(--primary);
}

.rotation-day-protein-progress,
.rotation-day-calorie-progress {
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}

.rotation-day-calorie-progress {
  display: flex;
}

.rotation-day-protein-progress span,
.rotation-day-calorie-progress span {
  display: block;
  flex: 0 0 auto;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.rotation-day-calorie-progress .is-consumed {
  border-radius: inherit 0 0 inherit;
  background: var(--muted);
}

.rotation-day-calorie-progress .is-planned {
  border-radius: 0;
  background: var(--success);
}

.rotation-day-calorie-progress .is-suggested {
  border-radius: 0 inherit inherit 0;
  background: var(--primary);
}

.rotation-day-calorie-progress.is-unknown {
  background: repeating-linear-gradient(
    135deg,
    var(--warning-soft) 0 0.35rem,
    var(--progress-track) 0.35rem 0.7rem
  );
}

.rotation-calorie-summary-detail {
  justify-content: space-between;
}

.rotation-calorie-planned-detail::before {
  width: 0.48rem;
  height: 0.48rem;
  margin-right: 0.25rem;
  display: inline-block;
  border-radius: 999px;
  background: var(--success);
  content: "";
  vertical-align: -0.02rem;
}

.rotation-calorie-summary.is-partial {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.rotation-calorie-goal-button {
  min-height: 1.65rem;
  padding: 0.2rem 0.48rem;
  font-size: 0.64rem;
}

.rotation-day-summary-detail {
  color: var(--muted);
  font-size: 0.66rem;
}

.rotation-day-summary-detail strong {
  color: var(--text);
}

.rotation-day-summary.is-infeasible {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

.rotation-feasibility-warning {
  color: var(--warning);
}

.rotation-slot-card.is-accepted {
  border-color: var(--success-border);
}

.rotation-protein-top-up-card {
  align-items: center;
  cursor: default;
  flex-direction: row;
  justify-content: space-between;
  gap: 0.45rem;
}

.rotation-protein-top-up-choice {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotation-protein-top-up-choice strong {
  color: var(--heading);
}

.rotation-protein-top-up-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.3rem;
}

.rotation-protein-top-up-actions button {
  min-width: 3.2rem;
  min-height: 1.8rem;
  padding: 0.2rem 0.48rem;
  flex: 0 0 auto;
  font-size: 0.68rem;
}

.rotation-protein-top-up-card > .rotation-fix-button {
  min-height: 1.8rem;
  padding: 0.2rem 0.48rem;
  flex: 0 0 auto;
  font-size: 0.68rem;
}

.rotation-slot-card[aria-busy="true"] {
  opacity: 0.68;
}

@media (min-width: 721px) {
  #app-shell > .rotation-workspace.active {
    height: calc(100vh - 84px);
    min-height: 0;
    padding: 0.75rem 1rem 1rem !important;
    overflow: hidden !important;
  }

  .rotation-app {
    height: 100%;
  }
}

@media (max-width: 720px) {
  #app-shell.container[data-active-route="rotation"].mobile-secondary-open {
    height: 100dvh;
    min-height: 0;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app {
    min-height: 0;
    display: contents !important;
  }

  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app > .mobile-day-header {
    position: relative;
    top: auto;
    z-index: 46;
    grid-row: 1;
    display: block !important;
  }

  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app > .mobile-day-scroll,
  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app > .mobile-settings-menu,
  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app > .mobile-chat-launcher,
  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-day-app > .mobile-settings-launcher,
  #app-shell[data-active-route="rotation"].mobile-secondary-open > .mobile-chat-backdrop {
    display: none !important;
  }

  #app-shell[data-active-route="rotation"].mobile-secondary-open > .rotation-workspace.active {
    position: relative;
    inset: auto;
    z-index: auto;
    grid-row: 2;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 0 !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden !important;
  }

  #app-shell[data-active-route="rotation"] .rotation-workspace > .mobile-secondary-header {
    display: none !important;
  }
}

/* Der Protein-Top-up bleibt als letzte Slot-Zeile voll bedienbar; die
   Mahlzeiten teilen sich den restlichen sichtbaren Bereich. */
.rotation-app:has(.rotation-protein-top-up-slot) {
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}

.rotation-app:has(.rotation-protein-top-up-slot) > .rotation-draft-banner {
  flex: 0 0 auto;
}

.rotation-app:has(.rotation-protein-top-up-slot) > .rotation-slate-dashboard {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) {
  gap: clamp(0.18rem, 0.45vh, 0.32rem);
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-slate-toolbar {
  min-height: 0;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-summary {
  padding: 0.28rem 0.5rem;
  gap: 0.14rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-summary-main > div:first-child > strong,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-target-percent strong {
  font-size: 0.9rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-summary-main > div:first-child > span,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-target-percent span {
  font-size: 0.52rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-summary-detail {
  font-size: 0.58rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-protein-progress,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-day-calorie-progress {
  height: 0.2rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance.is-rotation {
  padding: 0.3rem 0.48rem;
  gap: 0.22rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-heading strong {
  font-size: 0.78rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-heading span,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-values span,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-values small {
  font-size: 0.56rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-values {
  gap: 0.28rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-values > div {
  padding: 0.22rem 0.3rem;
  gap: 0.04rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .calorie-balance-values strong {
  font-size: 0.68rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-protein-top-up-card {
  gap: 0.16rem;
  padding-block: 0.2rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-top-up-option {
  padding-block: 0.12rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-top-up-option button,
.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-top-up-head button {
  min-height: 1.5rem;
  padding-block: 0.12rem;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  min-height: 0;
  flex: 1 1 0;
  align-content: stretch;
  overflow: hidden;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-swipe-hint {
  display: none;
}

.rotation-slate-dashboard[data-slot-count="1"]:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  grid-template-rows: max-content;
}

.rotation-slate-dashboard[data-slot-count="2"]:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  grid-template-rows: minmax(0, 1fr) max-content;
}

.rotation-slate-dashboard[data-slot-count="3"]:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  grid-template-rows: repeat(2, minmax(0, 1fr)) max-content;
}

.rotation-slate-dashboard[data-slot-count="4"]:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  grid-template-rows: repeat(3, minmax(0, 1fr)) max-content;
}

.rotation-slate-dashboard[data-slot-count="5"]:has(.rotation-protein-top-up-slot) .rotation-slot-grid {
  grid-template-rows: repeat(4, minmax(0, 1fr)) max-content;
}

.rotation-slate-dashboard:has(.rotation-protein-top-up-slot) .rotation-slot-card {
  overflow: hidden;
  padding-block: clamp(0.32rem, 0.75vh, 0.5rem);
}

/* Vier Mahlzeiten brauchen auch ohne Proteinsnack eine flexible vierte
   Zeile, damit die letzte Karte nicht unter dem mobilen Viewport endet. */
@media (max-width: 720px) {
  /* Der Entwurfs-Banner belegt eigenen Platz. Das Dashboard darf darunter
     nicht noch einmal die volle App-Hoehe beanspruchen. */
  .rotation-app:has(> .rotation-slate-dashboard) {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
  }

  .rotation-app > .rotation-draft-banner {
    flex: 0 0 auto;
  }

  .rotation-app > .rotation-slate-dashboard {
    height: auto;
    min-height: 0;
    flex: 1 1 0;
  }

  .rotation-slate-dashboard[data-slot-count="4"]:not(:has(.rotation-protein-top-up-slot)) .rotation-slot-grid {
    flex: 1 1 0;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    align-content: stretch;
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .rotation-top-up-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.4rem;
  }

  .rotation-top-up-selected,
  .rotation-top-up-hint {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .rotation-top-up-options {
    gap: 0.2rem;
  }

  .rotation-top-up-option {
    padding-inline: 0.24rem;
    gap: 0.2rem;
  }

  .rotation-top-up-option button {
    min-height: 1.6rem;
    padding-inline: 0.3rem;
    font-size: 0.56rem;
  }
}

@media (max-width: 390px), (max-height: 700px) {
  .rotation-protein-top-up-card {
    gap: 0.18rem;
    padding-block: 0.22rem;
  }

  .rotation-top-up-head .eyebrow {
    display: none;
  }

  .rotation-top-up-selected small {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Himbi app guide -------------------------------------------------------- */
.app-guide {
  position: fixed;
  inset: 0;
  z-index: 74;
  pointer-events: none;
}

.app-guide-launcher {
  position: absolute;
  right: 1.25rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: 6.2rem;
  height: 6.7rem;
  min-height: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  isolation: isolate;
}

.app-guide-launcher::before {
  position: absolute;
  right: 0.25rem;
  bottom: 0.15rem;
  left: 0.25rem;
  z-index: -1;
  height: 2.15rem;
  border-radius: 50%;
  background: rgba(28, 41, 34, 0.18);
  content: "";
  filter: blur(12px);
  transform: scaleX(0.78);
  animation: himbi-shadow-breathe 4.8s ease-in-out infinite;
}

.app-guide-mascot {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.himbi-character {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 8px 10px rgba(28, 41, 34, 0.2));
  animation: app-guide-arrive 520ms cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
}

.himbi-character-shadow {
  fill: rgba(20, 30, 25, 0.22);
  filter: blur(1.4px);
  transform-box: fill-box;
  transform-origin: center;
  animation: himbi-shadow-breathe 4.8s ease-in-out infinite;
}

.himbi-body-rig,
.himbi-body-core,
.himbi-leaves,
.himbi-arm,
.himbi-leg,
.himbi-eyes,
.himbi-pupils,
.himbi-mouth,
.himbi-brow {
  transform-box: fill-box;
}

.himbi-body-rig {
  transform-origin: center bottom;
}

.himbi-body-core {
  transform-origin: center bottom;
  animation: himbi-body-breathe 4.2s ease-in-out infinite;
}

.himbi-body-base {
  fill: #ad1748;
  stroke: rgba(86, 16, 48, 0.55);
  stroke-width: 2;
}

.himbi-drupelet {
  stroke: rgba(94, 13, 46, 0.32);
  stroke-width: 1.2;
}

.himbi-drupelet.shade-a { fill: #df2c68; }
.himbi-drupelet.shade-b { fill: #c91e59; }
.himbi-drupelet.shade-c { fill: #ef477d; }

.himbi-berry-shine {
  fill: rgba(255, 218, 229, 0.42);
}

.himbi-limb-line,
.himbi-finger {
  fill: none;
  stroke: #24533f;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.himbi-limb-line { stroke-width: 6; }
.himbi-finger { stroke-width: 2.4; }
.himbi-hand,
.himbi-foot { fill: #285943; }

.himbi-arm-left { transform-origin: right top; }
.himbi-arm-right { transform-origin: left center; animation: himbi-hand-wave-idle 7.4s ease-in-out infinite; }
.himbi-leg-left,
.himbi-leg-right { transform-origin: center top; }

.himbi-leaves {
  fill: #4f8c4b;
  stroke: #285943;
  stroke-width: 1.5;
  stroke-linejoin: round;
  transform-origin: center bottom;
  animation: himbi-leaf-sway 4.9s ease-in-out infinite;
}

.himbi-leaf.leaf-center { fill: #79c267; }
.himbi-leaf.leaf-left { fill: #68ab58; }
.himbi-leaf.leaf-right { fill: #5b9d50; }

.himbi-eye-white {
  fill: #fffaf3;
  stroke: rgba(74, 24, 44, 0.38);
  stroke-width: 1;
}

.himbi-eyes {
  transform-origin: center;
  animation: himbi-eye-blink 6.2s ease-in-out infinite;
}

.himbi-pupils {
  transform-origin: center;
  animation: himbi-pupil-look 8.4s ease-in-out infinite;
}

.himbi-pupil { fill: #342536; }
.himbi-eye-glint { fill: #fff; }
.himbi-cheek { fill: rgba(255, 174, 190, 0.62); }

.himbi-brow,
.himbi-mouth-smile {
  fill: none;
  stroke: #4a2034;
  stroke-linecap: round;
}

.himbi-brow { stroke-width: 2.2; }
.himbi-mouth-smile { stroke-width: 2.8; }
.himbi-mouth-cheer { display: none; fill: #4a2034; }

.app-guide-spark {
  position: absolute;
  width: 0.45rem;
  height: 0.45rem;
  border: 2px solid rgba(255, 250, 243, 0.94);
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transform: rotate(45deg) scale(0.25);
}

.app-guide-spark-one {
  top: 16%;
  right: 7%;
}

.app-guide-spark-two {
  top: 34%;
  left: 5%;
  width: 0.34rem;
  height: 0.34rem;
  animation-delay: 110ms;
}

.app-guide-launcher:hover,
.app-guide-launcher:focus-visible {
  background: transparent;
  box-shadow: none;
}

.app-guide-launcher:hover .himbi-character,
.app-guide-launcher:focus-visible .himbi-character,
.app-guide.is-open .app-guide-launcher .himbi-character {
  filter: drop-shadow(0 11px 13px rgba(28, 41, 34, 0.24));
}

.app-guide-launcher:hover .himbi-arm-right,
.app-guide-launcher:focus-visible .himbi-arm-right {
  animation: himbi-wave-hello 720ms ease-in-out both;
}

.app-guide-launcher:hover .himbi-leaves,
.app-guide-launcher:focus-visible .himbi-leaves {
  animation: himbi-leaf-hello 720ms ease-in-out both;
}

.app-guide-launcher:hover .app-guide-spark,
.app-guide-launcher:focus-visible .app-guide-spark,
.app-guide[data-pet-state="hopping"] .app-guide-mascot .app-guide-spark,
.app-guide[data-pet-state="answering"] .app-guide-mascot .app-guide-spark {
  animation: app-guide-pet-spark 620ms ease-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-body-rig {
  animation: himbi-rig-hop 560ms cubic-bezier(0.2, 0.85, 0.25, 1.08) both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-body-core {
  animation: himbi-body-hop 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-leg-left {
  animation: himbi-leg-hop-left 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-leg-right {
  animation: himbi-leg-hop-right 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-arm-left {
  animation: himbi-arm-hop-left 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-arm-right {
  animation: himbi-arm-hop-right 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-mascot .himbi-leaves {
  animation: himbi-leaf-hop 560ms ease-in-out both;
}

.app-guide[data-pet-state="hopping"] .app-guide-launcher::before {
  animation: himbi-shadow-hop 560ms ease-out both;
}

.app-guide[data-pet-state="thinking"] .app-guide-header-mascot .himbi-body-core {
  animation: himbi-body-think 1.45s ease-in-out infinite;
}

.app-guide[data-pet-state="thinking"] .app-guide-header-mascot .himbi-arm-right {
  animation: himbi-arm-think 1.45s ease-in-out infinite;
}

.app-guide[data-pet-state="thinking"] .app-guide-header-mascot .himbi-pupils {
  animation: himbi-pupils-think 1.45s ease-in-out infinite;
}

.app-guide[data-pet-state="thinking"] .app-guide-header-mascot .himbi-brow-left {
  transform-origin: center;
  animation: himbi-brow-think 1.45s ease-in-out infinite;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-body-core {
  animation: himbi-body-cheer 920ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-arm-left {
  animation: himbi-arm-cheer-left 920ms ease-in-out both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-arm-right {
  animation: himbi-arm-cheer-right 920ms ease-in-out both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-leg-left {
  animation: himbi-leg-cheer-left 920ms ease-in-out both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-leg-right {
  animation: himbi-leg-cheer-right 920ms ease-in-out both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-leaves {
  animation: himbi-leaf-cheer 920ms ease-in-out both;
}

.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-mouth-smile { display: none; }
.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-mouth-cheer { display: block; }
.app-guide[data-pet-state="answering"] .app-guide-header-mascot .himbi-eyes { animation: himbi-eye-happy 920ms ease-in-out both; }

.app-guide.is-open .app-guide-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-guide.is-open .app-guide-launcher *,
.app-guide.is-open .app-guide-launcher::before {
  animation-play-state: paused !important;
}

.app-guide-launcher-bubble {
  position: absolute;
  right: 5.1rem;
  top: 0.65rem;
  width: max-content;
  max-width: 9rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px 12px 3px 12px;
  background: var(--surface-strong);
  color: var(--primary-strong);
  box-shadow: var(--shadow-soft);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  opacity: 0;
  transform: translateX(0.35rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-guide-launcher:hover .app-guide-launcher-bubble,
.app-guide-launcher:focus-visible .app-guide-launcher-bubble {
  opacity: 1;
  transform: translateX(0);
}

.app-guide-backdrop {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.app-guide-panel {
  position: absolute;
  right: 1.5rem;
  bottom: 1rem;
  width: min(24rem, calc(100vw - 2rem));
  height: min(38rem, calc(100dvh - 2rem));
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-raised);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.75rem) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.app-guide.is-open .app-guide-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.app-guide-header {
  flex: 0 0 auto;
  min-height: 4.35rem;
  padding: 0.7rem 0.75rem 0.7rem 0.9rem;
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr) 2.75rem;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(135deg, var(--primary-tint), transparent 72%);
}

.app-guide-header-mascot {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  overflow: visible;
}

.app-guide-header-mascot .himbi-character {
  display: block;
  width: 2.8rem;
  height: 2.8rem;
  animation: none;
}

.app-guide-header-mascot .himbi-character-shadow,
.app-guide-header-mascot .himbi-body-rig,
.app-guide-header-mascot .himbi-body-core,
.app-guide-header-mascot .himbi-arm-left,
.app-guide-header-mascot .himbi-arm-right,
.app-guide-header-mascot .himbi-leg-left,
.app-guide-header-mascot .himbi-leg-right,
.app-guide-header-mascot .himbi-leaves,
.app-guide-header-mascot .himbi-eyes,
.app-guide-header-mascot .himbi-pupils {
  animation: none;
}

.app-guide-message.is-pending .himbi-body-core {
  animation: himbi-body-think 1.45s ease-in-out infinite;
}

.app-guide-message.is-new .himbi-body-core {
  animation: himbi-body-cheer 920ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.app-guide-header strong,
.app-guide-header span {
  display: block;
}

.app-guide-header strong {
  color: var(--heading);
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.app-guide-header span {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.app-guide-close {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1;
}

.app-guide-close:hover {
  background: var(--surface-muted);
  color: var(--heading);
}

.app-guide-messages {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.9rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scroll-behavior: smooth;
}

.app-guide-message {
  max-width: 88%;
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  align-items: end;
  gap: 0.45rem;
}

.app-guide-message-avatar {
  width: 1.9rem;
  height: 1.9rem;
  display: block;
  overflow: visible;
}

.app-guide-message-avatar .himbi-character {
  width: 1.9rem;
  height: 1.9rem;
  animation: none;
}

.app-guide-message-avatar .himbi-character-shadow,
.app-guide-message-avatar .himbi-body-rig,
.app-guide-message-avatar .himbi-body-core,
.app-guide-message-avatar .himbi-arm-left,
.app-guide-message-avatar .himbi-arm-right,
.app-guide-message-avatar .himbi-leg-left,
.app-guide-message-avatar .himbi-leg-right,
.app-guide-message-avatar .himbi-leaves,
.app-guide-message-avatar .himbi-eyes,
.app-guide-message-avatar .himbi-pupils {
  animation: none;
}

.app-guide-message p {
  margin: 0;
  padding: 0.72rem 0.8rem;
  border-radius: 14px 14px 14px 4px;
  background: var(--chat-agent);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.app-guide-message.user {
  align-self: flex-end;
  display: block;
}

.app-guide-message.user p {
  border-radius: 14px 14px 4px 14px;
  background: var(--chat-user);
}

.app-guide-message.is-pending p {
  color: var(--muted);
  font-style: italic;
}

.app-guide-suggestions {
  flex: 0 0 auto;
  padding: 0.35rem 0.9rem 0.65rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.app-guide-suggestions button {
  flex: 0 0 auto;
  min-height: 2.15rem;
  padding: 0.42rem 0.62rem;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  box-shadow: none;
  font-size: 0.74rem;
  font-weight: 750;
}

.app-guide-suggestions button:hover {
  border-color: var(--primary);
  background: var(--primary-tint);
}

.app-guide-form {
  flex: 0 0 auto;
  padding: 0.7rem 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  align-items: end;
  gap: 0.55rem;
  border-top: 1px solid var(--border-soft);
  background: var(--workspace);
}

.app-guide-form textarea {
  width: 100%;
  min-height: 2.75rem;
  max-height: 8rem;
  resize: vertical;
  padding: 0.7rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.35;
}

.app-guide-form button {
  width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.app-guide-form button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.app-guide-form button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.app-guide-scope {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0.9rem 0.65rem;
  background: var(--workspace);
  color: var(--muted-soft);
  font-size: 0.67rem;
  line-height: 1.35;
}

@keyframes app-guide-arrive {
  from { opacity: 0; transform: translateY(0.65rem) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes himbi-body-breathe {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.018, 0.986); }
  70% { transform: scale(0.996, 1.008); }
}

@keyframes himbi-leaf-sway {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.8deg); }
}

@keyframes himbi-eye-blink {
  0%, 44%, 48%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(0.08); }
}

@keyframes himbi-pupil-look {
  0%, 62%, 100% { transform: translateX(0); }
  69%, 77% { transform: translateX(1.8px); }
  84%, 91% { transform: translateX(-1.2px); }
}

@keyframes himbi-hand-wave-idle {
  0%, 72%, 100% { transform: rotate(0deg); }
  77% { transform: rotate(8deg); }
  82% { transform: rotate(-7deg); }
  87% { transform: rotate(7deg); }
  92% { transform: rotate(-3deg); }
}

@keyframes himbi-wave-hello {
  0%, 100% { transform: rotate(0deg); }
  22% { transform: rotate(13deg); }
  44% { transform: rotate(-12deg); }
  64% { transform: rotate(14deg); }
  82% { transform: rotate(-7deg); }
}

@keyframes himbi-leaf-hello {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-5deg); }
  68% { transform: rotate(4deg); }
}

@keyframes himbi-rig-hop {
  0%, 100% { transform: translateY(0); }
  18% { transform: translateY(2px); }
  50% { transform: translateY(-13px); }
  76% { transform: translateY(-2px); }
  88% { transform: translateY(1.5px); }
}

@keyframes himbi-body-hop {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.08, 0.9); }
  50% { transform: scale(0.95, 1.08); }
  78% { transform: scale(1.03, 0.97); }
}

@keyframes himbi-leg-hop-left {
  0%, 100% { transform: rotate(0deg); }
  18% { transform: rotate(12deg); }
  52% { transform: rotate(-18deg); }
  78% { transform: rotate(6deg); }
}

@keyframes himbi-leg-hop-right {
  0%, 100% { transform: rotate(0deg); }
  18% { transform: rotate(-12deg); }
  52% { transform: rotate(18deg); }
  78% { transform: rotate(-6deg); }
}

@keyframes himbi-arm-hop-left {
  0%, 100% { transform: rotate(0deg); }
  48% { transform: rotate(22deg); }
}

@keyframes himbi-arm-hop-right {
  0%, 100% { transform: rotate(0deg); }
  48% { transform: rotate(-24deg); }
}

@keyframes himbi-leaf-hop {
  0%, 100% { transform: rotate(0deg); }
  42% { transform: rotate(-7deg); }
  68% { transform: rotate(5deg); }
}

@keyframes himbi-body-think {
  0%, 100% { transform: rotate(-1.5deg) scale(1); }
  50% { transform: rotate(1.5deg) scale(1.012); }
}

@keyframes himbi-arm-think {
  0%, 100% { transform: rotate(-23deg); }
  50% { transform: rotate(-28deg); }
}

@keyframes himbi-pupils-think {
  0%, 100% { transform: translate(-1px, -1.5px); }
  50% { transform: translate(1px, -2px); }
}

@keyframes himbi-brow-think {
  0%, 100% { transform: translateY(-1px) rotate(-5deg); }
  50% { transform: translateY(-2px) rotate(-8deg); }
}

@keyframes himbi-body-cheer {
  0%, 100% { transform: scale(1); }
  18% { transform: scale(1.09, 0.92); }
  43% { transform: translateY(-4px) scale(0.98, 1.07); }
  72% { transform: scale(1.035, 0.98); }
}

@keyframes himbi-arm-cheer-left {
  0%, 100% { transform: rotate(0deg); }
  36%, 64% { transform: rotate(34deg); }
}

@keyframes himbi-arm-cheer-right {
  0%, 100% { transform: rotate(0deg); }
  36%, 64% { transform: rotate(-35deg); }
}

@keyframes himbi-leg-cheer-left {
  0%, 100% { transform: rotate(0deg); }
  38% { transform: rotate(14deg); }
  68% { transform: rotate(-5deg); }
}

@keyframes himbi-leg-cheer-right {
  0%, 100% { transform: rotate(0deg); }
  38% { transform: rotate(-14deg); }
  68% { transform: rotate(5deg); }
}

@keyframes himbi-leaf-cheer {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-8deg); }
  58% { transform: rotate(7deg); }
  78% { transform: rotate(-3deg); }
}

@keyframes himbi-eye-happy {
  0%, 22%, 78%, 100% { transform: scaleY(1); }
  38%, 62% { transform: scaleY(0.2) translateY(3px); }
}

@keyframes himbi-shadow-breathe {
  0%, 100% { opacity: 0.78; transform: scaleX(0.78); }
  18% { opacity: 0.58; transform: scaleX(0.69); }
  36% { opacity: 0.72; transform: scaleX(0.75); }
}

@keyframes himbi-shadow-hop {
  0%, 100% { opacity: 0.78; transform: scaleX(0.78); }
  50% { opacity: 0.32; transform: scaleX(0.5); }
  87% { opacity: 0.86; transform: scaleX(0.84); }
}

@keyframes app-guide-pet-spark {
  0% { opacity: 0; transform: translate3d(0, 0.2rem, 0) rotate(45deg) scale(0.2); }
  38% { opacity: 0.95; transform: translate3d(0, -0.18rem, 0) rotate(75deg) scale(1); }
  100% { opacity: 0; transform: translate3d(0, -0.55rem, 0) rotate(115deg) scale(0.35); }
}

@media (min-width: 721px) {
  #app-shell[data-active-route="day-overview"] .app-guide-launcher {
    right: 0.85rem;
    bottom: 7rem;
    width: 4.8rem;
    height: 5.2rem;
  }
}

@media (max-width: 720px) {
  body.app-guide-visible {
    overflow: hidden;
  }

  .app-guide {
    z-index: 96;
  }

  .app-guide-launcher {
    right: 0.5rem;
    bottom: max(0.35rem, env(safe-area-inset-bottom));
    width: 5.25rem;
    height: 5.7rem;
  }

  .mobile-settings-launcher {
    right: auto;
    left: 0.9rem;
  }

  .mobile-settings-menu {
    right: auto;
    left: 0.9rem;
  }

  .mobile-chat-launcher {
    right: 6rem;
    left: 4.65rem;
  }

  #app-shell.mobile-secondary-open > .route-panel.active {
    padding-bottom: calc(6.4rem + env(safe-area-inset-bottom)) !important;
  }

  .app-guide-launcher-bubble {
    display: none;
  }

  #app-shell.mobile-chat-open .app-guide-launcher,
  #app-shell.app-guide-open .app-guide-launcher,
  #app-shell.app-guide-open .mobile-chat-launcher,
  #app-shell.app-guide-open .mobile-settings-launcher,
  #app-shell.app-guide-open .mobile-settings-menu {
    visibility: hidden;
  }

  .app-guide-backdrop {
    background: var(--overlay);
    transition: opacity 180ms ease;
  }

  .app-guide.is-open .app-guide-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-guide-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(82dvh, 44rem);
    min-height: min(27rem, 100dvh);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    transform: translateY(2rem);
    transform-origin: bottom center;
  }

  .app-guide.is-open .app-guide-panel {
    transform: translateY(0);
  }

  .app-guide-header {
    padding-right: 0.65rem;
    padding-left: 0.8rem;
  }

  .app-guide-messages {
    padding-bottom: 0.7rem;
  }

  .app-guide-form {
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-guide-launcher::before,
  .app-guide-mascot,
  .himbi-character,
  .himbi-character *,
  .app-guide-spark,
  .app-guide-header-mascot,
  .app-guide-message-avatar,
  .app-guide-launcher-bubble,
  .app-guide-backdrop,
  .app-guide-panel,
  .app-guide-messages {
    animation: none;
    scroll-behavior: auto;
    transition: none;
  }

  .himbi-character * {
    transform: none !important;
  }
}

/* Chat reports ------------------------------------------------------------ */
.chat-report-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.chat-report-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(6px);
}

.chat-report-shell {
  padding: clamp(1rem, 4vw, 1.6rem);
  display: grid;
  gap: 0.9rem;
}

.chat-report-head,
.chat-report-actions,
.chat-report-reference-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-report-head {
  align-items: flex-start;
  justify-content: space-between;
}

.chat-report-head .eyebrow {
  margin-bottom: 0.2rem;
}

.chat-report-head h2 {
  margin: 0;
  color: var(--heading);
  font-size: clamp(1.3rem, 4vw, 1.75rem);
}

#chat-report-close {
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
}

.chat-report-disclosure,
.chat-report-exclusions,
.chat-report-result p {
  margin: 0;
  line-height: 1.5;
}

.chat-report-disclosure {
  color: var(--text);
}

.chat-report-exclusions {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-report-note {
  display: grid;
  gap: 0.4rem;
  color: var(--heading);
  font-weight: 750;
}

.chat-report-note > span small {
  color: var(--muted);
  font-weight: 500;
}

.chat-report-note textarea {
  width: 100%;
  min-height: 7rem;
  resize: vertical;
  line-height: 1.45;
}

#chat-report-note-count {
  justify-self: end;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
}

.chat-report-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.chat-report-status.is-error {
  color: var(--danger);
}

.chat-report-status.is-success {
  color: var(--success);
}

.chat-report-result {
  padding: 0.9rem;
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--success-border);
  border-radius: 14px;
  background: var(--success-soft);
}

.chat-report-result > strong,
.chat-report-result > label {
  color: var(--heading);
}

.chat-report-result > label {
  font-size: 0.78rem;
  font-weight: 750;
}

.chat-report-result p {
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-report-reference-row input {
  min-width: 0;
  flex: 1 1 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.chat-report-reference-row button {
  flex: 0 0 auto;
}

.chat-report-actions {
  justify-content: flex-end;
  padding-top: 0.2rem;
}

.chat-report-dialog button:disabled,
#report-chat-session:disabled,
#mobile-report-chat-session:disabled,
#chat-form button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.55;
}

@media (max-width: 720px) {
  .mobile-chat-report-button {
    position: absolute;
    top: 0.25rem;
    left: 0;
    min-height: 2rem;
    padding: 0.3rem 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 0;
    font-size: 0.72rem;
  }

  .mobile-chat-report-button svg {
    width: 1rem;
    height: 1rem;
  }

  .chat-report-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 18px;
  }

  .chat-report-shell {
    padding: 1rem;
  }

  .chat-report-reference-row {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-report-reference-row button {
    width: 100%;
  }
}


/* Zutaten werden nur zum aktuellen Gericht gefragt. */
.rotation-ingredient-question {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.1rem, 4vw, 2rem);
}
.rotation-ingredient-question h2 {
  font-size: clamp(1.6rem, 5vw, 2.35rem);
  overflow-wrap: anywhere;
}
.rotation-ingredient-question .rotation-review-decisions {
  margin-top: 0.75rem;
}
.rotation-ingredient-question .rotation-review-decisions button {
  min-height: 3.25rem;
}
.rotation-name-card .rotation-generate-button {
  margin-top: 0.5rem;
  width: 100%;
}
.rotation-taste-settings {
  border-top: 1px solid var(--border);
  margin-top: 1.2rem;
  padding-top: 1.2rem;
}
.rotation-taste-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.65rem;
  flex-wrap: wrap;
}
.rotation-taste-row > strong {
  overflow-wrap: anywhere;
  flex: 1 1 8rem;
  min-width: 0;
}
.rotation-taste-options {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.rotation-taste-options button {
  min-height: 2.4rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}
.rotation-taste-options button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--on-primary, white);
  border-color: var(--primary);
}
.rotation-taste-empty {
  font-size: 0.9rem;
}
