/* Clear & Kind. Brightened deliberately, and the brightening is a tone —
   not a loosening: the four verdicts, the sources, the dates and the rule
   version all stay exactly where they were.

   The important move is that RED IS NO LONGER THE ACCENT. A refusal used to
   fill the screen in the brand colour, which made the loudest thing on the
   page a "no" — read over the shoulder of a child who is told no all day.
   Red now appears only inside the verdict it belongs to; the accent is a calm
   teal, and the alternatives are what the eye lands on. */
:root{
    --ground:#fcfcfa;--card:#fff;--sunk:#f1f5f4;
    --ink:#1c2523;--ink-2:#4b5c58;--ink-3:#5f716d;
    --rule:#e5eae8;--accent:#0f766e;--accent-2:#e6f2f0;
    --safe:#0f766e;--safe-bg:#e4f2ee;--warn:#92400e;--warn-bg:#fdf0dc;
    --stop:#a8362a;--stop-bg:#fdecea;--unk:#5b6b73;--unk-bg:#eef1f3;
    --display:"Instrument Serif",Georgia,serif;--ui:Karla,-apple-system,sans-serif;
    --mono:"IBM Plex Mono",Menlo,monospace;

    /* A type scale, because there were twenty-two ad-hoc sizes and eleven of
       them were under 12px — some at 9px. This app exists because ingredient
       print is too small to read in a shop; rendering its own answer smaller
       than the packet was the wrong kind of irony. 12px is a hard floor and
       is reserved for mono metadata; anything a parent actually reads starts
       at 13px, and body text is 16px. */
    --t-xs:.75rem;      /* 12px — floor. Provenance, tags, eyebrows. */
    --t-sm:.8125rem;    /* 13px — brands, captions, disclosure summaries. */
    --t-base:.875rem;   /* 14px — supporting copy, list rows. */
    --t-md:1rem;        /* 16px — body and product names. */
    --t-lg:1.125rem;    /* 18px */
    --t-xl:1.5rem;      /* 24px — the verdict. */
    --t-2xl:1.875rem;   /* 30px — the masthead. */
  }
  @media (prefers-color-scheme:dark){:root{
    --ground:#121716;--card:#1a2120;--sunk:#212927;
    --ink:#eaf1ef;--ink-2:#a9bab6;--ink-3:#7b8c88;
    --rule:#2c3634;--accent:#5ec9b8;--accent-2:#16302c;
    --safe:#5ec9b8;--safe-bg:#123029;--warn:#e0a95f;--warn-bg:#32240f;
    --stop:#ef8f80;--stop-bg:#3a1c18;--unk:#a3b1b6;--unk-bg:#242c2f;
  }}
  *{box-sizing:border-box}
  /* Any `display` rule more specific than [hidden] would otherwise un-hide it. */
  [hidden]{display:none!important}
  body{background:var(--ground);color:var(--ink);font-family:var(--ui);
       font-size:1rem;line-height:1.55;margin:0;padding:1.5rem 1rem 4rem;
       -webkit-font-smoothing:antialiased}
  .wrap{max-width:30rem;margin:0 auto;display:flex;flex-direction:column;gap:.9rem}
  /* Sibling groups get gap, not per-element margins: spacing then survives
     items being added, removed or reordered. */
  .side{display:flex;flex-direction:column;gap:.9rem}
  .alts,.makes{display:flex;flex-direction:column;gap:.55rem}
  h1{font-family:var(--display);font-size:var(--t-2xl);font-weight:400;margin:0;
     letter-spacing:-.01em;line-height:1.05}
  .sub{color:var(--ink-3);font-size:var(--t-sm);margin:.15rem 0 .6rem}
  .eyebrow{font-family:var(--mono);font-size:var(--t-xs);letter-spacing:.14em;
           text-transform:uppercase;color:var(--ink-3)}
  .panel{background:var(--card);border:1px solid var(--rule);border-radius:14px;padding:1rem}
  .chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.6rem}
  .chip{font:inherit;font-size:var(--t-base);font-weight:500;padding:.5rem .85rem;
        min-height:2.5rem;border-radius:999px;border:1px solid var(--rule);
        background:transparent;color:var(--ink-3);cursor:pointer}
  .chip[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--card)}
  input[type=search]{font:inherit;width:100%;padding:.7rem .85rem;border-radius:10px;
                     border:1px solid var(--rule);background:var(--card);color:var(--ink)}
  :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
  .results{display:flex;flex-direction:column;gap:.4rem;margin-top:.6rem;
           max-height:15rem;overflow-y:auto}
  .hit{display:flex;gap:.6rem;align-items:center;background:var(--card);
       border:1px solid var(--rule);border-radius:10px;padding:.5rem .6rem;
       cursor:pointer;text-align:left;font:inherit;color:var(--ink)}
  .hit:hover{border-color:var(--accent)}
  .hit img{width:34px;height:34px;object-fit:contain;border-radius:6px;background:var(--sunk);flex:none}
  .hit .nm{font-size:var(--t-md);font-weight:600;line-height:1.2}
  .hit .br{font-size:var(--t-xs);color:var(--ink-3)}
  .verdict{border-radius:14px;padding:1rem;border:1px solid}
  .verdict.contains{background:var(--stop-bg);border-color:var(--stop)}
  .verdict.may_contain{background:var(--warn-bg);border-color:var(--warn)}
  .verdict.no_listed_allergens{background:var(--safe-bg);border-color:var(--safe)}
  .verdict.unverified{background:var(--unk-bg);border-color:var(--unk)}
  .v-state{font-family:var(--display);font-size:var(--t-xl);font-weight:400;line-height:1.15;
           letter-spacing:-.01em}
  .verdict.contains .v-state{color:var(--stop)}
  .verdict.may_contain .v-state{color:var(--warn)}
  .verdict.no_listed_allergens .v-state{color:var(--safe)}
  .verdict.unverified .v-state{color:var(--unk)}
  .v-prod{font-size:var(--t-md);color:var(--ink-2);margin-top:.15rem}
  .v-why{font-size:var(--t-md);margin-top:.5rem;color:var(--ink-2)}
  .label-text{font-family:var(--mono);font-size:var(--t-xs);line-height:1.55;color:var(--ink-2);
              background:var(--card);border-radius:8px;padding:.55rem .65rem;margin-top:.5rem;
              word-break:break-word;max-height:9rem;overflow-y:auto}
  details summary{cursor:pointer;font-size:var(--t-base);font-weight:600;color:var(--accent);list-style:none}
  details summary::-webkit-details-marker{display:none}
  details summary::before{content:"▸ "} details[open] summary::before{content:"▾ "}
  .tabs{display:flex;gap:.35rem}
  .tab{font:inherit;font-weight:600;font-size:var(--t-base);flex:1;padding:.7rem .3rem;
       min-height:2.75rem;
       border-radius:10px;border:1px solid var(--rule);background:var(--card);
       color:var(--ink-3);cursor:pointer}
  .tab[aria-selected="true"]{background:var(--accent-2);border-color:var(--accent);color:var(--accent)}
  .item{background:var(--card);border:1px solid var(--rule);border-radius:12px;
        padding:.75rem .85rem;display:flex;gap:.7rem}
  .item img{width:52px;height:52px;object-fit:contain;border-radius:8px;background:var(--sunk);flex:none}
  .bd{flex:1;min-width:0}
  .nm2{font-weight:700;font-size:var(--t-md);line-height:1.25}
  .br2{font-size:var(--t-xs);color:var(--ink-3);margin-bottom:.35rem}
  .match{font-family:var(--mono);font-size:var(--t-xs);color:var(--ink-3);
         display:flex;align-items:center;gap:.4rem;margin-bottom:.4rem}
  .bar{flex:1;max-width:64px;height:3px;background:var(--sunk);border-radius:2px;overflow:hidden}
  .bar i{display:block;height:100%;background:var(--accent)}
  .flag{display:inline-flex;align-items:center;gap:.3rem;font-size:var(--t-xs);font-weight:600;
        padding:.22rem .5rem;border-radius:7px}
  .flag.ok{background:var(--safe-bg);color:var(--safe)}
  .flag.may{background:var(--warn-bg);color:var(--warn)}
  .dot{width:6px;height:6px;border-radius:50%;background:currentColor}
  .verify{margin-top:.5rem;padding-top:.45rem;border-top:1px dashed var(--rule);
          font-size:var(--t-xs);font-weight:600;color:var(--ink-3)}
  .ing{list-style:none;padding:0;margin:.5rem 0 0}
  .ing li{display:flex;justify-content:space-between;gap:.6rem;padding:.35rem 0;
          border-bottom:1px solid var(--rule);font-size:var(--t-base)}
  .ing li:last-child{border-bottom:0}
  .tag{font-family:var(--mono);font-size:var(--t-xs);padding:.1rem .35rem;border-radius:4px;white-space:nowrap}
  .tag.sub{background:var(--warn-bg);color:var(--warn)}
  .tag.ok2{background:var(--safe-bg);color:var(--safe)}
  .cart{font:inherit;font-weight:700;font-size:var(--t-md);width:100%;margin-top:.7rem;
        padding:.8rem;min-height:2.9rem;border-radius:10px;border:0;background:var(--accent);color:var(--ground);cursor:pointer}
  .cart[disabled]{background:var(--safe)}
  details.excl{background:var(--sunk);border:1px solid var(--rule);border-radius:12px;padding:.6rem .8rem}
  details.excl summary{color:var(--ink-2)}
  .ex{display:flex;justify-content:space-between;gap:.6rem;padding:.4rem 0;
      border-bottom:1px solid var(--rule);font-size:var(--t-sm)}
  .ex:last-child{border-bottom:0}
  .ex span{color:var(--stop);font-weight:600;font-size:var(--t-xs);white-space:nowrap}
  .idle{text-align:center;padding:1.4rem 1rem;color:var(--ink-3);font-size:var(--t-base);
        background:var(--card);border:1px dashed var(--rule);border-radius:14px}
  .meta{font-family:var(--mono);font-size:var(--t-xs);color:var(--ink-3);text-align:center}
  .foot{max-width:30rem;margin:1.4rem auto 0;font-size:var(--t-sm);color:var(--ink-3);
        line-height:1.55;border-top:1px solid var(--rule);padding-top:.8rem}
  .foot b{color:var(--ink-2)}

/* Provenance: quiet, always present. A verdict without a source is a claim
   without evidence. */
.prov{font-family:var(--mono);font-size:var(--t-xs);line-height:1.5;color:var(--ink-3);
      margin-top:.5rem;padding-top:.4rem;border-top:1px dashed var(--rule)}
.prov.stale{color:var(--warn)}
.prov a{color:inherit}
.foot a{color:var(--ink-2)}

/* Recipe adaptation: the only generated content in the product, and it is
   labelled as such wherever it appears. */
button.adapt{font:inherit;font-weight:600;font-size:var(--t-base);width:100%;margin-top:.6rem;
  padding:.7rem;min-height:2.75rem;border-radius:9px;border:1px solid var(--accent);
  background:transparent;color:var(--accent);cursor:pointer}
button.adapt:disabled{opacity:.6;cursor:default}
.adapt-box{background:var(--sunk);border-radius:10px;padding:.7rem .8rem;margin-top:.6rem}
.ad-list{list-style:none;padding:0;margin:.4rem 0 0}
.ad-list li{padding:.35rem 0;border-bottom:1px solid var(--rule);font-size:var(--t-base)}
.ad-list li:last-child{border-bottom:0}
.ad-note{font-size:var(--t-sm);color:var(--ink-2);margin-top:.15rem}

/* The method. Retrieved and cited — never generated. */
details.method{margin-top:.6rem}
details.method summary{font-size:var(--t-base);font-weight:600;color:var(--accent);cursor:pointer}
ol.steps{margin:.5rem 0 0;padding-left:1.2rem}
ol.steps li{font-size:var(--t-base);line-height:1.5;padding:.2rem 0;color:var(--ink-2)}
ol.steps li::marker{color:var(--ink-3);font-family:var(--mono);font-size:var(--t-xs)}


/* ── Responsive ───────────────────────────────────────────────────────────────
   Phone first, because the real moment is standing in an aisle holding a
   packet. But the phone column alone on a laptop reads as unfinished, so the
   layout earns the extra width rather than just centring in it.

   Two ideas: the controls a parent keeps returning to (profile, search) become
   a sticky sidebar, and the results — the part that actually varies — take the
   room. Nothing below 900px changes at all. */

/* Tablet and up: cards pair off before the shell splits. */
@media (min-width: 620px) {
  body { padding: 2rem 1.5rem 4rem; }
  .wrap { max-width: 34rem; }
  .foot { max-width: 34rem; }
  #signin { margin-left: auto; margin-right: auto; }
  .results { max-height: 18rem; }
}

/* Laptop and up: controls to the side, results take the space. */
@media (min-width: 900px) {
  /* Width follows content, and there are three contents: the signed-out pitch
     beside its form, the signed-in controls alone, and the controls beside
     results. Each gets the room it actually needs — a grid inside a container
     narrower than the grid is how the intro column ended up 128px wide. */
  body:not(.app-open) .wrap { max-width: 58rem; }
  body:not(.app-open) .foot { max-width: 58rem; }
  body.has-result .wrap { max-width: 62rem; }
  body.has-result .foot { max-width: 62rem; }
  /* :not([hidden]) matters. A bare `#app { display: grid }` outranks the
     browser's own `[hidden] { display: none }` — an ID beats an attribute
     selector — so the signed-in panel rendered on top of the sign-in form. */
  body.has-result #app:not([hidden]) { display: grid;
         grid-template-columns: 21rem minmax(0, 1fr);
         gap: 1.5rem; align-items: start; }
  /* Sticky so the profile and search stay reachable while results scroll —
     the two things a parent switches between most. */
  body.has-result .side { position: sticky; top: 2rem; }
  .alts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results { max-height: 22rem; }
}

/* Wide: a third column of alternatives rather than ever-wider cards. */
@media (min-width: 1240px) {
  body.has-result .wrap { max-width: 76rem; }
  body.has-result .foot { max-width: 76rem; }
  body.has-result #app:not([hidden]) { grid-template-columns: 22rem minmax(0, 1fr); }
}

/* A sticky sidebar is wrong when the window is short — it can outgrow the
   viewport and strand the bottom of the panel out of reach. */
@media (min-width: 900px) and (max-height: 700px) {
  body.has-result .side { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ── Admin ────────────────────────────────────────────────────────────────────
   Dense by intent: this is an operator surface, scanned rather than read, so it
   trades the roomy spacing of the family-facing screens for rows you can
   compare down a column. */
.econ{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem}
.econ > div{background:var(--sunk);border-radius:10px;padding:.6rem .7rem}
.econ b{display:block;font-family:var(--display);font-size:var(--t-lg);line-height:1.1}
.econ span{font-family:var(--mono);font-size:var(--t-xs);color:var(--ink-3)}
@media (min-width:620px){ .econ{grid-template-columns:repeat(3,minmax(0,1fr))} }

.atab{width:100%;border-collapse:collapse;margin-top:.6rem;font-size:var(--t-sm)}
.atab th{text-align:left;font-family:var(--mono);font-size:var(--t-xs);
         letter-spacing:.1em;text-transform:uppercase;color:var(--ink-3);
         font-weight:500;padding:.4rem .5rem .4rem 0;border-bottom:1px solid var(--rule)}
.atab td{padding:.55rem .5rem .55rem 0;border-bottom:1px solid var(--rule);
         vertical-align:middle}
.atab tr:last-child td{border-bottom:0}
/* Numbers are compared down the column, so they line up. */
.atab td:nth-child(3),.atab td:nth-child(5){font-variant-numeric:tabular-nums}
.atab input.lim{width:5.5rem;font:inherit;font-size:var(--t-sm);padding:.35rem .45rem;
                border-radius:7px;border:1px solid var(--rule);
                background:var(--card);color:var(--ink);font-variant-numeric:tabular-nums}
button.mini{font:inherit;font-size:var(--t-xs);font-weight:600;padding:.4rem .6rem;
            min-height:2.25rem;border-radius:7px;border:1px solid var(--rule);
            background:var(--card);color:var(--ink-2);cursor:pointer;margin-right:.3rem}
button.mini:hover{border-color:var(--accent);color:var(--accent)}
/* The admin table is wider than a phone; let it scroll rather than squash. */
#admin-accounts{overflow-x:auto}


/* ── Messages ─────────────────────────────────────────────────────────────────
   Replacing window.alert meant replacing two of its properties, not just its
   look. It blocked until dismissed, so it could not be missed; and screen
   readers announced it. The markup carries role="status"/aria-live for the
   second, and these stay put rather than flashing past for the first. */
.msg{font-size:var(--t-sm);line-height:1.5;margin:.55rem 0 0;padding:.5rem .65rem;
     border-radius:9px;border:1px solid transparent}
.msg.error{background:var(--stop-bg);border-color:var(--stop);color:var(--stop)}
.msg.ok{background:var(--safe-bg);border-color:var(--safe);color:var(--safe)}
.msg.info{background:var(--sunk);border-color:var(--rule);color:var(--ink-2)}

/* Pinned to the bottom on a phone, where the thumb and the eye already are;
   it must clear the browser's own chrome, hence the safe-area inset. */
.toast{position:fixed;left:1rem;right:1rem;bottom:calc(1rem + env(safe-area-inset-bottom));
       z-index:50;margin:0 auto;max-width:26rem;font-size:var(--t-base);line-height:1.45;
       padding:.75rem .9rem;border-radius:12px;border:1px solid var(--rule);
       background:var(--card);color:var(--ink);
       box-shadow:0 6px 24px rgba(0,0,0,.14)}
.toast.error{background:var(--stop-bg);border-color:var(--stop);color:var(--stop)}
.toast.ok{background:var(--safe-bg);border-color:var(--safe);color:var(--safe)}
@media (prefers-color-scheme:dark){ .toast{box-shadow:0 6px 24px rgba(0,0,0,.5)} }


/* ── Signed-out intro ─────────────────────────────────────────────────────────
   The page used to open on a login form with no explanation, so anyone
   arriving from a link was asked to join something before being told what it
   was. The pitch now comes first and the caveat travels with it, because "we
   never say a food is safe" is the product's most important sentence and it
   was previously in a footer nobody signed out would scroll to. */
.intro{margin-bottom:1rem}
.intro-h{font-family:var(--display);font-size:var(--t-2xl);font-weight:400;
         line-height:1.12;letter-spacing:-.01em;margin:0 0 .5rem;
         text-wrap:balance}
/* Keep prose near a readable measure rather than letting it run the full
   column on a wide screen. */
.intro-p{max-width:44ch}
.intro-p{font-size:var(--t-md);line-height:1.55;color:var(--ink-2);margin:0;max-width:44ch}

.tracks{list-style:none;padding:0;margin:1rem 0 0;display:flex;
        flex-direction:column;gap:.45rem}
.tracks li{display:flex;flex-direction:column;gap:.1rem;background:var(--card);
           border:1px solid var(--rule);border-left:3px solid var(--accent);
           border-radius:10px;padding:.6rem .75rem}
.tracks b{font-size:var(--t-base)}
.tracks span{font-size:var(--t-sm);color:var(--ink-3)}

.intro-note{font-size:var(--t-sm);line-height:1.55;color:var(--ink-3);
            margin:.9rem 0 0;padding-top:.7rem;border-top:1px dashed var(--rule)}

/* The developer bypass is a backdoor with a label. It should look like a
   maintenance hatch, not a second way in. */
#signin-dev summary{font-size:var(--t-sm);font-weight:600;color:var(--ink-3);cursor:pointer}
#signin-dev summary:hover{color:var(--accent)}

@media (min-width:620px){
  .tracks{flex-direction:row}
  .tracks li{flex:1}
}
/* Side by side once there is room: the pitch reads while the form waits. */
@media (min-width:900px){
  /* minmax(0,1fr) on the text column and a fixed form column: the form has a
     natural size, the prose should take whatever is left. */
  #signin:not([hidden]){display:grid;grid-template-columns:minmax(22rem,1fr) 22rem;
                        gap:2.5rem;align-items:start}
  .intro{margin-bottom:0}
  .tracks{flex-direction:column}
}
