html { scroll-behavior: smooth; }

  .week-hero-card { padding: 1.1rem 1.2rem; background: linear-gradient(160deg, rgba(227, 242, 253, .92), rgba(241, 248, 233, .94)); border-color: rgba(80, 140, 115, .22); }
  .week-hero-card__eyebrow { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #245f46; margin-bottom: .7rem; }
  .week-hero-card__content { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
  .week-hero-card__title { margin: 0; font-size: 1.18rem; color: #174f39; }
  .week-hero-card__copy { margin: .45rem 0 0; max-width: 42rem; color: var(--text-muted); line-height: 1.6; }
  .week-hero-card__actions { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
  .week-hero-card__link { display: inline-flex; align-items: center; justify-content: center; min-height: 2.35rem; padding: .58rem .9rem; border-radius: 999px; background: rgba(255,255,255,.88); border: 1px solid rgba(29, 94, 62, .16); color: var(--green-dark); font-size: .84rem; font-weight: 700; text-decoration: none; }
  .week-hero-card__link--subtle { background: rgba(255,255,255,.64); color: var(--text-muted); }

/* Week Cards */
  .card-header { background: var(--green-pale); padding: .75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; gap: .5rem; }
    .card-header:hover { background: #c7ead4; }
    .card-header h2 { font-size: 1rem; font-weight: 600; color: var(--green-dark); flex: 1; }
    .card-header .toggle { font-size: 1.1rem; transition: transform .2s; flex-shrink: 0; }
    .card-header.collapsed .toggle { transform: rotate(-90deg); }
    .card-body { padding: 1.25rem; }
    .card-body.collapsed { display: none; }
  .collapse-pill { display: inline-flex; align-items: center; gap: .45rem; padding: .28rem .65rem; border-radius: 999px; background: rgba(255,255,255,.72); border: 1px solid rgba(24, 79, 57, .14); color: var(--green-dark); font-size: .77rem; font-weight: 700; white-space: nowrap; }
  .card-header.collapsed .collapse-pill { color: var(--text-muted); }

    /* Input Area */
    .input-card .card-header { background: var(--amber-light); border-color: var(--amber); }
    .input-card .card-header:hover { background: #f9d4b0; }
    .input-card .card-header h2 { color: #7c3900; }
    .input-card { border-color: var(--amber); }
    #md-input { width: 100%; min-height: 180px; border: 1.5px solid var(--border); border-radius: 7px; padding: .65rem .85rem; font-size: .85rem; font-family: 'Cascadia Code', 'Consolas', monospace; color: var(--text); background: var(--color-surface-elevated); resize: vertical; line-height: 1.5; }
    #md-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(64,145,108,.18); }
    .input-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .75rem; align-items: center; }
    .btn-render { padding: .55rem 1.4rem; background: linear-gradient(135deg, var(--green-dark), var(--green)); color: white; border: none; border-radius: 8px; font-size: .95rem; font-weight: 700; cursor: pointer; box-shadow: 0 3px 10px rgba(45,106,79,.25); transition: transform .1s, box-shadow .1s; }
    .btn-render:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(45,106,79,.32); }
    .btn-render:active { transform: none; }
    .btn-secondary { min-height: 2.75rem; padding: .5rem 1.1rem; background: white; color: var(--green-dark); border: 1.5px solid var(--green); border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; transition: background .12s; }
    .btn-secondary:hover { background: var(--green-pale); }
    .btn-danger { min-height: 2.75rem; padding: .38rem .75rem; background: white; color: #c0392b; border: 1.5px solid #e17070; border-radius: 7px; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .12s; flex-shrink: 0; }
    .btn-danger:hover { background: #fdecea; }
    .input-hint { font-size: .77rem; color: var(--text-muted); margin-left: auto; }
    .char-count { font-size: .75rem; color: var(--text-muted); margin-top: .35rem; }

    /* Save Row */
    .save-row { display: flex; gap: .6rem; align-items: center; margin-top: .9rem; flex-wrap: wrap; }
    .plan-name-field { flex: 1; min-width: 160px; border: 1.5px solid var(--border); border-radius: 7px; padding: .48rem .75rem; font-size: .88rem; color: var(--text); background: var(--color-surface-elevated); }
    .plan-name-field:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(64,145,108,.15); }
    .btn-save { min-height: 2.75rem; padding: .5rem 1.15rem; background: linear-gradient(135deg, #2d6a4f, #40916c); color: white; border: none; border-radius: 8px; font-size: .9rem; font-weight: 700; cursor: pointer; transition: transform .1s, opacity .1s; white-space: nowrap; }
    .btn-save:hover { opacity: .88; transform: translateY(-1px); }

    /* Plan-Bibliothek */
    .library-card .card-header { background: #e8f5e9; border-bottom: 1px solid #b2dfdb; }
    .library-card .card-header:hover { background: #d4edda; }
    .library-card .card-header h2 { color: #1b5e20; }
    .library-card { border-color: #a5d6a7; }
    .library-empty { text-align: center; padding: 1.5rem 1rem; color: var(--text-muted); font-size: .88rem; }
    .library-empty .empty-icon { font-size: 2rem; margin-bottom: .4rem; }
    .plan-list-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .85rem; border-radius: 9px; background: var(--green-bg); border: 1px solid var(--border); margin-bottom: .5rem; transition: background .12s; }
    .plan-list-item:last-child { margin-bottom: 0; }
    .plan-list-item:hover { background: var(--green-pale); }
    .pli-icon { font-size: 1.15rem; flex-shrink: 0; }
    .pli-info { flex: 1; min-width: 0; }
    .pli-name { font-weight: 700; color: var(--green-dark); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pli-date { font-size: .73rem; color: var(--text-muted); margin-top: .1rem; }
    .pli-actions { display: flex; gap: .4rem; flex-shrink: 0; }
    .btn-load { min-height: 2.75rem; padding: .35rem .75rem; background: var(--green-pale); color: var(--green-dark); border: 1.5px solid var(--green-light); border-radius: 7px; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .12s; white-space: nowrap; }
    .btn-load:hover { background: #b7e5c7; }
    .library-toolbar { display: flex; gap: .55rem; margin-top: 1rem; flex-wrap: wrap; align-items: center; padding-top: .9rem; border-top: 1px dashed var(--border); }

    /* Plan Overview */
    .plan-overview-card { margin: 0 0 1rem; padding: 1rem 1rem 1.1rem; border-radius: 16px; background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(240, 247, 243, .96)); border: 1px solid rgba(31, 94, 62, .12); box-shadow: 0 10px 24px rgba(21, 48, 36, .06); }
    .plan-overview-card__intro { margin-bottom: .85rem; }
    .plan-overview-card__eyebrow { display: inline-block; margin-bottom: .35rem; font-size: .73rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #4a7d63; }
    .plan-overview-card__title { margin: 0; font-size: 1.08rem; color: #184f39; }
    .plan-overview-card__copy { margin: .35rem 0 0; color: var(--text-muted); line-height: 1.55; }
    .plan-overview-card__jumps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .65rem; }
    .plan-jump-chip { display: flex; align-items: center; gap: .75rem; min-height: 4.4rem; padding: .75rem .85rem; border-radius: 14px; border: 1px solid rgba(31, 94, 62, .12); background: rgba(255,255,255,.82); color: inherit; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.75); }
    .plan-jump-chip__icon { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border-radius: 12px; background: rgba(210, 232, 219, .8); font-size: 1.15rem; }
    .plan-jump-chip__copy { display: flex; flex-direction: column; gap: .18rem; min-width: 0; }
    .plan-jump-chip__title { font-size: .88rem; font-weight: 700; color: var(--green-dark); }
    .plan-jump-chip__hint { font-size: .75rem; color: var(--text-muted); line-height: 1.35; }
    .plan-cluster { margin-top: 1rem; scroll-margin-top: calc(var(--safe-top) + 7.4rem); }
    .plan-cluster-header { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; padding: 0 .1rem; }
    .plan-cluster-header__eyebrow { display: inline-block; font-size: .73rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #4a7d63; }
    .plan-cluster-header__title { margin: .25rem 0 0; font-size: 1rem; color: #184f39; }
    .plan-cluster-header__count { display: inline-flex; align-items: center; padding: .28rem .62rem; border-radius: 999px; background: rgba(212, 237, 218, .9); color: #245f46; font-size: .76rem; font-weight: 700; white-space: nowrap; }
    .plan-cluster-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
    .plan-cluster-link { display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .65rem; border-radius: 999px; background: rgba(255,255,255,.88); border: 1px solid rgba(31, 94, 62, .12); color: var(--green-dark); font-size: .77rem; font-weight: 600; text-decoration: none; }
    .plan-cluster-link__number { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem; border-radius: 999px; background: #d7ebdf; font-size: .7rem; font-weight: 700; }
    .plan-cluster-body { display: grid; gap: .85rem; }

    /* Plan Section Cards */
    .plan-card { background: var(--white); border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; scroll-margin-top: calc(var(--safe-top) + 8rem); }
    .plan-card-header { background: linear-gradient(180deg, #eff8f3, #e2f0e6); padding: .85rem 1.05rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); }
    .plan-card-header:hover { background: #c7ead4; }
    .plan-card-leading { display: flex; align-items: center; gap: .7rem; min-width: 0; }
    .plan-card-number { background: var(--green-dark); color: white; font-size: .72rem; font-weight: 700; padding: .18rem .5rem; border-radius: 10px; min-width: 1.8rem; text-align: center; flex-shrink: 0; }
    .plan-card-icon { font-size: 1.1rem; flex-shrink: 0; }
    .plan-card-copy { display: flex; flex-direction: column; gap: .14rem; min-width: 0; }
    .plan-card-kicker { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #4a7d63; font-weight: 700; }
    .plan-card-title { font-size: 1rem; font-weight: 600; color: var(--green-dark); }
    .plan-card-toggle { font-size: 1.05rem; transition: transform .2s; flex-shrink: 0; }
    .plan-card-header.collapsed .plan-card-toggle { transform: rotate(-90deg); }
    .plan-card-body { padding: 1.25rem; }
    .plan-card-body.collapsed { display: none; }

    /* Markdown Content */
    .plan-content { font-size: .9rem; line-height: 1.75; color: var(--text); }
    .plan-content p { margin: .4rem 0; }
    .plan-content strong { color: var(--green-dark); font-weight: 700; }
    .plan-content em { font-style: italic; color: var(--text-muted); }
    .plan-content code { background: var(--green-pale); padding: .1rem .3rem; border-radius: 3px; font-family: monospace; font-size: .82rem; }
    .plan-h2 { font-size: .97rem; font-weight: 700; color: var(--green-dark); margin: 1.1rem 0 .45rem; padding-left: .7rem; border-left: 3px solid var(--green-light); }
    .plan-h3 { font-size: .88rem; font-weight: 700; color: var(--green); margin: .8rem 0 .3rem; }
    .plan-hr { border: none; border-top: 1px dashed var(--border); margin: .9rem 0; }
    .plan-list { padding-left: 1.4rem; margin: .35rem 0 .55rem; }
    .plan-list li { margin: .2rem 0; }

    /* Tables */
    .plan-table-wrap { overflow-x: auto; margin: .65rem 0 .8rem; border-radius: 8px; border: 1px solid var(--border); }
    .plan-table { border-collapse: collapse; width: 100%; font-size: .82rem; min-width: 400px; }
    .plan-table th { background: var(--green-pale); color: var(--green-dark); font-weight: 700; padding: .4rem .7rem; border: 1px solid var(--border); text-align: left; white-space: nowrap; }
    .plan-table td { padding: .38rem .7rem; border: 1px solid var(--border); vertical-align: top; }
    .plan-table tr:nth-child(even) td { background: #f8fdfb; }
    .plan-table td:first-child { font-weight: 600; color: var(--green-dark); white-space: nowrap; }

    /* Menu section mobile cards */
    .menu-day-grid { display: none; gap: .75rem; margin-bottom: .9rem; }
    .menu-day-card { border: 1px solid rgba(31, 94, 62, .12); border-radius: 14px; background: linear-gradient(180deg, #ffffff, #f7fbf8); padding: .9rem .95rem; box-shadow: 0 8px 18px rgba(20, 48, 36, .05); }
    .menu-day-card__header { display: flex; align-items: center; justify-content: space-between; gap: .65rem; margin-bottom: .75rem; }
    .menu-day-card__day { font-size: .98rem; color: var(--green-dark); }
    .menu-day-card__cost { display: inline-flex; align-items: center; padding: .28rem .58rem; border-radius: 999px; background: #eef7f1; color: #245f46; font-size: .74rem; font-weight: 700; }
    .menu-day-card__body { display: grid; gap: .65rem; }
    .menu-day-card__slot { display: grid; gap: .16rem; padding: .6rem .7rem; border-radius: 12px; background: #f5faf7; border: 1px solid rgba(31, 94, 62, .08); }
    .menu-day-card__label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5d7d6f; }
    .menu-day-card__value { font-size: .88rem; color: var(--text); line-height: 1.45; }
    .menu-day-card__notes { margin-top: .75rem; padding-top: .7rem; border-top: 1px dashed rgba(31, 94, 62, .16); }
    .menu-day-card__notes p { margin: .2rem 0 0; color: var(--text); line-height: 1.5; font-size: .85rem; }
    .week-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .65rem; margin-top: .9rem; }
    .week-summary-metric { padding: .72rem .8rem; border-radius: 12px; background: #f5faf7; border: 1px solid rgba(31, 94, 62, .1); }
    .week-summary-metric__label { display: block; margin-bottom: .24rem; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #5d7d6f; }
    .week-summary-metric__value { font-size: .94rem; color: var(--green-dark); }

    /* Scroll button */
    .scroll-fab { position: fixed; bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 1rem); right: 1.25rem; z-index: 9998; display: grid; gap: .55rem; }
    .scroll-fab .sa { width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; cursor: pointer; color: white; border: none; border-radius: 999px; background: var(--green-dark); box-shadow: 0 3px 10px rgba(45,106,79,.35); padding: 0; line-height: 1; transition: transform .16s, opacity .25s, background .2s; }
    .scroll-fab .sa:hover { background: var(--green); transform: translateY(-1px); }
    .scroll-fab.at-top .sa-up,
    .scroll-fab.at-bottom .sa-down { opacity: .45; }

    /* Empty State */
    .empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
    .empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
    .empty-state p { font-size: .95rem; line-height: 1.6; }
    .empty-state p strong { color: var(--green-dark); }
    .empty-state-actions { display: flex; justify-content: center; gap: .65rem; flex-wrap: wrap; margin-top: 1rem; }
    .empty-state-link { display: inline-flex; align-items: center; justify-content: center; min-height: 2.3rem; padding: .55rem .88rem; border-radius: 999px; background: white; border: 1px solid rgba(31, 94, 62, .12); color: var(--green-dark); font-size: .82rem; font-weight: 700; text-decoration: none; }

    /* Toast */
    .toast { position: fixed; bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 1rem); right: 1.5rem; background: var(--green-dark); color: white; padding: .6rem 1.2rem; border-radius: 8px; font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9999; }
    .toast.show { opacity: 1; }

    @media (max-width: 780px) {
      .week-hero-card__content { flex-direction: column; align-items: stretch; }
      .week-hero-card__actions { justify-content: flex-start; }
      .plan-overview-card__jumps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .plan-card-header { padding: .82rem .9rem; }
      .plan-card-leading { align-items: flex-start; }
      .plan-card-title { font-size: .95rem; }
      .plan-cluster-header { align-items: flex-start; flex-direction: column; }
      .plan-cluster-header__count { margin-top: -.15rem; }
    }

    @media (max-width: 600px) {
      .week-hero-card { padding: .95rem .95rem 1rem; }
      .week-hero-card__title { font-size: 1.04rem; }
      .week-hero-card__copy { font-size: .88rem; }
      .week-hero-card__actions { display: grid; grid-template-columns: 1fr 1fr; }
      .week-hero-card__link { width: 100%; }
      .plan-card-body { padding: .85rem 1rem; }
      .save-row { flex-direction: column; align-items: stretch; }
      .plan-name-field { width: 100%; }
      .plan-overview-card { padding: .88rem .88rem .95rem; }
      .plan-overview-card__jumps { grid-template-columns: 1fr; }
      .plan-jump-chip { min-height: 3.9rem; padding: .7rem .75rem; }
      .menu-day-grid { display: grid; }
      .menu-day-table { display: none; }
      .plan-cluster-links { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .1rem; }
      .plan-cluster-link { flex: 0 0 auto; }
      .collapse-pill { padding: .26rem .52rem; font-size: .72rem; }
      .collapse-pill .toggle-label { display: none; }
      .empty-state-actions { flex-direction: column; }
      .empty-state-link { width: 100%; }
    }

    /* Key-Value Grid */
    .kv-grid { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; margin: .4rem 0 .75rem; }
    .kv-key  { font-weight: 700; color: var(--green-dark); font-size: .82rem; white-space: nowrap; }
    .kv-val  { font-size: .85rem; color: var(--text); }

    /* Sub-cards (batches, templates, gerichte …) */
    .sub-card { background: var(--green-bg); border: 1px solid var(--border); border-radius: 8px; padding: .75rem 1rem; margin-bottom: .65rem; }
    .sub-card:last-child { margin-bottom: 0; }
    .sub-card-title { font-weight: 700; color: var(--green-dark); font-size: .92rem; margin-bottom: .45rem; }
    .dish-zone { margin-top: .7rem; padding-top: .65rem; border-top: 1px solid rgba(31,94,62,.12); }
    .dish-zone:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
    .dish-zone-title { font-size: .88rem; font-weight: 700; color: var(--green); margin: .8rem 0 .3rem; }
    .dish-zone:first-child .dish-zone-title { margin-top: 0; }
    .ingredient-switcher { margin: .35rem 0 .25rem; }
    .ingredient-switcher-label { font-size: .76rem; font-weight: 700; color: var(--text-muted); margin-bottom: .25rem; }
    .ingredient-switcher-controls { display: inline-flex; gap: .25rem; padding: .2rem; background: #eef6f1; border: 1px solid var(--border); border-radius: 999px; }
    .ingredient-switcher-btn { border: 0; background: transparent; color: var(--green-dark); font-size: .78rem; font-weight: 700; padding: .28rem .62rem; border-radius: 999px; cursor: pointer; }
    .ingredient-switcher-btn.active { background: white; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
    .ingredient-list[data-mode] { display: none; }
    .ingredient-list.active { display: block; }

    /* Shopping-list checkboxes */
    .shop-list { list-style: none; padding-left: 0; }
    .shop-item { padding: .18rem 0; }
    .shop-item label { display: flex; align-items: baseline; gap: .5rem; cursor: pointer; }
    .shop-item input[type="checkbox"] { flex-shrink: 0; width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--green); }
    .shop-item input[type="checkbox"]:checked + span { text-decoration: line-through; color: var(--text-muted); }
    .shop-item.vorhanden span { color: var(--text-muted); font-size: .85rem; }

    /* Critique list */
    .critique-list { list-style: none; padding-left: 0; }
    .critique-item { margin: .45rem 0; padding: .4rem .75rem; background: #fff8e1; border-left: 3px solid var(--amber); border-radius: 0 5px 5px 0; font-size: .88rem; }

    /* JSON badge in input card */
    .json-badge { display:inline-block; background:#e3f2fd; color:#1565c0; border:1px solid #90caf9; border-radius:4px; padding:.1rem .4rem; font-size:.72rem; font-weight:700; vertical-align:middle; margin-left:.4rem; }

    /* Pending-plan notice */
    .pending-notice { background:#e8f5e9; border:1px solid #a5d6a7; border-radius:8px; padding:.65rem 1rem; margin-bottom:.3rem; font-size:.85rem; color:#1b5e20; }
    .pending-notice strong { color:#2d6a4f; }