:root {
  --primary: #154273;
  --blue: #007bc7;
  --bg: #f0f2f5;
  --card: #fff;
  --text: #222;
  --muted: #777;
  --faint: #bbb;
  --border: #e3e5e8;
  --green: #16a34a; --green-bg: #dcfce7;
  --orange: #d97706; --orange-bg: #fef3c7;
  --red: #dc2626; --red-bg: #fee2e2;
  --sky: #2563eb; --sky-bg: #dbeafe;
  --grey-bg: #eef0f3;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.loading { display: flex; align-items: center; justify-content: center; height: 100vh; color: #888; }

/* Bouwstenen */
.card { background: var(--card); border-radius: 8px; padding: 20px; box-shadow: 0 1px 5px rgba(0,0,0,.08); margin-bottom: 16px; }
.btn { background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.blue { background: var(--blue); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.ghost { background: none; color: #555; border: 1px solid #ddd; }
.btn.link { background: none; color: var(--blue); padding: 0; border: none; }
.btn.wide { width: 100%; padding: 10px; font-size: 14px; }
.inp, select.inp, textarea.inp { padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; width: 100%; }
textarea.inp { resize: vertical; font-family: inherit; }
.inp:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.label { font-size: 10px; color: #999; letter-spacing: .5px; margin-bottom: 4px; text-transform: uppercase; display: block; }
.field { margin-bottom: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span2 { grid-column: span 2; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.err { color: var(--red); font-size: 12px; background: #fef2f2; padding: 7px 10px; border-radius: 6px; margin-bottom: 10px; }
.ok { color: var(--green); font-size: 13px; background: var(--green-bg); padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; }
.note { font-size: 12px; background: #f7f8fa; border-radius: 6px; padding: 10px 12px; color: #555; }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 700; white-space: nowrap; display: inline-block; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.orange { background: var(--orange-bg); color: var(--orange); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.sky { background: var(--sky-bg); color: var(--sky); }
.pill.grey { background: var(--grey-bg); color: #666; }
.pill.navy { background: #e8f0fe; color: var(--primary); }
code { background: #f0f0f0; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
h1.page { color: var(--primary); margin: 0 0 4px; font-size: 22px; }
h3.card-title { margin: 0 0 12px; color: var(--primary); font-size: 15px; }

/* Inlogschermen */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-box { background: #fff; border-radius: 12px; padding: 36px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,.1); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .mark { width: 48px; height: 48px; background: var(--primary); border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 10px; }
.auth-logo h2 { color: var(--primary); font-size: 20px; }
.auth-logo p { color: #888; font-size: 13px; margin-top: 4px; }
.auth-foot { text-align: center; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.qr { display: flex; justify-content: center; margin: 14px 0; }
.qr img, .qr canvas { border: 8px solid #fff; box-shadow: 0 0 0 1px #eee; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: #f7f8fa; padding: 12px; border-radius: 6px; margin: 10px 0; text-align: center; }

/* Layout */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 250px; background: var(--primary); color: #fff; display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; transition: width .2s; }
.sidebar.closed { width: 52px; }
.sb-head { padding: 14px 12px; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; gap: 8px; min-height: 52px; }
.sb-head .t { font-weight: 700; font-size: 14px; }
.sb-head .s { font-size: 10px; opacity: .6; }
.sb-toggle { margin-left: auto; background: none; border: none; color: #fff; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.sb-user { padding: 8px 14px 4px; font-size: 11px; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; color: #fff; padding: 10px 14px; cursor: pointer; font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; }
.sb-item:hover { background: rgba(255,255,255,.08); }
.sb-item.active { background: rgba(255,255,255,.18); }
.sb-item .ic { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.sb-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-item.theme { color: rgba(255,255,255,.85); padding: 6px 14px 6px 20px; font-size: 12px; }
.sb-section { padding: 10px 14px 4px; font-size: 10px; opacity: .5; letter-spacing: 1px; }
.sb-badge { background: #ef4444; border-radius: 10px; font-size: 11px; padding: 1px 6px; font-weight: 700; }
.sb-spacer { flex: 1; }
.sb-foot { border-top: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.65); }
.main { flex: 1; overflow-y: auto; padding: 24px; }
.main-inner { max-width: 1200px; }

/* Overzicht */
.stats { display: flex; gap: 12px; margin: 20px 0 24px; flex-wrap: wrap; }
.stat { background: #fff; border-radius: 8px; padding: 14px 18px; min-width: 100px; box-shadow: 0 1px 5px rgba(0,0,0,.08); flex: 1 1 90px; }
.stat .v { font-size: 28px; font-weight: 700; }
.stat .l { font-size: 12px; color: #888; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { background: #fff; border-radius: 8px; padding: 16px; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,.08); border-left: 4px solid; transition: box-shadow .15s; text-align: left; border-top: none; border-right: none; border-bottom: none; width: 100%; }
.tile:hover { box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.tile .name { font-weight: 700; font-size: 13px; color: var(--primary); flex: 1; }

/* Thema-detail */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fact { background: #f7f8fa; border-radius: 6px; padding: 10px; }
.fact .v { font-size: 13px; }
.fact .v.empty { color: var(--faint); font-style: italic; }
.tl { position: relative; padding-left: 32px; margin-top: 16px; }
.tl::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: #e5e7eb; border-radius: 1px; }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-dot { position: absolute; left: -28px; top: 5px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.tl-dot.mp { border-radius: 2px; transform: rotate(45deg); }
.tl-box { border: 1px solid #e5e7eb; border-left-width: 3px; border-radius: 6px; padding: 8px 12px; background: #fff; }
.tl-today { position: relative; margin: 4px 0 12px; }
.tl-today::before { content: ''; position: absolute; left: -32px; top: 50%; margin-top: -5px; width: 10px; height: 10px; background: #f59e0b; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #f59e0b; }
.tl-today span { font-size: 11px; color: #b45309; font-weight: 700; background: #fef3c7; padding: 2px 10px; border-radius: 10px; }
.icon-btn { background: none; border: 1px solid #e5e7eb; border-radius: 4px; padding: 1px 7px; cursor: pointer; font-size: 11px; color: #6b7280; }
.icon-btn:hover { background: #f3f4f6; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }

/* Nieuws */
.news-item { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 5px rgba(0,0,0,.08); margin-bottom: 14px; }
.news-item.archived { background: #fafafa; opacity: .75; }
.news-item .title { font-weight: 700; font-size: 15px; color: var(--primary); }
.news-item .body { color: #555; font-size: 13px; margin: 10px 0 8px; white-space: pre-wrap; }
.reaction { background: #f7f8fa; border-radius: 6px; padding: 6px 10px; margin-bottom: 5px; font-size: 12px; white-space: pre-wrap; }
.chip { padding: 3px 10px; border-radius: 12px; border: 1px solid #ddd; background: #fff; color: #555; cursor: pointer; font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Tabellen en tabs */
.table-wrap { background: #fff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,.08); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 12px; color: #888; font-weight: 600; background: #f7f8fa; border-bottom: 2px solid #e8eaed; white-space: nowrap; }
td { padding: 9px 14px; font-size: 13px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.tabs { display: inline-flex; margin-bottom: 20px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 5px rgba(0,0,0,.08); flex-wrap: wrap; }
.tabs button { padding: 10px 18px; border: none; background: #fff; color: #555; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--primary); color: #fff; font-weight: 700; }

/* Modaal venster */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; padding: 24px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h2 { color: var(--primary); font-size: 18px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #f0f0f0; flex-wrap: wrap; }
.copy-box { display: flex; gap: 6px; margin-top: 8px; }
.copy-box input { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,.25); max-width: 90vw; }
.toast.error { background: var(--red); }

@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; }
  .sidebar.closed { width: 0; }
  .main { padding: 64px 16px 24px; }
  .mobile-toggle { display: block !important; }
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .auth-box { padding: 24px; }
}
.mobile-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 30; background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 8px 12px; font-size: 16px; cursor: pointer; }
