/* BloomDesk - field-to-post tool for a flower farm.
   Palette: fir ink / greenhouse-glass sage ground / peony magenta accent /
   pollen gold for pending / stem green for good news. */
:root {
  --ink: #1e2b22;
  --ink-soft: #55645a;
  --ground: #f2f4ee;
  --panel: #ffffff;
  --line: #dde3d8;
  --peony: #a62963;
  --peony-soft: #f7e6ee;
  --pollen: #c99a2c;
  --pollen-soft: #f8f0dd;
  --stem: #4c7a57;
  --stem-soft: #e4efe6;
  --danger: #b3362a;
  --radius: 14px;
  --mono: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
header.app {
  position: sticky; top: 0; z-index: 20;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 10px;
  display: flex; align-items: baseline; gap: 10px;
}
header.app h1 {
  font-family: var(--display);
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
}
header.app h1 .dot { color: var(--peony); }
.region-chip {
  margin-left: auto;
  font: 500 12px/1 var(--mono);
  background: var(--stem-soft); color: var(--stem);
  border: 1px solid transparent;
  padding: 6px 10px; border-radius: 999px;
  max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gear { background: none; border: none; font-size: 20px; padding: 4px; cursor: pointer; }

main { padding: 16px; max-width: 720px; margin: 0 auto; }
section.tab { display: none; }
section.tab.active { display: block; }

h2 {
  font-family: var(--display);
  font-size: 17px; font-weight: 650; letter-spacing: -0.01em;
  margin: 20px 0 10px;
}
h2:first-child { margin-top: 0; }
.hint { color: var(--ink-soft); font-size: 13px; margin: 4px 0 12px; }

/* --- cards & stem-ledger signature ------------------------------------ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.listing {
  position: relative;
  padding-left: 26px;
}
.listing::before {           /* the stem */
  content: "";
  position: absolute; left: 12px; top: 14px; bottom: 14px;
  width: 2px; background: var(--line); border-radius: 2px;
}
.listing .node {             /* the leaf node = status */
  position: absolute; left: 6px; top: 18px;
  width: 14px; height: 14px;
  border-radius: 14px 2px 14px 2px;   /* leaf shape */
  background: var(--pollen);
}
.listing.approved .node { background: var(--stem); }
.listing.rejected .node { background: var(--ink-soft); }
.listing-head { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.listing-head img {
  width: 58px; height: 58px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); flex: none;
}
.listing-head .t { min-width: 0; }
.listing-head .t b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listing-head .t small { color: var(--ink-soft); font-size: 12px; }
.price-tag {
  margin-left: auto; text-align: right; flex: none;
  font: 600 15px/1.2 var(--mono);
}
.price-tag small { display: block; font: 400 10px/1.4 var(--mono); color: var(--ink-soft); }

.badge {
  display: inline-block; font: 500 11px/1 var(--mono);
  padding: 4px 8px; border-radius: 999px; margin-right: 6px;
}
.badge.pending { background: var(--pollen-soft); color: #8a6a1c; }
.badge.approved { background: var(--stem-soft); color: var(--stem); }
.badge.rejected { background: #eee; color: var(--ink-soft); }
.badge.err { background: #fbe6e3; color: var(--danger); }

/* --- forms -------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--peony); outline-offset: 1px;
}
textarea { min-height: 88px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; margin: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--peony); }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 70px;
  font: 600 13px/1 inherit;
  padding: 10px 8px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  cursor: pointer;
}
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

button.primary, button.ghost, button.danger {
  font: 600 15px/1 inherit; padding: 13px 16px;
  border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  width: 100%; margin-top: 12px;
}
button.primary { background: var(--peony); color: #fff; }
.filebtn {
  display: block; flex: 1; text-align: center;
  font: 600 15px/1 inherit; padding: 13px 16px;
  border-radius: 12px; cursor: pointer;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  margin-top: 12px; -webkit-user-select: none; user-select: none;
}
.filebtn:active { background: var(--ground); }
button.primary:disabled { opacity: 0.5; }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.danger { background: #fff; color: var(--danger); border-color: #ecc8c3; }
.btnrow { display: flex; gap: 10px; }
.btnrow button { margin-top: 12px; }

/* photo picker */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--panel);
  padding: 26px 16px; text-align: center; cursor: pointer;
}
.drop.has { padding: 0; border-style: solid; overflow: hidden; }
.drop img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.drop .cta { font-family: var(--display); font-weight: 650; font-size: 16px; }
.drop .sub { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }

/* survey band readout */
.band {
  font: 12px/1.5 var(--mono); color: var(--ink-soft);
  background: var(--ground); border-radius: 8px; padding: 8px 10px; margin-top: 6px;
}
.band b { color: var(--ink); }

/* tables (plan, sales) */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 11px/1.3 var(--mono); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
td.num, th.num { text-align: right; font-family: var(--mono); }

.pub-result { font: 12px/1.6 var(--mono); margin-top: 8px; }
.pub-result .ok { color: var(--stem); }
.pub-result .skip { color: var(--ink-soft); }
.pub-result .err { color: var(--danger); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 14px;
  padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: 88vw; z-index: 60;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* bottom nav */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: 9px 2px 8px; color: var(--ink-soft);
  font: 600 11px/1.3 inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav.tabs button .ic { font-size: 19px; line-height: 1; }
nav.tabs button.on { color: var(--peony); }

/* settings sheet */
#sheet {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(30, 43, 34, 0.45);
}
#sheet.open { display: block; }
#sheet .panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--panel); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow: auto;
}
.integ { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; }
.integ .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.integ .dot.on { background: var(--stem); }

.empty { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 26px 10px; }

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

/* admin unlock overlay */
#lock { position: fixed; inset: 0; z-index: 70; background: var(--ground);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
#lock[hidden] { display: none; }
#lock .panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; width: 100%; max-width: 420px; }
