:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-strong: #f0f6f1;
  --text: #18211d;
  --muted: #607066;
  --line: #d8e0da;
  --accent: #236f52;
  --accent-dark: #174c39;
  --accent-soft: #dceee5;
  --info: #386b9a;
  --info-soft: #e2eef8;
  --warn: #a85a3d;
  --warn-soft: #f8e7df;
  --danger: #a33b42;
  --danger-soft: #f7dfe2;
  --cat-protein: #2b1115;
  --cat-kylvara: #166534;
  --cat-frysvara: #1d4ed8;
  --cat-finish: #a16207;
  --cat-finish-soft: #fef3c7;
  --shadow: 0 14px 40px rgba(31, 44, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #000;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.38), rgba(0, 0, 0, 0.58)),
    url("images/sitegfx/back.png");
  background-attachment: fixed, fixed;
  background-position: top center, top center;
  background-repeat: no-repeat, no-repeat;
  background-size: 100% auto, 100% auto;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  filter: brightness(0.98);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(56, 107, 154, 0.28);
  outline-offset: 2px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

label span {
  color: var(--text);
}

.app-shell {
  width: min(1420px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
}

.top-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.brand-block {
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 7px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.15rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
  letter-spacing: 0;
}

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

.mode-switch,
.output-tabs,
.form-actions,
.storage-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.storage-panel {
  align-items: center;
  justify-content: flex-end;
}

.storage-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 750;
}

.connect-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 1rem;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(35, 111, 82, 0.2);
}

.connect-button.needs-connection,
button.needs-connection {
  color: #fff;
  background: #d3162a;
  border-color: #a90f20;
  box-shadow: 0 0 0 4px rgba(211, 22, 42, 0.14), 0 10px 26px rgba(163, 59, 66, 0.32);
}

.connect-button.connected,
button.connected {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(35, 111, 82, 0.16);
}

.mode-switch {
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.mode-button,
.output-tab {
  background: transparent;
  color: var(--muted);
}

.output-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border-color: #bfd9ca;
  color: var(--accent-dark);
}

.output-tab-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mode-button.active,
.output-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.output-tab:not(.active):hover,
.output-tab:not(.active):focus-visible {
  background: #f4f8f5;
}

.notice {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--info);
  border-radius: 8px;
  background: var(--info-soft);
  color: #1c496e;
  padding: 10px 12px;
  font-weight: 700;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.planner-main,
.editor-layout {
  display: grid;
  gap: 18px;
}

.control-band,
.week-panel,
.list-panel,
.editor-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-band,
.week-panel,
.list-panel,
.editor-form {
  padding: 16px;
}

.week-panel {
  position: sticky;
  top: 16px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.section-title.compact {
  align-items: center;
}

.week-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.week-title > div {
  min-width: 0;
}

.week-title .ghost-button {
  justify-self: end;
  white-space: nowrap;
}

.recipe-summary {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.recipe-summary h2,
.recipe-summary p {
  margin: 0;
}

.recipe-summary p {
  font-weight: 850;
}

.chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.25;
  padding: 5px 9px;
}

.chip {
  background: var(--info-soft);
  color: #214f78;
  border: 1px solid #c7dceb;
}

.chip.af-chip {
  background: #111815;
  color: #fff;
  border-color: #111815;
  padding: 8px 12px;
  font-size: 0.98rem;
  font-weight: 850;
}

.chip.finish-chip {
  background: var(--cat-finish-soft);
  color: #6f3f05;
  border-color: #f2cf80;
  font-size: 0.8rem;
  opacity: 0.92;
}

.chip.af-chip.cat-af_protein {
  background: var(--cat-protein);
  border-color: var(--cat-protein);
}

.chip.af-chip.cat-af_kylvara {
  background: var(--cat-kylvara);
  border-color: var(--cat-kylvara);
}

.chip.af-chip.cat-af_frysvara {
  background: var(--cat-frysvara);
  border-color: var(--cat-frysvara);
}

.chip.finish-chip.cat-ovr_kylvara {
  background: var(--cat-finish-soft);
  color: var(--cat-finish);
  border-color: #e7bd63;
}

.status-pill {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #bfd9ca;
}

.status-pill.test {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: #edc8b9;
}

.controls,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.combo-controls {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.clear-filter-button {
  min-width: 118px;
  min-height: 44px;
  white-space: nowrap;
}

.wide {
  grid-column: 1 / -1;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 14px;
}

.recipe-card,
.cart-item,
.editor-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.recipe-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px;
}

.recipe-card-spacer {
  min-height: 0;
}

.recipe-card .card-actions {
  align-self: end;
}

.recipe-card .card-actions .primary-button {
  width: 100%;
}

.recipe-card-top,
.recipe-card-header {
  display: grid;
  gap: 8px;
}

.recipe-card .recipe-card-top {
  grid-template-columns: minmax(0, 1fr) clamp(112px, 42%, 142px);
  align-items: start;
  gap: 10px;
}

.recipe-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #fff;
  border-radius: 8px;
  background-color: #fff;
  background-image: var(--recipe-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.recipe-card.has-image .recipe-card-image {
  cursor: zoom-in;
}

.recipe-card-image.empty {
  background-image: none;
}

.recipe-card.has-image .recipe-card-image:focus-visible {
  outline: 3px solid rgba(56, 107, 154, 0.32);
  outline-offset: 2px;
}

.recipe-card.has-image:has(.recipe-card-image:is(:hover, :focus-visible)) {
  z-index: 5;
}

.recipe-card.has-image:has(.recipe-card-image:is(:hover, :focus-visible))::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 0;
  z-index: 4;
  border-radius: 8px;
  background-color: #fff;
  background-image: var(--recipe-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipe-chip-stack {
  display: grid;
  gap: 7px;
}

.finish-chip-row {
  padding-top: 1px;
}

.detail-block {
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-block strong {
  color: var(--text);
}

.af-detail-list {
  display: grid;
  gap: 8px;
}

.af-detail-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 9px 10px;
}

.af-detail-name {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 850;
}

.af-detail-main {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 750;
}

.af-detail-seasoning {
  color: var(--muted);
  font-size: 0.88rem;
}

.plan-nutrition-mini {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: center;
  width: 100%;
  height: 34px;
  min-height: 34px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--muted);
  overflow: hidden;
  padding: 0 10px;
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
}

.plan-nutrition-mini span {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.plan-nutrition-mini strong {
  color: var(--text);
  font-size: 0.72rem;
}

.format-box {
  border: 1px solid #cbd9e5;
  border-radius: 8px;
  background: #f7fbff;
  color: #2c4f6e;
  padding: 9px;
  font-size: 0.9rem;
}

.auto-meta,
.picker-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.auto-meta {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.editor-recipe-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.editor-recipe-preview .empty-preview {
  color: var(--muted);
  font-weight: 800;
}

.image-picker-panel {
  gap: 8px;
}

.dish-image-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
  max-height: 178px;
  overflow: auto;
  padding-right: 4px;
}

.dish-image-choice {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 4px;
  text-align: center;
  overflow: hidden;
}

.dish-image-choice.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(35, 111, 82, 0.24);
}

.dish-image-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  background-color: #fff;
  background-image: var(--dish-thumb);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.dish-image-empty {
  align-self: center;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.1;
}

.dish-image-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--line);
  border-radius: 5px;
  padding: 4px;
}

.dish-image-tooltip {
  position: fixed;
  z-index: 60;
  max-width: min(320px, calc(100vw - 16px));
  border-radius: 7px;
  background: #111815;
  color: #fff;
  padding: 6px 8px;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.picker-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.picker-header h3 {
  margin: 0 0 2px;
}

.picker-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.selected-pill-row,
.option-grid,
.seasoning-targets,
.af-step-cards,
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-chip,
.selected-chip,
.target-chip {
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.option-chip {
  background: #fff;
  color: var(--accent-dark);
  border-color: #bfd9ca;
}

.option-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.selected-chip {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.selected-chip[draggable="true"] {
  cursor: grab;
}

.selected-chip[draggable="true"]:active {
  cursor: grabbing;
}

.target-chip {
  background: var(--info-soft);
  color: #214f78;
  border-color: #c7dceb;
}

.target-chip.active {
  background: var(--info);
  color: #fff;
  border-color: var(--info);
}

.seasoning-card {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.af-step-card {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.af-step-title {
  font-weight: 850;
}

.choice-group {
  display: grid;
  gap: 6px;
}

.choice-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.secondary-af {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.seasoning-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.secondary-button,
.ghost-button {
  background: #fff;
  color: var(--accent-dark);
  border-color: #bfd9ca;
}

.ghost-button {
  min-height: 38px;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #edc7cc;
}

.cart-list,
.editor-list {
  display: grid;
  gap: 8px;
}

.editor-list-filter {
  display: grid;
  gap: 6px;
  margin: -2px 0 12px;
}

.cart-item,
.editor-row {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.cart-item {
  position: relative;
  padding-right: 34px;
}

.editor-row {
  width: 100%;
  min-height: 44px;
  overflow: hidden;
  align-content: stretch;
  padding: 0;
  text-align: left;
}

.editor-af-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-height: 44px;
}

.editor-af-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 7px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
}

.editor-af-cell + .editor-af-cell {
  border-left: 1px solid rgba(255, 255, 255, 0.24);
}

.editor-af-cell.cat-af_protein {
  background: var(--cat-protein);
}

.editor-af-cell.cat-af_kylvara {
  background: var(--cat-kylvara);
}

.editor-af-cell.cat-af_frysvara {
  background: var(--cat-frysvara);
}

.editor-af-cell.cat-unknown {
  background: #4b5563;
}

.cart-item[draggable="true"] {
  cursor: grab;
}

.cart-item[draggable="true"]:active {
  cursor: grabbing;
}

.cart-item.dragging {
  opacity: 0.58;
}

.cart-recipe {
  display: block;
}

.cart-remove-button {
  position: absolute;
  top: 6px;
  right: 6px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  border-radius: 999px;
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
  padding: 0;
}

.cart-remove-button:hover,
.cart-remove-button:focus-visible {
  background: var(--danger-soft);
  border-color: #edc7cc;
  color: var(--danger);
}

.cart-remove-button::before,
.cart-remove-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.cart-remove-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cart-remove-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cart-recipe-chip-stack {
  gap: 5px;
}

.cart-recipe-chip-stack .chip-row {
  gap: 5px;
}

.cart-recipe-chip-stack .chip.af-chip {
  padding: 6px 9px;
  font-size: 0.84rem;
}

.cart-recipe-chip-stack .chip.finish-chip {
  padding: 4px 7px;
  font-size: 0.72rem;
}

.cart-title {
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--muted);
  padding: 14px;
}

.output-tabs {
  margin: 14px 0 10px;
  display: flex;
  width: 100%;
}

.output-tabs .output-tab {
  flex: 1 1 0;
}

.output-block {
  min-height: 140px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 9px;
  color: #26302a;
  font-size: 0.76rem;
  line-height: 1.32;
}

.output-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 10px 0 0;
}

.copy-output-button {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
  width: auto;
  margin: 0;
}

.share-output-button {
  display: none;
  flex: 0 0 42px;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: 42px;
  padding: 0;
  margin: 0;
}

.share-output-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.output-list,
.shopping-items,
.recipe-output-steps {
  display: grid;
  gap: 8px;
}

.output-group {
  display: grid;
  gap: 6px;
}

.output-group h3,
.recipe-output-header h3,
.recipe-output-step h4 {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.2;
}

.shopping-item,
.recipe-output-card,
.recipe-output-step,
.nutrition-summary {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.shopping-item,
.recipe-output-card {
  display: grid;
  gap: 7px;
  padding: 8px;
}

.prep-seasoning-line {
  display: grid;
  gap: 4px;
  padding: 2px 0 0;
  font-size: 0.74rem;
  line-height: 1.35;
}

.prep-seasoning-line span {
  color: var(--muted);
}

.shopping-item-main,
.shopping-item-meta,
.shopping-item-action,
.recipe-output-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.shopping-item-main {
  justify-content: space-between;
}

.shopping-item-action {
  justify-content: flex-end;
  margin-left: auto;
  text-align: right;
}

.shopping-item-main strong {
  font-size: 0.86rem;
}

.shopping-item-action span,
.shopping-item-meta,
.recipe-output-step p,
.nutrition-missing {
  color: var(--muted);
}

.shopping-item-meta {
  font-size: 0.7rem;
}

.mathem-link,
.missing-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 800;
}

.mathem-link {
  border: 1px solid #bfd9ca;
  background: #fff;
  color: var(--accent-dark);
  text-decoration: none;
}

.mathem-link:hover,
.mathem-link:focus-visible {
  border-color: var(--accent);
  background: #f4f8f5;
  color: var(--accent-dark);
}

.mathem-icon-link {
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
}

.mathem-link-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.missing-pill {
  border: 1px solid #edc7cc;
  background: var(--danger-soft);
  color: var(--danger);
}

.recipe-output-header {
  align-items: flex-start;
  flex-direction: column;
}

.recipe-output-header .recipe-chip-stack {
  width: 100%;
}

.nutrition-summary {
  padding: 7px;
}

.nutrition-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.nutrition-summary dt {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nutrition-summary dd {
  margin: 1px 0 0;
  font-size: 0.78rem;
  font-weight: 850;
}

.nutrition-missing {
  margin: 7px 0 0;
  font-size: 0.68rem;
}

.recipe-output-step {
  padding: 7px;
}

.recipe-output-step p {
  margin: 3px 0 0;
  font-size: 0.72rem;
}

.editor-layout {
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  align-items: start;
}

.editor-form,
.component-form {
  display: grid;
  gap: 12px;
}

.component-form {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.component-product-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.component-product-section[hidden] {
  display: none;
}

.component-product-grid,
.nutrition-editor-grid {
  display: grid;
  gap: 8px;
}

.component-product-grid {
  grid-template-columns: minmax(0, 1fr) 78px minmax(0, 1fr);
}

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

.compact-list {
  max-height: min(520px, calc(100vh - 360px));
  min-height: 240px;
  overflow: auto;
  gap: 10px;
  padding-right: 4px;
}

.editor-row.active {
  border-color: #fff;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}

.component-group {
  display: grid;
  gap: 4px;
}

.component-group-title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 2px 4px;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.component-group-list {
  display: grid;
  gap: 3px;
}

.component-row {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 4px 7px;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 700;
}

.component-row:hover {
  background: #f4f8f5;
}

.component-row.active {
  border-color: var(--accent);
  background: var(--surface-strong);
  color: var(--accent-dark);
}

.split {
  justify-content: space-between;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1120px) {
  .planner-layout,
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .week-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1420px);
    padding-top: 18px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .title-row {
    align-items: stretch;
  }

  .connect-button {
    width: 100%;
  }

  .top-actions,
  .storage-panel {
    justify-items: stretch;
    justify-content: stretch;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-button {
    flex: 1;
  }

  .controls,
  .form-grid,
  .component-product-grid,
  .nutrition-editor-grid,
  .nutrition-summary dl {
    grid-template-columns: 1fr;
  }

  .section-title,
  .section-title.compact {
    display: grid;
  }

  .recipe-summary {
    display: flex;
  }

  .share-output-button.is-share-ready {
    display: inline-flex;
  }
}
