:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel-2: #eef0f3;
    --line: #e3e6eb;
    --text: #1b2330;
    --muted: #6b7480;
    --brand: #ffd23f;
    --brand-2: #3a66f0;
    --ok: #1f9d57;
    --warn: #d98a00;
    --err: #e23b54;
    --radius: 10px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 244px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { font-weight: 700; font-size: 18px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; padding: 6px 10px 18px; overflow: hidden; white-space: nowrap; }
.brand-mark { color: var(--brand); display: inline-flex; }
.brand-light { color: var(--muted); font-weight: 500; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; border-radius: 8px; color: var(--muted);
    font-weight: 500;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--brand); }
.nav-item svg { flex-shrink: 0; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

.content { flex: 1; padding: 28px 34px; max-width: 1100px; }

/* Sticky topbalk: snel opslaan + naar de frontend */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -28px -34px 22px; padding: 11px 34px; background: color-mix(in srgb, var(--panel) 88%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.topbar-context { font-weight: 600; color: var(--muted); font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.topbar .btn { display: inline-flex; align-items: center; gap: 6px; }

/* Site-switcher (platformbeheerders) */
.site-switcher { position: relative; }
.site-switcher > summary { list-style: none; cursor: pointer; }
.site-switcher > summary::-webkit-details-marker { display: none; }
.site-switcher-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 6px; z-index: 60; }
.site-switcher-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px 4px; }
.site-switcher-menu a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); }
.site-switcher-menu a:hover { background: var(--bg); text-decoration: none; }
.site-switcher-menu a.active { font-weight: 600; color: var(--brand-2); }

/* Inline popover-menu (bv. tenant-acties in het platformoverzicht) */
.inline-menu { position: relative; display: inline-block; }
.inline-menu > summary { list-style: none; cursor: pointer; }
.inline-menu > summary::-webkit-details-marker { display: none; }
.inline-menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; box-shadow: 0 12px 32px rgba(0,0,0,.18); margin: 0; text-align: left; }

/* Gevarenzone-kaart (status schorsen / verwijderen) */
.card-danger { border-color: rgba(200, 50, 50, .35); background: linear-gradient(0deg, rgba(200,50,50,.04), rgba(200,50,50,.04)); }
.card-danger h2 { color: #b3261e; }

/* Checkbox-raster (bv. site-toegang per platformgebruiker) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem .9rem; margin: .35rem 0; }

/* ── Platform-overzicht ─────────────────────────────────────────────────── */
.platform-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; }
.platform-toolbar .tb-group { margin: 0; }
.platform-toolbar .tb-search { flex: 1 1 320px; }
.platform-toolbar .tb-tenant { flex: 0 1 360px; border-left: 1px solid var(--line); padding-left: 22px; }
.platform-toolbar label { margin-bottom: 6px; }
.tb-inline { display: flex; gap: 8px; align-items: center; }
.tb-inline input { flex: 1; }
.tb-inline .btn { white-space: nowrap; }
@media (max-width: 720px) {
    .platform-toolbar .tb-tenant { border-left: 0; padding-left: 0; flex-basis: 100%; }
}

/* Site-rijen in het platformoverzicht */
.site-table td { vertical-align: middle; }
.site-name { font-weight: 600; }
.site-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.site-domains > div { font-size: 13px; }
.site-meta { color: var(--muted); font-size: 12.5px; line-height: 1.55; white-space: nowrap; }
.site-meta b { color: var(--text); font-weight: 600; }
.site-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.tenant-card-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 12px; }
.tenant-card-head h2 { margin: 0; font-size: 1.05rem; }

/* Vierkante icoon-knop (consistente actie-cluster) */
.btn-icon { padding-left: 8px; padding-right: 8px; }

/* Subsectie-tabs */
.tabbar { display: flex; flex-direction: row; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tabbar a { padding: 10px 15px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.tabbar a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.tabbar a.active { color: var(--text); border-bottom-color: var(--brand-2); }

/* Koppen */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
h1 { font-size: 22px; margin: 0 0 2px; }
h2 { font-size: 16px; margin: 26px 0 12px; }
.sub { color: var(--muted); margin: 0; }

/* Kaarten */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { color: var(--muted); display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.stat .lbl svg { color: var(--brand); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tpl-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; background: var(--bg, #fff); }
.tpl-card-actions { display: flex; gap: 6px; align-items: center; }
/* Voorbeeldthema-gallery */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.preset-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.preset-swatch { display: flex; height: 56px; }
.preset-swatch span { flex: 1; }
.preset-body { padding: 12px 14px; flex: 1; }
.preset-card form { padding: 0 14px 14px; }
/* Academie-beheer: statkaarten, subtabs, mini-voortgang */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; }
a.stat-card:hover { border-color: var(--brand, #ad3c3c); }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat-sub { font-size: .74rem; color: var(--muted); opacity: .8; }
.stat-attention { border-color: #e0a23c; background: #fdf6ea; }
.stat-attention .stat-num { color: #9a6212; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.subtab { padding: 7px 14px; border: 1px solid var(--line); border-radius: 50px; font-size: .85rem; color: var(--muted); background: var(--panel); text-decoration: none; }
.subtab:hover { border-color: var(--brand, #ad3c3c); color: var(--text); }
.subtab.is-active { background: var(--brand, #ad3c3c); border-color: var(--brand, #ad3c3c); color: #fff; }
.subtab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 50px; background: rgba(0,0,0,.12); font-size: .72rem; text-align: center; }
.subtab.is-active .subtab-count { background: rgba(255,255,255,.28); }
.mini-progress { width: 110px; height: 6px; background: var(--line); border-radius: 50px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mini-progress-bar { height: 100%; background: var(--brand, #ad3c3c); border-radius: 50px; }
/* Workflow-builder */
.wf-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.wf-row .wf-cond-field { flex: 1; }
.wf-row .wf-cond-val { flex: 1; }
.wf-row input, .wf-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.wf-step { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.wf-step-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.wf-step-title { font-weight: 700; }
.wf-cfg { padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wf-cfg .field label { font-size: 12px; }
.wf-cfg input, .wf-cfg select, .wf-cfg textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.wf-cfg textarea { grid-column: 1 / -1; }
/* Cursusstructuur: module › les (Kajabi-stijl) */
.course-module { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.course-module-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.course-module-title { font-weight: 700; display: inline-flex; align-items: center; gap: 7px; flex: 1; }
.course-module-head .btn { margin-left: auto; }
.course-module-lessons { margin: 0; padding: 4px 6px; list-style: none; }
.course-module-lessons li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px; border-radius: 8px; }
.course-module-lessons li:hover { background: var(--panel-2); }
.course-module-lessons .lesson-title { display: inline-flex; align-items: center; gap: 8px; }
/* Drag-and-drop cursusstructuur */
.course-module[draggable="true"] { cursor: default; }
.course-drag { cursor: grab; color: var(--muted); font-size: 16px; line-height: 1; user-select: none; padding: 0 2px; }
.course-drag:active { cursor: grabbing; }
.course-module.is-dragging, .course-module-lessons li.is-dragging { opacity: .45; }
.course-module-lessons { min-height: 14px; }
.course-module-lessons.is-drop-target { background: rgba(31,157,87,.10); outline: 2px dashed var(--ok); outline-offset: -2px; border-radius: 8px; }
.course-loose { border-style: dashed; }

/* Knoppen */
/* ── Knoppensysteem ─────────────────────────────────────────────────────────
   Semantiek via kleur: groen = positief/bevestigen, oranje = signaal/let op,
   rood = negatief/onomkeerbaar, blauw = neutraal-informatief, grijs = secundair.
   Elke knop: icoon + 1-2 woorden. Publieke (themed) knoppen blijven ongemoeid. */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--text); cursor: pointer;
    font-size: 14px; font-weight: 600; font-family: inherit; line-height: 1.2;
    transition: background .15s, border-color .15s, filter .15s, color .15s;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--panel-2); }

/* Basis-primary (fallback voor niet-getthematiseerde publieke knoppen) */
.btn-primary { background: var(--brand); color: #1a1205; border-color: var(--brand); }
.btn-primary:hover { filter: brightness(1.05); }

/* Positief / bevestigen (opslaan, aanmaken, goedkeuren, publiceren) — groen in de admin */
.app .btn-primary, .btn-success {
    background: var(--ok); color: #fff; border-color: var(--ok);
}
.app .btn-primary:hover, .btn-success:hover { filter: brightness(1.06); border-color: var(--ok); }

/* Signaal / let op (herzien, deactiveren, concept) — oranje */
.btn-warn { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-warn:hover { filter: brightness(1.06); border-color: var(--warn); }

/* Negatief / onomkeerbaar (verwijderen, intrekken) — rood */
.btn-danger { background: #fdedef; color: #c01933; border-color: #f3c2cb; }
.btn-danger:hover { background: #f9d9de; border-color: #c01933; }
.btn-danger.btn-solid { background: var(--err); color: #fff; border-color: var(--err); }

/* Neutraal-informatief (technisch bewerken, bekijken) — blauw: zie .btn-tech */

.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

/* Formulieren */
.field { margin-bottom: 15px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=search], input[type=tel], input[type=date],
select, textarea {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    font-family: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); }
textarea { min-height: 120px; resize: vertical; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 15px; }
legend { padding: 0 8px; color: var(--muted); font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.flash-success { background: rgba(31,157,87,.10); border-color: var(--ok); color: #157f4a; }
.flash-error { background: rgba(226,59,84,.10); border-color: var(--err); color: #c42a43; }
.flash-info { background: rgba(58,102,240,.10); border-color: var(--brand-2); color: #2e54c4; }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: rgba(31,157,87,.14); color: #157f4a; }
.badge-muted { background: var(--panel-2); color: var(--muted); }
.badge-warn { background: rgba(217,138,0,.16); color: #9a6a00; }
.badge-info { background: rgba(43,79,208,.13); color: #2b4fd0; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.inline-form { display: inline; }

/* Auth-schermen */
.auth-wrap { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.auth-card .sub { text-align: center; margin-bottom: 22px; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.qr { background: #fff; padding: 14px; border-radius: 8px; display: inline-block; }
code.token { display: block; background: var(--panel-2); padding: 12px; border-radius: 8px; word-break: break-all; border: 1px solid var(--line); }

@media (max-width: 720px) {
    .sidebar { width: 64px; }
    .nav-item span, .brand-light, .brand span:not(.brand-mark) { display: none; }
    .content { padding: 18px; }
    .topbar { margin: -18px -18px 18px; padding: 10px 18px; }
    .perm-grid { grid-template-columns: 1fr; }
}

/* ---- Section-builder (pagina-editor) ---- */
.sb-add { display: flex; gap: 8px; align-items: center; }
.sb-list { display: flex; flex-direction: column; gap: 14px; }
.sb-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); overflow: hidden; }
.sb-shead { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sb-shead strong { flex: 1; }
.sb-sbody { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sb-field { display: flex; flex-direction: column; gap: 5px; }
.sb-flabel { font-size: 12.5px; color: var(--muted); }
.sb-rich { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.sb-img-row { display: flex; gap: 8px; align-items: center; }
.sb-img-row input { flex: 1; }
.sb-img-prev { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.sb-list-box { display: flex; flex-direction: column; gap: 10px; border-left: 2px solid var(--line); padding-left: 12px; }
.sb-list-item { display: flex; gap: 8px; align-items: flex-start; }
.sb-list-item .sb-img-row { flex: 1; }
.sb-subcard { flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--panel); }
.sb-subhead { display: flex; align-items: center; gap: 6px; }
.sb-subhead span { flex: 1; color: var(--muted); font-size: 12.5px; }

/* Media-picker modal (backend) */
.sb-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.sb-modal[hidden] { display: none; }
.sb-modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(720px, 92vw); max-height: 82vh; display: flex; flex-direction: column; overflow: hidden; }
.sb-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sb-modal-upload { display: flex; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.sb-modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; padding: 16px 18px; overflow: auto; }
.sb-thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--panel-2); }
.sb-thumb:hover { border-color: var(--brand-2); }
.sb-thumb img { width: 100%; height: 96px; object-fit: cover; display: block; }

/* ---- E-learning ---- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.course-card:hover { border-color: var(--brand-2); transform: translateY(-2px); }
.course-cover { height: 130px; background: var(--panel-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.course-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.course-body h3 { margin: 0; font-size: 1.05rem; }
.course-body p { margin: 0; font-size: 13px; }
.course-meta { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.course-hero { width: 100%; max-height: 240px; object-fit: cover; border-radius: 8px; margin-bottom: 14px; }

.progress { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--ok); border-radius: 99px; }
.progress-label { font-size: 12px; color: var(--muted); }

.lesson-list { list-style: none; padding: 0; margin: 0; counter-reset: les; }
.lesson-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lesson-list li:last-child { border-bottom: 0; }
.lesson-title { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.lesson-title:hover { color: var(--brand-2); }
.lesson-check { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.lesson-check.is-done { background: var(--ok); border-color: var(--ok); }
.lesson-list.compact li { padding: 8px 0; }
.lesson-list.compact li.is-current > a { color: var(--brand-2); font-weight: 600; }

.lesson-layout { display: grid; grid-template-columns: 1fr 280px; gap: 18px; align-items: start; }
.lesson-content { min-width: 0; }
.lesson-side h3 { margin-top: 0; }
.lesson-video { position: relative; padding-top: 56.25%; margin-bottom: 16px; border-radius: 8px; overflow: hidden; background: #000; }
.lesson-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.rich { line-height: 1.65; }
.rich h2 { font-size: 1.4rem; margin: 1.2em 0 .4em; }
.rich h3 { font-size: 1.15rem; margin: 1.1em 0 .4em; }
.rich p { margin: 0 0 .9em; }
.rich ul, .rich ol { margin: 0 0 .9em 1.2em; }
.rich img { max-width: 100%; border-radius: 8px; }
.rich a { color: var(--brand-2); }
.rich blockquote { margin: 0 0 .9em; padding: 8px 16px; border-left: 3px solid var(--brand-2); color: var(--muted); }
.rich pre { background: var(--panel-2); padding: 12px; border-radius: 8px; overflow: auto; }

@media (max-width: 760px) {
    .lesson-layout { grid-template-columns: 1fr; }
}

/* Collectie-link onder een collectie-keuze in de section-builder */
.sb-coll-link { display: inline-block; margin-top: 6px; font-size: .85rem; color: var(--accent, #ff5b24); text-decoration: none; }
.sb-coll-link:hover { text-decoration: underline; }

/* Notitie voor een aan een collectie gekoppeld lijstveld in de section-builder */
.sb-bound .sb-bound-note { font-size: .9rem; color: #475569; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; }

/* Drag-and-drop herordenen van collectie-items */
tr[draggable] .drag-handle { cursor: grab; color: #94a3b8; text-align: center; vertical-align: middle; }
tr[draggable] .drag-handle svg { fill: currentColor; }
tr[draggable]:hover .drag-handle { color: #475569; }
tr.dragging { opacity: .5; background: #f1f5f9; }
tbody[data-items-sortable].is-saving { opacity: .7; }
tbody[data-items-sortable].saved-flash tr { transition: background .3s; background: rgba(34,197,94,.10); }
tbody[data-items-sortable].save-error tr { background: rgba(239,68,68,.10); }

/* === Section-builder: professionele restyle (v1.13) ====================== */
.sb-list { gap: 10px; }
.sb-section {
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    box-shadow: 0 1px 2px rgba(16,24,40,.04); overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.sb-section:hover { box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.sb-section.sb-dragging { opacity: .5; }
.sb-shead {
    display: flex; align-items: center; gap: 6px; padding: 9px 10px 9px 6px;
    background: var(--panel); border-bottom: 1px solid transparent;
}
.sb-section:not(.is-collapsed) .sb-shead { border-bottom-color: var(--line); }
.sb-drag { display: inline-flex; align-items: center; cursor: grab; color: #9aa3af; padding: 4px; }
.sb-drag:active { cursor: grabbing; }
.sb-stitle { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; user-select: none; }
.sb-iconbtn {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted);
    cursor: pointer; padding: 0;
}
.sb-iconbtn:hover { background: var(--panel-2); color: var(--text); }
.sb-iconbtn.sb-danger:hover { background: #fdecee; color: var(--err); }
.sb-iconbtn-sm { width: 26px; height: 26px; }
.sb-iconbtn svg, .sb-drag svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-drag svg.i-fill { fill: currentColor; stroke: none; }
.sb-collapse svg { transition: transform .15s ease; }
.sb-section.is-collapsed .sb-collapse svg { transform: rotate(-90deg); }
.sb-section.is-collapsed .sb-sbody { display: none; }
.sb-sbody { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.sb-field { display: flex; flex-direction: column; gap: 6px; }
.sb-flabel { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sb-sbody input[type=text], .sb-sbody input[type=number], .sb-sbody input[type=url],
.sb-sbody input[type=email], .sb-sbody select, .sb-sbody textarea { background: #fff; }
.sb-list-box { border-left: none; padding-left: 0; gap: 10px; }
.sb-subcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); gap: 10px; }
.sb-subhead { gap: 6px; align-items: center; }
.sb-subhead span { flex: 1; font-weight: 600; color: var(--text); font-size: 12.5px; }

/* Velden vullen de volle breedte — ook binnen lijst-item-kaarten (fix) */
.sb-subcard, .sb-list-item.sb-subcard { align-items: stretch; }
.sb-field { width: 100%; }
.sb-sbody input[type=text], .sb-sbody input[type=number], .sb-sbody input[type=url],
.sb-sbody input[type=email], .sb-sbody select, .sb-sbody textarea { width: 100%; box-sizing: border-box; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea { box-sizing: border-box; }

/* Editor-knoppen: niet afbreken + eigen kleur per editor */
.btn { white-space: nowrap; }
.btn-tech { background: #eaf0ff; border-color: #c7d6ff; color: #2b4fd0; }
.btn-tech:hover { background: #dce6ff; border-color: #2b4fd0; }
.btn-content { background: #e7f6ee; border-color: #bfe6cf; color: #137a44; }
.btn-content:hover { background: #d6f0e2; border-color: #137a44; }

/* === Mediabibliotheek: net thumbnail-grid ============================== */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.media-card { position: relative; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.media-thumb { display: block; aspect-ratio: 4 / 3; background: var(--panel-2); overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-doc { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); }
.media-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.media-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card > .inline-form { position: absolute; top: 8px; right: 8px; }
.media-card > .inline-form .btn { background: rgba(255,255,255,.92); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.media-card > .inline-form .btn:hover { background: #fff; }

/* === Collectie-items zijpaneel (iframe) ================================= */
.colpanel-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 9600; }
.colpanel-backdrop[hidden] { display: none; }
.colpanel { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 95vw); background: #fff; z-index: 9700; display: flex; flex-direction: column; box-shadow: -14px 0 44px rgba(0,0,0,.22); }
.colpanel[hidden] { display: none; }
.colpanel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #1e293b; color: #fff; }
.colpanel-title { font-size: 14px; font-weight: 700; }
.colpanel-close { width: 32px; height: 32px; border: none; background: transparent; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px; }
.colpanel-close:hover { background: rgba(255,255,255,.16); }
.colpanel-frame { flex: 1; width: 100%; border: 0; display: block; }

/* Video-thumbnail in mediabibliotheek */
.media-thumb { position: relative; }
.media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.media-play svg { width: 40px; height: 40px; color: #fff; background: rgba(0,0,0,.45); border-radius: 50%; padding: 9px; box-sizing: border-box; }

/* Klikbare status-pill in het content-overzicht */
.status-pill {
    -webkit-appearance: none; appearance: none;
    border: 1px solid transparent; border-radius: 999px;
    padding: 5px 28px 5px 13px; font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
    background-repeat: no-repeat; background-position: right 9px center; background-size: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%236b7480' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.status-pill:hover { border-color: var(--line); }
.status-pill.status-published { background-color: #e7f6ee; color: #137a44; }
.status-pill.status-draft { background-color: #eef0f3; color: #6b7480; }

/* === Media-mappen ====================================================== */
.folder-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.folder-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); text-decoration: none; font-size: 13px; }
.folder-chip:hover { border-color: var(--muted); }
.folder-chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.folder-new { display: flex; gap: 6px; align-items: center; }
.folder-new input[type=text] { width: 160px; padding: 7px 10px; font-size: 13px; }
.media-actions { padding: 0 12px 12px; }
.media-move select { width: 100%; font-size: 12px; padding: 6px 8px; }

/* Video-thumbnails in de media-pickers */
.sb-thumb video, .ie-thumb video, .ed-thumb video { width: 100%; height: 96px; object-fit: cover; display: block; }

/* Inline checkbox-label (forms-builder, item-form, e.d.) */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: auto; }

/* Categorie-keuze (checkbox-pills) op het productformulier */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: .4rem .8rem; border: 1px solid #d8dee6; border-radius: 50px;
    cursor: pointer; font-size: .9rem; user-select: none; transition: all .12s;
}
.checkbox-pill:hover { border-color: #b6c0cc; }
.checkbox-pill input { margin: 0; }
.checkbox-pill:has(input:checked) { background: #eef4ff; border-color: #2f6bff; color: #1d3c8f; }

/* Handmatige productkiezer in de section-builder */
.sb-picker { display: flex; flex-direction: column; gap: 8px; }
.sb-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.sb-picker-empty { color: #8a94a3; font-size: .85rem; }
.sb-picker-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: #eef2f7; border: 1px solid #dbe2ea; border-radius: 6px;
    padding: .25rem .35rem .25rem .6rem; font-size: .85rem;
}
.sb-picker-mv, .sb-picker-x {
    border: none; background: transparent; cursor: pointer; color: #5a6675;
    font-size: .95rem; line-height: 1; padding: 0 3px; border-radius: 4px;
}
.sb-picker-mv:hover, .sb-picker-x:hover { background: #dbe2ea; color: #1e3a5f; }
.sb-picker-add { max-width: 260px; }

/* ── Academy: modules, bijlagen, quiz, opdracht, Q&A, certificaat ────────── */
.academy-module { margin-bottom: 18px; }
.academy-module-title { margin: 8px 0 6px; font-size: 1.05rem; }
.lesson-title .hint { margin-left: 6px; font-size: .78rem; }

.lesson-resources { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.lesson-resources ul { list-style: none; padding: 0; margin: 8px 0 0; }
.lesson-resources li { margin: 6px 0; }
.lesson-resources a { display: inline-flex; align-items: center; gap: 7px; }

.lesson-quiz, .lesson-assignment, .lesson-comments { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.quiz-question { border: none; padding: 0; margin: 0 0 16px; }
.quiz-question legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.quiz-answer { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin: 6px 0; cursor: pointer; transition: border-color .12s, background .12s; }
.quiz-answer:hover { border-color: var(--brand); }
.quiz-answer:has(input:checked) { border-color: var(--brand); background: rgba(173,60,60,.06); }
.quiz-result { padding: 10px 14px; border-radius: 9px; font-size: .92rem; display: inline-flex; align-items: center; gap: 7px; }
.quiz-result.is-pass { background: rgba(31,157,87,.12); color: #157f4a; }
.quiz-result.is-fail { background: rgba(217,138,0,.14); color: #9a6a00; }

.assignment-feedback { background: var(--panel); border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 8px 0; }

.comment-list { list-style: none; padding: 0; margin: 12px 0; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment.is-reply { margin-left: 28px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: .9rem; margin-bottom: 4px; }
.lesson-comments textarea { width: 100%; }

/* Certificaat */
.certificate { max-width: 820px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.certificate-inner { border: 3px double var(--brand); border-radius: 10px; padding: 48px 40px; text-align: center; }
.certificate-kicker { text-transform: uppercase; letter-spacing: .28em; font-size: .8rem; color: var(--brand); margin: 0 0 28px; }
.certificate-for { color: var(--muted); margin: 6px 0; }
.certificate-name { font-size: 2.2rem; font-weight: 700; margin: 6px 0; color: var(--pg-ink, #1e293b); }
.certificate-course { font-size: 1.4rem; margin: 6px 0 28px; }
.certificate-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 24px; }
@media print {
    .app-sidebar, .app-topbar, .page-head, .btn, .flex { display: none !important; }
    .certificate { border: none; }
}

/* JSON-voorbeeld in cursus-import */
.code-block { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; line-height: 1.5; white-space: pre; max-height: 360px; }
.lesson-blocks > .pg { padding-left: 0; padding-right: 0; }

/* Interactieve quizvormen: sorteren / matchen */
.quiz-sort-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.quiz-sort-row:last-child { border-bottom: none; }
.quiz-sort-item { flex: 1; font-weight: 500; }
.quiz-sort-row select { min-width: 200px; }
.sb-cfg { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0; }
.sb-cfg .flex { gap: 6px; margin-bottom: 6px; }
.sb-cfg-label { font-size: .82rem; color: var(--muted); margin: 6px 0 4px; }

/* WYSIWYG-editor in de section-builder (rich-tekst) */
.sb-wysiwyg { border: 1px solid #d8dee6; border-radius: 8px; overflow: hidden; background: #fff; }
.sb-wtoolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--panel, #FAF8F5); border-bottom: 1px solid #e7e5e0; }
.sb-wbtn { border: 1px solid #d8dee6; background: #fff; border-radius: 6px; padding: 3px 9px; font-size: .8rem; cursor: pointer; color: var(--text, #3D4A5C); }
.sb-wbtn:hover { border-color: var(--brand, #ad3c3c); color: var(--brand, #ad3c3c); }
.sb-wedit { min-height: 120px; padding: 12px 14px; font-size: .95rem; line-height: 1.6; outline: none; }
.sb-wedit:focus { box-shadow: inset 0 0 0 2px rgba(173,60,60,.12); }
.sb-wedit h3 { font-size: 1.15rem; margin: 12px 0 6px; }
.sb-wedit h4 { font-size: 1rem; margin: 10px 0 5px; }
.sb-wedit p { margin: 0 0 10px; }
.sb-wedit ul, .sb-wedit ol { margin: 0 0 10px; padding-left: 22px; }
.sb-wedit:empty::before { content: 'Begin met typen…'; color: #9aa3ad; }
