:root {
  --sage: #3D5048;
  --sage-deep: #2C3A35;
  --cream: #F4EFE3;
  --cream-2: #E8E1D2;
  --paper: #FAF7EE;
  --magenta: #D9377D;
  --ink: #22302B;
  --muted: #6B7A72;
  --line: #D5CFC0;
  --ok: #2E7D4F;
  --warn: #b8770a;
  --bad: #B3362B;
  --radius: 14px;
  --nav-h: 62px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper); color: var(--ink);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 34px);
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; border: 0; }
input, textarea { font: inherit; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
.view { max-width: 560px; margin: 0 auto; padding: 0 14px; }

/* ---------- header ---------- */
.hdr {
  display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 2px 12px;
}
.hdr h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--sage-deep); flex: 1; }
.hdr .sub { color: var(--muted); font-size: 13px; }
.hdr-logo { width: 34px; height: 34px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.hdr-logo svg { width: 32px; height: 32px; }

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
.splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; }
.sp-flask {
  stroke-dasharray: 420; stroke-dashoffset: 420;
  animation: sp-draw .95s cubic-bezier(.55,.1,.35,1) .15s forwards;
}
@keyframes sp-draw { to { stroke-dashoffset: 0; } }
.sp-leaf { opacity: 0; transform: scale(0); animation: sp-pop .5s cubic-bezier(.34,1.56,.64,1) forwards; }
.sp-leaf-m { animation-delay: 1.0s; }
.sp-leaf-t { animation-delay: 1.2s; }
.sp-leaf-g { animation-delay: 1.4s; }
@keyframes sp-pop { to { opacity: 1; transform: scale(1); } }
.splash-word {
  margin-top: 14px; font-size: 30px; font-weight: 700; letter-spacing: .34em;
  padding-left: .34em; color: #3B4D41;
  opacity: 0; transform: translateY(8px); animation: sp-rise .55s ease-out 1.7s forwards;
}
.splash-tag {
  margin-top: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--magenta);
  opacity: 0; transform: translateY(8px); animation: sp-rise .55s ease-out 1.9s forwards;
}
@keyframes sp-rise { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .sp-flask { animation: none; stroke-dashoffset: 0; }
  .sp-leaf { animation: none; opacity: 1; transform: scale(1); }
  .splash-word, .splash-tag { animation: none; opacity: 1; transform: none; }
}

/* ---------- login ---------- */
.login-wrap { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px 20px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { max-width: 260px; width: 100%; height: auto; margin: 0 auto 6px; display: block; }
.login-brand p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.field input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--paper); font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--sage); background: #fff; }
.btn {
  display: block; width: 100%; padding: 14px; border-radius: 12px; text-align: center;
  background: var(--sage-deep); color: var(--cream); font-weight: 700; font-size: 16px;
}
.btn:active { transform: scale(.985); }
.btn.magenta { background: var(--magenta); color: #fff; }
.btn.ghost { background: transparent; color: var(--sage-deep); border: 1.5px solid var(--sage-deep); }
.btn[disabled] { opacity: .55; }
.err { background: #FAE4EE; color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* ---------- search ---------- */
.searchbar { position: relative; margin: 2px 0 14px; }
.searchbar input {
  width: 100%; padding: 13px 14px 13px 42px; border: 1.5px solid var(--line);
  border-radius: 13px; background: #fff; font-size: 16px;
}
.searchbar input:focus { outline: none; border-color: var(--sage); }
.searchbar svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; fill: var(--muted); }

/* ---------- cards / sections ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; color: var(--sage-deep); margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 13px; }
.sect-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 10px; }

/* ---------- usual order ---------- */
.usual-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--cream-2); }
.usual-line:first-of-type { border-top: 0; }
.usual-line img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: var(--paper); flex: 0 0 auto; }
.usual-line .nm { flex: 1; font-size: 13.5px; line-height: 1.3; }
.usual-line .nm small { display: block; color: var(--muted); margin-top: 2px; }
.usual-line .pr { font-weight: 700; font-size: 13.5px; white-space: nowrap; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; }
.pcard .imgbox { height: 110px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.pcard img { max-height: 106px; object-fit: contain; }
.pcard .noimg { width: 64px; height: 64px; border-radius: 12px; background: var(--cream); display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; font-size: 22px; }
.pcard .brand { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--magenta); }
.pcard .nm { font-size: 13px; line-height: 1.3; margin: 2px 0 6px; flex: 1; }
.pcard .price { font-size: 15px; font-weight: 800; color: var(--sage-deep); }
.pcard .price small { color: var(--muted); font-weight: 500; text-decoration: line-through; margin-left: 5px; font-size: 11.5px; }
.stock { font-size: 11.5px; font-weight: 700; margin: 3px 0 8px; }
.stock.in { color: var(--ok); }
.stock.low { color: var(--warn); }
.stock.out { color: var(--bad); }

/* qty stepper + add */
.addrow { display: flex; gap: 7px; align-items: center; }
.stepper { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.stepper button { width: 30px; height: 34px; background: transparent; font-size: 17px; color: var(--sage-deep); font-weight: 700; }
.stepper .q { min-width: 26px; text-align: center; font-weight: 700; font-size: 14px; }
.addbtn {
  flex: 1; height: 34px; border-radius: 10px; background: var(--sage-deep); color: var(--cream);
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.addbtn.added { background: var(--ok); }
.addbtn[disabled] { background: var(--line); color: var(--muted); }

/* brand chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; background: #fff;
  border: 1.5px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.chip.on { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--cream); }

/* ---------- basket ---------- */
.bline { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--cream-2); }
.bline img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; background: var(--paper); }
.bline .nm { flex: 1; font-size: 13.5px; line-height: 1.3; }
.bline .nm .lp { color: var(--muted); font-size: 12px; }
.bline .rm { color: var(--bad); font-size: 12px; font-weight: 700; background: none; padding: 4px; }
.totals { padding: 14px 2px; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .row.grand { font-size: 18px; font-weight: 800; color: var(--sage-deep); border-top: 1.5px solid var(--line); margin-top: 8px; padding-top: 10px; }
.totals .row .disc { color: var(--magenta); }
textarea.note {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  padding: 12px; min-height: 64px; margin: 6px 0 14px; font-size: 15px;
}
textarea.note:focus { outline: none; border-color: var(--sage); }

/* ---------- account / orders ---------- */
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--cream-2); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv b { color: var(--sage-deep); }
.oline { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--cream-2); }
.oline:last-child { border-bottom: 0; }
.oline .no { font-weight: 800; color: var(--sage-deep); }
.oline .meta { flex: 1; color: var(--muted); font-size: 12.5px; }
.oline .amt { font-weight: 700; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; }
.pill.processing { background: #E7F2EA; color: var(--ok); }
.pill.completed { background: var(--cream-2); color: var(--sage-deep); }
.pill.on-hold, .pill.pending { background: #FFF3E0; color: var(--warn); }
.pill.cancelled, .pill.refunded, .pill.failed { background: #FAE4EE; color: var(--bad); }

/* ---------- confirmation ---------- */
.done-wrap { text-align: center; padding: 60px 10px 30px; }
.done-wrap .tick {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--ok); color: #fff; display: flex; align-items: center; justify-content: center;
}
.done-wrap h2 { font-size: 21px; color: var(--sage-deep); margin-bottom: 6px; }
.done-wrap p { color: var(--muted); margin-bottom: 24px; }

/* ---------- tab bar (floating pill, matches site mobile nav) ---------- */
.tabbar {
  position: fixed; left: 16px; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  height: var(--nav-h); background: var(--sage-deep); border-radius: 18px;
  display: flex; box-shadow: 0 8px 24px rgba(44, 58, 53, .35); z-index: 50;
  max-width: 560px; margin: 0 auto;
}
/* [hidden] is display:none in the UA sheet, which the .tabbar rule above
   outranks on specificity - so hiding the bar needs this to bite. */
.tabbar[hidden] { display: none; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #A9B8AE; position: relative; }
.tabbar a svg { width: 22px; height: 22px; fill: currentColor; }
.tabbar a span { font-size: 10.5px; font-weight: 700; }
.tabbar a.on { color: var(--cream); }
.badge {
  position: absolute; top: 7px; right: calc(50% - 20px); background: var(--magenta); color: #fff;
  font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; font-style: normal;
}

/* ---------- misc ---------- */
.spin { text-align: center; color: var(--muted); padding: 34px 0; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty svg { width: 44px; height: 44px; fill: var(--line); margin-bottom: 10px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 38px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
.loadmore { margin: 14px 0; }
.backlink { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 6px 0; }

/* ---------- library (public mode) ---------- */
.tabbar svg.st { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-brand { font-size: 13px; font-weight: 700; letter-spacing: .13em; color: var(--sage-deep); }
.lib-brand b { color: var(--magenta); }
.lib-hero { padding: 2px 2px 12px; }
.lib-h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 25px; line-height: 1.25; color: var(--sage-deep); }
.lib-h1 em { color: var(--magenta); }
.chips.scrollx { margin-bottom: 4px; }
.lcount { font-size: 12px; color: var(--muted); margin: 4px 2px 8px; }
.lgrid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
.lcard { min-width: 0; overflow-wrap: break-word; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 11px; position: relative; display: flex; flex-direction: column; }
.lcat { padding-right: 26px; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.lname { font-family: Georgia, serif; font-size: 16px; color: var(--ink); margin: 2px 0 3px; }
.lsum { font-size: 11.5px; line-height: 1.4; color: var(--muted); flex: 1; }
.lheart { position: absolute; top: 9px; right: 10px; width: 26px; height: 26px; background: none; padding: 3px; z-index: 2; }
.lheart svg { width: 19px; height: 19px; fill: none; stroke: #c9c2b0; stroke-width: 1.8; }
.lheart.on svg { fill: var(--magenta); stroke: var(--magenta); }
.lheart.big { position: static; width: 40px; height: 40px; padding: 8px; flex: 0 0 auto; }
.lheart.big svg { width: 24px; height: 24px; }
.gpill { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2.5px 9px; margin-top: 7px; align-self: flex-start; }
.g-good { background: #DFEBD2; color: #4d6b38; }
.g-prom { background: #DCEFEB; color: #2e6e63; }
.g-mixed { background: #F6ECCB; color: #8a6d1d; }
.g-none { background: var(--cream-2); color: var(--muted); }
.g-trad { background: #EFE3EE; color: #7c5578; }
.lib-note { font-size: 11.5px; line-height: 1.5; color: var(--muted); margin: 20px 2px 8px; }

/* monograph article */
.mono { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; }
.mono-title { display: flex; align-items: flex-start; gap: 8px; }
.mono h1 { font-family: Georgia, serif; font-weight: 400; font-size: 27px; color: var(--sage-deep); flex: 1; }
.mono .latin { font-style: italic; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.mono .aka { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mono-lede { font-family: Georgia, serif; font-size: 15.5px; line-height: 1.55; color: var(--ink); margin: 12px 0 4px; }
.mono h2 { font-family: Georgia, serif; font-weight: 400; font-size: 18px; color: var(--sage-deep); margin: 20px 0 8px; border-bottom: 1px solid var(--cream-2); padding-bottom: 5px; }
.mono p { font-size: 13.5px; line-height: 1.6; color: var(--ink); margin-bottom: 9px; }
.mono .ev { border-left: 3px solid var(--cream-2); padding-left: 12px; margin-bottom: 13px; }
.mono .ev-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.mono .ev-use { font-weight: 700; font-size: 13.5px; color: var(--sage-deep); }
.mono .ev .gpill { margin-top: 0; flex: 0 0 auto; }
.mono .safety { background: #FDF3F7; border: 1px solid #F3D7E4; border-radius: 12px; padding: 12px 14px; }
.mono .safety p:last-child { margin-bottom: 0; }
.mono .refs { list-style: none; }
.mono .refs li { font-size: 12px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--cream-2); }
.mono .refs li:last-child { border-bottom: 0; }
.mono .refs a { color: var(--sage); font-weight: 700; text-decoration: underline; white-space: nowrap; }
.dtitle { font-family: Georgia, serif; font-weight: 400; font-size: 24px; color: var(--sage-deep); margin-bottom: 2px; }

/* digest list */
.dcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.ddate { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* scan */
.scanbox { background: #141a17; border-radius: var(--radius); min-height: 150px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 14px; }
.scanbox video { display: none; width: 100%; max-height: 300px; border-radius: 10px; }
.scanbox.live video { display: block; }
.scanbox.live #scanStart { display: none; }
#codeForm input { padding-left: 14px; }
#codeForm { display: flex; gap: 8px; align-items: center; }
#codeForm input { flex: 1; }
.scanhit .lname { margin-top: 2px; }
.evlink { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--sage); text-decoration: underline; margin-top: 12px; }

/* product detail image — cap it like the grid does */
.pimgbox { height: 190px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; }
.pimgbox img { max-height: 100%; max-width: 100%; object-fit: contain; }

/* library tile on trade screens */
.libtile { display: flex; align-items: center; gap: 12px; background: var(--sage-deep); color: var(--cream); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 14px; }
.libtile-mark { width: 34px; height: 34px; flex: 0 0 auto; background: var(--paper); border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.libtile-mark svg { width: 26px; height: 26px; }
.libtile b { font-size: 14.5px; }
.libtile small { color: #c8d3cb; font-size: 12px; line-height: 1.35; display: inline-block; margin-top: 2px; }
.libtile span { margin-left: auto; font-size: 20px; color: #A9B8AE; }

/* ---------- first-run interest picker ---------- */
.ob { padding: 2px 0 26px; }
.ob-h1 { font-family: Georgia, serif; font-size: 25px; line-height: 1.25; color: var(--ink); margin: 8px 0 8px; }
.ob-sub { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin-bottom: 18px; }
.ob-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.ob-tile {
  min-width: 0; padding: 15px 13px; border-radius: 12px; background: #fff;
  border: 1.5px solid var(--line); font-size: 13.5px; font-weight: 600;
  color: var(--ink); text-align: left; line-height: 1.3; overflow-wrap: break-word;
}
.ob-tile.on { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--cream); }
/* Dimmed rather than removed at the cap, so the limit explains itself. */
.ob-tile.dim { opacity: .45; }
.ob-foot { margin-top: 22px; }
.ob-skip {
  display: block; width: 100%; margin-top: 12px; padding: 10px;
  background: none; color: var(--muted); font-size: 13.5px; text-decoration: underline;
}

/* ---------- tailored strip on the library home ---------- */
.fy { margin-bottom: 22px; }
.fy-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fy-based { font-size: 12px; line-height: 1.35; color: var(--muted); margin-top: 2px; overflow-wrap: break-word; }
.fy-edit {
  flex: 0 0 auto; background: none; color: var(--sage-deep);
  font-size: 13px; font-weight: 700; text-decoration: underline; padding: 2px 0;
}
.fy-more {
  display: block; width: 100%; margin-top: 10px; padding: 11px; border-radius: 11px;
  background: var(--paper); border: 1.5px solid var(--line);
  color: var(--sage-deep); font-size: 13.5px; font-weight: 700;
}


/* --- category ui v2 --- */
.ob-step { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ob-cats { display: flex; flex-direction: column; gap: 9px; }
.ob-cat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 15px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; cursor: pointer;
}
.ob-cat.on { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--cream); }
.ob-cat-l { font-size: 16px; font-weight: 600; }
.ob-cat-s { font-size: 12px; opacity: .7; white-space: nowrap; }
.ob-tile .cnt { display: block; font-size: 11px; opacity: .6; margin-top: 3px; font-variant-numeric: tabular-nums; }

.fbar { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 8px; }
.fbar .searchbar { flex: 1; margin: 0; }
.fbtn {
  display: flex; align-items: center; gap: 6px; padding: 0 13px; height: 42px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; position: relative;
}
.fbtn svg { width: 17px; height: 17px; }
.fbadge {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--magenta, #E71D73); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.fchips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.fchips:empty { display: none; }
.chip.clr { background: transparent; border-style: dashed; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip i { font-style: normal; opacity: .55; font-size: 11px; margin-left: 3px; font-variant-numeric: tabular-nums; }

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20, 26, 22, .45); }
.sheet-panel {
  position: relative; width: 100%; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--paper, #FAF7EE); border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp .18s ease-out;
}
@keyframes sheetUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } }
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 9px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 18px 4px; }
.sheet-head b { font-size: 16px; }
.sheet-x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.sheet-body { overflow-y: auto; padding: 4px 18px 8px; -webkit-overflow-scrolling: touch; }
.sheet-sect { margin-bottom: 14px; }
.sheet-lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.sheet-foot {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 14px;
  border-top: 1px solid var(--line); background: var(--paper, #FAF7EE);
}
.sheet-foot .btn { flex: 1; margin: 0; }
.sheet-foot .ob-skip { margin: 0; white-space: nowrap; }

/* ============================================================================
   COMPONENT KIT  (P0 task 11)
   Primitives shared by the admin stock loop and the library. Built against the
   existing custom properties above - no new palette.

   Two constraints shaped this and are worth stating, because both are easy to
   reintroduce:

   1. body has `overflow-x: hidden`, which creates a scroll container and stops
      `position: sticky` sticking on descendants in several engines. Every
      pinned element here is `position: fixed`.

   2. The tab bar is a FLOATING PILL, not a bar flush to the bottom edge:
      fixed, bottom 22px + safe-area, height var(--nav-h) 62px. Anything pinned
      to the bottom has to clear 22 + 62 + a gap, hence --act-bottom.
   ========================================================================= */

:root {
  /* 22px pill offset + 62px pill height + 12px breathing room */
  --act-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* ---------- bottom sheet ----------------------------------------------------
   Generalised from the library filter sheet rather than duplicated - the
   library already ships .sheet/.sheet-bg/.sheet-panel and both must stay in
   step. Only additions live here. */
.sheet-panel.tall { max-height: 92vh; }
.sheet-panel.short { max-height: 55vh; }
.sheet-title { font-size: 17px; font-weight: 700; }
.sheet-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- pinned action bar ---------------------------------------------- */
.actbar {
  position: fixed;                 /* NOT sticky - see note 1 above */
  left: 16px; right: 16px; bottom: var(--act-bottom);
  max-width: 560px; margin: 0 auto;
  display: flex; gap: 10px; align-items: center;
  padding: 10px; border-radius: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(44, 58, 53, .18);
  z-index: 45;                     /* under the tab pill (50), over content */
}
/* .btn is `display:block; width:100%`, so flex sizing alone loses to it and
   the second button overflows the bar. Reset the width explicitly. The .ghost
   colours are NOT redefined here - one definition of that class already exists
   and two would collide. */
.actbar .btn { flex: 1 1 0; width: auto; min-width: 0; margin: 0; }
.actbar .btn.ghost { flex: 0 1 auto; width: auto; padding-left: 20px; padding-right: 20px; }
/* Give a view room so the bar never covers its last row. */
.has-actbar { padding-bottom: calc(var(--act-bottom) + 76px); }

/* ---------- segmented control ---------------------------------------------- */
.seg {
  display: flex; padding: 3px; gap: 3px;
  background: var(--cream-2); border-radius: 12px;
}
.seg button {
  flex: 1; padding: 9px 10px; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 700;
  transition: background .12s, color .12s;
}
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(44,58,53,.12); }

/* ---------- big numeric entry + steppers ------------------------------------
   For typing a stock count. font-variant-numeric so digits do not jitter as
   the value changes, and inputmode=numeric on the element gets the right pad. */
.count-row { display: flex; align-items: center; gap: 12px; }
.count-input {
  flex: 1; min-width: 0; text-align: center;
  font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 12px 8px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
}
.count-input:focus { outline: none; border-color: var(--sage); }
.round {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 999px;
  background: var(--cream-2); color: var(--ink);
  font-size: 24px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.round:active { background: var(--line); }
.round.lg { width: 60px; height: 60px; flex-basis: 60px; font-size: 28px; }

/* ---------- banner ---------------------------------------------------------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--cream);
  margin-bottom: 12px;
}
.banner b { display: block; margin-bottom: 2px; }
.banner.info { border-color: var(--sage); background: #EAF0EC; }
.banner.warn { border-color: var(--warn); background: #FBF2E0; }
.banner.bad  { border-color: var(--bad);  background: #F9E9E7; }

/* ---------- pending / saving state ------------------------------------------
   A row that has been submitted but not confirmed. Deliberately still legible
   rather than a spinner over the top: on a bad signal this state can last, and
   the number underneath is what the user is checking. */
.pending { opacity: .55; position: relative; pointer-events: none; }
.pending::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--sage), transparent);
  animation: pendingSweep 1.1s linear infinite;
}
@keyframes pendingSweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- status pills ----------------------------------------------------- */
.spill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  text-transform: uppercase;
}
.spill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.spill.paid    { background: #E4F0E7; color: var(--ok); }
.spill.due     { background: #EAF0EC; color: var(--sage); }
.spill.overdue { background: #F9E9E7; color: var(--bad); }
.spill.draft   { background: var(--cream-2); color: var(--muted); }

/* ---------- value change ------------------------------------------------------
   A brief tint when a number updates, so a change made on a phone in an aisle
   is visible without a toast stealing focus. */
.bump { animation: bump .5s ease-out; }
@keyframes bump {
  0%   { background: rgba(217, 55, 125, .18); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .pending::after, .bump { animation: none; }
}

/* image fallback tiles */
.usual-line .noimg, .bline .noimg { width: 42px; height: 42px; border-radius: 8px; background: var(--cream); display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; font-size: 16px; flex: 0 0 auto; }
.pimgbox .noimg { width: 96px; height: 96px; border-radius: 16px; background: var(--cream); display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; font-size: 34px; }

/* no double-tap zoom */
html, body { touch-action: manipulation; }
button, a, input, select, label, .chip, .round, .stepper, .lcard, .tabbar, .seg, .pcard { touch-action: manipulation; }

/* admin hub: today + customers */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi .v { font-size: 21px; font-weight: 800; color: var(--sage-deep); line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .l { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .d.up { color: var(--ok); font-weight: 700; }
.kpi .d.down { color: var(--bad); font-weight: 700; }
.kpi.warn .v { color: var(--bad); }
.crow { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--cream-2); cursor: pointer; }
.crow:last-child { border-bottom: 0; }
.crow .lname { font-weight: 700; font-size: 14px; line-height: 1.3; }
.crow .lsum { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.actrow { display: flex; gap: 8px; margin-top: 12px; }
.actrow .btn { width: auto; flex: 1; margin: 0; padding: 11px 8px; font-size: 14px; text-decoration: none; }
p.hint { color: var(--muted); font-size: 13px; }

/* five-way admin segment */
.seg.five button { padding: 9px 4px; font-size: 12.5px; }

/* ---- activity log / inbox (v39) ---- */
.btn.sm { width: auto; padding: 7px 11px; font-size: 12.5px; margin: 0; }
.actrow.sm { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin: 0; }
#actBody { width: 100%; box-sizing: border-box; }

/* ---- receive goods (v40) ---- */
.recv-extra { display: flex; gap: 8px; margin: -2px 0 12px; }
.recv-extra input { flex: 1 1 0; min-width: 0; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.recv-extra input:focus { outline: none; border-color: var(--sage); }

/* ---- customer app v2 (v50) ---- */
.askbox { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 0 14px; border-radius: 16px; background: var(--sage-deep); color: var(--cream); text-decoration: none; }
.askbox .mark { width: 30px; height: 30px; border-radius: 50%; background: var(--magenta); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 17px; }
.askbox b { display: block; font-size: 15px; }
.askbox small { display: block; color: #C9D6CD; font-size: 12px; margin-top: 2px; }
.askbox > span:last-child { color: #C9D6CD; font-size: 20px; }
.ask-input { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); resize: none; }
.ask-input:focus { outline: none; border-color: var(--sage); }
.pick { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--cream-2); }
.pick:first-child { border-top: 0; }
.pick img, .pick .noimg { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: var(--paper); flex: 0 0 auto; }
.pick .noimg { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }
.pick .why { font-size: 12.5px; color: var(--muted); margin: 3px 0 6px; line-height: 1.4; }
.pick .addbtn { height: 34px; padding: 0 14px; }
.glance { display: flex; gap: 10px; margin-bottom: 14px; }
.glance a { flex: 1 1 0; min-width: 0; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; text-decoration: none; color: inherit; }
.glance .l { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.glance .v { font-size: 15px; font-weight: 800; color: var(--sage-deep); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.searchbar .cam { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--chip, #EEE9DB); display: flex; align-items: center; justify-content: center; }
.searchbar .cam svg { position: static; transform: none; width: 20px; height: 20px; fill: none; stroke: var(--sage-deep); stroke-width: 1.8; }
.searchbar.has-cam input { padding-right: 50px; }
.oline.tap { cursor: pointer; }

/* ---- action rows wrap: six buttons (Call, WhatsApp, Email, Directions, Website, Edit) must fit a phone ---- */
.actrow { flex-wrap: wrap; }
.actrow .btn { flex: 1 1 calc(33.333% - 6px); min-width: 0; white-space: nowrap; padding-left: 6px; padding-right: 6px; font-size: 13.5px; }
.actrow.sm .btn { flex: 0 0 auto; }

/* ---- order timeline (v53) ---- */
.tl { margin: 10px 0 4px; padding-left: 4px; }
.tl-step { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 14px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
.tl-step:last-child::before { display: none; }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); flex: 0 0 auto; margin-top: 3px; border: 2px solid var(--card, #fff); box-shadow: 0 0 0 1px var(--line); }
.tl-step.on .tl-dot { background: var(--sage); box-shadow: 0 0 0 1px var(--sage); }
.tl-step.bad .tl-dot { background: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.tl-l { font-weight: 700; font-size: 14px; color: var(--ink); }
.tl-step:not(.on) .tl-l { color: var(--muted); font-weight: 600; }
.tl-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* customer round two (v55): reorder reminder, saved lists */
.duebanner { margin: 6px 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--cream-2); color: var(--sage-deep); }
.duebanner b { display: block; font-size: 14px; }
.duebanner small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.duebanner.hot { background: #FAE4EE; color: var(--magenta); }
.duebanner.hot small { color: var(--magenta); opacity: .85; }
.duebanner.quiet { background: transparent; padding: 0 0 6px; }

/* store profile (v58) */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.pq { padding: 10px 0 12px; border-bottom: 1px solid var(--cream-2); }
.pq:last-child { border-bottom: 0; }
.pq-q { font-weight: 700; font-size: 14px; color: var(--sage-deep); margin-bottom: 8px; }
.pq-q small { font-weight: 500; color: var(--muted); font-size: 12px; }
.pq-other { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; margin-top: 8px; }
.pq .chip { white-space: nowrap; }
.nudge-x { margin-left: auto; background: transparent; border: 0; color: #A9B8AE; font-size: 22px; line-height: 1; padding: 4px 6px; }

/* date inputs: iOS keeps an intrinsic minimum width unless appearance is reset (v60) */
input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; box-sizing: border-box; max-width: 100%; }
.recv-bill { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.recv-bill input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--sage-deep); }
.recv-bill small { display: block; color: var(--muted); font-size: 12px; }

/* reconciliation (v61) */
.rdiff { border-top: 1px solid var(--cream-2); padding-bottom: 6px; }
.rside { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; }
.rtag { flex: 0 0 auto; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; background: var(--cream-2); color: var(--sage-deep); }
.rtag.xero { background: #E3EDF7; color: #1F4E79; }
.rval { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.rval i { color: var(--muted); }
.rbtn { flex: 0 0 auto; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; border: 1.5px solid var(--sage-deep); background: transparent; color: var(--sage-deep); }
.rbtn:disabled { opacity: .5; }
/* who exactly (v63) */
button.who { background: transparent; border: 0; padding: 0; white-space: nowrap; color: var(--sage-deep); font: inherit; font-size: 11.5px; font-weight: 700; }

/* analytics in the app (v65) */
.abars { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-top: 8px; }
.abar { flex: 1 1 0; min-width: 0; background: var(--sage-deep); border-radius: 3px 3px 0 0; opacity: .85; }
.abar.last { background: var(--magenta); opacity: 1; }
.axl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.achg { font-size: 11px; font-weight: 700; }
.achg.up { color: var(--ok); }
.achg.down { color: var(--bad); }
#anTabs { margin: 4px 0 10px; }
