/* DOPE — zwart, geel, strak. Mobiel eerst; geen horizontale paginascroll. */
:root {
  --bg: #0b0b0c;
  --surface: #151517;
  --surface-2: #1d1d21;
  --line: #2c2c33;
  --text: #f4f4f1;
  --muted: #a3a3a8;
  --yellow: #ffc814;
  --yellow-ink: #141000;
  --ok: #4ade80;
  --warn: #fbbf24;
  --error: #f87171;
  --info: #93c5fd;
  --focus: #ffffff;
  --radius: 10px;
  --top-h: 56px;
  --bottom-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--yellow); }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: .8rem 0 .4rem; }
.sub { font-size: 1rem; color: var(--muted); }
p { margin: .4rem 0 .8rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.ok-text { color: var(--ok); }
.error-text { color: var(--error); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--yellow); color: var(--yellow-ink); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; }

/* Focus is een witte ring; actieve tab is geel gevuld. Zo lijkt focus nooit een tweede actieve tab. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- kopbalk en navigatie ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: var(--top-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
  background: rgba(11, 11, 12, .96); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; flex: none; }
.envbanner { background: #ff5a1f; color: #111; font-weight: 700; text-align: center; padding: .4rem 1rem; font-size: .9rem; line-height: 1.3; }
.envbadge { flex: none; background: #ff5a1f; color: #111; font-weight: 800; font-size: .75rem; letter-spacing: .05em; padding: .15rem .45rem; border-radius: 4px; }
.brand img { width: 104px; height: auto; display: block; }
.topnav { display: none; gap: .25rem; flex: 1; flex-wrap: wrap; padding: .35rem 0; }
.topnav a { color: var(--text); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; white-space: nowrap; font-size: .95rem; }
.topnav a:hover { background: var(--surface-2); }
.topnav a[aria-current="page"] { background: var(--yellow); color: var(--yellow-ink); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: .6rem; align-items: center; min-width: 0; }
.who { color: var(--muted); text-decoration: none; font-size: .9rem; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell { position: relative; text-decoration: none; font-size: 1.15rem; padding: .3rem; }
.pill { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--yellow); color: var(--yellow-ink); font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.4; }
.bell .pill { position: absolute; top: -2px; right: -6px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(11, 11, 12, .98); border-top: 1px solid var(--line);
}
.bottomnav[hidden] { display: none; }
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; background: none; border: 0; font: inherit; font-size: .72rem; cursor: pointer; min-width: 0;
}
.bottomnav .nav-icon { font-size: 1.15rem; line-height: 1; }
.bottomnav [aria-current="page"] { color: var(--yellow-ink); background: var(--yellow); font-weight: 700; }
body.has-bottomnav main { padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 1rem); }
/* Toetsenbord open op telefoon: onderste menu weg zodat velden en knoppen bereikbaar blijven. */
body.typing .bottomnav { display: none; }
body.typing.has-bottomnav main { padding-bottom: 1rem; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none !important; }
  body.has-bottomnav main { padding-bottom: 2rem; }
  .brand img { width: 120px; }
}

/* ---------- pagina ---------- */
main { display: block; }
main:focus { outline: none; }
.page { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.page.narrow { max-width: 520px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin: 0; }
.loading { color: var(--muted); }
.empty { color: var(--muted); padding: 1rem; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .8rem 0; }
.two-col { display: grid; gap: 1rem; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.links { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }

/* ---------- formulieren ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .92rem; color: var(--text); }
label small { color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; width: 100%; min-width: 0;
}
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--yellow); flex: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[readonly] { opacity: .65; }
label.check { flex-direction: row; align-items: flex-start; gap: .6rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin: 0; display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
legend { padding: 0 .3rem; color: var(--muted); font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.two { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: end; }
.form-error { color: var(--error); margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--error); color: var(--error); }
.btn.primary.danger { background: var(--error); color: #1a0000; }
.btn.small { min-height: 38px; padding: .35rem .75rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; color: var(--yellow); font: inherit; cursor: pointer; text-decoration: underline; }
.linkish.danger { color: var(--error); }
.icon-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; width: 44px; height: 44px; font-size: 1.2rem; cursor: pointer; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- badges en meldingen ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); margin: .1rem .25rem .1rem 0; }
.badge.ok { color: var(--ok); border-color: rgba(74, 222, 128, .45); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 36, .45); }
.badge.error { color: var(--error); border-color: rgba(248, 113, 113, .5); }
.badge.info { color: var(--info); border-color: rgba(147, 197, 253, .45); }
.notice { border-left: 4px solid var(--line); background: var(--surface); padding: .7rem .9rem; border-radius: 6px; margin: .8rem 0; }
.notice.ok { border-color: var(--ok); }
.notice.warn { border-color: var(--warn); }
.notice.error { border-color: var(--error); }
.notice.info { border-color: var(--info); }
.notice.big { font-size: 1.05rem; }
.blocker { color: var(--warn); font-size: .85rem; margin: .2rem 0; }
.blockers { margin: .3rem 0 .6rem; padding-left: 1.1rem; color: var(--warn); font-size: .9rem; }
.reply { border-left: 3px solid var(--yellow); padding-left: .7rem; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(150%); bottom: calc(var(--bottom-h) + 14px + env(safe-area-inset-bottom));
  max-width: min(92vw, 520px); background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  padding: .7rem 1rem; border-radius: 8px; z-index: 60; transition: transform .2s ease, opacity .2s ease; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.error { border-left-color: var(--error); }
.toast.warn { border-left-color: var(--warn); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* ---------- lijsten en tabellen ---------- */
.list { list-style: none; margin: .5rem 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.list > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; min-width: 0; overflow-wrap: anywhere; }
.list > li.unread { border-left: 4px solid var(--yellow); }
.list > li > a { color: inherit; text-decoration: none; display: block; }
.list > li > small { display: block; color: var(--muted); }
.list.orders > li:hover { border-color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.badges { margin: .3rem 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .2rem 0 0; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.table .num { text-align: right; white-space: nowrap; }
/* Op smalle schermen worden tabelrijen kaarten: geen horizontale scroll. */
@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; padding: .5rem .7rem; }
  .table td { border: 0; padding: .2rem 0; }
  .table td.num { text-align: left; display: flex; justify-content: space-between; }
  .table td.num::before { content: attr(data-th); color: var(--muted); font-size: .85rem; }
  .table td:not([data-th]).num::before { content: ''; }
}
.chips, .tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.chip, .tabs a { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip[aria-current="page"], .tabs a[aria-current="page"] { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); font-weight: 600; }

/* ---------- aanbod ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0; align-items: end; }
.filters .grow { grid-column: 1 / -1; }
.filters .actions { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: repeat(6, minmax(0, 1fr)); } .filters .grow { grid-column: span 2; } .filters .actions { grid-column: auto; } }
.results-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: .4rem 0; }
.letters { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0 .8rem; }
.letters button { min-width: 38px; min-height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
details.group { border: 1px solid var(--line); border-radius: var(--radius); margin: .5rem 0; background: var(--surface); scroll-margin-top: calc(var(--top-h) + 8px); }
details.group > summary { cursor: pointer; padding: .7rem .9rem; display: flex; justify-content: space-between; font-weight: 700; font-size: 1.05rem; list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: '▸'; color: var(--yellow); margin-right: .5rem; }
details.group[open] > summary::before { content: '▾'; }
details.group > summary > span:first-child { flex: 1; }
.products { display: grid; gap: .5rem; padding: 0 .6rem .6rem; }
.page > .products { padding: 0; }
.product { display: grid; grid-template-columns: 1fr; gap: .5rem; padding: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.product.in-cart { border-color: var(--yellow); }
.product h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.product .strength { color: var(--yellow); font-weight: 600; }
.product .meta { margin: .15rem 0 .3rem; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.p-buy { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.05rem; }
.price small { display: block; color: var(--muted); font-weight: 400; font-size: .75rem; }
.qty { display: flex; align-items: center; gap: .3rem; }
.qty input { width: 4.2rem; text-align: center; padding: .5rem .3rem; }
@media (min-width: 720px) { .product { grid-template-columns: 1fr auto; align-items: center; } .p-buy { flex-direction: column; align-items: flex-end; } }
.cartbar {
  position: sticky; bottom: calc(var(--bottom-h) + 8px + env(safe-area-inset-bottom)); z-index: 10; margin-top: 1rem;
  display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--yellow); border-radius: var(--radius); padding: .6rem .8rem;
}
body.typing .cartbar { bottom: 8px; }
@media (min-width: 900px) { .cartbar { bottom: 12px; } }
.cart-lines { display: flex; flex-direction: column; gap: .5rem; }
.cart-line { display: grid; grid-template-columns: 1fr; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.cart-line.problem { border-color: var(--error); }
.cart-qty { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.cart-qty input { width: 5rem; }
.line-total { font-weight: 700; margin-left: auto; }
@media (min-width: 720px) { .cart-line { grid-template-columns: 1fr auto; align-items: center; } }
.totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.totals strong { font-size: 1.05rem; }

/* ---------- order ---------- */
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .8rem 0; }
.status-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.status-grid span:first-child { color: var(--muted); font-size: .78rem; }
.status-grid .badge { border-radius: 8px; margin: 0; }
.lines { display: flex; flex-direction: column; gap: .5rem; }
.line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.line-head { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; margin: .5rem 0; }
.counts div { background: var(--bg); border-radius: 6px; padding: .3rem .4rem; text-align: center; }
.counts dt { color: var(--muted); font-size: .7rem; }
.counts dd { margin: 0; font-weight: 700; }
.admin-actions { display: grid; gap: .5rem; }
@media (min-width: 900px) { .admin-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.admin-actions .card { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; }
.deliver-line { margin-bottom: .5rem; }

/* ---------- beheer ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .8rem 0; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; gap: .2rem; padding: .8rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.tile strong { font-size: 1.6rem; line-height: 1; }
.tile span { color: var(--muted); font-size: .85rem; }
.tile.info strong { color: var(--info); }
.tile.warn strong { color: var(--warn); }
.tile.error strong { color: var(--error); }
.prod-row { display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; align-items: start; }
.prod-row > .badge, .prod-row > .blocker { grid-column: 2; }
.prod-open { text-align: left; text-decoration: none; color: var(--text); }
.prod-open strong { text-decoration: underline; text-decoration-color: var(--line); }
.bulkbar { position: sticky; top: calc(var(--top-h) + 4px); z-index: 9; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--yellow); border-radius: var(--radius); padding: .5rem .7rem; }
.picker, .count-list { display: flex; flex-direction: column; gap: .35rem; max-height: 50vh; overflow-y: auto; padding-right: .2rem; }
.pick, .count-row { flex-direction: row; align-items: center; justify-content: space-between; gap: .6rem; background: var(--surface-2); border-radius: 8px; padding: .4rem .6rem; }
.pick input, .count-row input { width: 5rem; flex: none; }
.pick[hidden], .count-row[hidden] { display: none; }
.count-list { max-height: none; }
.sticky-actions { position: sticky; bottom: calc(var(--bottom-h) + 8px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: center; gap: .6rem; background: var(--surface-2); border: 1px solid var(--yellow); border-radius: var(--radius); padding: .6rem .8rem; }
body.typing .sticky-actions { bottom: 8px; }
@media (min-width: 900px) { .sticky-actions { bottom: 12px; } }
.secret { display: inline-block; font-size: 1.05rem; letter-spacing: .05em; background: var(--surface-2); padding: .4rem .6rem; border-radius: 6px; word-break: break-all; user-select: all; }
.steps { padding-left: 1.2rem; }
.more-menu { display: flex; flex-direction: column; gap: .3rem; }
.more-menu a { padding: .7rem .8rem; border-radius: 8px; color: var(--text); text-decoration: none; background: var(--surface-2); }
.more-menu a[aria-current="page"] { background: var(--yellow); color: var(--yellow-ink); font-weight: 700; }

/* ---------- dialoog: altijd binnen het zichtbare scherm, knoppen bereikbaar ---------- */
dialog {
  padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow: hidden;
}
dialog.wide { width: min(820px, calc(100vw - 16px)); }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100dvh - 18px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: .8rem; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .7rem 1rem; border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.modal-form > .form-error { padding: 0 1rem; }
@media (max-width: 520px) { dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 12px 12px 0 0; } .modal-foot .btn { flex: 1; } }
