/* Farm Stock. Colours taken from the Corowa Seeds logo: soil brown, leaf green, olive. */
:root {
  --soil: #3B312D;
  --soil-mid: #7F6C65;
  --leaf: #6CA042;
  --leaf-deep: #3D6B22;
  --leaf-press: #2F5419;
  --leaf-tint: #E7EFDD;
  --olive: #A7AF38;
  --bg: #F4F3EE;
  --card: #FFFFFF;
  --ink: #151515;
  --muted: #45443F;
  --line: #B9B8AE;
  --edge: #151515;
  --warn: #9A3B00;
  --warn-bg: #FFE2A8;
  --warn-ink: #5C3600;
  --bad: #A11A1A;
  --bad-bg: #FBE3E0;
  /* direction tags on load rows */
  --dir-in-bg: #1F5FA8;
  --dir-in-ink: #FFFFFF;
  --dir-out-bg: #FBE6D0;
  --dir-out-ink: #8A3C03;
  --dir-other-bg: #E3E2DB;
  --dir-other-ink: #33322E;
  --dir-tag-width: 84px; /* wide enough for TRANSFER; every tag is this width so the rows line up */
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
body.has-overlay { overflow: hidden; }
#top { position: sticky; top: 0; z-index: 5; }
#view, #top > .bar { max-width: 680px; margin: 0 auto; }
#top { background: var(--soil); border-bottom: 5px solid var(--leaf); padding-top: env(safe-area-inset-top); }
#view { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0; }
h2 { font-size: 22px; margin: 0; }
h3 { font-size: 16px; margin: 0; padding: 14px 16px 6px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
p { margin: 0; }
b { font-weight: 700; }
small { font-size: 16px; font-weight: 400; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 4px solid var(--olive); outline-offset: 2px; }

.pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 18px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.loading, .empty { color: var(--muted); }
.loading { padding: 48px 16px; text-align: center; }
.fine { font-size: 15px; color: var(--muted); }
.neg, .warn { color: var(--warn); font-weight: 700; }

/* header */
.bar { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px; color: #fff; background: var(--soil); }
.bar-auth { justify-content: center; padding: 20px 12px; }
.logo { height: 46px; width: auto; display: block; }
.logo-big { height: 110px; width: auto; display: block; }
.bar-who { flex: 1; min-width: 0; font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title { flex: 1; min-width: 0; font-size: 22px; font-weight: 700; }
.iconbtn { width: 52px; height: 52px; flex: none; display: grid; place-items: center; background: none; border: none; color: #fff; border-radius: 12px; }
.iconbtn:active { background: rgba(255, 255, 255, 0.18); }
.pill { flex: none; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: none; font-size: 16px; font-weight: 700; max-width: 56vw; text-align: left; line-height: 1.1; }
.pill-ok { background: #fff; color: var(--leaf-deep); }
.pill-wait { background: var(--warn-bg); color: var(--warn-ink); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill svg { flex: none; }

.banner { display: block; width: 100%; padding: 12px 16px; font-size: 17px; font-weight: 700; text-align: left; border: none; }
.banner-offline { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 2px solid var(--warn-ink); }
.banner-update { background: var(--leaf-tint); color: var(--leaf-deep); border-bottom: 2px solid var(--leaf-deep); }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 10px 16px; border-radius: 12px; border: 2px solid var(--edge); background: var(--card); color: var(--ink); font-size: 20px; font-weight: 700; text-align: center; width: 100%; }
.btn:active { background: var(--leaf-tint); }
.btn:disabled { opacity: 0.55; }
.btn-primary { background: var(--leaf-deep); border-color: var(--leaf-deep); color: #fff; }
.btn-primary:active { background: var(--leaf-press); }
.btn-secondary { border-color: var(--leaf-deep); color: var(--leaf-deep); }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-plain { border-color: transparent; background: none; color: var(--leaf-deep); }
.btn-big { min-height: 72px; font-size: 24px; border-radius: var(--radius); }
.btn-huge { min-height: 88px; font-size: 27px; border-radius: var(--radius); box-shadow: 0 3px 0 var(--leaf-press); }
.btn-small { min-height: 48px; font-size: 17px; width: auto; padding: 6px 14px; }
.btn-choice { min-height: 60px; font-size: 20px; line-height: 1.15; }
.btn-choice.on { background: var(--leaf-deep); border-color: var(--leaf-deep); color: #fff; }
.btn-kind { flex-direction: column; align-items: flex-start; gap: 4px; min-height: 92px; text-align: left; border-radius: var(--radius); }
.btn-kind b { font-size: 23px; }
.btn-kind span { font-size: 17px; font-weight: 400; }
.link { background: none; border: none; padding: 0; min-height: 44px; text-align: left; font-size: 18px; font-weight: 700; color: var(--leaf-deep); text-decoration: underline; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.row-btns .btn { width: auto; flex: 1 1 auto; }

/* cards and rows */
.card { background: var(--card); border: 2px solid var(--edge); border-radius: var(--radius); overflow: hidden; }
.card-pad { padding: 16px; }
.card.empty { display: flex; flex-direction: column; gap: 12px; }
.note { background: var(--leaf-tint); border-color: var(--leaf-deep); }
.row { display: flex; width: 100%; background: var(--card); border: none; border-bottom: 1px solid var(--line); padding: 14px 16px; text-align: left; }
.card > .row:last-child, .card > .sub:last-child, .card > .person:last-child { border-bottom: none; }
.row:active { background: var(--leaf-tint); }
.row-product { align-items: center; gap: 10px; min-height: 66px; font-size: 22px; font-weight: 700; }
.row-name { flex: 1; min-width: 0; }
.row-qty { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.chev { flex: none; color: var(--muted); transition: transform 0.15s; }
.row-product.open .chev { transform: rotate(180deg); }
.sub { background: var(--leaf-tint); border-bottom: 1px solid var(--line); padding: 6px 0; }
.sub-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px 8px 28px; font-size: 19px; }
.sub-row span:last-child { white-space: nowrap; text-align: right; }
button.sub-row { width: 100%; min-height: 48px; align-items: center; background: none; border: none; text-align: left; }
button.sub-row:active { background: var(--card); }
.log-after { white-space: nowrap; }
.now-line { display: flex; justify-content: space-between; gap: 12px; font-size: 21px; }
.now-line b:last-child { white-space: nowrap; text-align: right; }
div.storage { margin-top: 8px; }
.row-load { flex-direction: column; gap: 4px; }
.load-top { display: flex; justify-content: space-between; gap: 12px; font-size: 20px; }
.load-top b:last-child { white-space: nowrap; }
.load-mid { font-size: 17px; }
.load-bot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; color: var(--muted); }
.tag { flex: none; font-weight: 700; font-size: 15px; border-radius: 999px; padding: 3px 10px; }
.tag-ok { color: var(--leaf-deep); padding-right: 0; }
.tag-wait { background: var(--warn-bg); color: var(--warn-ink); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
/* direction tag at the start of a load row */
.row-load.row-dir { flex-direction: row; align-items: center; gap: 12px; }
.load-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.tag-dir { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: none; width: var(--dir-tag-width); padding: 5px 0; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 700; line-height: 1.2; text-transform: uppercase; letter-spacing: 0.04em; background: var(--dir-other-bg); color: var(--dir-other-ink); }
.tag-dir svg { flex: none; }
.tag-in { background: var(--dir-in-bg); color: var(--dir-in-ink); }
.tag-out { background: var(--dir-out-bg); color: var(--dir-out-ink); }

/* storages */
.storage { display: flex; flex-direction: column; gap: 5px; width: 100%; background: none; border: none; padding: 0; text-align: left; }
.storage:active { background: var(--leaf-tint); }
.storage > span { display: block; width: 100%; }
.link-ish { color: var(--leaf-deep); font-weight: 700; }
.storage > .storage-head { display: flex; justify-content: space-between; gap: 12px; font-size: 19px; }
.storage-head span { white-space: nowrap; }
.storage-what { font-size: 17px; }
.bar-track { height: 24px; background: #D9DCD3; border-radius: 6px; overflow: hidden; border: 1px solid var(--soil-mid); }
.bar-fill { display: block; height: 100%; background: var(--leaf-deep); }
.bar-near, .bar-over { background: var(--warn); }
.bar-note { font-size: 16px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span, .field > label { font-size: 18px; font-weight: 700; }
.input { width: 100%; min-height: 60px; padding: 8px 14px; background: var(--card); border: 2px solid var(--edge); border-radius: 12px; font-size: 21px; }
select.input { appearance: auto; }
.input-pin { letter-spacing: 0.4em; font-size: 28px; font-weight: 700; max-width: 220px; }
.qty-line { display: flex; align-items: center; gap: 12px; }
.input-qty { width: 210px; min-height: 84px; border: 3px solid var(--leaf-deep); font-size: 44px; font-weight: 700; text-align: center; }
.unit { font-size: 26px; font-weight: 700; }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 68px; padding: 8px 14px; background: var(--card); border: 2px solid var(--edge); border-radius: 12px; text-align: left; }
.pick:active { background: var(--leaf-tint); }
.pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 21px; overflow-wrap: break-word; }
.pick-text b, .pick-text small { min-width: 0; max-width: 100%; }
.pick-change { flex: none; font-size: 17px; font-weight: 700; color: var(--leaf-deep); }
.pick-empty { border-style: dashed; }
.pick-date { position: relative; }
.pick-date:focus-within { outline: 4px solid var(--olive); outline-offset: 2px; }
.date-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; font-size: 21px; }
.date-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }
.pick-empty b { font-weight: 400; color: var(--muted); }
.hint { font-size: 17px; margin-top: 4px; }
.errors { background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); border-radius: 12px; padding: 12px 14px; font-weight: 700; display: flex; flex-direction: column; gap: 4px; }
.savebar { margin-top: 8px; padding-top: 18px; border-top: 2px solid var(--line); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.check input { width: 28px; height: 28px; accent-color: var(--leaf-deep); }

/* one load */
.lines { display: flex; flex-direction: column; }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line span { color: var(--muted); flex: none; max-width: 45%; }
.line b { text-align: right; overflow-wrap: anywhere; }
.line-status { padding-top: 12px; }

/* people */
.person { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.person-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 21px; }

/* sign-in */
.pin-screen { align-items: center; text-align: center; }
.dots { display: flex; gap: 16px; margin: 8px 0; }
.dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--edge); }
.dot-on { background: var(--edge); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 340px; }
.key { height: 76px; border-radius: 14px; border: 2px solid var(--edge); background: var(--card); font-size: 30px; font-weight: 700; }
.key:active { background: var(--leaf-tint); }
.key-word { font-size: 17px; border-color: transparent; background: none; color: var(--leaf-deep); }

/* pop-ups and pick-lists */
#overlay:empty { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; z-index: 21; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-bottom { bottom: 0; max-height: 88vh; max-width: 680px; margin: 0 auto; border-radius: 18px 18px 0 0; border-top: 5px solid var(--leaf); padding-bottom: env(safe-area-inset-bottom); }
.sheet-full { top: 0; bottom: 0; display: flex; flex-direction: column; overflow: hidden; }
.sheet-full > .bar { flex: none; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 5px solid var(--leaf); }
.picker-search { flex: none; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.picker-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sheet-full > *, .picker-list > * { max-width: 680px; margin-left: auto; margin-right: auto; width: 100%; }
.row-pick { flex-direction: column; gap: 2px; min-height: 62px; justify-content: center; font-size: 21px; }
.row-pick small { color: var(--muted); }
.row-pick.on { background: var(--leaf-tint); box-shadow: inset 6px 0 0 var(--leaf-deep); }
.row-add b { color: var(--leaf-deep); }

#toast { position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--soil); color: #fff; border-radius: 12px; padding: 14px 18px; font-size: 18px; font-weight: 700; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); max-width: 640px; }
.toast-btn { background: none; border: 2px solid #fff; color: #fff; border-radius: 10px; min-height: 44px; padding: 4px 14px; font-weight: 700; }

@media (min-width: 720px) {
  #view { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
