:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --surface-warm: #fbf7f0;
  --text: #1f2b26;
  --muted: #66736c;
  --border: #dde5df;
  --primary: #1f6b4f;
  --primary-dark: #15543d;
  --primary-soft: #dceee5;
  --accent: #d99043;
  --danger: #a53b3b;
  --shadow: 0 18px 50px rgba(37, 55, 46, 0.09);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --max-width: 1440px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.identity-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 10% 10%, rgba(31,107,79,.12), transparent 34%),
    radial-gradient(circle at 90% 85%, rgba(217,144,67,.11), transparent 30%),
    var(--bg);
}

.identity-card {
  width: min(100%, 520px);
  padding: 42px;
  border: 1px solid rgba(221,229,223,.9);
  border-radius: 30px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 1.35rem;
}

.identity-card h1, .topbar h1, .section-heading h2, .summary-header h2, .dialog-card h2 {
  margin: 0;
  line-height: 1.12;
}

.identity-card h1 { font-size: clamp(2rem, 5vw, 3rem); }
.identity-intro { margin: 14px 0 30px; color: var(--muted); }

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 750; }
.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(31,107,79,.11); }
.field input.invalid { border-color: var(--danger); }
.field-error { min-height: 19px; margin-top: 6px; display: block; color: var(--danger); font-size: .78rem; }

.button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  transition: transform .15s, background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(31,107,79,.25); outline-offset: 2px; }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 22px rgba(31,107,79,.16); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.button-secondary:hover { border-color: #b8c7be; }
.button-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.button-small { min-height: 40px; padding: 0 14px; }
.button-large { width: 100%; min-height: 54px; margin-top: 8px; }

.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.topbar h1 { font-size: clamp(1.4rem, 2.5vw, 2rem); }

.stepper-shell { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.stepper {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 14px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stepper-button {
  position: relative;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 750;
}
.stepper-button::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 99px;
  background: transparent;
}
.stepper-button.active { color: var(--primary); background: var(--surface-soft); }
.stepper-button.active::after { background: var(--primary); }
.stepper-number { display: inline-grid; width: 24px; height: 24px; margin-right: 6px; place-items: center; border-radius: 50%; background: #e8ece9; font-size: .76rem; }
.stepper-button.active .stepper-number { background: var(--primary); color: #fff; }
.stepper-button.has-selection .stepper-number:not(.active) { box-shadow: inset 0 0 0 2px var(--primary-soft); }

.builder-layout {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 34px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}

.content-panel, .summary-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(37,55,46,.04);
}
.content-panel { padding: 30px; }
.summary-panel { position: sticky; top: 92px; padding: 24px; }

.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 26px; }
.section-heading h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); }
.section-description { max-width: 720px; margin: 8px 0 0; color: var(--muted); }
.selection-count, .summary-total {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
}

.dish-group + .dish-group { margin-top: 34px; }
.group-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.group-heading h3 { margin: 0; font-size: 1.05rem; }
.group-heading::after { content: ""; height: 1px; flex: 1; background: var(--border); }

.dish-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.dish-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.dish-card:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(37,55,46,.09); }
.dish-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,107,79,.08); }
.dish-image-wrap { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #e8eee9; }
.dish-image { width: 100%; height: 100%; object-fit: cover; }
.dish-image-wrap::after { content: ""; position: absolute; inset: auto 0 0; height: 42%; background: linear-gradient(transparent, rgba(0,0,0,.18)); pointer-events: none; }
.dish-body { padding: 18px; }
.dish-meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 9px; }
.category-chip { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--surface-warm); color: #805226; font-size: .72rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.selected-badge { color: var(--primary); font-size: .76rem; font-weight: 850; }
.dish-card h4 { margin: 0; font-size: 1.12rem; }
.dish-description { margin: 8px 0 16px; color: var(--muted); font-size: .9rem; }
.dish-actions { display: flex; gap: 9px; }
.dish-actions .button { width: 100%; min-height: 42px; }
.dish-card.selected .dish-actions .button { background: var(--surface-soft); border-color: #bdd8ca; color: var(--primary-dark); box-shadow: none; }

.navigation-bar { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; }

.summary-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.summary-header h2 { font-size: 1.45rem; }
.summary-section { padding: 14px 0; border-top: 1px solid var(--border); }
.summary-section:first-child { border-top: 0; padding-top: 0; }
.summary-section-title { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 9px; font-size: .86rem; font-weight: 850; }
.summary-empty { margin: 0; color: #919b95; font-size: .82rem; }
.summary-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; }
.summary-item-name { flex: 1; font-size: .84rem; font-weight: 700; }
.summary-item-category { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.remove-icon {
  width: 28px; height: 28px; flex: 0 0 28px; border: 0; border-radius: 8px; background: #f7eaea; color: var(--danger); font-size: 1rem; font-weight: 900;
}

.final-review { margin-top: 34px; padding: 24px; border-radius: 18px; background: linear-gradient(135deg, #eff7f2, #fbf7f0); border: 1px solid #d9e7dd; }
.final-review h3 { margin: 0 0 6px; font-size: 1.25rem; }
.final-review > p { margin: 0 0 18px; color: var(--muted); }
.final-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.final-meal { padding: 14px; border-radius: 12px; background: rgba(255,255,255,.78); border: 1px solid rgba(221,229,223,.9); }
.final-meal h4 { margin: 0 0 8px; font-size: .9rem; }
.final-meal ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .82rem; }
.final-meal p { margin: 0; color: #929c96; font-size: .82rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  min-width: 240px;
  max-width: min(90vw, 480px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #21372d;
  color: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  text-align: center;
  font-size: .88rem;
  font-weight: 750;
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

.confirm-dialog { width: min(calc(100% - 28px), 620px); padding: 0; border: 0; border-radius: 22px; background: transparent; }
.confirm-dialog::backdrop { background: rgba(21,33,27,.55); backdrop-filter: blur(3px); }
.dialog-card { position: relative; margin: 0; padding: 30px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.dialog-card-compact { text-align: center; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: #f0f3f1; color: var(--muted); font-size: 1.45rem; }
.dialog-copy { margin: 10px 0 20px; color: var(--muted); }
.dialog-summary { max-height: 46vh; overflow: auto; padding: 14px; border-radius: 14px; background: var(--bg); }
.dialog-user { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); font-size: .88rem; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.success-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 1.7rem; font-weight: 900; }

@media (max-width: 1020px) {
  .builder-layout { grid-template-columns: 1fr; }
  .summary-panel { position: static; order: -1; }
  .summary-content { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 18px; }
}

@media (max-width: 720px) {
  .identity-screen { padding: 16px; }
  .identity-card { padding: 26px 22px; border-radius: 22px; }
  .topbar-inner, .stepper, .builder-layout { width: min(calc(100% - 24px), var(--max-width)); }
  .topbar-inner { padding: 16px 0; }
  .stepper { gap: 5px; padding: 10px 0; }
  .stepper-button { padding: 8px 6px; text-align: center; font-size: .68rem; }
  .stepper-number { display: grid; margin: 0 auto 4px; }
  .stepper-button::after { left: 6px; right: 6px; }
  .builder-layout { padding: 18px 0 34px; gap: 16px; }
  .content-panel, .summary-panel { border-radius: 18px; }
  .content-panel { padding: 20px 16px; }
  .summary-panel { padding: 18px 16px; order: 0; }
  .summary-content { grid-template-columns: 1fr; }
  .section-heading { display: block; margin-bottom: 20px; }
  .selection-count { display: inline-flex; margin-top: 12px; }
  .dish-grid { grid-template-columns: 1fr; }
  .dish-image-wrap { aspect-ratio: 2/1; }
  .final-grid { grid-template-columns: 1fr; }
  .navigation-bar { position: sticky; bottom: 0; z-index: 10; margin: 28px -16px -20px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
  .navigation-bar .button { flex: 1; }
  .dialog-card { padding: 26px 20px 20px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (max-width: 430px) {
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 1.2rem; }
  .button-small { padding: 0 11px; font-size: .78rem; }
  .stepper-button { font-size: .62rem; }
  .stepper-button .stepper-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
