/* Buyer ordering portal — standalone stylesheet.
   Deliberately NOT static/style.css: that is the dashboard's, it is served
   from /dash/static (which 404s on this host by design), and it carries
   dashboard-specific chrome buyers should never see. */
:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --warn: #b45309;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.phead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.pbrand { font-weight: 700; letter-spacing: .14em; font-size: 13px; }
.pnav { display: flex; align-items: center; gap: 14px; }
.pnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.pnav a.on { color: var(--ink); font-weight: 600; }
.pnav form { margin: 0; }
.plink {
  background: none; border: 0; padding: 0; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline;
}
.pmain { max-width: 1040px; margin: 0 auto; padding: 20px; }
.pcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px;
}
.pnarrow { max-width: 420px; margin: 48px auto; }
h1 { font-size: 19px; margin: 0 0 14px; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.prow-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.prow-top h1 { margin: 0; }

.pmode { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pmode-btn {
  background: var(--card); border: 0; padding: 7px 16px; font: inherit;
  font-size: 13px; cursor: pointer; color: var(--muted);
}
.pmode-btn.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* table-layout: fixed so column widths come from the header row and NOTHING
   else. Without it the browser re-measures every column on each keystroke —
   "—" becoming "1,440" widens Units, which shoves every other column
   sideways while you are still typing (Henry, 2026-08-24: "the columns shift
   when i add or decrease number of units in IC/MC, its not GUI friendly").
   tabular-nums stops digits jittering within a fixed column for the same
   reason: 1 and 8 must occupy the same width. */
.ptable { width: 100%; border-collapse: collapse; margin-top: 14px; table-layout: fixed; }
.ptable td.num, .ptable th.num { font-variant-numeric: tabular-nums; }
/* Widths sized to the WIDEST real value each column holds, not guessed:
   line total "A$1,830.40" is the longest string on the row, units "2,880",
   price "A$12.70". Too narrow and fixed layout CLIPS rather than wrapping —
   which is what an ellipsis rule did on the first attempt. Numeric cells are
   nowrap with no ellipsis so a value can never be silently truncated: if a
   number does not fit, that is a bug to fix here, not something to hide. */
.ptable th.qty-col, .ptable td.qty-col { width: 104px; }
.ptable th.num, .ptable td.num { width: 104px; white-space: nowrap; }
.ptable th.units, .ptable td.units { width: 96px; }
.ptable th.line, .ptable td.line { width: 124px; }
/* "20" / "120" — the two narrowest columns, no need for 104px. */
.ptable th.small, .ptable td.small { width: 74px; }
.ptable th:first-child, .ptable td:first-child { width: auto; }   /* product name absorbs the slack */
.ptable th.pthumb, .ptable td.pthumb { width: 56px; }
/* Only the product NAME may ellipsis — it is prose and can be long. */
.ptable td:first-child .prodname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ptable th, .ptable td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.ptable th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.ptable td.num, .ptable th.num { text-align: right; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable .pline td { color: var(--muted); font-size: 13px; padding-top: 2px; padding-bottom: 2px; border-bottom: 0; }
.ptable tr.unpriced td { color: var(--muted); }
.ptable input.qty {
  width: 74px; padding: 5px 7px; text-align: right; font: inherit;
  border: 1px solid var(--line); border-radius: 6px;
}
.ptable input.qty:disabled { background: var(--bg); color: var(--muted); }
.ptable .prodname { font-weight: 600; }
.ptable .prodsku { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }

/* Product thumbnail. Fixed 44px box either way, so a SKU with no Shopify
   product (the placeholder) keeps the row heights identical. */
.ptable th.pthumb, .ptable td.pthumb { width: 56px; padding-right: 0; }
.ptable td.pthumb img {
  display: block; width: 44px; height: 44px; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
}

/* Openers for the product panel. Only rendered for a SKU that has something
   to show — a SKU with no Shopify product stays plain text. */
.pthumb-btn, .pprod-btn {
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  color: inherit; text-align: left; cursor: pointer; display: block;
}
.pprod-btn:hover .prodname, .pprod-btn:focus-visible .prodname { text-decoration: underline; }
.pthumb-btn:hover img { border-color: var(--accent); }
.pthumb-btn:focus-visible, .pprod-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pnoimg {
  display: flex; align-items: center; justify-content: center; text-align: center;
  width: 44px; height: 44px; border: 1px dashed var(--line); border-radius: 6px;
  background: var(--bg); color: var(--muted); font-size: 8px; letter-spacing: .02em;
  padding: 2px; overflow: hidden;
}

.ptotals {
  display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.ptotals div { display: flex; flex-direction: column; gap: 2px; }
.ptotals span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
/* ONE size for every figure. The grand total was 18px against 15px for
   everything else, which read as five different sizes across the row rather
   than as emphasis (Henry, 2026-08-24: "why is it all diff sizes"). Weight
   and colour carry the emphasis instead — same size, so the row scans as one
   line of figures. */
.ptotals b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptotals .grand b { font-weight: 800; color: var(--ink, #111); }

.pform { display: flex; flex-direction: column; gap: 10px; }
.pform label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pform input, .pform textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 6px; width: 100%; background: var(--card); color: var(--ink);
}
.pform input:focus, .pform textarea:focus { outline: none; border-color: var(--accent); }
.pgrid { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px 14px; }
.pgrid label { margin: 0; }

/* Address suggestion list — anchored to the street field, not the grid. */
.pfield { position: relative; }
.psuggest {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12); overflow: hidden;
}
.psuggest-item { padding: 8px 10px; font-size: 14px; cursor: pointer; }
.psuggest-item + .psuggest-item { border-top: 1px solid var(--line); }
.psuggest-item.on, .psuggest-item:hover { background: var(--bg); }

.pbtn {
  background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 7px; padding: 9px 20px; font: inherit; font-weight: 600;
  cursor: pointer; align-self: flex-start; text-decoration: none;
  display: inline-block;
}
.pbtn:disabled { background: var(--muted); cursor: default; }
.psubmit { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.pstate { color: var(--muted); font-size: 13px; margin: 0; }
.pstate.bad { color: var(--warn); }

.pstatus {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--line); color: var(--muted);
}
.pstatus.s-invoiced { border-color: var(--accent); color: var(--accent); }

/* Product panel — images + the Shopify description. */
.pmodal-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.pmodal {
  background: var(--card); border-radius: 12px; width: min(720px, 100%);
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3); overflow: hidden;
}
.pmodal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.pmodal-titles h2 { margin: 0; font-size: 16px; }
.pmodal-titles .prodsku { display: block; font-size: 11px; color: var(--muted); }
.pmodal-x {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 12px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.pmodal-x:hover { color: var(--ink); border-color: var(--muted); }
.pmodal-body { padding: 16px 20px 20px; }
.pmodal-copy { margin-top: 16px; font-size: 14px; }
.pmodal-copy p { margin: 0 0 10px; }
.pmodal-copy ul { margin: 0; padding-left: 18px; }
.pmodal-copy li { margin-bottom: 8px; }
.pmodal-copy li:last-child, .pmodal-copy p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .pgrid { grid-template-columns: 1fr; }
  .ptable th, .ptable td { padding: 6px; }
  .ptable .qty-col { display: none; }
  .pmodal-back { padding: 12px; }
  }


/* --- Product gallery: one large image + thumbnail strip ------------------
   Sized big deliberately. Several of these images are infographics whose
   content IS text (benefits, comparison table, guaranteed analysis), so the
   main stage has to be readable on a laptop, not a thumbnail. */
.pmodal-gallery { margin-bottom: 18px; }
.pmodal-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line, #e3e6ea); border-radius: 10px;
  overflow: hidden;
}
.pmodal-main {
  display: block; width: 100%; height: auto; max-height: 68vh;
  object-fit: contain; background: #fff;
}
.pmodal-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line, #d8dbe2); background: rgba(255,255,255,.92);
  font: 700 24px/1 inherit; color: #222; z-index: 2;
}
.pmodal-arrow:hover { background: #fff; }
.pmodal-arrow.prev { left: 10px; }
.pmodal-arrow.next { right: 10px; }
.pmodal-count {
  text-align: center; font-size: 11.5px; color: var(--muted, #6b7280);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.pmodal-thumbs {
  display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px;
}
.pmodal-thumb {
  width: 62px; height: 62px; object-fit: cover; flex: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 7px; background: #fff;
}
.pmodal-thumb:hover { border-color: var(--line, #d8dbe2); }
.pmodal-thumb.on { border-color: var(--accent, #0d9488); }

/* The modal itself needs room for a 68vh image. */
.pmodal { max-width: 900px; width: calc(100vw - 40px); }
@media (max-width: 640px) {
  .pmodal-main { max-height: 52vh; }
  .pmodal-arrow { width: 34px; height: 34px; font-size: 20px; }
}
