/* Customer PO portal. Lighter than the warehouse app: it should feel like the store, not a back office. */
:root {
  --bg: #f6f5f2; --panel: #fff; --fg: #1d2124; --muted: #60676c; --line: #dcdcd8; --accent: #d9541e; --accent-fg: #fff;
  --in: #2f8a5b; --limited: #c9a10c; --low: #e07a1f; --out: #c0392b; --off: #e3e4e1;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif; --body: "IBM Plex Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191b; --panel: #1f2326; --fg: #e7e9ea; --muted: #9aa2a7; --line: #363c40; --accent: #f07a45;
    --in: #63c08f; --limited: #e3c548; --low: #f0a050; --out: #ef6f62; --off: #363c40;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--body); }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: .01em; text-wrap: balance; }
h1 { font-size: 2.1rem; line-height: 1.1; }
h2 { font-size: 1.4rem; margin: 0 0 10px; }
h3 { font-size: 1.15rem; margin: 16px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.ptop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.pbrand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.35rem/1 var(--display); }
.pbrand img { border-radius: 4px; }
.pbrand small { display: block; font: 500 .8rem var(--body); color: var(--muted); margin-top: 2px; }
.ptop nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.ptop nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.ptop nav a[aria-current] { background: var(--fg); color: var(--bg); }
.pwrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 120px; }
.porg { margin: 0 0 4px; color: var(--muted); font-size: .875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.crumbs { margin: 0 0 4px; font-size: .875rem; }
.phead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.phead .pbtn { margin-left: auto; }
.pfoot { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px; }

.pbtn { display: inline-block; border: 0; border-radius: 6px; padding: 10px 18px; font: 600 1rem var(--body); background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; }
.pbtn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.pbtn.small { padding: 6px 12px; font-size: .875rem; }
.plink { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font: inherit; cursor: pointer; }
.pflash { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; background: #e2f2e9; color: #1b4d33; }
.pflash.err { background: #f8e1de; color: #7a2117; }
@media (prefers-color-scheme: dark) { .pflash { background: #1b2f25; color: #b8e6cc; } .pflash.err { background: #3a1f1c; color: #f5c3bc; } }

label { display: block; font-weight: 500; font-size: .9rem; margin: 0 0 12px; }
input, textarea, select { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: 400 1rem var(--body); background: var(--bg); color: var(--fg); }
input[type=checkbox] { display: inline; width: auto; margin: 3px 0 0; accent-color: var(--accent); }
input[type=file] { padding: 7px; }
.pcheck { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.pcheck input { width: 18px; height: 18px; flex: none; }
.pcheck.inline { display: inline-flex; border: 0; background: none; padding: 0; margin: 0; align-items: center; }
.pcheck.inline input { margin: 0; }

.pauth { max-width: 380px; margin: 32px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px; text-align: center; }
.pauth img { border-radius: 8px; margin-bottom: 8px; }
.pauth label, .pauth button { text-align: left; }
.pauth .pbtn { width: 100%; text-align: center; margin-top: 4px; }

.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.pbox { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.pship { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.pship label { grid-column: span 3; }
.pship .f-city { grid-column: span 1; }
.pship .f-state, .pship .f-zip { grid-column: span 1; }

.pempty { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: 24px; text-align: center; color: var(--muted); }
.plist { display: grid; gap: 8px; margin-bottom: 24px; }
.plist + h2, .pempty + h2, .phead + h2 { margin-top: 8px; }
.pcard { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.pcard-main { flex: 1; text-decoration: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.pcard-main .small { flex-basis: 100%; }
.pchip { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--off); }
.pchip.st-submitted { background: #fbefd6; color: #6d4a07; }
.pchip.st-approved, .pchip.st-sent { background: #e3edf8; color: #1d4673; }
.pchip.st-ordered { background: #e2f2e9; color: #1b4d33; }
.pchip.st-declined { background: #f8e1de; color: #7a2117; }
@media (prefers-color-scheme: dark) {
  .pchip.st-submitted { background: #352b18; color: #f0d08a; } .pchip.st-approved, .pchip.st-sent { background: #1c2b3c; color: #a9cbf0; }
  .pchip.st-ordered { background: #1b2f25; color: #b8e6cc; } .pchip.st-declined { background: #3a1f1c; color: #f5c3bc; }
}

/* Stock level: four segments, never a number. */
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; flex-wrap: wrap; }
.lvl .bar { display: inline-flex; gap: 2px; }
.lvl .bar i { width: 9px; height: 8px; border-radius: 2px; background: var(--off); }
.lvl-in .bar i.on { background: var(--in); } .lvl-in .lt { color: var(--in); }
.lvl-limited .bar i.on { background: var(--limited); } .lvl-limited .lt { color: var(--limited); }
.lvl-low .bar i.on { background: var(--low); } .lvl-low .lt { color: var(--low); }
.lvl-out .bar i.on { background: var(--out); } .lvl-out .lt { color: var(--out); }
.lvl .eta { font-weight: 400; color: var(--muted); }
p .lvl { margin-right: 10px; }

.pcolhead { margin-top: 28px; }
.pfilter { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.pfilter input[type=search] { max-width: 340px; margin: 0; }
.pmat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.pmat summary { cursor: pointer; padding: 12px 16px; font: 700 1.2rem var(--display); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pmat summary .small { font: 400 .875rem var(--body); }
.pcolors { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); background: var(--panel); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; overflow: hidden; }
.pcolor { display: grid; grid-template-columns: 48px 1fr 84px; gap: 12px; align-items: center; margin: 0; padding: 10px 14px; background: var(--panel); box-shadow: 0 0 0 .5px var(--line); font-weight: 400; cursor: text; }
.pcolor[hidden] { display: none; }
.pcolor.has { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.pcolor img, .pcolor .noimg { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--off); }
.pname { display: flex; flex-direction: column; gap: 3px; font-weight: 500; line-height: 1.25; }
.pwarn { font-size: .78rem; color: var(--low); font-weight: 500; }
.pcolor input { margin: 0; text-align: right; font-size: 1.05rem; }

.pbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  padding: 12px max(16px, calc((100vw - 1080px) / 2 + 16px)) max(12px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgb(0 0 0 / .06); }
.pbar #tot { font-weight: 600; }
.pbar-btns { display: flex; gap: 8px; }
.pdel { margin-top: 16px; }

.ptime { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.ptime li { position: relative; padding-left: 22px; color: var(--muted); }
.ptime li::before { content: ""; position: absolute; left: 0; top: .35em; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.ptime li.done { color: var(--fg); } .ptime li.done::before { background: var(--in); border-color: var(--in); }
.ptime li.now { color: var(--fg); font-weight: 600; } .ptime li.now::before { border-color: var(--limited); }
.ptime li.bad { color: var(--out); } .ptime li.bad::before { background: var(--out); border-color: var(--out); }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th, .ptable td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.ptable .n { text-align: right; }
.ptable tfoot td { font-weight: 700; border-bottom: 0; }
.pprod { color: var(--muted); font-size: .85rem; }
.pdl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.pdl dt { color: var(--muted); font-size: .875rem; }
.pdl dd { margin: 0; }
.pactions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 560px) {
  h1 { font-size: 1.7rem; }
  .pcolor { grid-template-columns: 40px 1fr 72px; gap: 10px; padding: 10px 12px; }
  .pcolor img, .pcolor .noimg { width: 40px; height: 40px; }
  .pgrid { grid-template-columns: 1fr; }
  .pbar-btns { width: 100%; } .pbar-btns .pbtn { flex: 1; }
}

/* Request an account */
.pauth.wide { max-width: 520px; text-align: left; }
.pauth.wide h1, .pauth.wide > p.muted { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { margin: 0 0 12px; }

.pcert { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px 2px; margin: -6px 0 12px; }
.pcert[hidden] { display: none; }
.pcert p { margin: 8px 0; }
