/* mobile first, big touch targets */
:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1c1e21;
  --dim: #6b7280;
  --line: #d9dce1;
  --accent: #1d5fd1;
  --err: #b42318;
  --ok: #1a7f37;
  --warn: #9a6700;
  --wo: #a40e26;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --card: #1f2226;
    --text: #e6e8eb;
    --dim: #9aa1ab;
    --line: #353a40;
    --accent: #6ea2ff;
    --err: #ff7b72;
    --ok: #56d364;
    --warn: #d29922;
    --wo: #ff8182;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
main { padding: 16px; max-width: 900px; margin: 0 auto; }
h1 { font-size: 1.4rem; margin: 0.2em 0 0.6em; }
h2 { font-size: 1.15rem; margin: 0 0 0.6em; }
h3 { font-size: 1rem; margin: 1em 0 0.4em; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.top .brand { font-weight: 600; text-decoration: none; color: var(--text); }
.top nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin: 0 0 16px;
}
.narrow { max-width: 420px; }
.inline { display: inline; }

label { display: block; margin: 0 0 12px; }
label.check { display: flex; gap: 8px; align-items: center; }
input, select, button { font: inherit; }
input:not([type=checkbox]), select {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text);
}
input.small { width: 7em; padding: 6px; margin: 0; }
input[type=checkbox] { width: 22px; height: 22px; }
button {
  padding: 10px 16px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }

.msg { padding: 10px 12px; border-radius: 6px; border: 1px solid; }
.msg.err, .err { color: var(--err); }
.msg.ok { color: var(--ok); }
.dim { color: var(--dim); }
.tag {
  font-size: 0.75rem; font-weight: normal; padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--accent); color: var(--accent); vertical-align: middle;
}

.msg.warn { color: var(--warn); }
.msg.wo { color: var(--wo); font-weight: 600; }

table { border-collapse: collapse; width: 100%; }
table.list { margin-bottom: 16px; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
table.kv td { padding: 4px 8px 4px 0; }
table.kv td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* counting screens */
.crumb { margin: 0 0 4px; }
input[type=search] { font-size: 1.05rem; }
.search { position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 2; }

.locs, .items { list-style: none; margin: 8px 0 16px; padding: 0; }
.locs li a.loc {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center;
  padding: 12px; margin-bottom: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; text-decoration: none; color: var(--text);
}
.locs .name { font-weight: 600; }
.locs .meta { color: var(--dim); font-size: 0.9rem; text-align: right; }
.locs .bar { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.locs .bar span { display: block; height: 100%; background: var(--ok); }
.locs a.closed, .locs a.empty { opacity: 0.6; }

.items li a {
  display: flex; gap: 10px; align-items: center; padding: 10px 8px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text);
}
.items li.done a, .items li.not_found a { opacity: 0.55; }
.items .what { flex: 1; min-width: 0; }
.items .mpn { font-weight: 600; word-break: break-all; }
.items .desc { display: block; color: var(--dim); font-size: 0.85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.items .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.items .counted { display: block; font-weight: 600; }
/* expected count is there but deliberately quiet */
.exp { color: var(--dim); font-size: 0.8rem; }
.elsewhere { color: var(--warn); font-size: 0.8rem; white-space: normal; display: block; max-width: 10em; }
.items.other .mpn { font-weight: normal; }
.tag.wo { border-color: var(--wo); color: var(--wo); }
.tag.var { border-color: var(--warn); color: var(--warn); }

.st { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--dim); flex: none; }
.st-counted { border-color: var(--warn); background: var(--warn); }
.st-done { border-color: var(--ok); background: var(--ok); }
.st-not_found { border-color: var(--err); background: var(--err); }

.count-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.count-head h1 { word-break: break-all; }
.count-head .expected { color: var(--dim); font-size: 0.85rem; white-space: nowrap; }
input.big { font-size: 1.6rem; padding: 12px; font-variant-numeric: tabular-nums; }
.total { margin: 4px 0 12px; min-height: 1.4em; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
button.big { flex: 1; font-size: 1.15rem; padding: 14px; }
details summary { cursor: pointer; }
details form { margin-top: 12px; }
