/* ============================================================
   Saladizer Web — full product UI (sage app palette)
   ============================================================ */

* { box-sizing: border-box; }

html, body, #root {
  margin: 0; padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { overflow-x: hidden; }

/* ── Theme defaults (light · app palette) ───────────────── */
:root {
  --bg:               var(--app-bg-root);
  --bg-surface:       var(--app-bg-default);
  --bg-elevated:      #fff;
  --bg-tinted:        var(--app-bg-secondary);
  --bg-mint:          var(--app-bg-tertiary);
  --fg:               var(--app-text);
  --fg-muted:         var(--app-text-secondary);
  --fg-inverse:       #fff;
  --primary:          var(--app-primary);
  --primary-soft:     var(--app-primary-light);
  --accent:           var(--color-smart-amber);
  --danger:           var(--app-accent);
  --error:            var(--app-error);
  --border:           var(--app-border);
  --border-strong:    #B8D9BD;

  --shadow-card:      0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-card-hover:0 8px 24px rgba(27, 58, 31, 0.10);
  --shadow-chip:      0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-modal:     0 12px 32px rgba(27, 58, 31, 0.18);
  --shadow-sticky:    0 -2px 8px rgba(0, 0, 0, 0.05);

  --sidebar-w: 264px;
  --topbar-h: 80px;
  --content-pad: 32px;
  --r-card: 20px;
  --r-tile: 16px;
  --r-pill: 9999px;
  --r-input: 14px;
}

/* ── Marketing palette tweak ───────────────────────────── */
[data-palette="marketing"] {
  --primary:      var(--color-forest-green);
  --primary-soft: rgba(27, 94, 32, 0.10);
}

/* ── Dark mode ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:               var(--app-dark-bg-root);
  --bg-surface:       var(--app-dark-bg-default);
  --bg-elevated:      var(--app-dark-bg-secondary);
  --bg-tinted:        var(--app-dark-bg-secondary);
  --bg-mint:          var(--app-dark-bg-tertiary);
  --fg:               var(--app-dark-text);
  --fg-muted:         var(--app-dark-text-secondary);
  --primary:          var(--app-dark-primary);
  --primary-soft:     var(--app-dark-primary-light);
  --border:           var(--app-dark-border);
  --border-strong:    #3A5841;
  --shadow-card:      0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-card-hover:0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-chip:      0 1px 4px rgba(0, 0, 0, 0.30);
  --shadow-sticky:    0 -2px 8px rgba(0, 0, 0, 0.35);
}

/* Arabic font swap on RTL */
[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", var(--font-sans); }
[dir="rtl"] .ltr-num { direction: ltr; unicode-bidi: isolate; }

/* ── Layout shell ──────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border);
  padding: 28px 18px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 20;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 22px;
  font-weight: 800; font-size: 24px;
  color: var(--primary); letter-spacing: -0.02em;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-section {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--fg-muted);
  padding: 18px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 14px;
  border-radius: 12px;
  font-weight: 600; font-size: 14.5px;
  color: var(--fg);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--bg-tinted); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item.active::before {
  content: ""; position: absolute;
  inset-inline-start: -18px; top: 10px;
  width: 3px; height: 24px;
  background: var(--primary);
  border-start-end-radius: 3px; border-end-end-radius: 3px;
}
.nav-item .badge {
  margin-inline-start: auto;
  font-size: 11px; font-weight: 700;
  background: var(--accent); color: #1B3A1F;
  padding: 2px 8px; border-radius: 9999px;
}

.sidebar-foot {
  margin-top: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.plus-promo {
  background: linear-gradient(135deg, #FFF5DA 0%, #FFE9A8 100%);
  border-radius: 16px; padding: 14px;
  border: 1px solid rgba(245, 166, 35, 0.30);
}
[data-theme="dark"] .plus-promo {
  background: linear-gradient(135deg, #3A2D0E 0%, #2A2206 100%);
  border-color: rgba(245, 166, 35, 0.30);
  color: #FFE5A0;
}
.plus-promo-title {
  display: flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: 13.5px; color: #6E4A05;
}
[data-theme="dark"] .plus-promo-title { color: #FFD568; }
.plus-promo-text {
  font-size: 12px; color: #7A5A1A;
  margin: 4px 0 10px; line-height: 1.45;
}
[data-theme="dark"] .plus-promo-text { color: #D4B675; }
.plus-promo-btn {
  display: block; width: 100%;
  background: #1B3A1F; color: #fff;
  border: 0; border-radius: 10px;
  padding: 9px 0; font-weight: 700; font-size: 12.5px;
  cursor: pointer;
}
[data-theme="dark"] .plus-promo-btn { background: #F5A623; color: #1B3A1F; }

/* ── Main area ─────────────────────────────────────────── */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: rgba(250, 255, 254, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--content-pad);
  z-index: 10;
}
[data-theme="dark"] .topbar { background: rgba(13, 31, 16, 0.85); }
.topbar-search {
  flex: 1; max-width: 460px;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 16px;
  background: var(--bg-tinted);
  border: 1px solid transparent;
  border-radius: 14px;
  transition: border 0.15s ease, background 0.15s ease;
}
.topbar-search:focus-within {
  border-color: var(--primary);
  background: var(--bg-elevated);
}
.topbar-search input {
  border: 0; outline: none; background: transparent;
  flex: 1; font-family: inherit; font-size: 14px; color: var(--fg);
}
.topbar-search input::placeholder { color: var(--fg-muted); }
.topbar-search kbd {
  font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--fg-muted);
  background: var(--bg-elevated); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px;
}
.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  margin-inline-start: auto;
}
.icon-btn {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-tinted);
  border: 0; border-radius: 12px;
  color: var(--fg-muted);
  cursor: pointer; position: relative;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn .dot {
  position: absolute; top: 9px; inset-inline-end: 9px;
  width: 8px; height: 8px; border-radius: 4px;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}
.lang-pill {
  display: inline-flex; background: var(--bg-tinted);
  border-radius: 9999px; padding: 4px;
}
.lang-pill button {
  border: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--fg-muted);
  padding: 7px 14px; border-radius: 9999px;
  cursor: pointer;
}
.lang-pill button.on { background: var(--primary); color: #fff; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  cursor: pointer; flex-shrink: 0;
}

/* ── Page wrapper ──────────────────────────────────────── */
.page {
  padding: var(--content-pad) var(--content-pad) 80px;
  max-width: 1400px;
  margin: 0 auto;
}
.page-eyebrow {
  font-size: 13px; font-weight: 600;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}
.page-title {
  font-weight: 800; font-size: 38px;
  letter-spacing: -0.02em; line-height: 1.1;
  color: var(--fg);
  margin: 6px 0 0;
}
.page-title .ar-sub {
  display: block;
  font-family: "IBM Plex Sans Arabic", inherit;
  font-size: 22px; font-weight: 600;
  color: var(--fg-muted);
  margin-top: 4px; direction: rtl;
}
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 32px 0 16px;
}
.section-title h2 {
  margin: 0;
  font-weight: 700; font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.section-title .link {
  font-size: 13.5px; font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.section-title .link:hover { text-decoration: underline; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 48px; padding: 0 22px;
  border: 0; border-radius: 9999px;
  font-family: inherit; font-weight: 700; font-size: 14.5px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #246834; box-shadow: 0 6px 18px rgba(45,122,62,0.30); }
[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #5BBD60; }
.btn-amber { background: var(--accent); color: #1B3A1F; }
.btn-amber:hover:not(:disabled) { background: #E89312; box-shadow: 0 6px 18px rgba(245,166,35,0.30); }
.btn-ghost {
  background: transparent; color: var(--fg);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-tinted); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: var(--bg-mint); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 13px; }

/* ── Cards & generic surfaces ──────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  border: 1px solid transparent;
  overflow: hidden;
}
.card-pad { padding: 24px; }

/* ── Macro rings (dashboard) ───────────────────────────── */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.macro-card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-card);
}
.macro-ring {
  width: 64px; height: 64px;
  flex-shrink: 0; position: relative;
}
.macro-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.macro-ring .track { stroke: var(--bg-mint); }
.macro-ring .fill  { stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.macro-ring .label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13.5px;
  color: var(--fg);
}
.macro-meta-label {
  font-size: 13px; color: var(--fg-muted); font-weight: 600;
}
.macro-meta-value {
  font-weight: 800; font-size: 22px;
  color: var(--fg);
  letter-spacing: -0.01em;
  line-height: 1.1; margin-top: 2px;
}
.macro-meta-target {
  font-size: 12px; color: var(--fg-muted);
  margin-top: 2px;
}

/* ── Hero card (Salad of the Day) ──────────────────────── */
.hero-card {
  position: relative;
  height: 320px;
  border-radius: 28px;
  overflow: hidden;
  background: #2D7A3E url('assets/salad-placeholder.png') center/cover;
  margin-top: 16px;
  box-shadow: var(--shadow-card);
}
.hero-card-shade {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, rgba(15, 40, 20, 0.78) 0%, rgba(15, 40, 20, 0.45) 50%, rgba(15, 40, 20, 0.15) 100%);
}
.hero-card-content {
  position: absolute; inset: 0;
  padding: 32px 36px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff;
}
.hero-card-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.28);
  padding: 6px 12px; border-radius: 9999px;
  font-size: 12.5px; font-weight: 700;
  width: max-content;
}
.hero-card-title {
  font-weight: 800; font-size: 40px;
  letter-spacing: -0.02em; line-height: 1.05;
  max-width: 540px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.20);
}
.hero-card-foot {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
}
.hero-stat {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(8px);
  padding: 8px 14px; border-radius: 9999px;
  font-size: 13.5px; font-weight: 700;
}

/* ── Preset grid card ──────────────────────────────────── */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.preset-card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  position: relative;
}
.preset-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.preset-card-photo {
  height: 168px; position: relative;
  background: linear-gradient(135deg, #2D7A3E 0%, #43A047 100%);
}
.preset-card-photo.has-img { background-size: cover; background-position: center; }
.preset-badge {
  position: absolute; top: 12px; inset-inline-start: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.95);
  padding: 5px 10px; border-radius: 9999px;
  font-size: 11.5px; font-weight: 700; color: #1B3A1F;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.preset-card-info { padding: 16px 18px 18px; }
.preset-card-name {
  font-weight: 700; font-size: 16px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.preset-card-meta {
  font-size: 13px; color: var(--fg-muted);
  margin-top: 4px;
  display: flex; gap: 6px; align-items: center;
}

/* ── Chips / filters ───────────────────────────────────── */
.chip-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 14px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 13.5px; font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--primary); }
.chip.on {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}
.chip.on svg { color: #fff; }

/* ── Tip card ──────────────────────────────────────────── */
.tip-card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 24px;
  display: flex; gap: 18px; align-items: flex-start;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.tip-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tip-title {
  font-weight: 700; font-size: 15px;
  color: var(--primary);
}
.tip-body {
  margin-top: 6px;
  font-size: 14.5px; line-height: 1.6;
  color: var(--fg);
}

/* ── Two-up layout (Dashboard secondary row) ───────────── */
.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* ── Quick build CTA panel ─────────────────────────────── */
.quick-build {
  background:
    radial-gradient(circle at 120% 0%, rgba(245,166,35,0.20), transparent 50%),
    linear-gradient(135deg, #1F5C2A 0%, #2D7A3E 100%);
  color: #fff;
  border-radius: var(--r-card);
  padding: 28px;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 220px;
}
.quick-build .eyebrow-light {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.78);
  letter-spacing: 0.06em; text-transform: uppercase;
}
.quick-build h3 {
  margin: 0; font-weight: 800; font-size: 26px;
  letter-spacing: -0.01em; line-height: 1.15;
}
.quick-build p {
  margin: 0; color: rgba(255,255,255,0.78);
  font-size: 14px; line-height: 1.5;
  max-width: 360px;
}
.quick-build .actions {
  margin-top: auto; display: flex; gap: 10px;
}
.quick-build .leafs {
  position: absolute;
  inset-inline-end: -30px; bottom: -30px;
  width: 220px; height: 220px;
  opacity: 0.10;
}

/* ── BUILDER VIEW ──────────────────────────────────────── */
.builder {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}
@media (max-width: 1180px) {
  .builder { grid-template-columns: 1fr; }
  .builder-rail { position: static !important; }
}

.builder-main {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 24px 24px 32px;
  box-shadow: var(--shadow-card);
}
.builder-cats {
  display: flex; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.builder-cat {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  font-family: inherit; font-weight: 600; font-size: 14px;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.builder-cat:hover { border-color: var(--primary); }
.builder-cat.on {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}
.builder-cat .count {
  background: rgba(255,255,255,0.20);
  border-radius: 9999px;
  font-size: 11px; padding: 2px 7px;
}
.builder-cat:not(.on) .count {
  background: var(--bg-tinted);
  color: var(--fg-muted);
}

.ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.ing-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  transition: border 0.15s, transform 0.15s;
}
.ing-card.has { border-color: var(--primary); background: var(--primary-soft); }
.ing-card:hover { border-color: var(--border-strong); }
.ing-thumb {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-mint);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 26px;
}
.ing-info { flex: 1; min-width: 0; }
.ing-name {
  font-weight: 700; font-size: 14.5px;
  color: var(--fg);
  display: flex; align-items: center; gap: 6px;
}
.ing-meta {
  font-size: 12.5px; color: var(--fg-muted);
  margin-top: 2px;
}
.ing-qty-controls {
  display: flex; align-items: center; gap: 4px;
}
.qty-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 0;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}
.qty-btn:active { transform: scale(0.92); }
.qty-btn.minus { background: var(--bg-tinted); color: var(--danger); }
.qty-btn.minus:hover { background: rgba(255,138,101,0.18); }
.qty-btn.minus:disabled { opacity: 0.30; cursor: default; }
.qty-btn.plus { background: var(--primary); color: #fff; }
.qty-btn.plus:hover { background: #246834; }
.qty-num {
  min-width: 28px; text-align: center;
  font-weight: 700; font-size: 14px;
  color: var(--fg);
}
.custom-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700;
  color: var(--danger);
  background: rgba(255,138,101,0.14);
  padding: 1px 6px; border-radius: 9999px;
}

/* ── Builder rail (right sticky) ───────────────────────── */
.builder-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  align-self: start;
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow: hidden;
}
.bowl {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 240px;
  margin: 0 auto;
}
.bowl svg { width: 100%; height: 100%; }
.bowl-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.bowl-cal {
  font-weight: 800; font-size: 30px;
  color: var(--fg); letter-spacing: -0.02em;
  line-height: 1;
}
.bowl-cal-label {
  font-size: 11.5px; font-weight: 700;
  color: var(--fg-muted);
  letter-spacing: 0.10em; text-transform: uppercase;
  margin-top: 4px;
}

.salad-name-input {
  border: 0; outline: none;
  background: transparent;
  font-family: inherit; font-weight: 700; font-size: 18px;
  color: var(--fg);
  letter-spacing: -0.01em;
  padding: 8px 0;
  border-bottom: 2px solid var(--border);
  width: 100%;
  transition: border 0.15s;
}
.salad-name-input:focus { border-bottom-color: var(--primary); }

.macro-bars { display: flex; flex-direction: column; gap: 10px; }
.macro-bar {
  display: grid;
  grid-template-columns: 64px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.macro-bar-label { font-weight: 600; color: var(--fg-muted); }
.macro-bar-track {
  height: 6px; background: var(--bg-mint);
  border-radius: 3px; overflow: hidden;
}
.macro-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease-out;
}
.macro-bar-fill.amber { background: var(--accent); }
.macro-bar-fill.carrot { background: var(--danger); }
.macro-bar-fill.leaf { background: var(--color-leaf-green); }
.macro-bar-value {
  text-align: end;
  font-weight: 700; color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.ing-list {
  margin: 0; padding: 0; list-style: none;
  max-height: 140px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.ing-list li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  padding: 4px 0;
  color: var(--fg);
}
.ing-list .dot {
  width: 8px; height: 8px; border-radius: 4px;
  background: var(--primary); flex-shrink: 0;
}
.ing-list .qty {
  margin-inline-start: auto;
  color: var(--fg-muted); font-weight: 600;
}

.rail-actions { display: flex; flex-direction: column; gap: 8px; }
.empty-bowl {
  text-align: center;
  padding: 18px 0 4px;
  color: var(--fg-muted);
  font-size: 13px;
}

/* ── Saved view rows ───────────────────────────────────── */
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.saved-card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.25s;
  position: relative;
}
.saved-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.saved-card-head {
  display: flex; align-items: center; gap: 12px;
}
.saved-card-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.saved-card-name {
  font-weight: 700; font-size: 16px;
  color: var(--fg);
}
.saved-card-meta {
  font-size: 12.5px; color: var(--fg-muted);
  margin-top: 2px;
}
.saved-card-foot {
  display: flex; gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 12.5px; color: var(--fg-muted);
}
.saved-card-foot span strong { color: var(--fg); font-weight: 700; }

/* ── Profile ──────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
@media (max-width: 980px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.profile-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 800; font-size: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.plus-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800;
  background: var(--accent); color: #1B3A1F;
  padding: 3px 10px; border-radius: 9999px;
  margin-inline-start: 6px;
}
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.stat-tile {
  background: var(--bg-tinted);
  border-radius: 14px;
  padding: 14px 10px;
}
.stat-tile-value { font-weight: 800; font-size: 22px; color: var(--fg); }
.stat-tile-label { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

.settings-list {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.settings-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.settings-row:hover { background: var(--bg-tinted); }
.settings-row:last-child { border-bottom: 0; }
.settings-row-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-row-name {
  flex: 1;
  font-weight: 600; font-size: 14.5px;
  color: var(--fg);
}
.settings-row-value {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 600;
}

/* ── Chef Saladizer slide-over ─────────────────────────── */
.chef-fab {
  position: fixed;
  inset-inline-end: 28px; bottom: 28px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2D7A3E 0%, #43A047 100%);
  color: #fff;
  border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px rgba(45, 122, 62, 0.45);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chef-fab:hover { transform: scale(1.05); }
.chef-fab::after {
  content: ""; position: absolute;
  inset: -6px; border-radius: 50%;
  border: 2px solid rgba(45, 122, 62, 0.30);
  animation: pulse-ring 2.5s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { opacity: 0.6; transform: scale(0.95); }
  100% { opacity: 0;   transform: scale(1.35); }
}

.chef-panel {
  position: fixed; top: 0; bottom: 0;
  inset-inline-end: 0;
  width: 420px; max-width: 100vw;
  background: var(--bg-surface);
  box-shadow: -16px 0 48px rgba(15, 40, 20, 0.18);
  border-inline-start: 1px solid var(--border);
  z-index: 70;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
[dir="rtl"] .chef-panel { transform: translateX(-100%); }
.chef-panel.open { transform: translateX(0); }
.chef-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 40, 20, 0.30);
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.chef-backdrop.open { opacity: 1; pointer-events: auto; }

.chef-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.chef-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2D7A3E 0%, #43A047 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.chef-avatar .online {
  position: absolute; bottom: 0; inset-inline-end: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-leaf-green);
  border: 2px solid var(--bg-surface);
}
.chef-name { font-weight: 800; font-size: 16px; color: var(--fg); }
.chef-sub { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.chef-close {
  margin-inline-start: auto;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-tinted); color: var(--fg-muted);
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chef-close:hover { background: var(--primary-soft); color: var(--primary); }

.chef-body {
  flex: 1; overflow-y: auto;
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.chef-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14.5px; line-height: 1.55;
}
.chef-msg.bot {
  background: var(--bg-tinted);
  color: var(--fg);
  align-self: flex-start;
  border-end-start-radius: 6px;
}
.chef-msg.user {
  background: var(--primary); color: #fff;
  align-self: flex-end;
  border-end-end-radius: 6px;
}
.chef-msg.thinking {
  background: var(--bg-tinted);
  color: var(--fg-muted);
  align-self: flex-start;
  border-end-start-radius: 6px;
  font-style: italic;
}
.chef-msg.thinking .dots span {
  display: inline-block;
  animation: bob 1.2s ease-in-out infinite;
}
.chef-msg.thinking .dots span:nth-child(2) { animation-delay: 0.15s; }
.chef-msg.thinking .dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.chef-suggest {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 22px 14px;
}
.chef-suggest button {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  background: var(--bg-tinted); color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 9999px; padding: 7px 12px;
  cursor: pointer;
}
.chef-suggest button:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); }

.chef-input-wrap {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.chef-input {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-tinted);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 4px 4px 4px 14px;
  transition: border 0.15s, background 0.15s;
}
.chef-input:focus-within { border-color: var(--primary); background: var(--bg-elevated); }
.chef-input input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--fg);
  padding: 10px 0;
}
.chef-input button.send {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--primary); color: #fff;
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chef-input button.send:disabled { opacity: 0.4; cursor: default; }

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: var(--bg-surface);
  padding: 12px 22px;
  border-radius: 9999px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.20);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 80;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive small fixes ────────────────────────────── */
@media (max-width: 1100px) {
  .app { grid-template-columns: 88px 1fr; }
  .sidebar { padding: 24px 12px; }
  .sidebar-brand span, .sidebar-section, .nav-item-label, .plus-promo { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .sidebar-brand { justify-content: center; padding: 6px 0 22px; }
}
@media (max-width: 760px) {
  .macro-grid { grid-template-columns: repeat(2, 1fr); }
  .two-up { grid-template-columns: 1fr; }
  .hero-card-title { font-size: 28px; }
  :root { --content-pad: 18px; }
  .topbar-search { display: none; }
}

/* RTL fixes for transforms */
[dir="rtl"] .nav-item.active::before {
  border-start-end-radius: 0; border-end-end-radius: 0;
  border-start-start-radius: 3px; border-end-start-radius: 3px;
}

/* Pretty scrollbars on overflow panels */
.chef-body::-webkit-scrollbar, .ing-list::-webkit-scrollbar { width: 6px; }
.chef-body::-webkit-scrollbar-thumb, .ing-list::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 3px;
}

/* ── Auth screen ──────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 122, 62, 0.10), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(245, 166, 35, 0.10), transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow-card-hover);
}
.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-brand img {
  height: 56px;
  width: auto;
  object-fit: contain;
}
.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 0 0 6px;
  font-family: "Readex Pro", var(--font-sans);
}
.auth-sub {
  text-align: center;
  color: var(--fg-muted);
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.5;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-label input {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--fg);
  background: var(--bg-surface);
  transition: border-color .15s, box-shadow .15s;
}
.auth-label input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.auth-error {
  background: rgba(220, 53, 69, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 53, 69, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}
.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}
.auth-submit:disabled { opacity: 0.6; cursor: progress; }
.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
}
.auth-switch .link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  padding: 6px;
}
.auth-switch .link:hover { text-decoration: underline; }

/* ── Loading + status overlays ───────────────────────── */
.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  font-size: 14px;
  background: var(--bg);
}
.view-loading {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 14px;
}
.view-error {
  padding: 24px;
  margin: 16px 0;
  background: rgba(220, 53, 69, 0.06);
  border: 1px solid rgba(220, 53, 69, 0.20);
  border-radius: 16px;
  color: var(--danger);
}

/* ── Modal ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
}
.modal-wide { max-width: 640px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  font-family: "Readex Pro", var(--font-sans);
}
.modal-close {
  background: var(--bg-tinted);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--fg-muted);
}
.modal-close:hover { color: var(--fg); background: var(--bg-mint); }
.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Form fields shared ─────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-field input,
.form-field select,
.form-field textarea {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg-surface);
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-tinted);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  appearance: none;
  width: 42px; height: 24px;
  border-radius: 12px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background .15s;
}
.toggle-row input[type="checkbox"]::after {
  content: '';
  position: absolute;
  inset-inline-start: 2px;
  top: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.toggle-row input[type="checkbox"]:checked { background: var(--primary); }
.toggle-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
[dir="rtl"] .toggle-row input[type="checkbox"]:checked::after { transform: translateX(-18px); }

/* ── Tag input ──────────────────────────────────────── */
.tag-input {
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 8px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 9999px;
}
.tag-chip button {
  background: rgba(0,0,0,0.08);
  border: none;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  cursor: pointer;
  color: inherit;
}
.tag-add {
  display: flex;
  gap: 6px;
}
.tag-add input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  background: var(--bg-elevated);
}
.tag-add input:focus { outline: none; border-color: var(--primary); }

/* ── Misc ──────────────────────────────────────────── */
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }
.warn-box {
  background: rgba(220, 53, 69, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 53, 69, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.info-note {
  background: var(--bg-tinted);
  color: var(--fg-muted);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Notifications drawer ─────────────────────────── */
.notif-drawer {
  position: fixed;
  top: 0;
  inset-inline-end: -380px;
  width: 380px;
  max-width: 100%;
  height: 100vh;
  background: var(--bg-elevated);
  border-inline-start: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: inset-inline-end .25s ease-out;
}
.notif-drawer.open { inset-inline-end: 0; }
.notif-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-title {
  font-weight: 700;
  color: var(--fg);
  font-size: 14px;
  margin-bottom: 4px;
}
.notif-body {
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 6px;
}
.notif-time {
  color: var(--fg-muted);
  font-size: 11px;
}

/* Settings rows clickable */
.settings-row {
  cursor: pointer;
  transition: background .15s;
}
.settings-row:hover { background: var(--bg-tinted); }

/* Profile section divider */
.profile-section-title {
  margin-top: 28px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

/* Notification bell dot */
.bell-with-dot {
  position: relative;
}
.bell-with-dot .unread-dot {
  position: absolute;
  top: 6px; inset-inline-end: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
}

/* Builder AI buttons */
.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.ai-actions button {
  flex: 1;
  min-width: 140px;
}

/* Chef "thinking" indicator pulse */
@keyframes chef-pulse-anim {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.6); opacity: 0.4; }
}
.chef-pulse { animation: chef-pulse-anim 1.1s ease-in-out infinite; }
