:root {
      --cream: #F7F3EC;
      --warm: #E8DFD0;
      --terracotta: #C4673A;
      --terracotta-light: #E08860;
      --forest: #3D5A47;
      --forest-light: #5A7A63;
      --ink: #1C1C1E;
      --muted: #7A7570;
      --baby: #6B9BB8;
      --baby-light: #A8C8DC;
      --surface: #FFFFFF;
      --shadow: rgba(28,28,30,0.08);
    }
    [data-theme="dark"] {
      --cream: #1A1917;
      --warm: #252320;
      --terracotta: #E08860;
      --terracotta-light: #F0A880;
      --forest: #5A8A6A;
      --forest-light: #7AAA8A;
      --ink: #F5F5F5;
      --muted: #A09890;
      --baby: #7EB3CC;
      --baby-light: #A8C8DC;
      --surface: #2A2826;
      --shadow: rgba(0,0,0,0.3);
    }
    [data-theme="dark"] body { background: var(--cream); color: var(--ink); }
    [data-theme="dark"] header { background: #141312; }
    [data-theme="dark"] .btn-ghost { background: rgba(255,255,255,.12); color: #F5F5F5; border-color: rgba(255,255,255,.25); }
    [data-theme="dark"] .btn-ghost:hover { background: rgba(255,255,255,.2); }
    [data-theme="dark"] .btn-primary { background: var(--terracotta); color: #fff; }
    [data-theme="dark"] .tab { color: #888; }
    [data-theme="dark"] .tab.active { color: #F5F5F5; }
    [data-theme="dark"] .baby-tab.active { color: #F5F5F5; }
    [data-theme="dark"] .day-label,
    [data-theme="dark"] .meal-name,
    [data-theme="dark"] .item-name { color: #F5F5F5; }
    [data-theme="dark"] .req-input { background: var(--surface); color: #F5F5F5; border-color: #444; }
    [data-theme="dark"] .shared-menu-label { color: #F5F5F5; }
    [data-theme="dark"] .error-banner { background: #3A1A1A; border-color: #6A2A2A; color: #F88; }
    [data-theme="dark"] .recipe-modal { background: var(--surface); }
    [data-theme="dark"] .recipe-modal-header { background: var(--surface); border-color: var(--warm); }
    [data-theme="dark"] .section-title,
    [data-theme="dark"] .shopping-section h2,
    [data-theme="dark"] h2,
    [data-theme="dark"] h3 { color: #F5F5F5; }

    /* Theme toggle */
    .theme-toggle-wrap {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .theme-toggle-emoji {
      font-size: 1rem;
      line-height: 1;
      user-select: none;
    }
    .theme-toggle {
      width: 40px; height: 22px;
      background: rgba(255,255,255,0.15);
      border: 1.5px solid rgba(255,255,255,0.25);
      border-radius: 11px;
      cursor: pointer;
      position: relative;
      flex-shrink: 0;
      transition: background 0.2s;
    }
    .theme-toggle::after {
      content: '';
      position: absolute; top: 2px; left: 2px;
      width: 16px; height: 16px;
      border-radius: 50%; background: white;
      transition: transform 0.22s cubic-bezier(.4,0,.2,1);
    }
    [data-theme="dark"] .theme-toggle::after { transform: translateX(18px); }

    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--cream);
      color: var(--ink);
      min-height: 100vh;
    }

    /* HEADER */
    header {
      background: var(--ink);
      color: #F5F0E8;
      padding: 2rem 2.5rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }
    header h1 {
      font-family: 'Playfair Display', serif;
      font-size: 2rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      color: #F5F0E8;
    }
    header h1 span { color: var(--terracotta-light); font-style: italic; }
    header p { font-size: 0.85rem; color: #999; margin-top: 0.2rem; }

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

    .btn {
      padding: 0.6rem 1.2rem;
      border-radius: 8px;
      border: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .btn-primary { background: var(--terracotta); color: white; }
    .btn-primary:hover { background: var(--terracotta-light); }
    .btn-secondary { background: var(--forest); color: white; }
    .btn-secondary:hover { background: var(--forest-light); }
    .btn-ghost { background: rgba(255,255,255,0.1); color: var(--cream); border: 1px solid rgba(255,255,255,0.2); }
    .btn-ghost:hover { background: rgba(255,255,255,0.2); }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; }

    /* TABS */
    .tabs {
      display: flex;
      gap: 0;
      background: var(--warm);
      border-bottom: 2px solid rgba(0,0,0,0.06);
      padding: 0 2.5rem;
    }
    .tab {
      padding: 1rem 1.5rem;
      border: none;
      background: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.9rem;
      font-weight: 500;
      cursor: pointer;
      color: var(--muted);
      border-bottom: 3px solid transparent;
      margin-bottom: -2px;
      transition: all 0.2s;
    }
    .tab.active { color: var(--ink); border-bottom-color: var(--terracotta); }
    .tab.baby-tab.active { border-bottom-color: var(--baby); }
    .tab:hover:not(.active) { color: var(--ink); }

    /* MAIN */
    main { padding: 2rem 2.5rem; max-width: 1400px; margin: 0 auto; }

    /* LOADING */
    .loading-state {
      text-align: center;
      padding: 5rem 2rem;
    }
    .spinner {
      width: 48px; height: 48px;
      border: 4px solid var(--warm);
      border-top-color: var(--terracotta);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin: 0 auto 1.5rem;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .loading-state h2 {
      font-family: 'Playfair Display', serif;
      font-size: 1.5rem;
      margin-bottom: 0.5rem;
    }
    .loading-state p { color: var(--muted); font-size: 0.9rem; }
    .loading-step { color: var(--terracotta) !important; font-weight: 600; margin-bottom: 0.35rem !important; }

    /* EMPTY STATE */
    .empty-state {
      text-align: center;
      padding: 5rem 2rem;
    }
    .empty-icon { font-size: 4rem; margin-bottom: 1rem; }
    .empty-state h2 {
      font-family: 'Playfair Display', serif;
      font-size: 2rem;
      margin-bottom: 0.75rem;
    }
    .empty-state p { color: var(--muted); max-width: 420px; margin: 0 auto 2rem; line-height: 1.6; }

    /* WEEK GRID */
    .week-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 0.75rem;
      margin-bottom: 2.5rem;
    }

    .day-card {
      background: var(--surface);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 2px 8px var(--shadow);
      transition: transform 0.2s, box-shadow 0.2s;
    }
    .day-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }

    .day-header {
      background: var(--ink);
      color: var(--cream);
      padding: 0.5rem 0.6rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .day-header-left { text-align: center; flex: 1; }
    .day-header .day-name {
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: #888;
    }
    .day-header .day-label {
      font-family: 'Playfair Display', serif;
      font-size: 1rem;
      font-weight: 700;
    }
    .regen-day-btn {
      background: none; border: none; cursor: pointer;
      font-size: 0.75rem; opacity: 0.5; padding: 0.2rem;
      color: var(--cream); transition: opacity 0.15s;
      flex-shrink: 0;
    }
    .regen-day-btn:hover:not(:disabled) { opacity: 1; }
    .regen-day-btn:disabled { opacity: 0.2; cursor: not-allowed; filter: grayscale(1); }

    .day-body { padding: 0.8rem; }

    .meal-slot { margin-bottom: 0.75rem; }
    .meal-slot:last-child { margin-bottom: 0; }
    .meal-type {
      font-size: 0.65rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 500;
      margin-bottom: 0.25rem;
    }
    .meal-type.lunch { color: var(--terracotta); }
    .meal-type.dinner { color: var(--forest); }
    .meal-type.baby-meal { color: var(--baby); }
    .meal-name {
      font-size: 0.8rem;
      font-weight: 500;
      line-height: 1.3;
      color: var(--ink);
    }
    .meal-desc {
      font-size: 0.7rem;
      color: var(--muted);
      margin-top: 0.15rem;
      line-height: 1.3;
    }
    .meal-divider {
      height: 1px;
      background: var(--warm);
      margin: 0.6rem 0;
    }

    /* BABY GRID */
    .baby-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 0.75rem;
      margin-bottom: 2.5rem;
    }
    .baby-card {
      background: var(--surface);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 2px 8px var(--shadow);
    }
    .baby-card .day-header { background: var(--baby); color: white; }
    .baby-card .day-header .day-name { color: rgba(255,255,255,0.7); }

    /* SHOPPING LIST */
    .shopping-section { margin-top: 1rem; }
    .shopping-section h2 {
      font-family: 'Playfair Display', serif;
      font-size: 1.5rem;
      margin-bottom: 0.25rem;
    }
    .shopping-section p { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

    .categories-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
      gap: 1rem;
    }

    .category-card {
      background: var(--surface);
      border-radius: 12px;
      padding: 1.2rem;
      box-shadow: 0 2px 8px var(--shadow);
    }
    .category-card h3 {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-weight: 600;
      margin-bottom: 0.8rem;
      padding-bottom: 0.5rem;
      border-bottom: 2px solid var(--warm);
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }
    .category-card ul { list-style: none; }
    .category-card li {
      font-size: 0.85rem;
      padding: 0.3rem 0;
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      border-bottom: 1px solid rgba(0,0,0,0.04);
      gap: 0.5rem;
    }
    .category-card li:last-child { border-bottom: none; }
    .item-name { color: var(--ink); }
    .item-qty { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

    /* SECTION TITLE */
    .section-title {
      font-family: 'Playfair Display', serif;
      font-size: 1.5rem;
      margin-bottom: 0.25rem;
    }
    .section-subtitle { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.25rem; }

    .panel { display: none; }
    .panel.active { display: block; }

    /* ERROR */
    .error-banner {
      background: #FEE;
      border: 1px solid #FCC;
      border-radius: 8px;
      padding: 1rem 1.25rem;
      margin-bottom: 1.5rem;
      font-size: 0.85rem;
      color: #C00;
    }

    .meal-link {
      display: inline-block;
      margin-top: 0.25rem;
      font-size: 0.65rem;
      color: var(--terracotta);
      text-decoration: none;
      font-weight: 500;
      opacity: 0.8;
      transition: opacity 0.15s;
    }
    .meal-link:hover { opacity: 1; text-decoration: underline; }

    /* ── CRÈCHE TOGGLE ── */
    .creche-toggle {
      display: block;
      width: 100%;
      margin-bottom: 0.6rem;
      padding: 0.3rem 0.5rem;
      border-radius: 6px;
      border: 1.5px dashed #ccc;
      background: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.68rem;
      font-weight: 500;
      color: var(--muted);
      cursor: pointer;
      transition: all 0.18s;
      text-align: center;
      letter-spacing: 0.03em;
    }
    .creche-toggle:hover { border-color: var(--baby); color: var(--baby); }
    .creche-toggle.creche-on {
      background: var(--baby);
      border-color: var(--baby);
      color: white;
      border-style: solid;
    }



    /* ── REQUIREMENTS BAR ── */
    .requirements-bar {
      background: var(--warm);
      border-bottom: 1px solid rgba(0,0,0,0.08);
      padding: 0.6rem 2.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .req-row {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      width: 100%;
    }
    .req-checkboxes {
      display: flex;
      align-items: center;
      gap: 1rem;
    }
    .req-label {
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--muted);
      white-space: nowrap;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    .req-input {
      flex: 1;
      min-width: 200px;
      padding: 0.4rem 0.75rem;
      border-radius: 8px;
      border: 1.5px solid rgba(0,0,0,0.1);
      background: var(--surface);
      font-family: 'DM Sans', sans-serif;
      font-size: 0.82rem;
      color: var(--ink);
      outline: none;
      transition: border-color 0.2s;
    }
    .req-input:focus { border-color: var(--terracotta); }
    .req-input::placeholder { color: #bbb; }
    .req-hint {
      font-size: 0.72rem;
      color: var(--terracotta);
      font-weight: 500;
      white-space: nowrap;
      min-width: 0;
      transition: opacity 0.3s;
    }
    .shared-menu-label {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      font-size: 0.78rem;
      font-weight: 500;
      color: var(--ink);
      white-space: nowrap;
      cursor: pointer;
      user-select: none;
    }
    .shared-menu-label input[type="checkbox"] {
      accent-color: var(--forest);
      width: 15px;
      height: 15px;
      cursor: pointer;
    }

    /* ── RESPONSIVE ── */
    @media (max-width: 1100px) {
      .week-grid, .baby-grid { grid-template-columns: repeat(4, 1fr); }
    }
    @media (max-width: 800px) {
      .week-grid, .baby-grid { grid-template-columns: repeat(3, 1fr); }
      main { padding: 1.25rem 1rem; }
      .tabs { padding: 0 1rem; overflow-x: auto; }
      .tab { padding: 0.8rem 1rem; font-size: 0.82rem; white-space: nowrap; }
    }
    @media (max-width: 560px) {
      header { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1.25rem 1rem; }
      header h1 { font-size: 1.4rem; }
      .header-actions { width: 100%; }
      .header-actions .btn { flex: 1; justify-content: center; font-size: 0.78rem; padding: 0.5rem 0.75rem; }
      .week-grid, .baby-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
      .day-header .day-name { display: none; }  /* hide LUN — day-label shows full name */
      .day-header .day-label { font-size: 0.9rem; font-weight: 700; }
      .day-body { padding: 0.6rem; }
      .meal-name { font-size: 0.75rem; }
      .meal-desc { font-size: 0.65rem; }
      .categories-grid { grid-template-columns: 1fr; }
      .tabs { padding: 0 0.75rem; }
      .tab { padding: 0.75rem 0.85rem; font-size: 0.78rem; }
      .requirements-bar { padding: 0.6rem 1rem; gap: 0.5rem; }
      .req-label { display: none; }
    }
    @media (max-width: 360px) {
      .week-grid, .baby-grid { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
    }

    /* Scrollable tabs on narrow screens */
    .tabs { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }

    /* ── SHARE TOAST ── */
    .share-toast {
      position: fixed;
      bottom: 1.5rem;
      left: 50%;
      transform: translateX(-50%) translateY(2rem);
      background: var(--ink);
      color: var(--cream);
      padding: 0.7rem 1.25rem;
      border-radius: 10px;
      font-size: 0.85rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 0.6rem;
      box-shadow: 0 4px 20px rgba(0,0,0,0.25);
      opacity: 0;
      transition: all 0.3s ease;
      z-index: 2000;
      white-space: nowrap;
    }
    .share-toast.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    .share-toast.error { background: #C00; }

    /* ── HISTORY ── */
    .history-list { display: flex; flex-direction: column; gap: 0.75rem; max-width: 600px; }
    .history-item {
      background: var(--surface);
      border-radius: 12px;
      padding: 1rem 1.25rem;
      box-shadow: 0 2px 8px var(--shadow);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }
    .history-item-info { flex: 1; }
    .history-item-date { font-size: 0.78rem; font-weight: 600; color: var(--ink); }
    .history-item-preview { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
    .history-item-actions { display: flex; gap: 0.5rem; }
    .btn-sm {
      padding: 0.35rem 0.75rem;
      border-radius: 6px;
      border: none;
      font-family: 'DM Sans', sans-serif;
      font-size: 0.75rem;
      font-weight: 500;
      cursor: pointer;
    }
    .btn-sm-primary { background: var(--terracotta); color: white; }
    .btn-sm-ghost { background: var(--warm); color: var(--ink); }
    .btn-sm-ghost:hover { background: #ddd; }
    .history-empty { color: var(--muted); font-size: 0.9rem; padding: 2rem 0; }

    /* ── MOBILE EXPAND ── */
    @media (max-width: 560px) {
      .meal-desc, .meal-link { display: none; }
      .day-card.expanded .meal-desc,
      .day-card.expanded .meal-link { display: block; }
      .day-card { cursor: pointer; }
      .day-card::after {
        content: '›';
        position: absolute;
        bottom: 0.4rem;
        right: 0.6rem;
        font-size: 0.9rem;
        color: var(--muted);
        transition: transform 0.2s;
      }
      .day-card { position: relative; }
      .day-card.expanded::after { transform: rotate(90deg); }
    }

    /* ── PRINT ── */
    @media print {
      .mockup-banner, header .header-actions, .tabs, .requirements-bar,
      .share-toast, .btn, .creche-toggle, .meal-link { display: none !important; }
      header { padding: 1rem; }
      header h1 { font-size: 1.4rem; }
      body { background: white; }
      .week-grid, .baby-grid { grid-template-columns: repeat(7, 1fr) !important; gap: 0.4rem; }
      .day-card, .baby-card, .category-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        break-inside: avoid;
      }
      .panel { display: block !important; margin-bottom: 2rem; }
      .panel::before {
        content: attr(data-print-title);
        display: block;
        font-family: 'Playfair Display', serif;
        font-size: 1.2rem;
        font-weight: 700;
        margin-bottom: 0.75rem;
        border-bottom: 2px solid #C4673A;
        padding-bottom: 0.4rem;
      }
      main { padding: 0.5rem; }
    }

    /* ── RECIPE MODAL ── */
    .recipe-overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.55);
      backdrop-filter: blur(3px);
      z-index: 3000;
      display: flex; align-items: center; justify-content: center;
      padding: 1rem;
      opacity: 0; transition: opacity 0.2s;
      pointer-events: none;
    }
    .recipe-overlay.open { opacity: 1; pointer-events: all; }
    .recipe-modal {
      background: var(--surface);
      border-radius: 16px;
      max-width: 560px; width: 100%;
      max-height: 85vh;
      overflow-y: auto;
      box-shadow: 0 20px 60px rgba(0,0,0,0.3);
      transform: translateY(12px); transition: transform 0.2s;
    }
    .recipe-overlay.open .recipe-modal { transform: translateY(0); }
    .recipe-modal-header {
      padding: 1.25rem 1.5rem 0.75rem;
      border-bottom: 1px solid var(--warm);
      display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
      position: sticky; top: 0; background: var(--surface); z-index: 1;
    }
    .recipe-modal-title {
      font-family: 'Playfair Display', serif;
      font-size: 1.2rem; font-weight: 700; line-height: 1.3;
    }
    .recipe-modal-close {
      background: none; border: none; font-size: 1.4rem;
      cursor: pointer; color: var(--muted); flex-shrink: 0;
      padding: 0; line-height: 1;
    }
    .recipe-modal-close:hover { color: var(--ink); }
    .recipe-modal-body { padding: 1.25rem 1.5rem 1.5rem; }
    .recipe-modal-body h3 {
      font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
      font-weight: 700; color: var(--terracotta); margin: 1rem 0 0.4rem;
    }
    .recipe-modal-body h3:first-child { margin-top: 0; }
    .recipe-modal-body ul, .recipe-modal-body ol {
      padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.3rem;
    }
    .recipe-modal-body li { font-size: 0.88rem; line-height: 1.5; }
    .recipe-modal-body p { font-size: 0.88rem; line-height: 1.6; color: var(--muted); }
    .recipe-loading {
      display: flex; flex-direction: column; align-items: center;
      gap: 1rem; padding: 2.5rem 1rem; color: var(--muted);
    }
    .recipe-loading .spinner { width: 32px; height: 32px; border-width: 3px; margin: 0; }
