:root {
  --navy: #14324a;
  --navy-2: #1f4a6b;
  --orange: #f08a24;
  --bg: #f3f5f7;
  --card: #fff;
  --text: #17222c;
  --muted: #5f6d7a;
  --line: #dbe2e8;
  --ok: #1f8a4c;
  --warn: #c98200;
  --err: #c0392b;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.noscroll { overflow: hidden; }
a { color: var(--navy-2); }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { margin-left: auto; text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.err { color: var(--err); }

/* Kopbalk */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--navy); color: #fff; padding: .55rem 1rem;
  padding-top: calc(.55rem + env(safe-area-inset-top));
}
.top .brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.top .brand img { border-radius: 7px; }
.top nav { display: flex; gap: .25rem; }
.top nav a { color: #cfe0ee; text-decoration: none; padding: .45rem .75rem; border-radius: 8px; font-weight: 600; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: #cfe0ee; margin-bottom: 0; }
.top .who .link { color: #fff; }
@media (max-width: 640px) {
  .top { gap: .4rem .75rem; }
  .top .who span { display: none; }
  .top nav { order: 3; width: 100%; }
  .top nav a { flex: 1; text-align: center; }
}

.wrap { max-width: 960px; margin: 0 auto; padding: 1rem; }
.card {
  display: block; background: var(--card); border-radius: var(--radius); padding: 1.1rem;
  margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(20,50,74,.06), 0 0 0 1px var(--line);
  color: inherit; text-decoration: none;
}
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 1rem; }

/* Formulieren */
label { display: block; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400;
  padding: .7rem .8rem; border: 1px solid #c4ced8; border-radius: 10px; background: #fff; color: var(--text);
  min-height: 48px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(240,138,36,.35); border-color: var(--orange); }
input.filled { background: #f2fbf5; border-color: #9fd3b2; }
label.check { display: flex; align-items: center; gap: .6rem; font-weight: 500; min-height: 48px; }
label.check input { width: 22px; height: 22px; min-height: 0; margin: 0; }
.stack > * + * { margin-top: .9rem; }
.grid2, .grid3 { display: grid; gap: .8rem; grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: .88rem; margin: .3rem 0 0; min-height: 1.2em; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; gap: .5rem; align-items: center; margin: .5rem 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 650; padding: .65rem 1rem; min-height: 44px; border-radius: 10px;
  border: 1px solid #c4ced8; background: #fff; color: var(--navy); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--navy-2); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: #da7a17; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.small { min-height: 36px; padding: .35rem .7rem; font-size: .88rem; }
.btn.big { width: 100%; min-height: 58px; font-size: 1.1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; word-break: break-word; }
.flash.ok { background: #e6f6ec; color: #145c33; border: 1px solid #b9e2c8; }
.flash.fout { background: #fdecea; color: #8e2318; border: 1px solid #f3c2bc; }
.banner { background: #fff4e6; border: 1px solid #f6cf9f; padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; }

/* Inloggen */
body.login-page { display: grid; min-height: 100vh; place-items: center; background: var(--navy); }
.login-card { background: #fff; border-radius: 18px; padding: 1.6rem; width: min(380px, calc(100vw - 2rem)); text-align: center; }
.login-card form { text-align: left; }
.login-card form > * + * { margin-top: .9rem; }
.login-card img { border-radius: 14px; }

/* Uploadscherm */
.step {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--orange); color: #fff; font-size: .95rem; margin-right: .35rem; vertical-align: 2px;
}
.klus-head { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.klus-head h1 { margin-bottom: .25rem; }
.klus-head p { margin: 0; }
.klus-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.klus-list { list-style: none; margin: 0; padding: 0; }
.klus-pick { display: block; padding: .8rem; border-radius: 10px; border: 1px solid var(--line); margin-bottom: .5rem; text-decoration: none; color: inherit; }
.klus-pick:hover { border-color: var(--orange); }
.klus-pick span { display: block; font-size: .88rem; }

.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pick {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  min-height: 118px; border-radius: var(--radius); background: var(--navy); color: #fff; cursor: pointer;
  font-size: 1.05rem; font-weight: 700; text-align: center; user-select: none;
}
.pick:active { transform: scale(.98); }
.pick:nth-child(1) { background: var(--orange); }
.pick .ico { font-size: 2.2rem; line-height: 1; }
.pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.pick:focus-within { outline: 3px solid rgba(240,138,36,.5); outline-offset: 2px; }

details.datum { margin-top: 1rem; border: 1px dashed var(--line); border-radius: 10px; padding: .7rem .9rem; }
details.datum summary { cursor: pointer; font-weight: 600; }
details.datum[open] summary { margin-bottom: .7rem; }

.summary { margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; background: #eef4f9; font-weight: 500; }
.summary[data-busy="0"] { background: #e6f6ec; }
.queue { list-style: none; padding: 0; margin: 1rem 0 0; }
.q-item { display: flex; gap: .75rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); }
.q-thumb { flex: 0 0 52px; height: 52px; border-radius: 8px; background: #e7ecf0; display: grid; place-items: center; font-size: 1.5rem; overflow: hidden; }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; }
.q-body { flex: 1; min-width: 0; }
.q-name { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-status { font-size: .85rem; color: var(--muted); }
.bar { height: 6px; background: #e3e9ee; border-radius: 4px; overflow: hidden; margin: .3rem 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }
.q-item[data-state="klaar"] .bar span { background: var(--ok); }
.q-item[data-state="klaar"] .q-status { color: var(--ok); }
.q-item[data-state="dubbel"] .q-status { color: var(--warn); }
.q-item[data-state="fout"] { cursor: pointer; }
.q-item[data-state="fout"] .q-status { color: var(--err); font-weight: 600; }
.q-item[data-state="fout"] .bar span { background: var(--err); width: 100% !important; }

/* Archief */
.search { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.search .grow { flex: 1 1 260px; }
.search label:not(.grow) { flex: 1 1 140px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.chip { padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--navy); font-size: .9rem; background: #fff; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.klus-row:hover { box-shadow: 0 0 0 2px var(--orange); }
.klus-row-head { display: flex; gap: 1rem; align-items: flex-start; }
.strip { display: flex; gap: .4rem; margin-top: .7rem; overflow: hidden; }
.strip .tile { flex: 0 0 72px; height: 72px; }
.tile { position: relative; display: block; border-radius: 8px; overflow: hidden; background: #e3e9ee; border: 0; padding: 0; cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.is-video::after { content: "▶"; position: absolute; left: 6px; bottom: 4px; color: #fff; font-size: .9rem; text-shadow: 0 1px 3px #000; }
.tile .time { position: absolute; right: 5px; bottom: 4px; color: #fff; font-size: .75rem; text-shadow: 0 1px 3px #000; }
.tile .noimg { display: grid; place-items: center; height: 100%; font-size: 1.8rem; color: var(--muted); }
.tile .noimg small { font-size: .7rem; display: block; }
.tile.pending { opacity: .7; }
.day h2 { margin: 1.4rem 0 .6rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.gallery .tile { aspect-ratio: 1; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0 2rem; }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: #0b141c; display: flex; flex-direction: column; }
.v-bar { display: flex; gap: .5rem; align-items: center; padding: .6rem; padding-top: calc(.6rem + env(safe-area-inset-top)); color: #dbe5ee; flex-wrap: wrap; }
.v-bar .v-info { flex: 1 1 100%; order: 9; font-size: .8rem; min-width: 0; overflow-wrap: anywhere; color: #9fb3c4; }
.v-bar .v-close { margin-left: auto; }
.v-bar form { margin: 0; }
.v-stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: .5rem; }
.v-stage img, .v-stage video { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
.v-msg { color: #fff; text-align: center; padding: 2rem; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 2.2rem; cursor: pointer; }
.v-nav:disabled { opacity: .15; }
.v-prev { left: 8px; }
.v-next { right: 8px; }

/* Beheer */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .55rem .9rem; border-radius: 10px; text-decoration: none; color: var(--navy); font-weight: 600; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.tabs a.on { background: var(--navy); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: #fff; border-radius: var(--radius); padding: 1rem; box-shadow: 0 0 0 1px var(--line); }
.stat b { display: block; font-size: 1.5rem; color: var(--navy); }
.stat span { color: var(--muted); font-size: .9rem; }
table { width: 100%; border-collapse: collapse; }
table.list td, table.checks td { padding: .55rem .4rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.checks td:first-child { white-space: nowrap; font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; background: var(--ok); }
.dot.let-op { background: var(--warn); }
.dot.fout { background: var(--err); }
details.user, details.year { border-top: 1px solid var(--line); padding: .7rem 0; }
details.user summary, details.year summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
details.user[open] summary, details.year[open] summary { margin-bottom: .8rem; }
details.user.inactive { opacity: .6; }
.badge { font-size: .75rem; background: #e7eef4; color: var(--navy); padding: .1rem .5rem; border-radius: 999px; font-weight: 600; }
.badge.off { background: #fdecea; color: var(--err); }
.danger-zone { box-shadow: 0 0 0 2px #f3c2bc; }
