/* Apicius · "Greens and Pulses" brand
   Every colour is a real ingredient. Text is always black bean on chickpea or white. */
:root {
  --chickpea: #F7EDD6;      /* background */
  --black-bean: #231F20;    /* text */
  --kale: #2E5E3A;          /* buttons, headline numbers */
  --kale-dark: #1F4228;
  --red-lentil: #E2613B;    /* fit score, highlights (dark text on top) */
  --edamame: #9DBF5A;       /* shared ingredients, fills */
  --kidney: #8A2C2C;        /* deep accent, warnings */
  --chickpea-deep: #E8C989; /* pulse portions, tape */
  --paper: #FFFFFF;
  --oat: #F3EEE1;           /* chips, soft fills */
  --line: #E8DABD;
  --quiet: #5E584C;
  --radius: 22px;
  --display: "Bitter", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--chickpea); color: var(--black-bean); font: 16px/1.5 var(--body); }
a { color: var(--kale); }
a:hover { color: var(--kale-dark); }
main { max-width: 980px; margin: 0 auto; padding: 16px 16px 104px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.15; }
h1 { font-size: 1.75rem; margin: 8px 0 6px; }
h2 { font-size: 1.25rem; margin: 26px 0 8px; }
h3 { font-size: 1.05rem; margin: 16px 0 6px; }
.lead { color: var(--quiet); margin: 0 0 16px; }
.quiet { color: var(--quiet); }
.small { font-size: .85rem; }
.panel { background: var(--paper); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

.btn, button { display: inline-block; background: var(--kale); color: #FFFFFF; border: 2px solid var(--kale); border-radius: 999px;
  padding: 11px 20px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover, button:hover { background: var(--kale-dark); border-color: var(--kale-dark); color: #FFFFFF; }
.btn.ghost, button.ghost { background: transparent; color: var(--kale); }
.btn.ghost:hover, button.ghost:hover { background: var(--oat); color: var(--kale-dark); }
.btn.small, button.small { padding: 6px 14px; font-size: .85rem; min-height: 36px; }
input, select { font: inherit; color: var(--black-bean); background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 9px 12px; min-height: 44px; }
input:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--edamame); outline-offset: 2px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--kale); }
label { display: block; margin: 10px 0 4px; color: var(--quiet); font-size: .9rem; }
.check { display: flex; gap: 8px; align-items: center; color: var(--black-bean); margin: 6px 0; }
.flash { background: var(--paper); border-left: 6px solid var(--edamame); padding: 12px 14px; border-radius: 14px; margin: 8px 0; }
.warn { border-left-color: var(--red-lentil); }
.bad { color: var(--kidney); font-weight: 700; }
.good { color: var(--kale); font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--quiet); font-weight: 500; font-size: .85rem; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* top bar and bottom nav */
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; max-width: 980px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  color: var(--black-bean); text-decoration: none; }
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
nav.bottom a { color: var(--quiet); text-decoration: none; font-size: .75rem; text-align: center; padding: 4px 6px; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; }
nav.bottom a svg { width: 22px; height: 22px; }
nav.bottom a.on { color: var(--kale); font-weight: 700; }

/* KPIs */
.hero { background: var(--kale); color: #FFFFFF; border-radius: var(--radius); padding: 16px 18px; display: flex;
  justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0; }
.hero .v { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; }
.hero .l { font-size: .85rem; }
.hero.miss { background: var(--kidney); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: var(--paper); border-radius: 16px; padding: 12px 14px; }
.kpi .v { font-family: var(--display); font-size: 1.4rem; font-weight: 800; }
.kpi .l { color: var(--quiet); font-size: .8rem; }
.kpi.hit .v { color: var(--kale); }
.kpi.miss .v { color: var(--kidney); }
.plants { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin-top: 6px; }

/* ---------- recipe card ---------- */
.rcard { display: flex; flex-direction: column; gap: 10px; background: var(--paper); border-radius: var(--radius); padding: 16px;
  color: var(--black-bean); text-decoration: none; width: 300px; max-width: 100%; }
a.rcard:hover { color: var(--black-bean); box-shadow: 0 0 0 3px var(--edamame); }
.rcard .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rcard .meal { font-size: .72rem; font-weight: 700; color: var(--kale); text-transform: uppercase; letter-spacing: .05em; }
.fit { background: var(--red-lentil); color: var(--black-bean); border-radius: 999px; padding: 3px 11px;
  font-family: var(--display); font-weight: 800; font-size: 1rem; white-space: nowrap; }
.fit.low { background: var(--oat); }
.rcard .name { font-family: var(--display); font-weight: 800; font-size: 1.45rem; line-height: 1.08; }
.beans { display: flex; gap: 5px; }
.beans span { width: 26px; height: 14px; border-radius: 7px; background: var(--oat); }
.beans span.on { background: var(--kale); }
.beans span.half { background: linear-gradient(90deg, var(--kale) 50%, var(--oat) 50%); }
.rcard .cap { font-size: .72rem; color: var(--quiet); margin-top: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { background: var(--oat); border-radius: 999px; padding: 4px 10px; font-size: .78rem; }
.chip b { font-family: var(--display); }
.shared { font-size: .8rem; display: flex; gap: 6px; align-items: center; }
.shared::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--edamame); flex: none; }
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rcards .rcard { width: auto; }

/* plan tiles */
.tile { display: block; border-radius: 16px; padding: 9px 10px; background: var(--paper); color: var(--black-bean);
  min-height: 78px; position: relative; border: 2px solid transparent; }
.tile .r { display: inline-block; background: var(--red-lentil); border-radius: 999px; padding: 0 8px; font-family: var(--display);
  font-weight: 800; font-size: .85rem; }
.tile .n { font-weight: 700; font-size: .86rem; line-height: 1.2; margin-top: 4px; }
.tile .t { font-size: .72rem; color: var(--quiet); margin-top: 2px; }
.tile.shares { border-color: var(--edamame); }
.tile.shares .t { color: var(--kale); font-weight: 700; }
.tile.out { background: transparent; border: 2px dashed var(--line); color: var(--quiet); display: grid; place-items: center; }
.tile .pin { position: absolute; top: 8px; right: 9px; font-size: .62rem; font-weight: 800; text-transform: uppercase; color: var(--quiet); }

.day { display: grid; grid-template-columns: 54px repeat(3, 1fr); gap: 8px; margin: 10px 0; align-items: start; }
.day .dl { font-family: var(--display); font-weight: 800; font-size: 1rem; padding-top: 6px; }
.mealhead { display: grid; grid-template-columns: 54px repeat(3, 1fr); gap: 8px; color: var(--quiet); font-size: .8rem; }
details.why > summary { list-style: none; cursor: pointer; border-radius: 16px; }
details.why > summary::-webkit-details-marker { display: none; }
details.why[open] .whybox { display: block; }
.whybox { display: none; position: fixed; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow: auto; z-index: 20;
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 20px 20px 32px; font-size: .95rem; color: var(--black-bean);
  box-shadow: 0 -10px 40px rgba(35,31,32,.25); }
@media (min-width: 700px) { .whybox { left: 50%; transform: translateX(-50%); width: 640px; } }
.whybox .close { float: right; }
.whybox .wtitle { font-family: var(--display); font-weight: 800; font-size: 1.4rem; line-height: 1.1; }
.whybox .reason { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; }
.whybox .reason > i { flex: none; width: 18px; height: 12px; border-radius: 6px; margin-top: 5px; }
.whybox ul { margin: 4px 0 0; padding-left: 18px; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(35,31,32,.35); z-index: 15; display: none; }
body.sheet-open .sheet-backdrop { display: block; }

/* goal grid */
.goalgrid { position: relative; width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: 18px;
  background:
    linear-gradient(var(--line), var(--line)) center/2px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) center/100% 2px no-repeat, var(--chickpea);
  touch-action: none; cursor: crosshair; }
.goalgrid .q { position: absolute; font-family: var(--display); font-weight: 800; font-size: .95rem; }
.goalgrid .q small { display: block; font-family: var(--body); font-weight: 400; color: var(--quiet); font-size: .72rem; }
.goalgrid .q.tl { left: 12px; top: 10px; } .goalgrid .q.tr { right: 12px; top: 10px; text-align: right; }
.goalgrid .q.bl { left: 12px; bottom: 10px; } .goalgrid .q.br { right: 12px; bottom: 10px; text-align: right; }
.dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--chickpea-deep);
  border: 2px solid var(--black-bean); }
.dot.me { background: var(--black-bean); width: 22px; height: 22px; margin: -11px 0 0 -11px; box-shadow: 0 0 0 3px var(--paper); }
.dot.house { background: var(--kale); width: 26px; height: 26px; margin: -13px 0 0 -13px; border-color: var(--paper);
  box-shadow: 0 0 0 4px rgba(157,191,90,.6); }
.dot span { position: absolute; left: calc(100% + 6px); top: -1px; white-space: nowrap; font-size: .78rem; font-weight: 700; color: var(--black-bean); }
.axis { color: var(--quiet); font-size: .8rem; }

/* card detail and misc */
.back { flex: 1; min-width: 260px; }
.steps li { margin: 8px 0; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; background: var(--oat); font-size: .75rem; color: var(--quiet); }
.badge.est { background: #FBE3D9; color: var(--kidney); }
.listcheck { display: flex; gap: 10px; align-items: flex-start; }
.listcheck input:checked + div { text-decoration: line-through; opacity: .55; }
.slotpick select { width: 100%; font-size: .85rem; padding: 6px; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
@media (max-width: 560px) {
  .day, .mealhead { grid-template-columns: 40px repeat(3, 1fr); gap: 6px; }
  .tile { padding: 8px; }
  .tile .n { font-size: .78rem; }
  .rcard { width: 100%; }
}

/* goal readout and reference notes */
.dot span.below { left: 50%; top: calc(100% + 4px); transform: translateX(-50%); }
.readout { background: var(--chickpea); border-radius: 16px; padding: 12px 14px; margin: 12px 0; max-width: 420px; }
.readout .rhead { font-family: var(--display); font-size: 1.1rem; }
.readout .rhead span { font-family: var(--body); font-size: .85rem; }
.wrow { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .8rem; }
.wl { width: 170px; flex: none; }
.wbar { flex: 1; height: 10px; border-radius: 5px; background: var(--paper); overflow: hidden; }
.wbar i { display: block; height: 10px; border-radius: 5px; background: var(--kale); width: 0; transition: width .15s; }
.ref { font-size: .8rem; color: var(--quiet); margin: 4px 0 6px; line-height: 1.45; }
.ref b { color: var(--black-bean); }
.scale { position: relative; height: 18px; margin: 6px 0 0; border-top: 3px solid var(--line); max-width: 420px;
  background: linear-gradient(90deg, transparent 0 60%, var(--edamame) 60% 100%) top/100% 3px no-repeat; }
.scale span { position: absolute; top: 2px; transform: translateX(-50%); font-size: .68rem; color: var(--quiet); white-space: nowrap; }
.scale span::before { content: ""; position: absolute; left: 50%; top: -7px; width: 2px; height: 6px; background: var(--quiet); }
select { max-width: 100%; }
