:root {
  --blue: #0d2f9e; --blue-2: #1d4ed8; --blue-soft: #e2e9fd; --bg: #eef1f7;
  --ink: #1b2236; --muted: #5d6680; --line: #d9deea; --red: #b42318; --green: #137333;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff; padding: 10px 14px; }
.brand { font-weight: 700; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: #f3d27a; color: #5a3f00; font-size: 14px; font-weight: 800; }
.iconbtn { background: none; border: 0; color: #fff; font-size: 24px; padding: 0 6px; }
.practice { background: #fff4d6; color: #7a4b00; font-size: 12.5px; text-align: center; padding: 5px; font-weight: 600; }

main { max-width: 640px; margin: 0 auto; padding: 12px 12px 96px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 0 10px; font-size: 13px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs .ti { font-size: 20px; line-height: 1; }
.tabs button.on { color: var(--blue); font-weight: 700; }

/* metal colours (calm) */
.m-22K { --mc: #8a5a00; --ms: #fbf1d9; }
.m-18K { --mc: #8c3d17; --ms: #fbebe2; }
.m-24K { --mc: #6f5800; --ms: #fff6c8; }
.m-SILVER { --mc: #4a5568; --ms: #edf0f4; }
.mchip { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--mc); background: var(--ms);
  border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mcard { text-align: left; background: #fff; border: 2px solid transparent; border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); border-left: 6px solid var(--mc); }
.mcard.on { border-color: var(--mc); background: var(--ms); }
.mname { font-size: 13px; font-weight: 700; color: var(--mc); }
.mweight { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.mcount { font-size: 12.5px; color: var(--muted); }

.searchbar { margin: 12px 0 8px; }
.searchbar.flat { margin: 6px 0 10px; }
.searchbar input, .in { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; }
.searchbar input:focus, .in:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px var(--blue-soft); }

.list { display: flex; flex-direction: column; gap: 6px; }
.listhead { font-size: 13px; color: var(--muted); padding: 0 2px 2px; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 6px; }
.list .row { margin-bottom: 0; }
.tag { flex: none; min-width: 58px; text-align: center; font-weight: 800; font-size: 13.5px; color: var(--blue);
  background: var(--blue-soft); border-radius: 8px; padding: 6px 6px; }
.tag.big { font-size: 17px; padding: 10px; min-width: 72px; }
.rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rname { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rsub { font-size: 12.5px; color: var(--muted); }
.soldline { font-size: 12.5px; color: var(--red); font-weight: 600; }
.rw { flex: none; font-weight: 800; font-size: 15.5px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 4px 0; }
.link { background: none; border: 0; color: var(--blue-2); font-weight: 700; padding: 0; text-decoration: underline; }

.panel { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
h1 { font-size: 19px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 4px; }
.sec { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.num { font-size: 18px; font-weight: 700; }
.chips, .filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.filters { margin: 0 0 12px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.metalpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mpick { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 2px; font-weight: 700; font-size: 14px; color: var(--mc); }
.mpick.on { border-color: var(--mc); background: var(--ms); }
.netbox { margin-top: 12px; background: var(--blue-soft); border-radius: 10px; padding: 12px; font-size: 15px; }
.netbox b { font-size: 20px; }
.err { color: var(--red); background: #fdecec; border-radius: 8px; padding: 8px 10px; font-weight: 600; font-size: 14px; }

.btn { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 14px; font-weight: 700; font-size: 15.5px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { color: var(--red); border-color: #f1c4c0; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.wide { width: 100%; margin-top: 14px; }

.sheetwrap { position: fixed; inset: 0; z-index: 20; background: rgb(15 23 42 / .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.shead { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.weights { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; margin-bottom: 10px; }
.weights div { background: var(--bg); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.weights span { font-size: 12px; color: var(--muted); }
.weights .net { background: var(--blue-soft); }
.weights .net b { font-size: 17px; }
.kv { display: flex; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.kv span { width: 80px; flex: none; color: var(--muted); }
.sbtns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.day { background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.dayh { font-size: 16px; margin: 0 0 8px; }
.sum { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.sum th { text-align: right; color: var(--muted); font-weight: 600; padding: 3px 2px; }
.sum td { text-align: right; padding: 5px 2px; border-top: 1px solid var(--line); white-space: nowrap; }
.sum td:first-child, .sum th:first-child { text-align: left; }
.pos { color: var(--green); } .neg { color: var(--red); }
.hl { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.hact { flex: none; width: 74px; font-size: 12px; font-weight: 800; border-radius: 6px; padding: 2px 4px; text-align: center; }
.a-in .hact { background: #e6f4ea; color: var(--green); }
.a-out .hact { background: #fdecec; color: var(--red); }
.a-back .hact, .a-edit .hact { background: #fff4d6; color: #7a4b00; }
.a-del .hact { background: #eee; color: #555; }
.hmain { flex: 1; min-width: 0; }
.hsub { display: block; font-size: 12px; color: var(--muted); }
.hw { flex: none; font-weight: 700; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 78px; z-index: 30; background: #1b2236; color: #fff;
  border-radius: 12px; padding: 11px 14px; display: flex; gap: 14px; align-items: center; max-width: 92vw; font-size: 14.5px; }
.toast .undo { background: none; border: 0; color: #9db8ff; font-weight: 800; }

@media (min-width: 700px) { .cards { grid-template-columns: repeat(4, 1fr); } }

/* sign-in, shops, people */
.center { text-align: center; }
.biglogo { width: 72px; height: 72px; margin: 6px auto 10px; border-radius: 18px; background: #f3d27a; color: #5a3f00;
  display: grid; place-items: center; font-weight: 800; font-size: 30px; }
.btn.google { background: #fff; border-color: var(--line); color: var(--muted); }
.btn.center { display: block; text-align: center; text-decoration: none; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center; font-weight: 800; }
.shopav { background: #fbf1d9; }
.go { color: var(--muted); font-size: 22px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.waitbox { background: #fff8e6; border: 1px solid #f3dca0; }
.waitbox h2 { font-size: 16px; }
.in.code { font-size: 24px; font-weight: 800; letter-spacing: 6px; text-transform: uppercase; text-align: center; }
.codebox { font-size: 32px; font-weight: 800; letter-spacing: 8px; text-align: center; background: var(--blue-soft);
  color: var(--blue); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.person { display: flex; gap: 10px; align-items: center; padding: 10px 0 6px; border-top: 1px solid var(--line); }
.person .rmain b { font-size: 15px; }
.pbtns { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; }
.pbtns .btn { padding: 8px 12px; font-size: 14px; }
.rolechip { font-size: 12px; font-weight: 800; border-radius: 6px; padding: 2px 8px; background: #edf0f4; color: #4a5568; }
.rolechip.owner { background: #fbf1d9; color: #8a5a00; }
.kv small { font-weight: 400; }

.filebtn { display: block; cursor: pointer; }
.person .btn { padding: 8px 12px; font-size: 14px; flex: none; }

/* barcodes */
.topbtns { display: flex; gap: 2px; align-items: center; }
.scanbtn { font-size: 20px; }
.scanrow { display: flex; gap: 8px; }
.scanrow .in { flex: 1; }
.scanrow .btn { flex: none; padding: 8px 14px; font-size: 18px; }
.codebox.small { font-size: 20px; letter-spacing: 1px; word-break: break-all; }
.camwrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.camwrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camline { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
.countbig { font-size: 20px; text-align: center; margin: 6px 0; }
.countbig b { font-size: 28px; }
.bar { height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.bar span { display: block; height: 100%; background: var(--green); }
.picklist { max-height: 50vh; overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.pick { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.pick small { margin-left: auto; color: var(--muted); }
.labelpreview { display: flex; justify-content: center; padding: 12px; background: var(--bg); border-radius: 10px; margin-bottom: 6px; }
.labelpreview > div { background: #fff; box-shadow: 0 0 0 1px #ccc; }

/* label layouts (mm) — same for preview and print */
.bc { display: block; width: 100%; }
.lbl-tag { width: 72mm; height: 12mm; display: flex; color: #000; font: 7pt/1.15 Arial, sans-serif; }
.lbl-tag .half { width: 36mm; height: 12mm; padding: 0.8mm 2mm; overflow: hidden; }
.lbl-tag .t { font-size: 6pt; text-align: center; letter-spacing: .3px; }
.lbl-tag .txt b { font-size: 8pt; }
.lbl-tag .txt span { font-size: 6pt; }
.lbl-small { width: 50mm; height: 25mm; padding: 1.5mm 3mm; color: #000; font: 8pt/1.2 Arial, sans-serif; overflow: hidden; }
.lbl-small .t, .lbl-a4 .t { font-size: 7pt; text-align: center; }
.lbl-a4 { width: 38.1mm; height: 21.2mm; padding: 1.2mm 2mm; color: #000; font: 7pt/1.15 Arial, sans-serif; overflow: hidden; }
#printarea { display: none; }
@media print {
  body.printing > *:not(#printarea) { display: none !important; }
  body.printing { background: #fff; }
  body.printing #printarea { display: block; }
  .onelabel { page-break-after: always; break-after: page; overflow: hidden; }
  .a4grid { display: grid; grid-template-columns: repeat(5, 38.1mm); grid-auto-rows: 21.2mm; column-gap: 2.5mm; }
}

/* fast entry + import */
.seg { display: flex; background: #fff; border-radius: 12px; padding: 4px; margin-bottom: 10px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 10px 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--blue); color: #fff; }
.fastform { border: 2px solid var(--blue-soft); }
.problist { max-height: 40vh; overflow: auto; }

/* metals per shop */
.cards.one { grid-template-columns: 1fr; }
.metalpick.n1 { grid-template-columns: 1fr; }
.metalpick.n2 { grid-template-columns: 1fr 1fr; }
.metalpick.n3 { grid-template-columns: repeat(3, 1fr); }
.metalticks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.mtick { display: flex; gap: 8px; align-items: center; border: 2px solid var(--line); border-radius: 10px; padding: 10px; font-weight: 700; color: var(--mc); }
.mtick input { width: 20px; height: 20px; }

/* rates, prices, options */
.ratebar { background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.ratebar.missing { background: #fff8e6; border: 1px solid #f3dca0; }
.ratebar .rate { display: flex; flex-direction: column; }
.ratebar .rate span { font-size: 12px; color: var(--muted); }
.ratebar .rate b { font-size: 18px; }
.ratebar .rate small { font-size: 11.5px; color: #8a5a00; }
.ratebar .btn { margin-left: auto; padding: 9px 12px; font-size: 14px; }
.mvalue { font-size: 13px; font-weight: 700; color: var(--green); }
.rw { display: flex; flex-direction: column; align-items: flex-end; }
.rw .price { font-size: 13px; color: var(--green); font-weight: 700; }
.pricebox { background: #e6f4ea; border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pricebox span { font-size: 13px; color: var(--muted); }
.pricebox b { font-size: 20px; color: var(--green); }
.pricebox small { width: 100%; font-size: 12.5px; color: var(--muted); }
.pricebox.none { background: #fff8e6; color: #7a4b00; font-size: 13.5px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.opt input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
select.in { appearance: auto; }

/* TEST app */
.practice.testbar { background: #c62828; color: #fff; }

.testtag { background: #c62828; color: #fff; font-size: 12px; font-weight: 800; border-radius: 6px; padding: 2px 6px; margin-left: 4px; }
