:root {
  --bg: #f4f7fa; --panel: #fff; --ink: #14212b; --muted: #5d6b78; --line: #dbe3ea;
  --accent: #0a6fb5; --accent-ink: #fff; --ok: #1d8a4f; --warn: #b7791f; --err: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 20px; background: #0b3954; color: #fff; }
header.top a { color: #fff; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; }
.brand-logo { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; padding: 4px 6px; height: 46px; }
.brand-logo img { height: 38px; width: auto; display: block; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { padding: 6px 12px; border-radius: 6px; opacity: .85; }
nav a.active, nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
.who { margin-left: auto; font-size: 14px; opacity: .9; }
body { min-height: 100vh; display: flex; flex-direction: column; }
main { max-width: 1200px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; flex: 1 0 auto; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 14px 20px; border-top: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-size: 13px; }
h1 { font-size: 24px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
input, select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=checkbox] { display: inline; width: auto; margin: 0; }
.num { width: 110px; }
.title-input { font-size: 18px; font-weight: 600; max-width: 420px; }
.code-input { text-transform: uppercase; letter-spacing: 3px; font-family: ui-monospace, Consolas, monospace; }
.inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.inline input:not([type=checkbox]) { width: auto; flex: 1 1 220px; margin: 0; }
.inline label { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; align-items: end; }
.btn { display: inline-block; padding: 8px 16px; font: inherit; font-weight: 600; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; margin-bottom: 10px; }
.btn.small { padding: 5px 10px; font-size: 13px; margin: 0; }
.btn.ghost { background: #e8eef3; color: var(--ink); }
.btn.danger { background: #fbe9e7; color: var(--err); }
.btn:disabled { opacity: .35; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #e6f4ec; color: var(--ok); }
.flash.err { background: #fbe9e7; color: var(--err); }
.err-text { color: var(--err); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; vertical-align: middle; }
.badge.on { background: #e6f4ec; color: var(--ok); }
.badge.off { background: #eceff2; color: var(--muted); }
.badge.warn { background: #fdf3e1; color: var(--warn); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat b { display: block; font-size: 28px; }
.stat span { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
table.items input { margin: 0; }
.filters { display: flex; gap: 6px; margin: 4px 0 14px; }
.filters a { padding: 5px 12px; border-radius: 99px; background: #e8eef3; color: var(--ink); text-decoration: none; font-size: 14px; }
.filters a.active { background: var(--accent); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.tile .rename input { margin: 0; font-weight: 600; border-color: transparent; padding: 4px 6px; }
.tile .rename input:focus { border-color: var(--line); }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #0b1a24; border-radius: 6px; }
.mini { width: 96px; aspect-ratio: 16/9; object-fit: cover; background: #0b1a24; border-radius: 4px; display: block; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pick { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); margin: 0; }
.pick:has(input:checked) { border-color: var(--accent); background: #eef6fc; }
.pick .mini { width: 100%; }
.pick span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: #eef6fc; }
.dropzone input { display: none; }
.upload-row { display: grid; grid-template-columns: 1fr 160px 110px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.upload-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row progress { width: 100%; }
.upload-row.failed .state { color: var(--err); }
.upload-row.done .state { color: var(--ok); }
code { background: #eef2f5; padding: 1px 6px; border-radius: 4px; }
@media (max-width: 600px) {
  .who { margin-left: 0; width: 100%; }
  .brand-logo { height: 38px; } .brand-logo img { height: 30px; }
  .site-footer { justify-content: center; text-align: center; }
  .upload-row { grid-template-columns: 1fr 80px; }
  .upload-row progress { display: none; }
}

/* ---- Fase 2: planning ---- */
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 16px; }
.segmented label { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 12px 40px; position: relative; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink); font-weight: 600; margin: 0; }
.segmented label small { font-weight: 400; color: var(--muted); }
.segmented input { position: absolute; left: 14px; top: 15px; width: auto; margin: 0; }
.segmented label:has(input:checked) { border-color: var(--accent); background: #eef6fc; }
fieldset.days { border: 0; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
fieldset.days legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; padding: 0; }
fieldset.days label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); margin: 0; cursor: pointer; }
fieldset.days label:has(input:checked) { border-color: var(--accent); background: #eef6fc; }
#scheduleForm.is-event .when-recurring, #scheduleForm:not(.is-event) .when-event { display: none; }
.week { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.week-row { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; }
.week-row > span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.week .bar { position: relative; height: 30px; background: #eef2f5; border-radius: 6px; overflow: hidden; }
.week-axis .bar { height: 16px; background: none; overflow: visible; }
.week-axis i { position: absolute; transform: translateX(-50%); font-style: normal; font-size: 11px; color: var(--muted); }
.week-axis i:first-child { transform: none; }
.week-axis i:last-child { transform: translateX(-100%); }
.seg { position: absolute; top: 0; bottom: 0; border-right: 1px solid rgba(255,255,255,.7); overflow: hidden; }
.seg.empty { background: repeating-linear-gradient(45deg, #e3e8ec, #e3e8ec 6px, #eef2f5 6px, #eef2f5 12px) !important; }
.seg em { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--err); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
details summary { cursor: pointer; margin: 8px 0; }
@media (max-width: 600px) { .week-row { grid-template-columns: 56px 1fr; } .seg em { display: none; } }

/* ---- Fase 3: wedstrijdmodus en scoreborden ---- */
textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: 13px/1.4 ui-monospace, Consolas, monospace; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); margin: 8px 0 14px; }
td.url { font-size: 13px; word-break: break-all; color: var(--muted); }
.btn.big { padding: 14px 22px; font-size: 17px; width: 100%; margin: 6px 0 0; }
.match .live { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; margin-bottom: 14px; border-radius: 8px; background: #fdf3e1; border: 1px solid #f0d9a8; }
.match .live form { flex: 0 0 auto; min-width: 140px; }
.match-form { display: flex; flex-direction: column; gap: 4px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 10px; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; padding: 16px 12px; text-align: center; font-weight: 600; font-size: 16px; color: var(--ink); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input:checked + span { border-color: var(--accent); background: #eef6fc; color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.match-form .code-input { font-size: 22px; padding: 12px; }
.match-form.no-code .code-row { display: none; }
.match h3 { font-size: 15px; margin: 16px 0 6px; }
ul.planned { list-style: none; padding: 0; margin: 0; }
ul.planned li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* ---- Fase 4: preview, editors, widgets ---- */
.preview-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4px 14px; align-items: end; }
.preview-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.preview-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-wrap:fullscreen { border-radius: 0; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 20px; }
.small-link { font-size: 12px; font-weight: 400; }
.editor { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.2fr); gap: 16px; align-items: start; }
.editor-preview { position: sticky; top: 12px; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } .editor-preview { position: static; order: -1; } }
input.color { height: 42px; padding: 4px; width: 120px; }
#tplHtml, #tplFields { font-size: 13px; }
.mini.type-slide, .mini.type-widget { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 600; }
.mini.type-slide { background: #0a6fb5; }
.mini.type-widget { background: #1d8a4f; }
.widget-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-bottom: 12px; }
.widget-value { font-size: 34px; font-weight: 700; }
.value-input { font-size: 20px; max-width: 160px; }
.card-head h2 small { font-weight: 400; font-size: 13px; }

/* ---- Fase 5: gebruikers ---- */
fieldset.roles { border: 0; padding: 0; margin: 4px 0 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
fieldset.roles legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; padding: 0; }
fieldset.roles label { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 36px; position: relative; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); margin: 0; cursor: pointer; }
fieldset.roles label small { color: var(--muted); }
fieldset.roles input { position: absolute; left: 12px; top: 13px; width: auto; margin: 0; }
fieldset.roles label:has(input:checked) { border-color: var(--accent); background: #eef6fc; }
#userForm:has(input[name="role"][value="superadmin"]:checked) #scopeBox { opacity: .4; pointer-events: none; }
tr.inactive td { opacity: .55; }
.card.narrow-left { max-width: 520px; }

/* ---- Verenigingen ---- */
.logo-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.logo-preview { width: 140px; height: 90px; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#e9eef2 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.logo-preview img { max-width: 120px; max-height: 70px; }
td.logo-cell { width: 70px; }
td.logo-cell img { max-width: 60px; max-height: 36px; display: block; }
tr.foreign td { color: var(--muted); }
.live.foreign { background: #eef2f5; border-color: var(--line); }
ul.conflicts { background: #fbe9e7; color: var(--err); border-radius: 8px; padding: 10px 14px 10px 32px; margin: -6px 0 14px; }
