/* Bloxy's Command Deck — readable first, cute second.
   Brand: hot magenta, light pink, deep purple, periwinkle, near-black navy, white.
   Status colours (red/green/amber) are deliberately NOT magenta so a warning never looks like decoration. */
:root {
  --navy: #12122a; --navy-2: #1c1b3a; --navy-3: #29275a;
  --magenta: #ff2e93; --pink: #ffb8da; --purple: #5b2a86; --peri: #8ea2ff; --white: #ffffff;
  --bg: var(--navy); --surface: var(--navy-2); --surface-2: var(--navy-3);
  --text: #f4f2ff; --muted: #b3b0d6; --line: #050512; --edge: #8ea2ff;
  --accent: var(--magenta); --accent-ink: #ffffff;
  --bad: #ff4d4d; --bad-bg: #3a0f17; --good: #3ddc97; --good-bg: #0e2e25; --amber: #ffc24b; --amber-bg: #33270b;
  --shadow: 4px 4px 0 var(--line);
  --r: 16px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fff1f8; --surface: #ffffff; --surface-2: #f3eaff;
  --text: #12122a; --muted: #5b5880; --line: #12122a; --edge: #12122a;
  --bad: #d0122b; --bad-bg: #ffe3e6; --good: #0b8a55; --good-bg: #ddf7ea; --amber: #a06200; --amber-bg: #fff1d6;
  --accent: #d1006b;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h2 { font-size: 1.1rem; margin: 0 0 10px; font-weight: 800; letter-spacing: .01em; }
h3 { font-size: 1rem; margin: 16px 0 8px; font-weight: 800; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .lg { font-size: 1.1rem; } .center { text-align: center; }
.okc { color: var(--good); } .badc { color: var(--bad); font-weight: 800; } .warn { color: var(--amber); }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--purple);
  border-bottom: 3px solid var(--line);
}
.top img { border-radius: 50%; border: 3px solid var(--white); background: var(--white); }
.brand { display: flex; flex-direction: column; line-height: 1.1; color: #fff; }
.brand b { font-size: 1.15rem; font-weight: 900; letter-spacing: .02em; text-shadow: 2px 2px 0 var(--line); }
.brand small { color: var(--pink); font-weight: 700; font-size: .78rem; }

main { padding: 12px 16px; max-width: 760px; margin: 0 auto; }

/* sticker surfaces */
.card, .tile, .pcard {
  background: var(--surface); border: 3px solid var(--edge); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 14px; margin: 0 0 14px;
}
.card.bad, .pcard.bad, .po.bad, .backup.bad { border-color: var(--bad); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 800; color: var(--text); background: var(--surface-2);
  border: 3px solid var(--line); box-shadow: 3px 3px 0 var(--line); text-decoration: none;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: .9rem; box-shadow: 2px 2px 0 var(--line); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--muted); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.block { display: flex; width: 100%; margin-bottom: 14px; }
.btn.wa { background: #1f7a4d; color: #fff; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.3rem; min-width: 44px; min-height: 44px; cursor: pointer; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, .tabs a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

.pill, .tag, .status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; border: 2px solid var(--line); background: var(--surface-2); vertical-align: middle; }
.pill.red { background: var(--bad); color: #fff; } .pill.ok { background: var(--good); color: #062016; }
.tag { background: var(--peri); color: var(--navy); font-size: .7rem; padding: 1px 7px; }
.tag.amber { background: var(--amber); color: #241600; }
.status.s-enquiry { background: var(--surface-2); } .status.s-deposit { background: var(--pink); color: var(--navy); }
.status.s-ordered { background: var(--peri); color: var(--navy); } .status.s-arrived { background: var(--amber); color: #241600; } .status.s-delivered { background: var(--good); color: #062016; }

/* banner */
.banner { display: block; width: 100%; padding: 12px 16px; font: inherit; font-weight: 800; text-align: left; border: 0; border-bottom: 3px solid var(--line); cursor: pointer; }
.banner.bad { background: var(--bad); color: #fff; }

/* dashboard */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; margin: 0; text-decoration: none; min-height: 92px; justify-content: center; }
.tile b { font-size: 1.6rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: .85rem; font-weight: 600; }
.tile.neg b { color: var(--bad); }
.quick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick .btn { padding: 8px; }
.flags { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.flags li a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; border-left: 6px solid; }
.flags li.red a { background: var(--bad-bg); border-color: var(--bad); }
.flags li.amber a { background: var(--amber-bg); border-color: var(--amber); }
.seednote { color: var(--muted); font-size: .85rem; }

/* pricing guard — arm's-length readable */
.pg-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search { flex: 1; }
.pcard { padding: 14px 14px 10px; }
.pcard.good { border-color: var(--good); } .pcard.bad { border-color: var(--bad); border-width: 4px; } .pcard.unk { border-style: dashed; }
.pc-top { display: flex; justify-content: space-between; align-items: start; }
.pc-top h3 { margin: 0; font-size: 1.25rem; font-weight: 900; }
.pc-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.pc-nums span, .stat span, .grid4 span { display: block; font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.xl { font-size: 2rem; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.xl.floor { color: var(--pink); }
:root[data-theme="light"] .xl.floor { color: var(--purple); }
.pc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 6px 8px; }
.stat b { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 400px) { .pc-stats { grid-template-columns: 1fr 1fr; } }
.stat.good b { color: var(--good); } .stat.bad { background: var(--bad); } .stat.bad b, .stat.bad span { color: #fff; }
.alarm { margin-top: 8px; background: var(--bad); color: #fff; font-weight: 900; text-align: center; padding: 8px; border-radius: 10px; border: 3px solid var(--line); letter-spacing: .03em; }
.unknown { margin-top: 8px; background: var(--amber-bg); color: var(--amber); font-weight: 800; padding: 8px; border-radius: 10px; text-align: center; }
.pc-comp { margin-top: 8px; font-size: .95rem; }
.offer { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.offer label { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.offer input { width: 130px; font-size: 1.15rem; font-weight: 800; }
.offer output { font-weight: 800; }
.offer-good { color: var(--good); font-size: 1.05rem; } .offer-bad { color: #fff; background: var(--bad); padding: 4px 10px; border-radius: 8px; font-size: 1.05rem; }
.pc-foot { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.note { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 6px solid var(--peri); font-size: .92rem; }
.note p { margin: 3px 0; }
.item-main small.note-line { color: var(--text); }

/* lists */
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.row-head h2 { margin: 0; }
.item { display: flex; align-items: center; gap: 10px; border-top: 2px solid var(--surface-2); padding: 8px 0; }
.item-main { flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 6px 0; cursor: pointer; min-height: 44px; }
.item-main.block { width: 100%; border-top: 2px solid var(--surface-2); padding: 10px 0; }
.item-main small { color: var(--muted); }
.item-main.bad { border-left: 5px solid var(--bad); padding-left: 10px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 1.3rem; font-weight: 900; cursor: pointer; }
.stepper b { min-width: 30px; text-align: center; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--surface-2); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.kv.total { font-size: 1.1rem; font-weight: 800; } .kv.neg b, .kv.bad b, .kv.bad span { color: var(--bad); } .kv.done { opacity: .55; }
.bar { height: 14px; background: var(--surface-2); border: 2px solid var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--peri), var(--magenta)); }
.warnline { color: var(--amber); font-weight: 700; font-size: .9rem; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--surface-2); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.tbl td.hot { color: var(--pink); font-weight: 900; font-size: 1.2rem; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chip { flex: none; min-height: 38px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--muted); background: transparent; color: var(--text); font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.chip.on { background: var(--peri); color: var(--navy); border-color: var(--line); }
.po-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid4 b { font-size: 1.3rem; font-weight: 900; font-variant-numeric: tabular-nums; }
@media (min-width: 560px) { .grid4 { grid-template-columns: repeat(4, 1fr); } }
.stack { display: grid; gap: 10px; margin: 10px 0; }
.formula { white-space: pre-wrap; font-size: .82rem; background: var(--surface-2); padding: 12px; border-radius: 10px; overflow-x: auto; }
details summary { cursor: pointer; font-weight: 700; padding: 8px 0; }

/* forms */
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--muted); border-radius: 10px; padding: 10px 12px; min-height: 46px;
}
input[readonly] { opacity: .8; border-style: dashed; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: .8rem; font-weight: 800; color: var(--muted); }
.field small { color: var(--muted); font-size: .75rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid2 .span2 { grid-column: span 2; }
.line { border: 2px dashed var(--surface-2); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.line .grid4 { grid-template-columns: 1fr 1fr; gap: 0 8px; }
@media (min-width: 560px) { .line .grid4 { grid-template-columns: repeat(4, 1fr); } }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; margin: 10px 0; }
.check input { width: 24px; min-height: 24px; height: 24px; }
.calc { background: var(--surface-2); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.working { margin: 6px 0 0; padding-left: 20px; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.working li { margin: 2px 0; }

/* bottom sheet */
dialog#sheet { padding: 0; border: 3px solid var(--edge); border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
  width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; box-shadow: 0 -4px 0 var(--line); }
dialog#sheet.wide { max-width: 760px; }
dialog::backdrop { background: rgba(5, 5, 18, .7); }
.sheet-inner { display: flex; flex-direction: column; max-height: 92vh; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 2px solid var(--surface-2); }
.sheet-head h2 { margin: 0; }
.sheet-body { overflow-y: auto; padding: 14px 16px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 2px solid var(--surface-2); }
.sheet-foot .primary { flex: 1; max-width: 260px; }
@media (min-width: 700px) { dialog#sheet { border-radius: 20px; margin: auto; } }

/* tab bar — thumb zone */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 3px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 800; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--text); background: var(--surface-2); }
.tabs a.on svg { stroke: var(--magenta); }
.tabs .badge { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--bad); color: #fff; font-style: normal; font-size: .7rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; border: 2px solid var(--line); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 20; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  max-width: 600px; margin: 0 auto; padding: 12px 14px; border-radius: 14px; background: var(--peri); color: var(--navy); font-weight: 800;
  border: 3px solid var(--line); box-shadow: var(--shadow); transform: translateY(150%); opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { transform: none; opacity: 1; pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* first run, batches, public/private form sections */
.welcome { border-color: var(--magenta); }
.welcome p { margin: 8px 0 14px; }
.nextbatch { margin-top: 8px; font-size: .92rem; padding: 6px 10px; border-radius: 10px; border: 2px dashed var(--surface-2); }
h3.sec { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 10px; border-top: 2px solid var(--surface-2); }
h3.sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.tag.private { background: var(--surface-2); color: var(--text); }
.warnbox { border-color: var(--amber); }
code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; word-break: break-all; }
.bare { margin: 8px 0 12px; padding-left: 22px; font-weight: 800; }
.bare li { margin: 4px 0; }
