:root {
  --bg: #f2f4f7; --card: #fff; --ink: #15202b; --muted: #5d6b7a; --line: #dbe2ea;
  --brand: #1f3a5f; --brand2: #2e5b8f; --ok: #15803d; --okbg: #e7f6ed;
  --warn: #a15c07; --warnbg: #fff3dc; --err: #b91c1c; --errbg: #fdeaea; --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand2); }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  background: var(--brand); color: #fff; padding: 10px 14px; }
.bar .brand { font-weight: 700; margin-right: auto; }
.bar a, .bar button.link { color: #fff; background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0; font-size: 14px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.16); white-space: nowrap; }
.pill.off { background: #f59e0b; color: #1b1300; font-weight: 600; }
.pill.demo { background: #fde68a; color: #3b2a00; }

main { max-width: 760px; margin: 0 auto; padding: 12px; }
h2 { font-size: 17px; margin: 16px 0 8px; }
h2 small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand2); border-color: var(--brand2); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; margin-top: 12px; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.grid button { min-height: 58px; padding: 8px; border-radius: var(--r); border: 2px solid var(--line); background: var(--card);
  font-size: 17px; font-weight: 600; cursor: pointer; }
.grid button.on { border-color: var(--brand2); background: #e8f0fa; color: var(--brand); }
.row { display: flex; gap: 8px; margin-top: 8px; }
input[type=text], input[type=password], input[type=number], input:not([type]), select {
  width: 100%; min-height: 48px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, select:focus { outline: none; border-color: var(--brand2); }

/* scanner */
.ctx { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.ctx b { font-size: 17px; }
#scan-form { display: flex; gap: 8px; }
#code { font-size: 22px; min-height: 60px; border-width: 3px; border-color: var(--brand2); font-family: ui-monospace, Consolas, monospace; }
#code:focus { box-shadow: 0 0 0 4px rgba(46,91,143,.2); }
#kbd { min-width: 60px; font-size: 22px; }
.toggles { display: flex; justify-content: space-between; align-items: center; margin: 8px 2px; font-size: 14px; color: var(--muted); }
.toggles label { display: flex; align-items: center; gap: 6px; }
.toggles input { width: 20px; height: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.last { min-height: 110px; border-width: 2px; }
.last .hint { color: var(--muted); text-align: center; padding: 26px 0; }
.last.ok { border-color: var(--ok); background: var(--okbg); }
.last.unk { border-color: var(--warn); background: var(--warnbg); }
.last.err { border-color: var(--err); background: var(--errbg); }
.last.pend { border-color: #9aa7b5; background: #eef1f4; }
.last .row1 { display: flex; justify-content: space-between; align-items: center; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--ok); color: #fff; }
.unk .tag { background: var(--warn); }
.plus { font-size: 22px; font-weight: 800; }
.big { font-size: 19px; font-weight: 700; margin: 4px 0; word-break: break-word; }
.meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.tot { margin-top: 6px; font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: 6px 2px; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 12px; color: var(--muted); }

.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.lines li.unk { border-left: 5px solid var(--warn); }
.lines li.pending { opacity: .65; border-style: dashed; }
.lines .q { min-width: 46px; font-size: 19px; font-weight: 800; text-align: center; }
.lines .info { flex: 1; min-width: 0; }
.lines .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 17px; }
.actions { display: flex; gap: 8px; margin: 14px 0 30px; }
.actions .btn { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--brand2); text-decoration: underline; cursor: pointer; padding: 8px 0; }

.done { text-align: center; padding: 30px 10px; }
.done .check { font-size: 56px; color: var(--ok); }
.done code { display: block; margin: 10px 0; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; word-break: break-all; font-size: 13px; }

.modal { position: fixed; inset: 0; background: rgba(10,20,30,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal .box { background: #fff; border-radius: 14px; padding: 16px; width: 100%; max-width: 440px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 8px; }
.modal .btns { display: flex; gap: 8px; margin-top: 14px; }
.modal .btns .btn { flex: 1; }
#m-input { font-size: 30px; font-weight: 700; text-align: center; margin-top: 10px; min-height: 64px; border-width: 3px; border-color: var(--brand2); }
.merr { color: var(--err); font-weight: 600; min-height: 1.3em; margin-top: 6px; text-align: center; }
.qty-info { margin-top: 6px; font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #15202b; color: #fff; padding: 10px 16px;
  border-radius: 10px; z-index: 60; max-width: 92vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--err); }

/* login */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login h1 { font-size: 22px; }
.login .err { color: var(--err); min-height: 1.4em; }

/* beheer */
body.admin main { max-width: 1200px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--brand); border-color: var(--brand2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.filters select, .filters input { width: auto; min-height: 40px; }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f7f9fb; font-weight: 600; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr.closed td { color: var(--muted); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #e5e7eb; }
.badge.open { background: #dbeafe; color: #1e40af; }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cards .card h3 { margin: 0 0 8px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 99px; background: #eef2f7; font-size: 14px; }
.chip.off { opacity: .45; text-decoration: line-through; }
.chip button { border: 0; background: none; cursor: pointer; font-size: 13px; padding: 0 4px; color: var(--muted); }
.inline { display: flex; gap: 6px; }
.inline input, .inline select { min-height: 38px; }
.inline .btn { min-height: 38px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.results .card { margin-bottom: 8px; }
.files li { padding: 4px 0; font-size: 14px; }
.files { list-style: none; padding-left: 0; }
.files .dir { font-weight: 700; margin-top: 10px; }
@media (max-width: 520px) { .stats b { font-size: 17px; } .kv { grid-template-columns: 1fr; } }
