:root {
  /* BMW-inspired: near-black, BMW blue, M tricolour accents, square corners */
  --bg: #f2f3f5; --card: #fff; --ink: #0d1117; --muted: #6b7480; --line: #dcdfe4;
  --brand: #0d1117; --brand2: #1c69d4; --accent: #e7222e;
  --m1: #81c4ff; --m2: #16588e; --m3: #e7222e;
  --ok: #1d8a4f; --warn: #b86e00; --bad: #d0021b; --eu: #1c69d4; --hk: #262626;
  --r: 3px; --shadow: 0 1px 0 rgba(13,17,23,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  padding-bottom: 72px; }
a { color: var(--brand2); text-decoration: none; }
h1 { font-size: 24px; margin: 8px 0 16px; font-weight: 700; letter-spacing: -.01em; } h1 small { font-size: 15px; font-weight: 400; color: var(--muted); }
h2 { font-size: 13px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.muted { color: var(--muted); } .small, small { font-size: 12.5px; } .nw { white-space: nowrap; }

header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  background: var(--brand); color: #fff; padding: 10px 16px 13px; padding-top: max(10px, env(safe-area-inset-top)); }
header.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--m1) 0 33.3%, var(--m2) 33.3% 66.6%, var(--m3) 66.6% 100%); }
header .brand span { text-transform: uppercase; letter-spacing: .12em; font-size: 14px; }
header .brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
header .brand img, .brand img { width: 28px; height: 28px; }
nav.main { display: none; gap: 2px; flex: 1; overflow-x: auto; }
nav.main a { color: #aab3bd; padding: 6px 10px; white-space: nowrap; font-size: 14px; border-bottom: 2px solid transparent; }
nav.main a.on, nav.main a:hover { color: #fff; border-bottom-color: var(--brand2); }
.menu { margin-left: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; font-size: 22px; padding: 2px 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu .drop { position: absolute; right: 0; top: 40px; background: #fff; color: var(--ink); border-radius: var(--r);
  box-shadow: 0 8px 30px rgba(0,0,0,.2); min-width: 220px; padding: 6px; display: flex; flex-direction: column; }
.menu .drop a { padding: 10px 12px; border-radius: 6px; color: var(--ink); }
.menu .drop a:hover { background: var(--bg); }
.menu .who { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.langs { display: flex; gap: 6px; padding: 6px; flex-wrap: wrap; }
.langs a { border: 1px solid var(--line); padding: 4px 10px !important; border-radius: 20px; font-size: 13px; }

nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; text-align: center; padding: 6px 2px 8px; font-size: 11.5px; color: var(--ink); }
nav.bottom a span { display: block; font-size: 21px; line-height: 1.3; }

main { max-width: 1180px; margin: 0 auto; padding: 14px; }
main.narrow { max-width: 440px; padding-top: 8vh; }
.card { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); padding: 16px; margin: 0 0 14px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 12px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.btns.sticky { position: sticky; bottom: 70px; background: var(--card); padding: 8px 0; margin-bottom: 0; }
.btns form, form.inline, form.mini { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 8px; font: inherit; font-weight: 500;
  cursor: pointer; min-height: 42px; white-space: nowrap; }
.btn:hover { border-color: #b6c2cd; }
.btn { border-radius: var(--r); }
.btn.primary { background: var(--brand2); border-color: var(--brand2); color: #fff; }
.btn.primary:hover { background: #0653b6; border-color: #0653b6; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.bad { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; }
.big-dest { font-size: 17px; min-width: 96px; }

.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.form label small { font-weight: normal; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #c8cdd3;
  border-radius: var(--r); padding: 9px 10px; min-height: 42px; width: 100%; }
form.inline input, form.inline select, form.mini input, .filters input, .filters select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fc8e8; border-color: var(--brand2); }
input.bad { border-color: var(--bad); background: #fff5f4; } input.good { border-color: var(--ok); }
input.num { width: 110px; text-align: right; min-height: 34px; padding: 4px 8px; }
.grid2, .grid4 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.photo input { padding: 14px; border-style: dashed; background: #fafcfd; }
.price { background: #fffbea; border-radius: 6px; padding: 2px 6px; }
label.price { padding: 6px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[name=q] { flex: 1 1 220px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; background: var(--card); }
.card table.t { background: transparent; }
table.t th, table.t td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: #f8fafb; }
table.t .n, th.n { text-align: right; white-space: nowrap; }
td.warn { color: var(--warn); font-weight: 600; }
td.thumb { width: 52px; padding: 4px; } td.thumb img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
tr.off td { opacity: .5; }
tr.r-damaged td { background: #fff6e6; } tr.r-missing td { background: #fdeceb; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 2px; text-transform: uppercase; letter-spacing: .03em; background: #e9eef3; color: #3b4b5a; white-space: nowrap; }
.s-intake, .s-open { background: #eef1f4; } .s-packed, .s-closed { background: #e4effa; color: #1b5f8f; }
.s-loaded, .s-loading, .s-sealed { background: #fff1cc; color: #7a5200; } .s-transit { background: #e7e3fb; color: #4b3aa8; }
.s-arrived { background: #dff3f7; color: #0d6b80; } .s-received { background: #dff4e7; color: #1d6e40; }
.s-damaged { background: #ffe9c7; color: #8a5600; } .s-missing { background: #fbdedb; color: #9b2c20; } .s-sold { background: #14202b; color: #fff; }
.dest { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 1px 7px; border-radius: 2px; background: #e9eef3; letter-spacing: .06em; }
.d-EU { background: var(--eu); color: #fff; } .d-HK { background: var(--hk); color: #fff; }
.chk { font-weight: 600; font-size: 12.5px; } .c-ok { color: var(--ok); } .c-damaged { color: var(--warn); } .c-missing { color: var(--bad); }

.flash { padding: 10px 14px; border-radius: var(--r); margin-bottom: 10px; background: #dff4e7; color: #155c35; }
.flash.err { background: #fbdedb; color: #8e271d; } .flash.warn { background: #fff1cc; color: #6d4a00; }

.actions.big { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--brand2); border-radius: var(--r); padding: 18px 10px; text-align: center; color: var(--ink); font-weight: 600; }
.tile:hover { border-top-color: var(--accent); }
.tile span { display: block; font-size: 30px; margin-bottom: 4px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { display: block; font-size: 22px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 700; }
.kpi.neg b, .kpi.bad b { color: var(--bad); } .kpi.ok b { color: var(--ok); } .kpi.warn b { color: var(--warn); }
.list { display: flex; flex-direction: column; gap: 6px; }
.list .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--brand2); border-radius: var(--r); padding: 11px 13px; color: var(--ink); }
.list .row .muted { flex-basis: 100%; font-size: 13px; }
.list .row.on { outline: 2px solid var(--brand2); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 14px; margin-bottom: 10px; }
.facts b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.steps { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.steps span { flex: 1; text-align: center; font-size: 12px; padding: 5px 4px; border-radius: 4px; background: #eef1f4; color: var(--muted); min-width: 70px; }
.steps span.done { background: var(--brand); color: #fff; }
.steps span.done:last-of-type { background: var(--brand2); }
.bars { display: grid; gap: 8px; margin: 6px 0 10px; font-size: 13px; }
.bar { height: 10px; background: #eef1f4; border-radius: 10px; overflow: hidden; margin-top: 3px; }
.bar i { display: block; height: 100%; width: 0; background: var(--ok); }
.bar i.over { background: var(--bad); }
.checklist { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 6px; cursor: pointer; }
.checklist label:hover { background: var(--bg); }
.checklist input { width: 20px; min-height: 20px; height: 20px; }
td input[type=checkbox] { width: 22px; height: 22px; min-height: 22px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: #e9eef3; }
.photos figcaption { position: absolute; left: 6px; bottom: 6px; font-size: 11px; color: #fff; background: var(--bad); padding: 1px 6px; border-radius: 4px; }
.photos form { position: absolute; top: 4px; right: 4px; }
.photos .x { border: 0; background: rgba(0,0,0,.55); color: #fff; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; cursor: pointer; }

.scanform { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.scanform input[name=code] { flex: 1 1 200px; font-size: 18px; letter-spacing: .03em; text-transform: uppercase; }
.btn.cam { font-size: 20px; min-width: 52px; }
.camwrap { flex-basis: 100%; position: relative; }
.camwrap video { width: 100%; max-height: 60vh; object-fit: cover; border-radius: var(--r); background: #000; display: block; }
.camwrap .btn { position: absolute; top: 8px; right: 8px; }
.hist summary { color: var(--muted); }
.qr { width: 200px; height: 200px; }
.cols { display: grid; gap: 14px; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.login .brand.big { font-size: 22px; font-weight: 700; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; color: var(--brand); }
.login .brand.big img { width: 40px; height: 40px; }
.roles td { font-size: 12.5px; }

/* new pieces */
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; height: auto; }
.form .btns label, .form label.inl { flex-direction: row; align-items: center; gap: 6px; margin: 0; color: var(--ink); }
.form .stripitem { flex-direction: row; align-items: center; margin: 0; color: var(--ink); font-size: 14px; }
.dgb { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; background: #d97706; padding: 0 5px; border-radius: 2px; vertical-align: middle; }
.stripgrid { display: grid; grid-template-columns: 1fr; gap: 4px; margin-top: 10px; }
.stripitem { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.stripitem:hover { border-color: var(--brand2); }
.stripitem input.num { width: 70px; }
.stripitem[hidden], details[hidden] { display: none; }
.photos.pick label { position: relative; display: block; cursor: pointer; }
.photos.pick input { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; min-height: 24px; z-index: 2; }
.photos.pick input:checked + img { outline: 3px solid var(--brand2); outline-offset: -3px; }
.photos.pick small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.inboxbar .code { width: 160px; } .inboxbar .or { color: var(--muted); font-size: 13px; }
.offer-row { border-top: 1px solid var(--line); padding: 10px 0; } .offer-row.off { opacity: .5; }
.linkbox input { font-size: 13px; background: #f7f8fa; }
.logoprev { margin: 0 0 12px; } .logoprev img { max-height: 70px; max-width: 260px; display: block; background: #0d1117; padding: 10px; margin-bottom: 6px; }

/* wheels */
.seg { display: flex; gap: 0; margin-bottom: 14px; border: 1px solid var(--brand2); border-radius: var(--r); overflow: hidden; }
.form .segbtn { flex: 1; flex-direction: row; justify-content: center; align-items: center; gap: 6px; margin: 0; padding: 11px 6px;
  color: var(--brand2); font-weight: 600; font-size: 14px; cursor: pointer; }
.segbtn + .segbtn { border-left: 1px solid var(--brand2); }
.segbtn:has(input:checked) { background: var(--brand2); color: #fff; }
.segbtn input { position: absolute; opacity: 0; width: 1px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 14px; padding: 10px 12px 4px; }
fieldset[hidden], [data-wrear][hidden] { display: none; }
legend { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: 0 6px; }
.form label.chk { align-self: end; padding-bottom: 12px; }
.wgrid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.wcard { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brand2); border-radius: var(--r); color: var(--ink); padding: 8px; }
.wimg { flex: 0 0 96px; height: 96px; background: #e9ecef; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: #a0a8b2; }
.wimg img { width: 96px; height: 96px; object-fit: cover; }
.wbody { min-width: 0; } .wtop { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wtitle { font-weight: 600; margin-top: 3px; } .wspec { font-size: 13px; color: var(--brand2); margin: 2px 0; }
.wheelbox { border-left: 3px solid var(--brand2); background: #f4f8fd; padding: 10px 12px; margin: 8px 0 12px; }
.wheelbox .btn { margin-top: 8px; }
.warnt { color: var(--warn); font-weight: 600; }

@media (min-width: 760px) {
  .wgrid { grid-template-columns: 1fr 1fr; }
  .grid4 { grid-template-columns: repeat(4, 1fr); }
  .stripgrid { grid-template-columns: repeat(3, 1fr); }
  body { padding-bottom: 0; }
  nav.bottom { display: none; }
  nav.main { display: flex; }
  .btns.sticky { bottom: 0; }
  .grid2 { grid-template-columns: 1fr 1fr; } .grid2 .wide { grid-column: 1 / -1; }
  .grid4 { grid-template-columns: repeat(5, 1fr); }
  .actions.big { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .facts { grid-template-columns: repeat(4, 1fr); }
  .list .row .muted { flex-basis: auto; margin-left: auto; }
  .cols { grid-template-columns: 280px 1fr; }
  .bars { grid-template-columns: 1fr 1fr; }
}
@media print { header.top, nav.bottom, .btns, form { display: none !important; } body { background: #fff; } }
