/* SimplePlan — stijl. Licht thema, compacte planbord-UI. */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn: #f59e0b;
  --warn-bg: #fef3c7;
  --row-h: 46px;
  --left-w: 220px;
  --header-h: 52px;
  --tl-header-h: 48px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .12);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; }
button { font-family: inherit; }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); border-radius: 8px;
  cursor: pointer; font-size: 13px; text-decoration: none; line-height: 1;
  white-space: nowrap;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-icon { padding: 7px 10px; font-size: 16px; line-height: 1; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { background: rgba(255,255,255,.25); border-radius: 10px; padding: 1px 7px; font-size: 11px; }
#btn-unplanned .pill { background: var(--primary); color: #fff; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(1200px 600px at 50% -10%, #dbeafe, transparent), var(--bg); }
.login-card { background: var(--panel); padding: 32px; border-radius: 16px;
  box-shadow: var(--shadow); width: 320px; }
.login-logo { margin: 0; font-size: 26px; color: var(--primary); }
.login-sub { margin: 4px 0 20px; color: var(--muted); }
.login-card label { display: block; font-weight: 600; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.login-error { background: #fee2e2; color: var(--danger); padding: 10px;
  border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 14px 0 0; }

/* ---------- App-layout ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: var(--header-h); flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 0 14px; background: var(--panel);
  border-bottom: 1px solid var(--border); }
.topbar-left, .topbar-center, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-center { flex: 1; justify-content: center; }
.brand { font-weight: 700; color: var(--primary); font-size: 16px; }
.page-title { color: var(--muted); font-weight: 600; }
.range-label { color: var(--muted); font-size: 13px; min-width: 120px; }

.view-toggle { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; }
.vt-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px;
  cursor: pointer; color: var(--muted); font-size: 13px; }
.vt-btn.is-active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

.zoom-levels { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.zoom-btn { border: 0; border-left: 1px solid var(--border); background: var(--panel);
  padding: 7px 11px; cursor: pointer; font-size: 13px; color: var(--muted); }
.zoom-btn:first-child { border-left: 0; }
.zoom-btn.is-active { background: var(--primary); color: #fff; }

/* Multiselect-filter (projecten/teams) */
.rowfilter { position: relative; }
.caret { font-size: 10px; color: var(--muted); }
.btn-icon-text { padding: 4px 10px; font-size: 12px; }
.rowfilter-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 45;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); width: 240px; padding: 8px; }
.rfm-head { display: flex; gap: 6px; padding: 2px 4px 8px; border-bottom: 1px solid var(--border); }
.rfm-list { max-height: 320px; overflow-y: auto; padding-top: 6px; }
.rfm-item { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 6px;
  cursor: pointer; font-size: 13px; }
.rfm-item:hover { background: #f1f5f9; }
.rfm-item input { margin: 0; }
.rfm-item .swatch { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 11px; }
.rfm-item .rfm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.role-badge { font-size: 12px; padding: 4px 9px; border-radius: 999px; font-weight: 600; }
.role-beheerder { background: #dcfce7; color: #166534; }
.role-viewer { background: #e0e7ff; color: #3730a3; }

/* ---------- Filterbalk ---------- */
.filterbar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #f1f5f9; border-bottom: 1px solid var(--border); }
.input { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13px; background: var(--panel); }
#f-search { flex: 1; max-width: 320px; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

/* ---------- Planbord ---------- */
.board { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.board-left { width: var(--left-w); flex: 0 0 var(--left-w); background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 3; }
.left-header { height: var(--tl-header-h); display: flex; align-items: center; padding: 0 14px;
  font-weight: 700; border-bottom: 1px solid var(--border); color: var(--muted);
  text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.row-labels { flex: 1; overflow: hidden; }
.row-label { height: var(--row-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; border-bottom: 1px solid var(--border); gap: 8px; }
.row-label .rl-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-label .swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
.row-label .rl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-label .rl-add { opacity: 0; border: 0; background: var(--primary); color: #fff; width: 22px; height: 22px;
  border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1; flex: 0 0 22px; }
.row-label:hover .rl-add { opacity: 1; }

.board-right { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.timeline-header { height: var(--tl-header-h); flex: 0 0 auto; overflow: hidden;
  border-bottom: 1px solid var(--border); background: var(--panel); position: relative; }
.timeline-scroll { flex: 1; overflow: auto; position: relative; }
.timeline-content { position: relative; }

/* Header-cellen */
.th-band { position: absolute; top: 0; height: 22px; border-left: 1px solid var(--border);
  font-size: 11px; color: var(--muted); padding: 4px 6px; font-weight: 600; overflow: hidden;
  white-space: nowrap; }
.th-tick { position: absolute; top: 22px; height: 26px; border-left: 1px solid var(--border);
  font-size: 11px; color: var(--muted); padding: 5px 5px; overflow: hidden; white-space: nowrap; }
.th-tick.is-weekend { background: #f8fafc; }
.th-tick.is-today { background: #eff6ff; color: var(--primary); font-weight: 700; }

/* Roosterlijnen + lanes */
.lane { position: absolute; left: 0; right: 0; height: var(--row-h);
  border-bottom: 1px solid var(--border); }
.lane.is-alt { background: #fcfdff; }
.lane.dragover { background: #eff6ff; }
.gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.gridline.is-weekend { background: transparent; }
.weekend-band { position: absolute; top: 0; bottom: 0; background: #f8fafc55; }

/* Nu-lijn */
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.now-line::before { content: ""; position: absolute; top: 0; left: -4px; width: 10px; height: 10px;
  background: var(--danger); border-radius: 50%; }

/* Eventbalken */
.event { position: absolute; height: 30px; border-radius: 7px; color: #fff; padding: 0 8px;
  display: flex; align-items: center; font-size: 12px; font-weight: 600; overflow: hidden;
  white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.25); cursor: pointer; user-select: none;
  border: 1px solid rgba(0,0,0,.12); z-index: 4; }
.event .ev-title { overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.event.is-admin { cursor: grab; }
.event.dragging { z-index: 20; opacity: .9; box-shadow: var(--shadow); cursor: grabbing; }
.event.is-overlap { outline: 2px solid var(--warn); outline-offset: 1px; }
.event .handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.event .handle.left { left: 0; } .event .handle.right { right: 0; }
.event .ov-badge { margin-left: 6px; font-size: 11px; }

/* ---------- Zijpaneel ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 40; }
.sidepanel { position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh;
  background: var(--panel); box-shadow: var(--shadow); z-index: 50; overflow-y: auto; padding: 20px; }
.sp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sp-head h2 { margin: 0; font-size: 18px; }
.sp-close { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 10px;
  border: 1px solid var(--border-strong); border-radius: 8px; font-size: 14px; font-family: inherit; }
.field textarea { resize: vertical; min-height: 60px; }
.field .field-err { color: var(--danger); font-size: 12px; margin-top: 4px; display: none; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field.has-error .field-err { display: block; }
.field-row { display: flex; gap: 10px; } .field-row .field { flex: 1; }
.sp-meta { color: var(--muted); font-size: 12px; border-top: 1px solid var(--border);
  padding-top: 12px; margin-top: 12px; line-height: 1.6; }
.sp-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.sp-actions .spacer { flex: 1; }
.readonly-view .field input, .readonly-view .field select, .readonly-view .field textarea { display: none; }
.ro-value { font-size: 14px; padding: 4px 0; }
.color-chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.sp-warn { background: var(--warn-bg); color: #92400e; padding: 10px; border-radius: 8px;
  font-size: 13px; margin-bottom: 14px; border: 1px solid #fde68a; }

/* ---------- Ongepland paneel ---------- */
.unplanned-panel { position: fixed; top: var(--header-h); right: 0; width: 300px; max-width: 90vw;
  bottom: 0; background: var(--panel); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  z-index: 30; padding: 14px; overflow-y: auto; }
.up-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.up-hint { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.up-item { border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 8px; cursor: grab; background: var(--panel); }
.up-item:hover { background: #f8fafc; }
.up-item.dragging { opacity: .5; }
.up-item .up-title { font-weight: 600; }
.up-item .up-sub { color: var(--muted); font-size: 12px; }

/* ---------- Beheer ---------- */
.manage { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px; overflow: auto; }
.manage-col { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.manage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.manage-head h2 { margin: 0; font-size: 18px; }
.manage-list { margin-top: 12px; }
.manage-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; }
.manage-item.archived { opacity: .6; }
.manage-item .mi-swatch { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 14px; }
.manage-item .mi-main { flex: 1; min-width: 0; }
.manage-item .mi-name { font-weight: 600; }
.manage-item .mi-desc { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-item .mi-count { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #f1f5f9; color: var(--muted); }

/* Projectstatus-badges */
.status-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  white-space: nowrap; flex: 0 0 auto; letter-spacing: .02em; text-transform: uppercase; }
.status-new { background: #f1f5f9; color: #475569; }
.status-progress { background: #dbeafe; color: #1e40af; }
.status-on-hold { background: #fef3c7; color: #92400e; }
.status-delivered { background: #dcfce7; color: #166534; }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: var(--shadow); max-width: 90vw; }
.toast.warn { background: #92400e; }
.toast.error { background: var(--danger); }
.toast.success { background: #166534; }

.empty-hint { color: var(--muted); padding: 20px; text-align: center; }
[hidden] { display: none !important; }

/* Help-icoon (?) in de bovenbalk */
.btn-help { width: 32px; height: 32px; padding: 0; border-radius: 50%; justify-content: center;
  font-weight: 700; color: var(--primary); border-color: var(--border-strong); }
.btn-help:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Handleiding-pagina */
.doc-scroll { flex: 1; overflow-y: auto; background: var(--bg); }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 24px 64px;
  background: var(--panel); min-height: 100%; }
.doc h1 { font-size: 28px; margin: 0 0 8px; }
.doc-lead { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 24px; }
.doc h2 { font-size: 20px; margin: 32px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 16px; margin: 18px 0 6px; }
.doc p { line-height: 1.7; margin: 0 0 12px; }
.doc ul, .doc ol { line-height: 1.7; padding-left: 22px; margin: 0 0 12px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--primary); }
.doc-role { display: inline-block; background: #dcfce7; color: #166534; font-size: 12px;
  font-weight: 600; padding: 3px 10px; border-radius: 999px; margin: 0 0 12px; }
.doc-toc { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 24px; }
.doc-toc strong { display: block; margin-bottom: 8px; }
.doc-toc ol { margin: 0; }
.doc-toc a { text-decoration: none; }
.doc-toc a:hover { text-decoration: underline; }
.doc section { scroll-margin-top: 16px; }
.doc-foot { margin-top: 32px; }
@media (max-width: 620px) { .doc { padding: 20px 16px 48px; } }
