:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1c2330; --muted: #5f6b7a; --line: #dde2e8;
  --accent: #2554c7; --ok: #1d7a46; --warn: #a15c00; --bad: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
header.top { background: var(--ink); color: #fff; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
header.top .brand { margin-right: 8px; display: flex; align-items: center; }
header.top .brand img { height: 30px; width: auto; display: block; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
header.top nav a { color: #cfd8e6; text-decoration: none; }
header.top nav a:hover { color: #fff; }
header.top .who { margin-left: auto; color: #cfd8e6; font-size: 13px; }
header.top .who button { background: none; border: 0; color: #cfd8e6; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 22px 0 8px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.msg { padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; border: 1px solid var(--line); background: var(--card); }
.msg.success { border-color: #a6d8b9; background: #eefaf2; }
.msg.warning { border-color: #f1cf91; background: #fff8ea; }
.msg.error { border-color: #f3b0aa; background: #fff1f0; }
.errors { color: var(--bad); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; background: #eef1f5; }
.tag.in_box { background: #e6f4ea; } .tag.allocated { background: #e8eefc; } .tag.pulled { background: #fff3d6; }
.tag.shipped { background: #eceff3; } .tag.missing, .tag.removed { background: #fde8e6; }
.short { color: var(--bad); font-weight: 600; }
form.inline { display: inline; }
label { display: block; font-weight: 600; margin: 8px 0 4px; }
input[type=text], input[type=search], input[type=number], input[type=password], textarea, select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; max-width: 420px; background: #fff;
}
textarea { min-height: 140px; }
button, .btn { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button.danger { background: var(--bad); border-color: var(--bad); }
button.small { padding: 3px 9px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; }
.searchbar input { flex: 1; min-width: 200px; }

/* Pull list on a phone: one card per block, big tap targets. */
.pull-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.pull-item.done { opacity: .55; }
.pull-item .where { font-weight: 700; font-size: 16px; }
.pull-item .btns { display: flex; flex-direction: column; gap: 6px; }
.pull-item .btns button { min-width: 110px; min-height: 40px; }
.pull-table { display: none; }

@media (min-width: 760px) {
  .pull-cards { display: none; }
  .pull-table { display: block; }
}

@media print {
  header.top, .no-print, .msg, .actions { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { max-width: none; padding: 0; }
  .panel { border: 0; padding: 0; }
  .pull-cards { display: none !important; }
  .pull-table { display: block !important; }
  th, td { padding: 3px 5px; }
  tr { page-break-inside: avoid; }
}

/* Inventory filters */
.filters .tabs { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.filters .tabs label { font-weight: 600; margin: 0; display: flex; gap: 6px; align-items: center; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-row input[type=search] { flex: 1 1 220px; max-width: none; }
.filter-row select { flex: 0 1 auto; width: auto; max-width: 100%; }
.pager { align-items: center; }

/* Stats: bar lists and weekly columns (one hue; the number is always shown) */
h3 { font-size: 15px; margin: 0 0 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.barlist { display: grid; grid-template-columns: minmax(90px, 42%) 1fr auto; gap: 7px 10px; align-items: center; font-size: 14px; }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { height: 12px; background: #eef1f5; border-radius: 0 4px 4px 0; }
.bl-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.bl-num { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
.inline-bar { display: grid; grid-template-columns: 1fr 52px; gap: 8px; align-items: center; }
.cols { display: flex; gap: 6px; align-items: flex-end; height: 150px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.col-num { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
.col-bar { flex: 1; width: 100%; display: flex; align-items: flex-end; padding: 2px 0; }
.col-fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.col-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.subtabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); text-decoration: none; font-size: 14px; }
.subtabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (max-width: 600px) { .barcol { display: none; } }

/* Card pictures (Pokémon TCG API). Card ratio 63:88. */
.thumb { display: block; width: 40px; aspect-ratio: 63 / 88; border-radius: 3px; overflow: hidden; background: #eef1f5; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.md { width: 64px; border-radius: 4px; }
.thumb.lg { width: 72px; border-radius: 5px; }
.thumb-empty { background: repeating-linear-gradient(135deg, #eef1f5 0 6px, #e4e8ee 6px 12px); }

/* Phone-first lists: picture cards on phones, tables on desktop. */
.m-only { display: none; }
.tile { display: flex; gap: 12px; align-items: flex-start; }
.tile-wrap, .m-only > .tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.tile-body { min-width: 0; flex: 1; }
.tile-body .where { font-weight: 700; font-size: 15px; }
.tile-name { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tile-qty { margin-top: 4px; font-size: 14px; }
.tile-actions { margin-top: 8px; display: flex; gap: 8px; }
.tile-actions button { min-height: 40px; flex: 1; }
.pull-item { grid-template-columns: auto 1fr auto; align-items: start; }
@media (max-width: 600px) {
  .m-only { display: block; }
  .d-only { display: none; }
}
@media print { .m-only { display: none !important; } .d-only { display: block !important; } .thumb { display: none; } }
.set-row { padding: 12px; }
.set-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.set-count { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.set-fix { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.set-fix select { flex: 1 1 220px; max-width: none; }
@media (max-width: 760px) {
  /* Pull list on a phone: picture + location on top, big buttons side by side below. */
  .pull-item { grid-template-columns: auto 1fr; }
  .pull-item .btns { grid-column: 1 / -1; flex-direction: row; }
  .pull-item .btns form { flex: 1; display: flex; }
  .pull-item .btns button { flex: 1; min-height: 44px; }
}
