:root {
  --green: #2f6b3a;
  --green-dark: #22502b;
  --green-soft: #e7f1e8;
  --amber: #8a5a00;
  --amber-soft: #fdf1d8;
  --grey: #6b7280;
  --grey-soft: #f1f2f4;
  --line: #e3e5e8;
  --ink: #1d2327;
  --bg: #f7f8f6;
  --card: #ffffff;
  --red-soft: #fdecea;
  --red: #9b2c22;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
a { color: var(--green); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand img { border-radius: 8px; }
.brand small { display: block; font-weight: 400; color: var(--grey); font-size: .78rem; }
.top nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: .9rem; }
.who { color: var(--grey); }
.navlink { color: var(--ink); text-decoration: none; font-weight: 600; }
.navlink:hover { color: var(--green); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--green); color: #fff; font-size: .75rem; text-align: center; line-height: 1.6; }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--green); font: inherit; cursor: pointer; text-decoration: underline; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 48px; }

/* forms */
input, select, button { font: inherit; }
input[type=email], input[type=password], input[type=text], input[type=search], select {
  width: 100%; padding: 9px 11px; border: 1px solid #c9cdd2; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #9cc7a3; outline-offset: 1px; }
button.primary {
  background: var(--green); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; font-weight: 600;
}
button.primary:hover { background: var(--green-dark); }
label { display: block; margin: 0 0 14px; font-weight: 500; }
label input { margin-top: 5px; font-weight: 400; }
.alert { background: var(--amber-soft); color: var(--amber); border-radius: 8px; padding: 10px 12px; }
.hint { color: var(--grey); font-size: .88rem; }

/* sign-in pages */
.auth { max-width: 420px; margin: 32px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 20px; }
.auth .code { font-size: 1.4rem; letter-spacing: .25em; text-align: center; }
.auth .message { font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 16px; }
.facts dt { color: var(--grey); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.qr { display: flex; justify-content: center; margin: 8px 0 4px; }
.qr svg { width: 220px; height: 220px; }
.key { font-family: ui-monospace, Consolas, monospace; font-size: 1rem; letter-spacing: .05em; background: var(--grey-soft); padding: 8px 10px; border-radius: 6px; text-align: center; overflow-wrap: anywhere; }

/* catalogue: one compact row per variety, grouped by species */
.intro .note { color: var(--grey); margin: 0 0 4px; font-size: .9rem; }
.intro .updated { color: var(--grey); font-size: .82rem; margin: 0 0 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.searchrow { display: flex; gap: 8px; flex: 2 1 280px; }
.searchrow input { flex: 1; min-width: 0; }
.filters details.more { flex: 5 1 560px; }
.filters summary { cursor: pointer; color: var(--green); font-size: .9rem; padding: 2px 0; }
.selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto; gap: 8px; align-items: center; }
.filters .check { margin: 0; font-weight: 400; white-space: nowrap; font-size: .9rem; }
.filters .check input { width: auto; margin: 0 4px 0 0; vertical-align: -2px; }
.filters .clear { font-size: .9rem; }
.count { color: var(--grey); font-size: .85rem; margin: 0 0 8px; }
.empty { background: var(--card); border: 1px dashed var(--line); padding: 24px; text-align: center; border-radius: var(--radius); }
.species-group { margin: 0 0 18px; }
.species-head { font-size: 1rem; margin: 0 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--green-soft); color: var(--green-dark); }
.species-head span { color: var(--grey); font-weight: 400; font-size: .82rem; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(390px, 100%), 1fr)); gap: 8px; }
.item { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.thumb { position: relative; flex: 0 0 80px; width: 80px; height: 80px; border-radius: 6px; overflow: hidden; background: var(--grey-soft); }
.thumb img { display: block; width: 80px; height: 80px; object-fit: cover; }
.thumb .more { display: none; }
/* the fruit: a small round photo on the corner of the plant photo */
.thumb .ph.fruit { position: absolute; left: 4px; bottom: 4px; width: 30px; height: 30px; border-radius: 999px; overflow: hidden;
                   border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.thumb .ph.fruit img { width: 100%; height: 100%; }
.thumb.fruitonly .ph.fruit { position: static; width: 80px; height: 80px; border: 0; border-radius: 0; box-shadow: none; }
.thumb.fruitonly .tag { position: absolute; left: 4px; bottom: 4px; background: rgba(255,255,255,.92); color: var(--green-dark);
                        font-size: .66rem; font-weight: 700; padding: 0 5px; border-radius: 4px; line-height: 1.5; }
.lightbox figcaption a { color: #bfe3c4; margin-left: 10px; white-space: nowrap; }
.thumb.nophoto { background: var(--grey-soft) url("leaf.svg") center / 30px no-repeat; opacity: .45; }
.phcount { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.62); color: #fff; font-size: .7rem; line-height: 1.5; padding: 0 6px; border-radius: 999px; pointer-events: none; }
.info { flex: 1; min-width: 0; }
.info h3 { font-size: .98rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.line { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "what price add" "avail price add"; column-gap: 8px; row-gap: 2px; padding: 4px 0; border-top: 1px solid var(--line); font-size: .85rem; }
.line:first-of-type { border-top: 0; padding-top: 1px; }
.line .what { grid-area: what; font-weight: 600; }
.line .what .type { font-weight: 400; color: var(--grey); }
.line .avail { grid-area: avail; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.line .price { grid-area: price; text-align: right; white-space: nowrap; align-self: center; }
.line .price small { display: block; color: var(--grey); font-size: .72rem; }
.lvl { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.lvl-x10k, .lvl-x5k, .lvl-x1k, .lvl-x200 { color: var(--green-dark); }
.lvl-low { color: var(--amber); }
.lvl-none { color: var(--grey); font-weight: 400; }
/* availability «signal» bars: 5 rising bars, as many lit as the level */
.bars { display: inline-flex; align-items: flex-end; gap: 1px; height: 13px; }
.bars i { display: block; width: 4px; border-radius: 1px; background: #d8dcd9; }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 7px; } .bars i:nth-child(3) { height: 9px; }
.bars i:nth-child(4) { height: 11px; } .bars i:nth-child(5) { height: 13px; }
.bars i.on { background: var(--green); }
.lvl-x200 .bars i.on { background: #6aa577; }
.lvl-low .bars i.on { background: #d69a1e; }
.legend { margin-left: 10px; }
.legend .leg { white-space: nowrap; margin-right: 8px; }
.legend .bars { vertical-align: -1px; margin: 0 2px 0 4px; }
.size { font-size: .72rem; border-radius: 5px; padding: 0 5px; border: 1px solid currentColor; line-height: 1.5; }
.size.lvl-x10k, .size.lvl-x5k, .size.lvl-x1k, .size.lvl-x200 { color: var(--green-dark); background: var(--green-soft); }
.size.lvl-low { color: var(--amber); background: transparent; }

/* add to cart: a round «+» that opens a small form */
.add { grid-area: add; position: relative; align-self: center; }
.add summary { list-style: none; cursor: pointer; width: 28px; height: 28px; border-radius: 999px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 1.15rem; font-weight: 700; line-height: 1; user-select: none; }
.add summary::-webkit-details-marker { display: none; }
.add summary:hover, .add[open] summary { background: var(--green-dark); }
.add form { position: absolute; right: 0; top: 34px; z-index: 20; width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); padding: 10px 12px; }
.add form label { margin: 0 0 8px; font-size: .82rem; }
.add form input, .add form select { padding: 6px 8px; }
.add form button { width: 100%; }
.add-what { margin: 0 0 8px; font-size: .8rem; color: var(--grey); }
.line:target { background: var(--green-soft); border-radius: 6px; }

/* messages */
.flash { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; margin: 0; max-width: min(92vw, 520px); padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 600; }
.flash-ok { background: var(--green-dark); color: #fff; }
.flash-error { background: var(--amber-soft); color: var(--amber); border: 1px solid #ecd39b; }
.flash.hide { opacity: 0; transition: opacity .5s; pointer-events: none; }

/* cart and requests */
.page { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.page h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta { color: var(--grey); margin-top: -6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 0 0 10px; }
.tbl th { text-align: left; font-weight: 600; color: var(--grey); font-size: .8rem; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.tbl td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
.tbl td small { display: block; color: var(--grey); font-size: .78rem; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl input[type=number] { width: 110px; text-align: right; padding: 6px 8px; }
.tbl tfoot td { border-bottom: 0; }
.tbl tr.gone td { opacity: .55; }
.tbl small.warn { color: var(--amber); font-weight: 600; }
.cartform, .sendform { margin-top: 6px; }
.sendform { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.sendform textarea { width: 100%; padding: 9px 11px; border: 1px solid #c9cdd2; border-radius: 8px; font: inherit; margin-top: 5px; }
.sendform .clear { margin-left: 12px; }
button.secondary { background: #fff; color: var(--green-dark); border: 1px solid var(--green); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.st { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; }
.st-sent { background: var(--grey-soft); color: var(--ink); }
.st-received { background: var(--amber-soft); color: var(--amber); }
.st-confirmed, .st-done { background: var(--green-soft); color: var(--green-dark); }
.st-cancelled { background: var(--red-soft); color: var(--red); }
.comment { white-space: pre-line; background: var(--grey-soft); border-radius: 8px; padding: 10px 12px; }

/* photo viewer */
.lightbox { position: fixed; inset: 0; background: rgba(10,14,12,.92); display: flex; align-items: center; justify-content: center; z-index: 50; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 90vh; text-align: center; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 6px; cursor: pointer; }
.lightbox figcaption { color: #e9efe9; margin-top: 8px; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; }
.lb-next { right: 14px; top: 50%; }
body.noscroll { overflow: hidden; }

@media (min-width: 861px) {
  .filters summary { display: none; }            /* app.js opens the filters on wide screens */
}
@media (max-width: 860px) {
  .selects { grid-template-columns: 1fr 1fr; margin-top: 6px; }
}
@media (max-width: 640px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl td { border: 0; padding: 3px 0; }
  .tbl td.num { text-align: left; }
  .tbl td[data-label]::before { content: attr(data-label) ": "; color: var(--grey); font-size: .78rem; }
  .tbl td:first-child::before { content: none; }
  .tbl tfoot tr { display: flex; justify-content: space-between; }
  .page { padding: 14px; }
}
@media (max-width: 420px) {
  main { padding: 14px 10px 40px; }
  .thumb, .thumb > .ph:not(.fruit) > img, .thumb.fruitonly .ph.fruit { width: 68px; height: 68px; flex-basis: 68px; }
  .top { padding: 10px 14px; }
  .auth { margin: 16px auto; padding: 20px 16px; }
}
