/* Beheer, scheidsrechter en banenteller */
:root {
  --navy: #0b2545; --blue: #1366b3; --cyan: #2bb5e8; --bg: #f2f5f9; --card: #fff; --txt: #17202b; --dim: #667487; --line: #dde3ea;
  --ok: #1a8f5a; --okbg: #e3f5ec; --err: #b3261e; --errbg: #fbe9e7; --warn: #9a6700; --warnbg: #fff4d6;
  --plus: #19a463; --minus: #d2452f; --pending: #f2b705;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--txt); font-size: 16px; line-height: 1.45; }
a { color: var(--blue); }
h1 { font-size: 1.7rem; margin: .4em 0 .6em; }
h1 small, h2 small { font-weight: 400; color: var(--dim); font-size: .7em; }
h2 { font-size: 1.2rem; margin: 0 0 .7em; }
h3 { font-size: 1rem; margin: 1.4em 0 .6em; }
code { background: #eef2f6; padding: 0 .3em; border-radius: 4px; }
.muted { color: var(--dim); }
.center { text-align: center; }
.r { text-align: right; }

.top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--navy); color: #fff; padding: .6rem 1.2rem; }
.top .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.top nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.top nav a { color: #cfe0f3; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; }
.top nav a.on, .top nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.top .who { font-size: .9rem; color: #cfe0f3; }
.top .who a { color: #fff; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
.wrap.wide { max-width: 1500px; }
.wrap.narrow { max-width: 460px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.stat span { display: block; color: var(--dim); font-size: .85rem; }
.stat strong { font-size: 1.6rem; }
.status-bezig { color: var(--ok); } .status-afgelopen { color: var(--warn); } .status-voorbereiding { color: var(--dim); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--okbg); color: var(--ok); border: 1px solid #bfe6d1; }
.flash.err { background: var(--errbg); color: var(--err); border-color: #f3c3bd; }
.flash.warn { background: var(--warnbg); color: var(--warn); border-color: #f0dca0; }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--txt); padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .65rem; font-size: .88rem; }
.btn.pulse { box-shadow: 0 0 0 4px rgba(19, 102, 179, .3); }

form.inline { display: inline; }
.form { display: grid; gap: .9rem; }
.form.cols { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form .full { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
.form label small { font-weight: 400; color: var(--dim); }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.form.big input { font-size: 1.2rem; padding: .7rem; }
input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--txt); }
textarea { width: 100%; margin-bottom: .6rem; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.links { width: 100%; border-collapse: collapse; margin-bottom: .8rem; }
.links td { padding: .3rem .4rem; }
.links td:first-child { white-space: nowrap; width: 1%; }
.links input { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .5rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th.r, table.list td.r { text-align: right; }
table.list th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); }
tr.inactive td { color: var(--dim); }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 99px; background: #eef2f6; color: var(--dim); font-weight: 600; }
.tag.warn { background: var(--warnbg); color: var(--warn); }
.danger-zone { border-color: #f3c3bd; }

.tabs { display: flex; gap: .3rem; margin: 0 0 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem 1rem; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--txt); font-weight: 600; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.lanes-edit { display: grid; grid-template-columns: repeat(var(--lanes), minmax(200px, 1fr)); gap: .8rem; overflow-x: auto; }
.lane-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.lane-row span { min-width: 0; overflow-wrap: anywhere; }
.lane-row select { padding: .25rem .3rem; width: 6.5em; flex-shrink: 0; }

/* Scheidsrechter */
.refbar { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; }
.refbar span { display: block; font-size: .8rem; }
.refbar strong { font-size: 1.4rem; }
.refbtns { margin-left: auto; display: flex; gap: .5rem; }
.ref-lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 700px), 1fr)); gap: 1rem; }
.ref-lane { overflow-x: auto; }
.ref-table td.big { font-size: 1.25rem; font-weight: 700; white-space: nowrap; }
.ref-table td.nm { font-weight: 600; }
.ref-table td.acts { white-space: nowrap; }
.ref-table td.acts .btn { margin-right: .2rem; }
.ref-table tr.recent td { background: #eaf7f0; }
.dlg { border: none; border-radius: 14px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dlg::backdrop { background: rgba(11, 37, 69, .45); }
.dlg-inner { padding: 1.2rem 1.4rem; display: grid; gap: .8rem; }
.dlg-inner label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.dlg-foot { text-align: right; }
.scroll { max-height: 55vh; overflow: auto; }
table.hist tr.voided td { text-decoration: line-through; color: var(--dim); }
table.hist tr.voided td:last-child { text-decoration: none; }
td.pos { color: var(--plus); font-weight: 700; } td.neg { color: var(--minus); font-weight: 700; }

/* Banenteller (tablet) */
body.teller-body { background: #0b2545; color: #fff; }
body.teller-body h1 { color: #fff; }
.lane-pick { display: grid; grid-template-columns: repeat(var(--lanes), 1fr); gap: 1rem; margin: 2rem 0; }
.lane-btn { aspect-ratio: 1; background: #fff; color: var(--navy); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; font-size: 1.4rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.lane-btn strong { font-size: 4.5rem; line-height: 1; }
.lane-btn small { color: var(--dim); font-size: 1rem; }
main.teller { height: 100vh; height: 100dvh; padding: 0; }
#app { height: 100%; display: flex; flex-direction: column; }
.tbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; background: #071a33; }
.tbar-lane { color: #fff; text-decoration: none; font-size: 1.8rem; font-weight: 800; }
.tbar-lane small { font-size: .8rem; font-weight: 400; color: #9fb7d3; margin-left: .3rem; }
.tbar-mid { display: flex; align-items: center; gap: 1rem; }
.pill { padding: .25rem .8rem; border-radius: 99px; font-weight: 700; background: #33465e; }
.pill.st-bezig { background: var(--plus); } .pill.st-afgelopen { background: #a07400; }
.clock { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--cyan); }
.tbar-right { text-align: right; font-size: .9rem; }
.lanetotal { font-weight: 700; font-size: 1.05rem; }
.net.ok { color: #6be0a5; } .net.busy { color: #ffd166; } .net.bad { color: #ff8a7a; font-weight: 700; }
.banner { background: #ffd166; color: #3b2a00; padding: .7rem 1rem; font-weight: 600; text-align: center; }
.banner a { color: #3b2a00; }
.tgrid { flex: 1; min-height: 0; display: grid; gap: 12px; padding: 12px; align-content: center; justify-content: center; overflow: auto; }
.tgrid .empty { grid-column: 1 / -1; text-align: center; color: #cfe0f3; font-size: 1.3rem; }
.swim { position: relative; width: var(--size, 180px); height: var(--size, 180px); max-width: 100%; border: none; border-radius: 18px; background: #fff; color: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em; padding: .6em; cursor: pointer; overflow: hidden;
  font: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  box-shadow: 0 5px 0 #b8c7d9, 0 8px 18px rgba(0, 0, 0, .25); transition: background .15s, transform .05s; }
.swim:active { transform: translateY(3px); box-shadow: 0 2px 0 #b8c7d9; }
.swim .nm { font-size: calc(var(--size, 180px) * .12); font-weight: 700; text-align: center; line-height: 1.15; max-height: 2.4em; overflow: hidden; word-break: break-word; }
.swim .mt { font-size: calc(var(--size, 180px) * .2); font-weight: 800; font-variant-numeric: tabular-nums; }
.swim .badge { font-size: calc(var(--size, 180px) * .075); font-weight: 700; min-height: 1.2em; }
.swim .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: transparent; }
.swim .bar i { display: block; height: 100%; width: 0; background: rgba(255, 255, 255, .85); }
.swim.pending { background: var(--pending); color: #2b2100; box-shadow: 0 5px 0 #b98b00; }
.swim.locked.plus { background: var(--plus); color: #fff; box-shadow: 0 5px 0 #0e6b40; }
.swim.locked.minus { background: var(--minus); color: #fff; box-shadow: 0 5px 0 #8e2a1b; }
.swim.locked { cursor: not-allowed; }
.swim.changed:not(.locked):not(.pending) { background: #d8f1ff; }
.swim.queued .mt::after { content: " ⟳"; font-size: .5em; vertical-align: middle; }
.swim.off { opacity: .55; }
.swim.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.toast { position: fixed; left: 50%; bottom: 3.2rem; transform: translateX(-50%); background: #fff; color: var(--navy); padding: .8rem 1.2rem; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); max-width: 90vw; text-align: center; }
.toast.warn { background: #fff4d6; color: #5c3f00; }
.thelp { text-align: center; font-size: .85rem; color: #9fb7d3; padding: .4rem; background: #071a33; }

/* Afrekening */
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.print-only { display: none; }
@media print {
  .top, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card { border: none; padding: 0; }
  .bill { page-break-after: always; }
  .print-only { display: table-cell; }
}
@media (max-width: 700px) {
  .ref-lanes { grid-template-columns: 1fr; }
  .refbtns { margin-left: 0; }
  .ref-table td.acts { white-space: normal; }
}
