/* Norton family nutrition. Everything is local — the page loads no network resources.

   Phone first: a bottom tab bar, large tap targets, bottom sheets, toasts.
   At 860px and wider the tabs move into the header. */

:root {
  color-scheme: light;
  --surface-0: #f4f5f2;
  --surface-1: #ffffff;
  --surface-2: #eceee9;
  --border: #e3e5df;
  --border-strong: #c9ccc3;
  --text-primary: #14170f;
  --text-secondary: #4a4f44;
  --text-muted: #7c8275;
  --good: #1c7c45;
  --good-bg: #e4f4ea;
  --warning: #9a6200;
  --warning-bg: #fdf1d8;
  --critical: #c22a2a;
  --critical-bg: #fbe9e9;
  --accent: #1f7a4d;
  --accent-strong: #17613c;
  --accent-bg: #e3f2ea;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(20, 23, 15, .05), 0 6px 20px rgba(20, 23, 15, .05);
  --shadow-up: 0 -8px 30px rgba(20, 23, 15, .12);
  --radius: 16px;
  --radius-sm: 10px;
  --tabbar: 62px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0f110d;
    --surface-1: #191c16;
    --surface-2: #23271f;
    --border: #2b2f26;
    --border-strong: #454a3e;
    --text-primary: #f3f5ee;
    --text-secondary: #c2c7b8;
    --text-muted: #8e9483;
    --good: #4cc27f;
    --good-bg: #16301f;
    --warning: #e0a63c;
    --warning-bg: #33280f;
    --critical: #f07a7a;
    --critical-bg: #3a1a1a;
    --accent: #3dae74;
    --accent-strong: #52c488;
    --accent-bg: #163121;
    --on-accent: #06140c;
    --shadow: none;
    --shadow-up: 0 -8px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface-0); color: var(--text-primary); font-family: var(--sans);
       line-height: 1.45; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 1.1rem; margin: 26px 0 10px; letter-spacing: -.01em; }
h3 { font-size: .8rem; margin: 22px 4px 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
     font-weight: 700; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.error { color: var(--critical); }
[hidden] { display: none !important; }
svg.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9;
           stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- shell */

header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
             padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
             background: color-mix(in srgb, var(--surface-0) 86%, transparent);
             backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
             border-bottom: 1px solid transparent; }
header.top.scrolled { border-bottom-color: var(--border); }
header.top h1 { font-size: 1rem; margin: 0; font-weight: 700; flex: 1; white-space: nowrap; letter-spacing: -.01em; }
header.top h1 a { color: inherit; text-decoration: none; }
.top-actions { display: flex; gap: 4px; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
           height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
           background: color-mix(in srgb, var(--surface-1) 92%, transparent);
           backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
             color: var(--text-muted); font-size: .68rem; font-weight: 600; text-decoration: none; position: relative; }
nav.tabs a.on { color: var(--accent); }
nav.tabs a .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
                    border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: .68rem;
                    display: grid; place-items: center; }

main.wrap { max-width: 760px; margin: 0 auto; padding: 4px 16px calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)); }
body.has-sticky main.wrap { padding-bottom: calc(var(--tabbar) + 120px + env(safe-area-inset-bottom)); }
main.wrap.wide { max-width: 1040px; }

/* The tab bar sits outside the header: a blurred header would otherwise
   become the containing block and pin the bar to the top. */
@media (min-width: 860px) {
  nav.tabs { top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); height: 60px; padding: 0;
             background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
             display: flex; align-items: center; gap: 4px; }
  nav.tabs a { flex-direction: row; gap: 7px; font-size: .9rem; padding: 8px 14px; border-radius: 999px; }
  nav.tabs a.on { background: var(--accent-bg); }
  nav.tabs a .badge { position: static; }
  nav.tabs svg.icon { width: 18px; height: 18px; }
  header.top { justify-content: space-between; padding: 10px 24px; height: 60px; }
  main.wrap { padding-bottom: 60px; }
  body.has-sticky main.wrap { padding-bottom: 130px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 14px; }
.page-head h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; margin: 0; line-height: 1.1; }
.page-head .sub { color: var(--text-muted); font-size: .9rem; margin-top: 4px; }
.page-head .tools { display: flex; gap: 8px; flex: none; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.title-row h2 { margin: 16px 0 8px; }

/* ----------------------------------------------------------- buttons */

button, .btn { font: inherit; font-weight: 600; min-height: 40px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
               border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-primary);
               display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
               transition: transform .08s, background .15s, border-color .15s; touch-action: manipulation; }
button:active, .btn:active { transform: scale(.97); }
.btn:hover { text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { background: var(--accent-strong); }
button.soft { background: var(--accent-bg); border-color: transparent; color: var(--accent-strong); }
button.danger { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
button.link { border: 0; background: none; padding: 4px 6px; min-height: 0; color: var(--accent); font-weight: 600; border-radius: 6px; }
button.big { min-height: 52px; width: 100%; font-size: 1.02rem; border-radius: 14px; }
button:disabled { opacity: .55; cursor: default; }
button.icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; border-color: transparent;
                  background: transparent; color: var(--text-secondary); flex: none; }
button.icon-btn:hover { background: var(--surface-2); }
button.icon-btn.tint { background: var(--accent-bg); color: var(--accent-strong); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------- cards, chips */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 16px; }
section.card + section.card { margin-top: 12px; }
.grid > section.card + section.card { margin-top: 0; }
.person { cursor: pointer; text-align: left; width: 100%; font-weight: 400; display: block; min-height: 0; }
.person:hover { border-color: var(--accent); }
.person .name { font-weight: 700; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: .78rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid transparent;
        color: var(--text-secondary); font-weight: 600; white-space: nowrap; min-height: 0; line-height: 1.4; }
.chip.good { color: var(--good); background: var(--good-bg); }
.chip.warn { color: var(--warning); background: var(--warning-bg); }
.chip.strict { background: var(--critical-bg); color: var(--critical); }
.chip.off { opacity: .5; text-decoration: line-through; }
button.chip { cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; min-height: 36px; padding: 6px 14px;
              background: var(--surface-1); border: 1px solid var(--border-strong); color: var(--text-primary); }
button.chip.on, button.chip.good { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-strong); }
button.chip.warn { background: var(--warning-bg); border-color: transparent; color: var(--warning); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.eaters .chip { font-size: .8rem; min-height: 30px; padding: 3px 10px; }

/* ------------------------------------------------------------- forms */

label { display: block; font-size: .82rem; color: var(--text-secondary); margin-bottom: 5px; font-weight: 600; }
input, select, textarea { font: inherit; font-size: 16px; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
                          border: 1px solid var(--border-strong); background: var(--surface-1);
                          color: var(--text-primary); min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.rows .entry { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) auto;
               align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
label.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary); font-size: .95rem;
               margin: 8px 12px 0 0; font-weight: 500; }
input.narrow { width: 5em; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-wrap label.inline { margin: 0; }

/* The add bar: one large field with a leading icon and trailing buttons. */
.addbar { display: flex; align-items: center; gap: 4px; background: var(--surface-1); border: 1px solid var(--border-strong);
          border-radius: 14px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow); color: var(--text-muted); }
.addbar:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -1px; }
.addbar input { border: 0; background: none; padding: 10px 6px; min-height: 44px; outline: none !important; flex: 1; min-width: 0; }
.addbar button.primary { min-height: 36px; padding: 6px 14px; }

/* Segmented control. */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px;
       padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; min-height: 36px; padding: 6px 8px; border-radius: 9px; font-size: .9rem;
              color: var(--text-secondary); gap: 6px; }
.seg button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg button .n { color: var(--text-muted); font-weight: 500; font-size: .8rem; }
.seg svg.icon { width: 17px; height: 17px; }
.seg.mini { display: inline-grid; }
.seg.mini button { min-height: 32px; padding: 4px 9px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.stepper input { width: 4.2em; text-align: center; font-weight: 700; }

/* -------------------------------------------------------------- lists */

ul.items { list-style: none; margin: 0; padding: 0; background: var(--surface-1); border: 1px solid var(--border);
           border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; position: relative; min-height: 56px; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; border-top: 1px solid var(--border); }
ul.items.plain .item + .item::before { left: 14px; }
.item-main { flex: 1; min-width: 0; }
.item-name { font-weight: 600; overflow-wrap: anywhere; }
.item-meta { color: var(--text-muted); font-size: .85rem; }
.item-name .item-meta { font-weight: 400; margin-left: 8px; text-decoration: none; display: inline-block; }
.item .chips { margin-top: 5px; }
.item.tap { cursor: pointer; }
.item.tap:active { background: var(--surface-2); }
.item.done .item-name { text-decoration: line-through; color: var(--text-muted); font-weight: 500; }
.item.leaving { opacity: 0; transform: translateX(24px); transition: opacity .18s, transform .18s; }
.check { width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--border-strong);
         background: none; color: transparent; flex: none; transition: background .15s, border-color .15s, transform .15s; }
.check svg.icon { width: 16px; height: 16px; stroke-width: 3; }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: scale(1.06); }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
       background: var(--surface-2); color: var(--text-muted); }
.dot svg.icon { width: 16px; height: 16px; stroke-width: 2.6; }
.dot.have { background: var(--good-bg); color: var(--good); }
.dot.low { background: var(--warning-bg); color: var(--warning); }
.dot.gf { background: var(--critical-bg); color: var(--critical); }
.dot.missing { background: none; border: 2px dashed var(--border-strong); }
.group-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 8px; }
.group-head h3 { margin: 0; display: flex; align-items: center; gap: 7px; }
.group-head h3 svg.icon { width: 16px; height: 16px; }
.group-head .n { color: var(--text-muted); font-size: .8rem; }
.aisle h3 { text-transform: uppercase; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.progress.warn > i { background: var(--warning); }
.meter { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--text-secondary); margin-top: 8px; }
.meter .progress { flex: 1; max-width: 120px; }

.empty { text-align: center; padding: 36px 20px; color: var(--text-secondary); }
.empty .art { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-strong);
              display: grid; place-items: center; margin: 0 auto 14px; }
.empty .art svg.icon { width: 34px; height: 34px; }
.empty h3 { font-size: 1.15rem; text-transform: none; letter-spacing: -.01em; color: var(--text-primary); margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 34ch; }
.empty .actions { justify-content: center; margin-top: 0; }

.stickybar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 25;
             padding: 10px 16px; background: linear-gradient(to top, var(--surface-0) 70%, transparent); }
.stickybar > div { max-width: 728px; margin: 0 auto; }
.stickybar button { box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
@media (min-width: 860px) { .stickybar { bottom: 0; padding-bottom: 20px; } }

/* ----------------------------------------------------- sheets, toasts */

dialog.sheet { border: 0; padding: 0; background: var(--surface-1); color: var(--text-primary); width: 100%; max-width: 560px;
               max-height: 88dvh; margin: auto auto 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-up);
               overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
dialog.sheet::backdrop { background: rgba(10, 12, 8, .45); animation: fade .2s; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 6px 20px; }
.sheet-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.02em; }
.sheet-body { padding: 6px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: grid; gap: 8px; }
.sheet-body .field { margin-top: 16px; }
.sheet-body .field > label { margin-bottom: 7px; }
.sheet-body .split { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.sheet-body .split > label { margin: 0; font-size: 1rem; color: var(--text-primary); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 620px) { dialog.sheet { margin: auto; border-radius: 22px; } }

.switch { appearance: none; width: 52px !important; height: 32px !important; min-height: 0; border-radius: 16px; padding: 0;
          background: var(--border-strong); border: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
                 background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); z-index: 60;
          display: grid; gap: 8px; justify-items: center; padding: 0 12px; pointer-events: none; }
body.has-sticky #toasts { bottom: calc(var(--tabbar) + 86px + env(safe-area-inset-bottom)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 6px; max-width: 520px; width: fit-content;
         background: #20241c; color: #f3f5ee; border-radius: 14px; padding: 8px 8px 8px 16px; min-height: 48px;
         box-shadow: 0 8px 28px rgba(0, 0, 0, .28); animation: toast-in .2s cubic-bezier(.2, .8, .2, 1); font-size: .95rem; }
.toast span { flex: 1; padding-right: 6px; }
.toast button { border: 0; background: rgba(255, 255, 255, .12); color: #8fe0b1; min-height: 34px; padding: 4px 12px; white-space: nowrap; }
.toast.error { background: #6d1f1f; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- home */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
a.tile { display: block; color: inherit; text-decoration: none; padding: 14px 16px; }
a.tile:active { transform: scale(.98); }
.tile .ico { width: 36px; height: 36px; border-radius: 11px; background: var(--accent-bg); color: var(--accent-strong);
             display: grid; place-items: center; margin-bottom: 10px; }
.tile .big-n { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.tile .lbl { font-weight: 600; margin-top: 3px; }
.tile .sub { color: var(--text-muted); font-size: .82rem; margin-top: 2px; }
.tile .sub.warn { color: var(--warning); font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head strong { font-size: 1.02rem; letter-spacing: -.01em; }
.meal-row { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border); }
.meal-row:first-of-type { border-top: 0; }
.meal-row .when { width: 5.2em; flex: none; color: var(--text-muted); font-size: .78rem; text-transform: uppercase;
                  letter-spacing: .05em; font-weight: 700; }
a.cook-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border);
             color: inherit; text-decoration: none; }
a.cook-row:first-of-type { border-top: 0; }
.cook-row .item-main { min-width: 0; }
.cook-row > svg.icon { color: var(--text-muted); width: 18px; height: 18px; }
.ring { --p: 0; width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
        background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); font-size: .7rem; font-weight: 700; }
.ring::before { content: attr(data-label); width: 30px; height: 30px; border-radius: 50%; background: var(--surface-1);
                display: grid; place-items: center; }
.ring.full { background: var(--accent); color: var(--on-accent); }
.ring.full::before { content: none; }
.people { display: flex; gap: 14px; overflow-x: auto; padding: 4px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.people::-webkit-scrollbar { display: none; }
a.face { display: grid; justify-items: center; gap: 5px; color: inherit; text-decoration: none; font-size: .8rem; font-weight: 600; flex: none; }
.face .av { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-strong);
            display: grid; place-items: center; font-size: 1.2rem; font-weight: 800; position: relative; }
.face .av.strict::after { content: ""; position: absolute; top: 1px; right: 1px; width: 13px; height: 13px; border-radius: 50%;
                          background: var(--critical); border: 2px solid var(--surface-0); }
.face .av.add { background: var(--surface-2); color: var(--text-muted); }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
          background: var(--critical-bg); color: var(--critical); font-size: .9rem; font-weight: 600; margin: 12px 0; }
.banner.warn { background: var(--warning-bg); color: var(--warning); }
.banner.info { background: var(--accent-bg); color: var(--accent-strong); }
.banner svg.icon { width: 18px; height: 18px; margin-top: 1px; }

/* ------------------------------------------------------------- recipes */

.rgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
a.rcard { display: flex; flex-direction: column; color: inherit; text-decoration: none; padding: 14px 16px; }
a.rcard:hover { border-color: var(--accent); }
.rcard .name { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.rcard .missing { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }
.rcard .chips { margin-top: auto; padding-top: 10px; }
.rcard .meter .progress { max-width: none; }
ol.steps { padding-left: 0; list-style: none; counter-reset: step; margin: 0; }
ol.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px 0; }
ol.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; background: var(--accent-bg);
                      color: var(--accent-strong); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }

/* ---------------------------------------------------------------- plan */

.day h3 { margin: 0 0 10px; color: var(--text-primary); font-size: 1rem; text-transform: none; letter-spacing: -.01em; }
.day.today { border-color: var(--accent); }
.slots { display: grid; }
.slot { display: grid; grid-template-columns: 78px 1fr; gap: 6px 10px; align-items: center; padding: 8px 0;
        border-top: 1px solid var(--border); }
.slot:first-child { border-top: 0; padding-top: 0; }
.slot:last-child { padding-bottom: 0; }
.slot > :nth-child(n+3) { grid-column: 2; }
.slot .chips { margin-top: 0; }
.slot.empty select { color: var(--text-muted); border-style: dashed; background: none; }
.slot .meal { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.slot details summary { cursor: pointer; color: var(--text-muted); font-size: .82rem; }
.slot details .chips { margin-top: 8px; }
.day { margin-top: 12px; }
details.card > summary { cursor: pointer; }

/* ------------------------------------------- foods, profile, growth */

ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li { padding: 8px 0; border-bottom: 1px solid var(--border); }
ul.log li:last-child { border-bottom: 0; }
ul.log .when { color: var(--text-muted); font-size: .85rem; margin-right: 8px; }
#status { min-height: 1.4em; }
#status.error, p.error { color: var(--critical); }
video.scanner { width: 100%; max-height: 46vh; aspect-ratio: 4 / 3; border-radius: 14px; background: #000; object-fit: cover; display: block; }
.scan-frame { position: relative; }
.scan-frame::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: #ff5a5a;
                     box-shadow: 0 0 10px #ff5a5a; opacity: .8; border-radius: 2px; }
.scan-result { margin-top: 12px; }
dialog.sheet video.scanner { max-height: 32vh; aspect-ratio: 16 / 10; }
dialog.sheet .scan-result .alert { margin: 8px 0; box-shadow: none; }
.alert { margin: 12px 0; border-left: 4px solid var(--warning); }
.alert.strict { border-left-color: var(--critical); background: var(--critical-bg); }
.alert.strict strong { color: var(--critical); }
.alert.ok { border-left-color: var(--good); }
.alert ul { margin: 8px 0; padding-left: 20px; }
table.facts { width: 100%; border-collapse: collapse; }
table.facts th, table.facts td { text-align: right; padding: 7px 4px; border-bottom: 1px solid var(--border); }
table.facts th { font-size: .8rem; color: var(--text-muted); }
table.facts th:first-child, table.facts td:first-child { text-align: left; }
table.facts td.sub { padding-left: 20px; color: var(--text-secondary); }
.fit { margin-bottom: 10px; }
.fit ul { list-style: none; padding: 0; margin: 6px 0 0; }
.flag { display: grid; grid-template-columns: 1.2em 1fr; gap: 6px; padding: 4px 0; font-size: .92rem; }
.flag .mark { font-weight: 700; }
.flag.warn .mark { color: var(--warning); }
.flag.good .mark { color: var(--good); }
.flag.info .mark { color: var(--text-muted); }

.growth { margin-top: 12px; }
.chart-figure { margin: 16px 0; background: var(--surface-1); border: 1px solid var(--border);
                border-radius: var(--radius); padding: 12px; }
.chart-figure figcaption { font-weight: 600; margin-bottom: 6px; }
.plot { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .axis { fill: var(--text-muted); font-size: 11px; font-family: var(--sans); }
.chart .pctl { fill: none; stroke: var(--border); stroke-width: 1; }
.chart .pctl.major { stroke: var(--border-strong); stroke-width: 1.5; }
.chart .series { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; background: none; }
.chart .dot.active { r: 6; }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.tip { position: absolute; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
       border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; font-size: .85rem;
       box-shadow: var(--shadow); white-space: nowrap; }
.table-view { margin: 8px 0 16px; }
.table-view summary { cursor: pointer; color: var(--accent); }
