/* Layout: one view at a time; tabs in the top bar on wide screens, a bottom nav bar on phones. */
:root {
  --fg: #1d2420;
  --muted: #5c6862;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --line: #dde4df;
  --brand: #1f5e45;
  --up: #2f6fd0;
  --down: #d9722b;
  --warn: #a5620a;
  --bad: #c0392b;
  --grid: #e9eeea;
  --axis: #b8c2bc;
  --ref: #7d8a83;
  --sel: rgba(47, 111, 208, .08);
  --v-ft: #2f6fd0; --v-abs: #2a9a6e; --v-sec: #8a5cd0; --v-snip: #c4417c;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 16px rgba(20, 40, 30, .05);
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --fs-cap: 13px;
  --fs-body: 16px;
  --radius: 12px;
  --nav-h: 64px;
  --bar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #e4ebe6; --muted: #9aa8a0; --bg: #101412; --panel: #19201c; --line: #2c3531;
    --brand: #7fd1a8; --up: #6ea2f0; --down: #f0a060; --warn: #e0a24a; --bad: #ef6f5e;
    --grid: #252d29; --axis: #45514b; --ref: #8a978f; --sel: rgba(110, 162, 240, .12);
    --v-ft: #6ea2f0; --v-abs: #4cc493; --v-sec: #b18cf0; --v-snip: #ea6fa3;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fg: #e4ebe6; --muted: #9aa8a0; --bg: #101412; --panel: #19201c; --line: #2c3531;
  --brand: #7fd1a8; --up: #6ea2f0; --down: #f0a060; --warn: #e0a24a; --bad: #ef6f5e;
  --grid: #252d29; --axis: #45514b; --ref: #8a978f; --sel: rgba(110, 162, 240, .12);
  --v-ft: #6ea2f0; --v-abs: #4cc493; --v-sec: #b18cf0; --v-snip: #ea6fa3;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: var(--fs-body); line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
a { color: var(--up); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--up); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Top bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--panel); z-index: 30; }
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.bar-inner {
  max-width: 1100px; margin-inline: auto; height: var(--bar-h);
  display: flex; align-items: center; gap: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-weight: 600; white-space: nowrap; }
.brand img { border-radius: 7px; }
.tabs { display: none; gap: 4px; margin-left: auto; }
.tabs a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-weight: 500;
}
.tabs a[aria-current="page"] { color: var(--fg); background: var(--sel); }
.install {
  margin-left: auto; border: 0; background: var(--up); color: var(--panel);
  border-radius: 999px; padding: 6px 16px; min-height: 40px; cursor: pointer; font-weight: 600; white-space: nowrap;
}

/* Install steps: a bottom sheet on phones, a centred dialog on wide screens. */
.sheet {
  border: 0; border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%; max-width: 100%; margin: auto 0 0; background: var(--panel); color: var(--fg);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .25);
}
.sheet::backdrop { background: rgba(10, 20, 15, .45); }
.sheet h2 { margin-bottom: 12px; }
.sheet ol { margin: 0 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
.sheet .note { margin-bottom: 12px; }
.sheet-close {
  width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--up); color: var(--panel);
  font-weight: 600; cursor: pointer;
}
@media (min-width: 760px) {
  .sheet { margin: auto; width: min(440px, calc(100% - 32px)); border-radius: 16px; padding: 24px; }
}

/* Bottom nav (phones) */
.bottom-nav {
  position: fixed; inset: auto 0 0; z-index: 20; background: var(--panel); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.bottom-nav a {
  height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 500;
}
.bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav a[aria-current="page"] { color: var(--brand); }

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabs { display: flex; }
  .install { margin-left: 8px; }
  .bottom-nav { display: none; }
}

/* Views */
main {
  max-width: 1100px; margin-inline: auto; padding-block: 20px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.view { display: flex; flex-direction: column; gap: 16px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 6vw, 38px); line-height: 1.15; margin: 4px 0 0; text-wrap: balance; }
h2 { font-size: 18px; font-weight: 600; margin: 0; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); max-width: 70ch; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
@media (min-width: 760px) { .card { padding: 20px; } }
.note { margin: 0; color: var(--muted); font-size: var(--fs-cap); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.site-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-cap); display: flex; flex-direction: column; gap: 4px; }

/* Segmented control */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; align-self: flex-start; max-width: 100%; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Legend */
.key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-cap); color: var(--muted); align-items: center; }
.key > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Direction glyphs, shared by the map and the crop card */
.c { display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 14px; line-height: 1; }
.c.up { color: var(--up); background: color-mix(in srgb, var(--up) 15%, transparent); }
.c.peak { color: var(--panel); background: var(--up); }
.c.down { color: var(--down); background: color-mix(in srgb, var(--down) 16%, transparent); }
.c.low { color: var(--down); }
.c.mix { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.c.nd { color: var(--muted); }
.c.inferred { opacity: .55; outline: 1.5px dashed currentColor; outline-offset: -1.5px; }
.key .c { width: 26px; height: 22px; }

/* Compare by stage: one card per hormone, crops grouped by direction as wrapping tags. */
.cmp { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.cmp .loading { grid-column: 1 / -1; min-height: 160px; border-radius: 10px; background: var(--grid); }
.cmp-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cmp-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
/* Direction label above its crops, so names get the full card width on a phone. */
.grp { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.grp > .c { height: 26px; padding: 0 10px; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.grp.nd > .c { background: none; padding-left: 0; height: 20px; }
.names { display: flex; flex-wrap: wrap; gap: 6px; }
.name {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 4px 10px; min-height: 30px;
  font-size: 14px; cursor: pointer;
}
.name:hover { border-color: var(--up); }
.name.inferred { border-style: dashed; color: var(--muted); }
.name.on { border-color: var(--up); background: var(--sel); font-weight: 600; }
.grp.nd .name { border-color: transparent; background: none; color: var(--muted); padding-inline: 4px; }

/* Crop tiles: compact name buttons in a wrapping grid; the open crop's panel spans the full width under its row. */
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tiles .loading { grid-column: 1 / -1; min-height: 96px; border-radius: 10px; background: var(--grid); }
.tile {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 0 10px 0 12px; min-height: 44px;
}
.tile:hover { border-color: var(--up); }
.tile[aria-pressed="true"] { border-color: var(--up); background: var(--up); color: var(--panel); }
.tile-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: inline-flex; gap: 3px; flex: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--grid); outline: 1px solid var(--axis); outline-offset: -1px; }
.dots i.on { background: var(--brand); outline: 0; }
.tile[aria-pressed="true"] .dots i { outline-color: var(--panel); background: transparent; }
.tile[aria-pressed="true"] .dots i.on { background: var(--panel); }
/* Crop bar: the chosen crop opens the picker; arrows step through crops in the same order. */
.crop-bar { display: flex; align-items: center; gap: 10px; }
.crop-pick {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--up); background: var(--sel); border-radius: 12px; color: var(--fg);
}
.crop-pick-name { font-size: 20px; font-weight: 600; }
.caret { color: var(--up); font-size: 14px; }
.crop-count { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.stepper { display: inline-flex; gap: 6px; }
.stepper button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--fg);
}
.stepper button:hover, .crop-pick:hover { border-color: var(--up); }
.crop-panel { display: flex; flex-direction: column; gap: 10px; }
.picker .tiles { margin-bottom: 14px; max-height: 60vh; overflow-y: auto; }
.picker .note { margin-bottom: 12px; }
@media (min-width: 760px) { .picker { width: min(640px, calc(100% - 32px)); } }
@media (max-width: 380px) { .crop-count { display: none; } }
/* Compact table: hormone names down the side, one column per stage. */
.ct { display: grid; grid-template-columns: minmax(5.5rem, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 4px 6px; align-items: center; font-size: 14px; }
.ct-stage { display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; font-size: 13px; text-align: center; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.ct-stage .pill { font-size: 11px; padding: 0 7px; }
.ct-h { color: var(--fg); line-height: 1.2; }
.ct .c { height: 30px; gap: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ct .c.nd { color: var(--muted); }
.ev summary { cursor: pointer; color: var(--up); font-weight: 500; font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.ev p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.ev strong { color: var(--fg); }
@media (max-width: 420px) {
  .ct-h { font-size: 13px; }
  .ct .c { font-size: 12px; padding: 0 2px; }
}
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.measured { color: var(--brand); border-color: currentColor; }
.pill.partly { color: var(--up); border-color: currentColor; }
.pill.inferred { border-style: dashed; }

/* Charts */
.chart { position: relative; min-height: 160px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 13px; }
.chart .row { cursor: pointer; }
.chart .loading { min-height: 160px; border-radius: 8px; background: var(--grid); }
.fail { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 160px; color: var(--muted); font-size: var(--fs-cap); }
.fail::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.readout {
  border-radius: 10px; background: var(--bg); padding: 10px 12px; font-size: 14px; min-height: 64px;
  display: flex; flex-direction: column; gap: 2px;
}
.readout .t { font-weight: 600; }
.readout .m { color: var(--muted); }
.readout .hint { color: var(--muted); margin: auto 0; }
/* Update toast: above the bottom nav on phones, bottom centre on wide screens. */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 14px;
  background: var(--fg); color: var(--bg); border-radius: 12px; padding: 10px 10px 10px 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25); font-size: 15px;
}
.toast button {
  flex: none; border: 0; border-radius: 8px; padding: 8px 14px; min-height: 40px; cursor: pointer;
  background: var(--bg); color: var(--fg); font-weight: 600;
}
@media (min-width: 760px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { animation: toast-in .25s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
}

/* On phones the readout rides above the bottom nav while its chart is on screen, so a tapped row is never out of sight. */
@media (max-width: 759px) {
  .readout {
    position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 5;
    background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
  }
}

/* "Applied only": the hormone was tested as a spray or dip but its natural level was not measured. */
.c.trt { color: var(--muted); background: none; outline: 1.5px dotted var(--axis); outline-offset: -1.5px; }

/* Crop table extras: group headings, coverage line, evidence by stage */
.ct-group {
  grid-column: 1 / -1; margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.cov { margin: 0; font-size: 14px; color: var(--muted); }
.cov strong { color: var(--fg); }
.ev-stage h4 { margin: 12px 0 2px; font-size: 15px; }
.ev-stage p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ev-stage p strong { color: var(--fg); }
.src { color: var(--muted); font-size: 13px; white-space: normal; }
.none { color: var(--muted); font-style: italic; }

/* Compare: group headings and per-card counts */
.cmp-group { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.cmp-card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cmp-card h4 { margin: 0; font-size: 16px; font-weight: 600; }
.cnt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.grp .why { font-size: 12px; color: var(--muted); }

/* Regulators: booster/blocker pairs */
.pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pairs li { display: grid; grid-template-columns: 7rem 1fr 1fr; gap: 10px; align-items: start; font-size: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.pairs li:first-child { border-top: 0; padding-top: 0; }
.pairs .ph { font-weight: 600; }
.pairs b { font-weight: 600; }
@media (max-width: 640px) { .pairs li { grid-template-columns: 1fr; gap: 3px; } }

/* Regulators: filters */
.reg-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.field { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.field select {
  font: inherit; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); min-width: 10rem;
}
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--up); }

/* Regulators: one card per product × crop, showing the chain */
.reg-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.reg-list .loading { grid-column: 1 / -1; min-height: 160px; border-radius: 10px; background: var(--grid); }
.reg { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.reg > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.reg h3 { margin: 0; font-size: 17px; font-weight: 600; }
.act { flex: none; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; background: var(--grid); color: var(--fg); }
.act.boosts, .act.releases, .act.mimics { background: color-mix(in srgb, var(--up) 15%, transparent); color: var(--up); }
.act.blocks { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.act.indirect, .act.several { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.reg-meta { margin: 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ev-badge { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; border: 1px solid currentColor; }
.ev-badge.measured { color: var(--brand); }
.ev-badge.effect { color: var(--up); }
.ev-badge.practice { color: var(--muted); border-style: dashed; }
.chain { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.chain li { position: relative; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.chain li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--up); }
.chain li strong { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chain li.missing span { color: var(--muted); font-style: italic; }
.chain li.missing::before { background: var(--panel); border: 2px solid var(--axis); width: 6px; height: 6px; }
.reg-more summary { cursor: pointer; color: var(--up); font-weight: 500; font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.reg-more p { margin: 4px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }

/* Six items in the bottom nav */
.bottom-nav { grid-template-columns: repeat(6, 1fr); }
.bottom-nav a { font-size: 11px; }

.c.nod { color: var(--muted); background: var(--grid); }
.ct .c { height: auto; min-height: 30px; padding-block: 3px; white-space: normal; text-align: center; line-height: 1.1; }

/* Inline crop list under the crop button */
.crop-pick-more { font-size: 13px; color: var(--up); font-weight: 600; }
.crop-pick .caret { transition: transform .15s ease-out; }
.crop-pick[aria-expanded="true"] .caret { transform: rotate(180deg); }
.crop-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.crop-list .note { margin: 0; }
.crop-bar .stepper { margin-left: auto; }
.crop-bar { flex-wrap: wrap; }
.crop-pick { flex: 1 1 auto; justify-content: flex-start; max-width: 100%; }
.crop-pick .caret { margin-left: auto; }
@media (max-width: 420px) { .crop-pick-name { font-size: 18px; } }
/* Keep crop button and arrows on one row on phones */
.crop-bar { flex-wrap: nowrap; }
.crop-pick { flex: 1 1 0; min-width: 0; }
.crop-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crop-pick-more { white-space: nowrap; }
@media (max-width: 420px) {
  .crop-pick { gap: 8px; padding: 0 12px; }
  .crop-pick .dots { display: none; }
  .crop-bar .stepper button { width: 40px; height: 40px; }
}

/* Arrows removed: the crop button has room for its dots again on phones */
@media (max-width: 420px) { .crop-pick .dots { display: inline-flex; } }

/* Safety notice on the Regulators view */
.notice {
  border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.5;
}
.notice strong { color: var(--warn); }
/* Pairs now have three parts: boost, block, natural opponent */
.pairs li { grid-template-columns: 7rem repeat(3, 1fr); }
@media (max-width: 900px) { .pairs li { grid-template-columns: 1fr; gap: 3px; } }

/* Ripening chart: hollow "at harvest" swatch, and one line per measurement in the readout */
.sw.ring { background: var(--panel); border: 2px solid var(--muted); width: 10px; height: 10px; }
.readout .ro-item { display: block; padding-top: 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.readout .ro-item:first-of-type { border-top: 0; margin-top: 0; }

/* Stage views: the chosen crop's hormones at this stage */
.stage-card .crop-bar { margin-top: -2px; }
.sh-list { display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.sh-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; min-height: 34px; font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.sh-row .c { height: 28px; padding: 0 10px; gap: 5px; font-size: 13px; font-weight: 600; white-space: nowrap; min-width: 6.5rem; }
.crop-note { margin: 0; font-size: 14px; color: var(--up); font-weight: 500; }
.crop-note.missing { color: var(--muted); font-weight: 400; font-style: italic; }

/* Top-bar crop chip and its panel */
.crop-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--up); background: var(--sel); color: var(--fg); max-width: 50vw;
}
.chip-label { font-size: 12px; color: var(--muted); }
.chip-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crop-chip .caret { color: var(--up); font-size: 12px; transition: transform .15s ease-out; }
.crop-chip[aria-expanded="true"] .caret { transform: rotate(180deg); }
.crop-panel-global { border-top: 1px solid var(--line); background: var(--panel); max-height: 70vh; overflow-y: auto; }
.crop-panel-inner { max-width: 1100px; margin-inline: auto; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
@media (max-width: 480px) { .brand span { display: none; } .bar-inner { gap: 10px; } .install { padding: 6px 12px; } }

/* Collapsed comparison */
.cmp-details > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.cmp-details > summary::-webkit-details-marker { display: none; }
.cmp-sum-title { font-size: 18px; font-weight: 600; }
.cmp-sum-title::after { content: " ▾"; color: var(--up); font-size: 14px; }
.cmp-details[open] .cmp-sum-title::after { content: " ▴"; }

/* Folded No data */
.gaps { margin: 0; font-size: 14px; color: var(--muted); }
.gaps strong { color: var(--fg); }
.cmp-gaps { grid-column: 1 / -1; }
details.grp.nd > summary { cursor: pointer; color: var(--muted); font-size: 13px; min-height: 28px; display: flex; align-items: center; }
details.grp.nd .names { margin-top: 6px; }

/* Residues */
.res summary { cursor: pointer; color: var(--up); font-weight: 500; font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.res h4 { margin: 10px 0 4px; font-size: 14px; text-transform: capitalize; }
.res p, .res li { margin: 4px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.res p strong, .res li strong { color: var(--fg); }
.res ul.mrl { margin: 4px 0 0; padding-left: 18px; }
.persist { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; white-space: nowrap; border: 1px solid currentColor; }
.persist.high { color: var(--bad); }
.persist.mid { color: var(--warn); }
.persist.low { color: var(--brand); }
.persist.unknown { color: var(--muted); border-style: dashed; }
.soil-table { display: flex; flex-direction: column; }
.soil-row { border-bottom: 1px solid var(--line); }
.soil-row > summary { cursor: pointer; display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr); gap: 10px; align-items: center; min-height: 44px; font-size: 14px; }
.soil-name { font-weight: 600; text-transform: capitalize; }
.soil-time { color: var(--muted); font-size: 13px; text-align: right; }
.soil-row p { margin: 4px 0 6px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.soil-row p strong { color: var(--fg); }
@media (max-width: 520px) { .soil-row > summary { grid-template-columns: 1fr auto; } .soil-time { grid-column: 1 / -1; text-align: left; } }
.soil-name, .res h4 { text-transform: none; }
.soil-name::first-letter, .res h4::first-letter { text-transform: uppercase; }
.soil-name { display: block; }

/* Soil list: name and badge on one line, time underneath; two columns on wide screens */
.soil-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); column-gap: 28px; }
.soil-row > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 8px 0; min-height: 0; }
.soil-row > summary::-webkit-details-marker { display: none; }
.soil-row > summary { list-style: none; }
.soil-name { display: inline; font-size: 15px; }
.soil-time { flex-basis: 100%; text-align: left; font-size: 14px; color: var(--fg); }
.soil-row > summary::after { content: "▾"; margin-left: auto; color: var(--muted); font-size: 12px; order: 2; }
.soil-row[open] > summary::after { content: "▴"; }
.soil-time { order: 3; }
@media (max-width: 520px) { .soil-time { grid-column: auto; } }
.soil-row > summary { position: relative; padding-right: 22px; }
.soil-row > summary::after { position: absolute; right: 2px; top: 12px; margin: 0; }
.soil-more { display: contents; }
.soil-more[hidden] { display: none !important; }
.soil-toggle {
  grid-column: 1 / -1; justify-self: start; margin-top: 10px; min-height: 40px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--up); font-weight: 600;
}

/* Phones: tighter headings, intros and cards so screens are not padded out */
@media (max-width: 600px) {
  main { padding-block: 12px 20px; }
  .view { gap: 12px; }
  h1 { font-size: 26px; margin-top: 0; }
  .lead { font-size: 15px; line-height: 1.45; }
  .card { padding: 14px; gap: 10px; }
  .chart, .chart .loading, .fail { min-height: 0; }
  .readout { min-height: 0; padding: 8px 10px; }
  .reg { padding: 12px; gap: 6px; }
  .chain { gap: 6px; }
  .sh-row { min-height: 30px; }
  .site-foot { margin-top: 12px; }
}
.reg-more .chain { margin: 6px 0; }

/* Crop menu: a small pop-up under the chip that floats over the page instead of pushing it down */
.bar { position: sticky; }
.crop-panel-global {
  position: absolute; z-index: 25; top: calc(100% + 6px);
  left: max(16px, calc((100% - 1100px) / 2 + 16px)); width: min(520px, calc(100% - 32px));
  max-height: min(60vh, 420px); overflow-y: auto; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.crop-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.crop-opt {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-size: 14px; font-weight: 500;
}
.crop-opt:hover { border-color: var(--up); }
.crop-opt[aria-pressed="true"] { background: var(--up); border-color: var(--up); color: var(--panel); }
.crop-opt[aria-pressed="true"] .dots i { outline-color: var(--panel); background: transparent; }
.crop-opt[aria-pressed="true"] .dots i.on { background: var(--panel); }
.crop-menu-note { flex-basis: 100%; margin: 4px 2px 0; font-size: 12px; color: var(--muted); }

/* Current tab: a highlighted pill behind the icon, bold label and a bar along the top */
.bottom-nav a { position: relative; }
.bottom-nav a svg { padding: 3px 12px; width: 24px; height: 24px; border-radius: 999px; box-sizing: content-box; }
.bottom-nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.bottom-nav a[aria-current="page"] svg { background: color-mix(in srgb, var(--brand) 16%, transparent); }
.bottom-nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.tabs a[aria-current="page"] { color: var(--brand); font-weight: 700; background: color-mix(in srgb, var(--brand) 12%, transparent); }

/* Regulators: one compact filter row and a one-line notice */
.reg-filters { gap: 8px 14px; }
.reg-filters .field select { min-width: 0; min-height: 40px; }
.reg-filters .check { min-height: 40px; }
details.notice { padding: 8px 12px; }
details.notice > summary { cursor: pointer; list-style: none; font-size: 14px; }
details.notice > summary::-webkit-details-marker { display: none; }
details.notice > summary::after { content: " More"; color: var(--up); font-weight: 500; }
details.notice[open] > summary::after { content: " Less"; }
details.notice p { margin: 6px 0 0; font-size: 14px; }
.reg-list > .soil-toggle { grid-column: 1 / -1; }

/* Flowering charts: the chosen crop's cards are marked and shown first */
.flower-charts { display: flex; flex-direction: column; gap: 16px; }
.card.mine { border-color: var(--up); box-shadow: inset 0 0 0 1px var(--up); }

/* Stage comparison: one line per hormone, tap to see crop names */
.cmp { gap: 0 24px; }
.cmp-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; gap: 8px; }
.cmp-card > summary {
  cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 10px 22px 10px 0; position: relative;
}
.cmp-card > summary::-webkit-details-marker { display: none; }
.cmp-card > summary::after { content: "▾"; position: absolute; right: 2px; top: 12px; color: var(--muted); font-size: 12px; }
.cmp-card[open] > summary::after { content: "▴"; }
.cmp-card[open] { padding-bottom: 12px; }
.cmp-name { font-weight: 600; font-size: 15px; flex-basis: 100%; }
.cmp-mine { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.cmp-mine .c { height: 24px; padding: 0 8px; gap: 4px; font-size: 12px; font-weight: 600; }
.cmp-counts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.cnt-chip { height: 22px; padding: 0 6px; gap: 3px; font-size: 12px; font-weight: 600; border-radius: 6px; }
.cmp-group { margin-top: 10px; }

/* Dosing notice uses the same expand marker as the rest of the app */
details.notice > summary { position: relative; padding-right: 22px; }
details.notice > summary::after { content: "▾"; position: absolute; right: 0; top: 2px; color: var(--warn); font-weight: 400; font-size: 12px; }
details.notice[open] > summary::after { content: "▴"; }

/* Soil list groups */
.soil-table { display: flex; flex-direction: column; gap: 4px; }
.soil-group > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; padding: 10px 22px 8px 0; position: relative; border-bottom: 1px solid var(--line); }
.soil-group > summary::-webkit-details-marker { display: none; }
.soil-group > summary::after { content: "▾"; position: absolute; right: 2px; top: 12px; color: var(--muted); font-size: 12px; }
.soil-group[open] > summary::after { content: "▴"; }
.soil-group-title { font-weight: 600; font-size: 15px; }
.soil-group-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); column-gap: 28px; }
.persist.role { color: var(--muted); border-color: var(--line); background: var(--bg); }

/* Soil list hierarchy: group headings as tinted bands, their products indented under a guide line */
.soil-group { margin-top: 8px; }
.soil-group > summary {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 32px 10px 12px; border-bottom: 1px solid var(--line);
}
.soil-group > summary::after { right: 12px; top: 13px; }
.soil-group[open] > summary { border-radius: 10px 10px 0 0; }
.soil-group-title { font-size: 16px; }
.soil-group-rows { margin: 0 0 6px 12px; padding-left: 14px; border-left: 2px solid var(--line); }
.soil-group-rows .soil-name { font-size: 14px; }

/* Lists of expandable rows are one column, so opening a row never stretches a neighbour */
.soil-group-rows { display: block; }
.cmp { display: flex; flex-direction: column; }
.reg-list { align-items: start; }

/* Soil rows: what the product does, then how long it lasts */
.soil-fn { flex-basis: 100%; font-size: 14px; color: var(--fg); order: 3; }
.soil-time { order: 4; color: var(--muted); }
.soil-fn strong, .soil-time strong { font-weight: 600; color: var(--fg); }

/* Chart labels: a halo in the card colour so gridlines pass behind the text */
.chart text.lbl { paint-order: stroke; stroke: var(--panel); stroke-width: 5px; stroke-linejoin: round; }

.soil-concern strong { color: var(--bad); }
