@import url('https://fonts.googleapis.com/css2?family=Itim&family=Mali:wght@300;400;500;600;700&display=swap');

  :root {
    /* soft pastel café — sage matcha · blush · cream */
    --bg: #f7f2e8;
    --bg-2: #f1e9d8;
    --card: #fffdf8;
    --card-2: #fbf5e9;
    --ink: #5d5145;
    --ink-soft: #8a7e70;
    --muted: #ada291;
    --line: #ece2cf;

    --sage: #93a468;        /* primary */
    --sage-deep: #74854c;
    --sage-soft: #e6ecd4;
    --pink: #e6a6a6;
    --pink-soft: #fbe3e1;
    --matcha: #a8c07e;
    --matcha-soft: #e9f0d8;
    --cream-chip: #f3e7c8;

    --paid: #74854c;        /* sage = paid */
    --paid-soft: #e6ecd4;
    --warn: #cd7a68;        /* unpaid rose */
    --warn-soft: #f8e0da;

    --font-body: 'Mali', -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Itim', 'Mali', cursive;

    --radius: 18px;
    --radius-sm: 14px;
    --tabh: 68px;
    --appbar-h: 50px;
    --shadow-sm: 0 2px 6px -2px rgba(120,100,70,.14);
    --shadow: 0 10px 26px -14px rgba(120,100,70,.32);
    --shadow-lg: 0 18px 44px -18px rgba(120,100,70,.40);
    --ease: cubic-bezier(.22,.61,.36,1);
  }

  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: var(--font-body); color: var(--ink); font-size: 15px; line-height: 1.45;
    background:
      radial-gradient(900px 460px at 8% -6%, #fbf6ea 0%, transparent 55%),
      radial-gradient(760px 420px at 108% 2%, var(--matcha-soft) 0%, transparent 52%),
      radial-gradient(680px 380px at -8% 102%, var(--pink-soft) 0%, transparent 50%),
      linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed; min-height: 100vh;
  }
  #app { position: relative; z-index: 1; }
  .hidden { display: none !important; }
  svg { display: block; }

  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes pop  { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

  /* ---------- splash ---------- */
  .splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 0 30px; text-align: center; }
  .splash-logo { font-family: var(--font-display); font-size: 46px; color: var(--sage-deep); animation: rise .6s var(--ease) both; }
  .splash-msg { color: var(--ink-soft); animation: rise .6s .08s var(--ease) both; max-width: 360px; }

  /* ---------- app bar ---------- */
  .appbar {
    position: sticky; top: 0; z-index: 20; height: var(--appbar-h);
    display: flex; align-items: center; gap: 8px; padding: 0 14px;
    max-width: 600px; margin: 0 auto;
    background: linear-gradient(180deg, rgba(247,242,232,.96), rgba(247,242,232,.78));
    backdrop-filter: blur(10px);
  }
  .appbar .ab-title { flex: 1; text-align: center; font-family: var(--font-display); font-size: 20px; color: var(--sage-deep); }
  .appbar .ab-btn {
    width: 36px; height: 36px; border: none; background: var(--card); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--shadow-sm); color: var(--sage-deep); transition: transform .12s var(--ease);
  }
  .appbar .ab-btn:active { transform: scale(.9); }
  .appbar .ab-btn.ghost { background: transparent; box-shadow: none; pointer-events: none; }
  .appbar .ab-btn svg { width: 20px; height: 20px; }

  main { padding: 6px 12px calc(var(--tabh) + 26px); max-width: 600px; margin: 0 auto; }
  #page-add { padding-bottom: 112px; }
  .page { display: none; }
  .page.active { display: block; animation: fade .35s var(--ease) both; }

  .step-label { font-family: var(--font-display); font-size: 15px; color: var(--sage-deep); margin: 14px 0 7px; }
  h2 { font-family: var(--font-display); font-size: 17px; font-weight: 400; margin: 18px 0 8px; color: var(--sage-deep); display: flex; align-items: center; gap: 8px; }
  h2:first-child { margin-top: 6px; }

  /* ---------- home ---------- */
  .hero { text-align: center; padding: 4px 0 4px; position: relative; }
  .hero .logo { font-family: var(--font-display); font-size: 42px; color: var(--sage-deep); line-height: 1; }
  .hero .tagline { color: var(--ink-soft); margin-top: 2px; }
  .hero .mascot { width: 68px; height: 68px; margin: 2px auto 0; animation: floaty 4s ease-in-out infinite; }
  .home-search {
    display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line);
    border-radius: 999px; padding: 10px 14px; box-shadow: var(--shadow-sm); margin: 12px 0 14px; color: var(--muted);
  }
  .home-search svg { width: 18px; height: 18px; flex: none; color: var(--sage); }
  .home-search input { border: none; background: none; outline: none; font: inherit; color: var(--ink); width: 100%; }
  .home-results {
    display: grid; gap: 8px; margin: -6px 0 16px;
  }
  .search-result {
    border: 1px solid var(--line); background: rgba(255,253,248,.92); border-radius: 16px;
    box-shadow: var(--shadow-sm); padding: 10px 14px; text-align: left; font: inherit; color: var(--ink);
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
  }
  .search-result .sub { color: var(--muted); font-size: 12px; white-space: nowrap; }

  .navgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .navcard {
    border: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
    border-radius: var(--radius); padding: 12px; min-height: 104px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
    box-shadow: var(--shadow-sm); transition: transform .14s var(--ease), box-shadow .14s; animation: pop .4s var(--ease) both;
  }
  .navcard:active { transform: scale(.97); }
  .navcard:hover { box-shadow: var(--shadow); }
  .navcard .nc-icon { width: 42px; height: 42px; }
  .navcard .nc-label { font-family: var(--font-display); font-size: 17px; }
  .navcard.c1 { background: var(--cream-chip); }
  .navcard.c2 { background: var(--sage-soft); }
  .navcard.c3 { background: var(--pink-soft); }
  .navcard.c4 { background: var(--matcha-soft); }
  .navcard:nth-child(2){ animation-delay:.05s } .navcard:nth-child(3){ animation-delay:.1s } .navcard:nth-child(4){ animation-delay:.15s }

  .hero-cta {
    width: 100%; margin-top: 14px; border: none; cursor: pointer;
    background: linear-gradient(165deg, var(--sage) 0%, var(--sage-deep) 100%); color: #fcfdf6;
    font-family: var(--font-display); font-size: 18px; padding: 13px; border-radius: 999px;
    box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: transform .12s var(--ease); animation: pop .4s .2s var(--ease) both;
  }
  .hero-cta:active { transform: translateY(1px) scale(.99); }
  .hero-cta svg { width: 21px; height: 21px; }

  /* ---------- chips ---------- */
  .chips { display: flex; flex-wrap: wrap; gap: 7px; }
  .chip {
    font-family: var(--font-body); font-size: 14px; font-weight: 500;
    border: 1.5px solid var(--line); background: var(--card); color: var(--ink-soft);
    border-radius: 999px; padding: 7px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: transform .12s var(--ease), background .15s, border-color .15s, color .15s; user-select: none;
  }
  .chip:hover { border-color: var(--sage); }
  .chip:active { transform: scale(.94); }
  .chip.sel { background: linear-gradient(165deg, var(--sage) 0%, var(--sage-deep) 100%); border-color: var(--sage-deep); color: #fcfdf6; box-shadow: 0 6px 14px -7px rgba(116,133,76,.7); }
  .chip.ghost { border-style: dashed; color: var(--muted); background: transparent; box-shadow: none; }
  .chip.ghost:hover { color: var(--sage); }

  /* repeat-order */
  .repeat-order { margin-top: 10px; }
  .repeat-btn {
    width: 100%; border: 1.5px dashed var(--sage); background: var(--sage-soft); color: var(--sage-deep);
    border-radius: var(--radius-sm); padding: 12px 14px; font: inherit; font-weight: 600; cursor: pointer;
    transition: transform .12s var(--ease);
  }
  .repeat-btn:active { transform: scale(.98); }

  /* ---------- menu list ---------- */
  #menuList { display: flex; flex-direction: column; gap: 7px; }
  .menu-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: transform .12s var(--ease), border-color .15s, background .15s;
  }
  .menu-item:hover { border-color: var(--sage); }
  .menu-item:active { transform: scale(.99); }
  .menu-item.sel { border-color: var(--sage); background: var(--sage-soft); }
  .menu-item > span:first-child { flex: 1; }
  .menu-item .price { font-family: var(--font-display); font-size: 17px; color: var(--sage-deep); }
  .menu-item .fav-star { color: var(--sage-deep); }
  /* radio dot on the right */
  .menu-item::after {
    content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; transition: .15s;
  }
  .menu-item.sel::after { border-color: var(--sage); background: var(--sage); box-shadow: inset 0 0 0 4px var(--card); }

  .opts { display: flex; flex-wrap: wrap; gap: 8px; }

  /* ---------- recipe book ---------- */
  .recipe-panel-lead {
    color: var(--ink-soft); font-size: 13px; line-height: 1.4; margin: 0 0 10px;
  }
  .menu-tools { display: grid; gap: 10px; margin: 2px 0 12px; }
  .recipe-search {
    display: flex; align-items: center; gap: 8px; background: var(--card);
    border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 12px;
    box-shadow: var(--shadow-sm); color: var(--muted);
  }
  .recipe-search svg { width: 17px; height: 17px; flex: none; color: var(--sage); }
  .recipe-search input { border: none; background: none; outline: none; font: inherit; color: var(--ink); width: 100%; min-width: 0; }
  .recipe-list { display: grid; gap: 8px; }
  .recipe-card {
    width: 100%; text-align: left; border: 1.5px solid var(--line); background: rgba(255,253,248,.96);
    color: var(--ink); border-radius: var(--radius-sm); padding: 0;
    box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; animation: pop .28s var(--ease) both;
    transition: transform .12s var(--ease), border-color .15s, box-shadow .15s;
  }
  .recipe-card-body {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center;
    padding: 11px 12px;
  }
  .recipe-thumb {
    width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
  }
  .recipe-thumb.cat-coffee { background: linear-gradient(145deg, #e8d4bc, #c9a87c); }
  .recipe-thumb.cat-tea { background: linear-gradient(145deg, #f0dcc8, #d4a574); }
  .recipe-thumb.cat-matcha { background: linear-gradient(145deg, #d8e8c8, #9cb87a); }
  .recipe-thumb.cat-other { background: linear-gradient(145deg, #e4e0f0, #b8b0d0); }
  .recipe-card-main { min-width: 0; }
  .recipe-price-line {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    font-size: 13px; color: var(--ink-soft); margin: 2px 0 6px;
  }
  .recipe-profit { color: var(--sage-deep); font-weight: 700; }
  .recipe-cost-pill {
    text-align: right; flex: none; min-width: 58px;
    background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 6px 8px;
  }
  .recipe-cost-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .recipe-cost-val {
    display: block; font-family: var(--font-display); font-size: 16px; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .recipe-card:active { transform: scale(.99); }
  .recipe-card:hover { border-color: var(--sage); box-shadow: var(--shadow); }
  .recipe-card-top, .recipe-meta, .recipe-facts {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  }
  .recipe-cat, .recipe-cup, .recipe-meta span, .recipe-facts span {
    border-radius: 999px; padding: 3px 8px; font-size: 12px; line-height: 1.25;
    background: var(--sage-soft); color: var(--sage-deep);
  }
  .recipe-cup { background: var(--cream-chip); color: var(--ink-soft); }
  .recipe-name {
    font-family: var(--font-display); color: var(--ink); font-size: 18px; line-height: 1.18;
    margin: 7px 0 6px; overflow-wrap: anywhere;
  }
  .recipe-meta span { background: var(--card-2); color: var(--ink-soft); border: 1px solid var(--line); }
  .recipe-note-preview { color: var(--muted); font-size: 12px; margin-top: 7px; }
  .recipe-empty { margin-top: 16px; }
  .recipe-back { margin-bottom: 10px; }
  .recipe-hero {
    border: 1.5px solid #d3dcb8; border-radius: var(--radius); padding: 14px;
    background: linear-gradient(155deg, var(--sage-soft) 0%, #dfe8cb 100%);
    box-shadow: var(--shadow); animation: pop .3s var(--ease) both;
  }
  .recipe-hero-kicker { color: var(--sage-deep); font-size: 12px; font-weight: 700; }
  .recipe-title {
    display: block; margin: 4px 0 8px; font-size: 22px; line-height: 1.12;
    overflow-wrap: anywhere;
  }
  .recipe-note {
    margin-top: 10px; color: var(--ink-soft); background: rgba(255,253,248,.64);
    border: 1px solid rgba(255,253,248,.8); border-radius: var(--radius-sm); padding: 8px 10px;
  }
  .recipe-econ {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 10px 0 14px;
  }
  .recipe-econ-item {
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 9px 8px; text-align: center; box-shadow: var(--shadow-sm);
  }
  .recipe-econ-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
  .recipe-econ-val {
    display: block; font-family: var(--font-display); font-size: 17px; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .recipe-econ-margin { display: block; font-size: 11px; color: var(--sage-deep); margin-top: 1px; }
  .econ-profit .recipe-econ-val { color: var(--sage-deep); }
  .recipe-cost-breakdown {
    display: grid; gap: 8px; margin-bottom: 14px;
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 11px; box-shadow: var(--shadow-sm);
  }
  .cost-breakdown-row { display: grid; gap: 6px; }
  .cost-breakdown-head {
    display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-soft);
  }
  .cost-breakdown-name { overflow-wrap: anywhere; }
  .cost-breakdown-pct { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .cost-breakdown-track {
    height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden;
  }
  .cost-breakdown-fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, var(--sage) 0%, var(--sage-deep) 100%);
    min-width: 4px;
  }
  .ingredient-grid, .recipe-steps { display: grid; gap: 6px; }
  .ingredient-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
    border-bottom: 1px dashed var(--line); padding: 8px 2px;
  }
  .ingredient-name { overflow-wrap: anywhere; }
  .ingredient-amount {
    font-family: var(--font-display); font-size: 18px; color: var(--sage-deep);
    white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right;
    display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  }
  .ingredient-line-cost { font-size: 12px; color: var(--muted); font-family: var(--font-body, inherit); }
  .recipe-step {
    display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 9px; align-items: start;
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm); padding: 10px;
  }
  .step-no {
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); font-family: var(--font-display);
  }
  .recipe-actions {
    position: sticky; bottom: calc(var(--tabh) + 10px); z-index: 10;
    margin-top: 14px; display: flex; gap: 10px;
  }
  .recipe-use-btn { flex: 1; font-size: 16px; padding: 12px 16px; }
  .recipe-edit-btn {
    flex: none; font-size: 15px; padding: 12px 16px;
    background: var(--card); border: 1.5px solid var(--sage); color: var(--sage-deep);
  }
  .recipe-danger { margin-top: 12px; text-align: center; }
  .recipe-delete-btn {
    border: none; background: none; color: var(--warn); font: inherit; font-size: 13px;
    cursor: pointer; padding: 8px 12px; text-decoration: underline;
  }

  /* ---------- sold stats ---------- */
  .recipe-sold { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
  .recipe-sold-item {
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 12px 14px; box-shadow: var(--shadow-sm);
  }
  .recipe-sold-item.sold-today { background: var(--pink-soft); border-color: #f0cfca; }
  .recipe-sold-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .recipe-sold-val { font-family: var(--font-display); font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .recipe-sold-unit { font-family: var(--font-body); font-size: 13px; color: var(--ink-soft); font-weight: 400; }

  /* ---------- donut cost chart ---------- */
  .recipe-donut-box {
    display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center;
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
  }
  .recipe-donut { width: 132px; height: 132px; flex: none; }
  .donut-legend { display: grid; gap: 9px; min-width: 0; }
  .donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
  .donut-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
  .donut-legend-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .donut-legend-val { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
  @media (max-width: 360px) { .recipe-donut-box { grid-template-columns: 1fr; justify-items: center; } }

  /* ---------- FAB (add recipe) ---------- */
  .fab {
    position: fixed; right: 18px; bottom: calc(var(--tabh) + 18px); z-index: 40;
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(145deg, var(--sage) 0%, var(--sage-deep) 100%); color: #fff;
    box-shadow: 0 6px 18px rgba(116,133,76,.4); display: flex; align-items: center; justify-content: center;
    transition: transform .12s var(--ease); animation: pop .3s var(--ease) both;
  }
  .fab svg { width: 26px; height: 26px; }
  .fab:active { transform: scale(.92); }

  /* ---------- recipe form: ingredient & step editors ---------- */
  select {
    width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 10px 12px; font: inherit; background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm);
  }
  select:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
  .rf-ing-list, .rf-step-list { display: grid; gap: 8px; margin-bottom: 10px; }
  .rf-ing-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px;
  }
  .rf-ing-row .rf-ing-select { flex: 1 1 100%; }
  .rf-ing-row .rf-ing-amt { flex: 1 1 70px; width: auto; min-width: 0; }
  .rf-ing-row .rf-ing-name { flex: 2 1 90px; width: auto; min-width: 0; }
  .rf-ing-row .rf-ing-unit { flex: 1 1 60px; width: auto; min-width: 0; }
  .rf-ing-row .rf-ing-cpu { flex: 1 1 70px; width: auto; min-width: 0; }
  .rf-ing-unit-label { font-size: 13px; color: var(--ink-soft); min-width: 36px; }
  .rf-ing-line { margin-left: auto; font-family: var(--font-display); color: var(--sage-deep); font-variant-numeric: tabular-nums; }
  .rf-ing-remove {
    flex: none; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--card); color: var(--warn); cursor: pointer; font-size: 14px; line-height: 1;
  }
  .rf-step-row { display: flex; align-items: center; gap: 8px; }
  .rf-step-row input { flex: 1; }
  .rf-step-no {
    width: 26px; height: 26px; flex: none; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); font-family: var(--font-display); font-size: 13px;
  }
  .rf-total {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: var(--sage-soft); border: 1.5px solid #d3dcb8; border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 12px; color: var(--ink-soft); font-size: 14px;
  }
  .rf-total-val { font-family: var(--font-display); font-size: 22px; color: var(--sage-deep); }
  .buy-preview { font-size: 13px; color: var(--ink); text-align: right; line-height: 1.5; }

  /* ---------- stock / inventory ---------- */
  .admin-row.low { border-color: #e6b9a0; background: var(--warn-soft); }
  .stock-badge {
    display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
    background: var(--warn); color: #fff; font-size: 11px; font-family: var(--font-body); vertical-align: middle;
  }
  .ing-stock { text-align: right; flex: none; }
  .ing-stock-label { display: block; font-size: 11px; color: var(--muted); }
  .ing-stock-val { font-family: var(--font-display); font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .low-stock-alert {
    background: var(--warn-soft); border: 1.5px solid #e6b9a0; border-radius: var(--radius-sm);
    padding: 12px 14px; margin-bottom: 14px;
  }
  .low-stock-head { font-family: var(--font-display); color: var(--warn); margin-bottom: 8px; }
  .low-stock-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-soft); padding: 3px 0; }
  .low-stock-qty { font-variant-numeric: tabular-nums; white-space: nowrap; }
  .recipe-servings {
    display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
    background: var(--sage-soft); border: 1.5px solid #d3dcb8; border-radius: var(--radius-sm);
    padding: 10px 14px; font-size: 14px; color: var(--ink);
  }
  .recipe-servings.low { background: var(--warn-soft); border-color: #e6b9a0; }
  .recipe-servings-icon { font-size: 18px; }
  .recipe-servings-limit { color: var(--muted); font-size: 12.5px; }

  /* ---------- menu admin ---------- */
  .menu-page-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
  .admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; }
  .admin-category-bar { margin: 12px 0 14px; }
  .admin-category-bar .chips { gap: 7px; }
  .admin-list { display: grid; gap: 8px; margin-top: 4px; }
  .admin-row {
    background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
    padding: 11px 12px; box-shadow: var(--shadow-sm);
  }
  .admin-row.inactive { opacity: .62; }
  .admin-row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .admin-title { font-family: var(--font-display); font-size: 17px; color: var(--ink); }
  .admin-price { font-family: var(--font-display); font-size: 17px; color: var(--sage-deep); white-space: nowrap; }
  .admin-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
  .admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .admin-form {
    background: var(--card); border: 1.5px solid var(--sage); border-radius: var(--radius);
    padding: 14px; margin: 0 0 14px; box-shadow: var(--shadow);
  }
  .admin-form h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 18px; color: var(--ink); }
  .admin-field { margin-bottom: 12px; }
  .admin-field:last-of-type { margin-bottom: 0; }
  .admin-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
  .admin-field .chips { gap: 7px; }
  .admin-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
  .order-date-block { margin-bottom: 12px; }
  .order-date-block__label { margin: 6px 0 8px; }
  .order-date-input { width: 100%; margin-bottom: 8px; }
  .order-date-block__chips { gap: 10px; margin-bottom: 4px; }
  .order-date-hint { margin: 8px 0 12px; padding: 8px 11px; font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); background: rgba(255,253,248,.85); border-radius: 12px; }
  .order-date-hint--future { color: var(--brand-dark, #1a5c42); font-weight: 600; background: rgba(45,90,61,.08); }
  .date-switcher { margin-bottom: 14px; }
  .date-switcher__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
  .round-date-input { max-width: 138px; padding: 7px 10px; font-size: 13px; background: rgba(255,253,248,.86); }

  input[type=number] {
    width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 10px 12px; font: inherit; background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm);
  }
  input[type=number]:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }

  /* ---------- stepper / inputs ---------- */
  .row { display: flex; align-items: center; gap: 12px; }
  .stepper { display: flex; align-items: center; gap: 12px; }
  .stepper button {
    width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line);
    background: var(--card); font-size: 21px; color: var(--sage-deep); cursor: pointer;
    box-shadow: var(--shadow-sm); transition: transform .1s var(--ease); display: flex; align-items: center; justify-content: center;
  }
  .stepper button:active { transform: scale(.9); }
  .stepper .val { min-width: 30px; text-align: center; font-family: var(--font-display); font-size: 21px; }

  textarea, input[type=text], input[type=date] {
    width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    padding: 10px 12px; font: inherit; background: var(--card); color: var(--ink); resize: vertical; box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s;
  }
  textarea:focus, input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
  input[type=date] { width: auto; }
  .pay { display: flex; flex-wrap: wrap; gap: 8px; }

  /* ---------- save bar ---------- */
  .savebar {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + 12px);
    display: flex; gap: 8px; padding: 11px 12px; max-width: 600px; margin: 0 auto; z-index: 30;
    background: var(--bg-2); border: 1.5px solid var(--line); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -12px 28px -14px rgba(120,100,70,.28);
  }
  .btn { flex: 1; border: none; border-radius: 999px; padding: 12px; font-family: var(--font-display); font-size: 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s var(--ease), opacity .15s; }
  .btn:active { transform: translateY(1px) scale(.99); }
  .btn.secondary { background: var(--card); color: var(--sage-deep); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
  .btn.primary { background: linear-gradient(165deg, var(--sage) 0%, var(--sage-deep) 100%); color: #fcfdf6; }
  .btn:disabled { opacity: .42; box-shadow: none; transform: none; cursor: default; }

  /* ---------- summary card (sage hero) ---------- */
  .summary {
    position: relative; overflow: hidden; border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
    background: linear-gradient(155deg, var(--sage-soft) 0%, #dbe4c4 100%);
    border: 1.5px solid #d3dcb8; box-shadow: var(--shadow); animation: pop .45s var(--ease) both;
  }
  .summary .title { font-family: var(--font-display); font-size: 18px; color: var(--sage-deep); margin-bottom: 10px; }
  .summary .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .summary .grid > div { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
  .summary .grid .lbl { font-size: 12px; color: var(--ink-soft); }
  .summary .grid .v { font-family: var(--font-display); font-size: 18px; color: var(--sage-deep); }
  .summary .grid .v.warn { color: var(--warn); }
  .summary .grid .v.ok { color: var(--paid); }
  .summary .stat-ico { width: 24px; height: 24px; color: var(--sage-deep); opacity: .85; }
  .summary-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
  .summary-actions .chip { font-size: 12px; padding: 7px 10px; background: rgba(255,255,255,.7); }

  /* category cards (3 colored) */
  .catcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
  .catcard { border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; box-shadow: var(--shadow-sm); animation: pop .4s var(--ease) both; }
  .catcard svg { width: 30px; height: 30px; margin: 0 auto 4px; }
  .catcard .cc-name { font-size: 12px; color: var(--ink-soft); }
  .catcard .cc-cups { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
  .catcard.k0 { background: var(--sage-soft); } .catcard.k1 { background: var(--pink-soft); } .catcard.k2 { background: var(--matcha-soft); }

  /* ---------- donut ---------- */
  .donut-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .donut { width: 96px; height: 96px; border-radius: 50%; flex: none; position: relative; }
  .donut::after { content: ''; position: absolute; inset: 20px; background: var(--card); border-radius: 50%; }
  .donut-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 15px; color: var(--sage-deep); z-index: 1; }
  .legend { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: 6px; }
  .legend-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; white-space: nowrap; }
  .legend-row .dot { width: 10px; height: 10px; border-radius: 4px; flex: none; }
  .legend-row .lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .legend-row .lg-val { color: var(--ink-soft); font-variant-numeric: tabular-nums; font-size: 12px; }

  /* ---------- rank rows ---------- */
  .rank { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 6px; box-shadow: var(--shadow-sm); animation: pop .3s var(--ease) both; }
  .rank .n { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px; color: var(--sage-deep); background: var(--sage-soft); border-radius: 50%; flex: none; }
  .rank .name { flex: 1; min-width: 0; }
  .rank .name > .sub { color: var(--muted); font-size: 12px; }
  .rank .val { color: var(--ink-soft); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .rank .val.warn { color: var(--warn); }
  .barline { height: 6px; border-radius: 6px; background: var(--sage-soft); overflow: hidden; margin-top: 5px; }
  .barline > span { display: block; height: 100%; background: linear-gradient(90deg, var(--matcha), var(--sage)); border-radius: 6px; transition: width .5s var(--ease); }
  .sub { font-size: 13px; color: var(--muted); }

  /* cards used in dash gauges */
  .panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .panel .title { font-family: var(--font-display); font-size: 16px; color: var(--sage-deep); margin-bottom: 8px; }
  .kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 13px; color: var(--ink-soft); }
  .kv .v { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
  .kv .v.ok { color: var(--paid); } .kv .v.warn { color: var(--warn); }

  /* ---------- order card ---------- */
  #orderList { display: flex; flex-direction: column; gap: 8px; }
  .order { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 11px 12px; box-shadow: var(--shadow-sm); animation: pop .35s var(--ease) both; transition: opacity .2s, border-color .2s; }
  .order.done { opacity: .5; }
  .order .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  .order .who { font-family: var(--font-display); font-size: 16px; }
  .order .time { color: var(--muted); font-size: 12px; white-space: nowrap; }
  .order .body { margin: 3px 0; }
  .order .sub { color: var(--ink-soft); font-size: 12px; background: var(--card-2); border-radius: 10px; padding: 5px 8px; margin-top: 5px; }
  .order .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 9px; flex-wrap: wrap; }
  .order .foot > div:first-child { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
  .order .net-amt { font-family: var(--font-display); font-size: 16px; color: var(--sage-deep); }
  .order .pay-tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
  .pay-unpaid { color: var(--warn); background: var(--warn-soft); }
  .pay-paid { color: var(--paid); background: var(--paid-soft); }
  .pay-free { color: var(--muted); background: var(--card-2); }
  .order .acts { display: flex; gap: 6px; }
  .order .acts button { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 12px; color: var(--ink-soft); cursor: pointer; transition: transform .1s var(--ease), border-color .15s; }
  .order .acts button:hover { border-color: var(--sage); }
  .order .acts button:active { transform: scale(.93); }
  .order .acts .del { color: var(--warn); }
  .order.pending { border-style: dashed; opacity: .85; }
  .order.error { border-color: var(--warn); background: var(--warn-soft); }

  /* prep summary + grouped */
  .prep-summary, .prep-people { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); margin-bottom: 8px; }
  .prep-title { font-family: var(--font-display); font-size: 16px; color: var(--sage-deep); margin-bottom: 6px; }
  .prep-line { display: flex; justify-content: space-between; padding: 2px 0; }
  .prep-qty { font-family: var(--font-display); color: var(--sage-deep); }
  .prep-sep { color: var(--line); margin: 6px 0; letter-spacing: 2px; }
  .prep-subtotal { font-weight: 600; color: var(--sage-deep); margin-top: 4px; }
  .prep-person-line { padding: 3px 0; border-bottom: 1px dashed var(--line); }
  .prep-person-line:last-child { border-bottom: none; }
  .group { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 11px 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm); animation: pop .35s var(--ease) both; }
  .group .g-head { display: flex; justify-content: space-between; gap: 10px; font-family: var(--font-display); font-size: 16px; margin-bottom: 3px; }
  .group .g-head span:last-child { color: var(--sage-deep); }
  .group .g-line { color: var(--ink-soft); font-size: 13px; padding: 1px 0; }

  .empty { text-align: center; color: var(--muted); padding: 32px 12px; white-space: pre-line; }

  .viewbar { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; flex-wrap: wrap; }
  .viewbar .chips { flex: 1; }
  #btnUnpaidOnly.sel { background: var(--warn); border-color: var(--warn); color: #fff; }

  /* ---------- bottom nav (4 tabs, line icons) ---------- */
  .tabbar {
    position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 2px; padding: 6px 8px; width: calc(100% - 24px); max-width: 440px; z-index: 40;
    background: rgba(255,253,248,.9); backdrop-filter: blur(14px) saturate(1.3);
    border: 1.5px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lg);
  }
  .tab { flex: 1; border: none; background: none; cursor: pointer; border-radius: 16px; padding: 5px 4px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: color .18s, background .18s, transform .12s var(--ease); }
  .tab svg { width: 21px; height: 21px; }
  .tab span { font-size: 10.5px; font-weight: 500; }
  .tab:active { transform: scale(.92); }
  .tab.active { color: var(--sage-deep); }
  .tab.active span { font-weight: 700; }

  /* ---------- toast ---------- */
  .toast { position: fixed; bottom: calc(var(--tabh) + 78px); left: 50%; transform: translateX(-50%); background: var(--sage-deep); color: #fcfdf6; padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 60; box-shadow: var(--shadow-lg); animation: pop .25s var(--ease) both; max-width: 90vw; text-align: center; }

  .order:nth-child(2), .rank:nth-child(2), .group:nth-child(2) { animation-delay: .05s; }
  .order:nth-child(3), .rank:nth-child(3), .group:nth-child(3) { animation-delay: .09s; }
  .order:nth-child(4), .rank:nth-child(4), .group:nth-child(4) { animation-delay: .13s; }
  .order:nth-child(n+5), .rank:nth-child(n+5) { animation-delay: .16s; }

  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }