/* WOEF CSS — Vanilla HTML/CSS/JS
   Geen Bootstrap, geen externe afhankelijkheden. */

:root{
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f4f7fd;
  --surface-3: #eaf1fb;
  --text: #1f2937;
  --muted: #6b7280;
  --text-muted: #6b7280;
  --border: rgba(15,23,42,.13);
  --shadow: 0 14px 34px rgba(16,24,40,.12);
  --shadow-sm: 0 10px 24px rgba(16,24,40,.10);
  --shadow-md: 0 18px 42px rgba(16,24,40,.18);

  --primary: #0f6cbd;
  --primary-2: #0b5da5;
  --accent: #f59e0b;
  --success: #1f9d55;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --success-bg: rgba(31,157,85,.14);
  --warning-bg: rgba(217,119,6,.16);
  --danger-bg: rgba(220,38,38,.14);
  --info-bg: rgba(2,132,199,.14);
  --bg-muted: var(--surface-2);

  --radius: 14px;
  --radius-sm: 12px;

  --sidebar-w: 268px;
  --header-h: 64px;
  --container-pad: 22px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

body.theme-dark{
  --bg: #0b1220;
  --surface: #0f172a;
  --surface-2: #13203b;
  --surface-3: #172844;
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);
  --text-muted: rgba(255,255,255,.68);
  --border: rgba(255,255,255,.12);
  --shadow: 0 18px 45px rgba(0,0,0,.38);
  --shadow-sm: 0 14px 30px rgba(0,0,0,.33);
  --shadow-md: 0 24px 54px rgba(0,0,0,.45);

  --primary: #6cb7ff;
  --primary-2: #3f97f1;
  --accent: #fbbf24;
  --success: #38d27c;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --success-bg: rgba(56,210,124,.2);
  --warning-bg: rgba(245,158,11,.2);
  --danger-bg: rgba(239,68,68,.2);
  --info-bg: rgba(56,189,248,.2);
  --bg-muted: var(--surface-2);
}

/* Role accents: single place to tune visual identity per doelgroep */
body.role-admin{
  --primary: #0f6cbd;
  --primary-2: #0b5da5;
  --accent: #f59e0b;
  --success: #1f9d55;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --success-bg: rgba(31,157,85,.14);
  --warning-bg: rgba(217,119,6,.16);
  --danger-bg: rgba(220,38,38,.14);
  --info-bg: rgba(2,132,199,.14);
}
body.role-pentester{
  --primary: #0b7a75;
  --primary-2: #0a6662;
  --accent: #f97316;
  --success: #0f9f75;
  --warning: #ea7a12;
  --danger: #d93f45;
  --info: #0e8fb1;
  --success-bg: rgba(15,159,117,.16);
  --warning-bg: rgba(234,122,18,.18);
  --danger-bg: rgba(217,63,69,.15);
  --info-bg: rgba(14,143,177,.16);
}
body.role-client{
  --primary: #2557d6;
  --primary-2: #1f47b2;
  --accent: #14b8a6;
  --success: #1b8f5c;
  --warning: #ca8a04;
  --danger: #dc2626;
  --info: #0369a1;
  --success-bg: rgba(27,143,92,.14);
  --warning-bg: rgba(202,138,4,.17);
  --danger-bg: rgba(220,38,38,.14);
  --info-bg: rgba(3,105,161,.14);
}
body.role-unassigned{
  --primary: #475569;
  --primary-2: #334155;
  --accent: #94a3b8;
  --success: #2f855a;
  --warning: #b7791f;
  --danger: #c53030;
  --info: #2b6cb0;
  --success-bg: rgba(47,133,90,.14);
  --warning-bg: rgba(183,121,31,.16);
  --danger-bg: rgba(197,48,48,.14);
  --info-bg: rgba(43,108,176,.14);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1100px 580px at 105% -12%, color-mix(in oklab, var(--primary) 14%, transparent), transparent 62%),
    radial-gradient(920px 460px at -18% 118%, color-mix(in oklab, var(--info) 10%, transparent), transparent 58%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; display: block; }
button, input, select, textarea{ font: inherit; }

.logo-theme-light{ display: block; }
.logo-theme-dark{ display: none; }
body.theme-dark .logo-theme-light{ display: none !important; }
body.theme-dark .logo-theme-dark{ display: block !important; }

/* Login/auth logo wissel met extra specificiteit (voorkomt dubbele logo's). */
.auth .logo-theme-light{ display: block; }
.auth .logo-theme-dark{ display: none; }
body.theme-dark .auth .logo-theme-light{ display: none !important; }
body.theme-dark .auth .logo-theme-dark{ display: block !important; }

.skip-link{
  position: absolute;
  top: 10px; left: -9999px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #111827;
  color: white;
  z-index: 9999;
}
.skip-link:focus{ left: 12px; }

.app{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .18s ease;
}

/* ---------- Sidebar ---------- */
.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 88%, var(--surface-3)), var(--surface));
  border-right: 1px solid var(--border);
  padding: 14px 12px;
  overflow: auto;
  transition: transform .18s ease, opacity .18s ease;
}

/* Desktop/sidebar collapse state */
body.sidebar-collapsed .app{
  grid-template-columns: 0 1fr;
}
body.sidebar-collapsed .sidebar{
  transform: translateX(-105%);
  opacity: 0;
  pointer-events: none;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 14px;
}
.brand-mark{
  width: 36px; height: 36px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--accent) 60%, var(--primary)));
  box-shadow: 0 14px 28px color-mix(in oklab, var(--primary) 26%, transparent);
}
.brand-name{
  font-weight: 900;
  letter-spacing: -0.02em;
}
.brand-name span{ color: var(--primary); }

.sidebar hr{
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 10px 12px;
}

.nav-section{
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 12px 6px;
}

.nav{
  display: grid;
  gap: 4px;
  padding: 0 6px;
}
.nav a, .nav button{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.nav a:hover, .nav button:hover{
  background: color-mix(in oklab, var(--surface-2) 84%, var(--primary));
  border-color: var(--border);
}
.nav a.active{
  background: color-mix(in oklab, var(--primary) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
  color: var(--primary);
  box-shadow: inset 3px 0 0 0 color-mix(in oklab, var(--primary) 88%, transparent);
}
.nav .left{
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.ico{
  width: 18px; height: 18px;
  display: inline-block;
  opacity: .9;
}
.chev{
  width: 10px; height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}
.nav-item[data-open="true"] .chev{ transform: rotate(-135deg); }

.subnav{
  display: none;
  margin: 2px 0 6px 18px;
  border-left: 2px solid color-mix(in oklab, var(--primary) 32%, transparent);
  padding-left: 8px;
  gap: 4px;
}
.nav-item[data-open="true"] .subnav{ display: grid; }
.subnav a{
  font-weight: 650;
  font-size: 13.5px;
  padding: 9px 10px;
}

/* ---------- Main area ---------- */
.main{
  min-width: 0;
}
.header{
  position: sticky;
  top: 0;
  height: var(--header-h);
  z-index: 40;
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.header-inner{
  width: 100%;
  padding: 0 var(--container-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.h-left{
  display: flex;
  align-items: center;
  gap: 12px;
}

.iconbtn{
  width: 44px; height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.iconbtn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-sm); background: var(--surface-2); }
.iconbtn:active{ transform: translateY(0); }
.iconbtn:focus-visible{ outline: 3px solid color-mix(in oklab, var(--primary) 34%, transparent); outline-offset: 2px; }
body.theme-dark .iconbtn{ color: #fff; }
body.theme-dark .ico{ opacity: 1; }

.search{
  position: relative;
  width: min(520px, 48vw);
}
.search input{
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 44px 0 42px;
  color: var(--text);
}
.search .s-ico{
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  display: grid;
  place-items: center;
  width: 18px;
  opacity: .7;
}
.search .clear{
  position: absolute;
  right: 10px; top: 0; bottom: 0;
  margin: auto;
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: none;
  place-items: center;
}
.search.has-value .clear{ display: grid; }

.h-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Dropdown */
.dd{
  position: relative;
}
.dd-panel{
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 340px;
  max-width: calc(100vw - 26px);
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
}
.dd[data-open="true"] .dd-panel{ display: block; }
.dd-head{
  padding: 12px 14px;
  font-weight: 900;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.dd-body{
  max-height: 360px;
  overflow: auto;
}
.dd-item{
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.dd-item:last-child{ border-bottom: none; }
.dd-item b{ display:block; }
.dd-item small{ color: var(--muted); }
.badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  min-width: 18px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 900;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 16%, var(--surface));
  color: var(--primary);
  border: 1px solid color-mix(in oklab, var(--primary) 32%, var(--border));
}
.dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  background: var(--info);
}
.dot.warn{ background: var(--warning); }
.dot.ok{ background: var(--success); }
.dot.bad{ background: var(--danger); }

.profile-btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.profile-btn:hover{ background: var(--surface-2); }
.avatar{
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.profile-btn strong{ font-size: 14px; }
.profile-menu .dd-panel{ width: 260px; }
.profile-menu a{
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 750;
}
.profile-menu a:last-child{ border-bottom: none; }
.profile-menu a:hover{ background: var(--surface-2); }

/* ---------- Inhoud ---------- */
.content{
  padding: 18px var(--container-pad) 40px;
}
.page-title{
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}
.page-title h1{
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.breadcrumbs{
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.breadcrumbs a{ color: var(--primary); }

.grid{
  display: grid;
  gap: 14px;
}
.grid.cols-4{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in oklab, var(--surface) 90%, var(--surface-2)), var(--surface));
  border-radius: var(--radius);
  box-shadow: 0 0 0 rgba(0,0,0,0);
  overflow: hidden;
}
.card:hover{ box-shadow: var(--shadow-sm); }
.card-head{
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.card-head h2{
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.card-body{
  padding: 14px 16px;
}
.kpi{
  display: flex;
  gap: 12px;
  align-items: center;
}
.kpi .k-ico{
  width: 44px; height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--primary) 13%, var(--surface));
  color: var(--primary);
  border: 1px solid color-mix(in oklab, var(--primary) 30%, var(--border));
}
.kpi .val{
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.02em;
}
.kpi .sub{
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
}
.pill b{ color: var(--text); }

.table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td{
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th{
  color: var(--muted);
  background: color-mix(in oklab, var(--surface-2) 84%, var(--surface));
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 900;
  user-select: none;
}
.table th.sortable{
  cursor: pointer;
}
.table th.sortable:hover{
  color: var(--text);
}
.table tr:hover td{ background: color-mix(in oklab, var(--surface-2) 55%, transparent); }
.tag{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 900;
  font-size: 12px;
}
.tag.ok{
  background: var(--success-bg);
  border-color: color-mix(in oklab, var(--success) 38%, var(--border));
  color: color-mix(in oklab, var(--success) 84%, var(--text));
}
.tag.warn{
  background: var(--warning-bg);
  border-color: color-mix(in oklab, var(--warning) 38%, var(--border));
  color: color-mix(in oklab, var(--warning) 84%, var(--text));
}
.tag.bad{
  background: var(--danger-bg);
  border-color: color-mix(in oklab, var(--danger) 38%, var(--border));
  color: color-mix(in oklab, var(--danger) 84%, var(--text));
}

.form{
  display: grid;
  gap: 12px;
}
.field{
  display: grid;
  gap: 6px;
}
.field label{
  font-weight: 900;
  font-size: 13px;
  color: var(--muted);
}
.input, textarea, select{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
textarea{ min-height: 120px; resize: vertical; }
.help{ font-size: 13px; color: var(--muted); }
.err{ color: var(--danger); font-weight: 800; font-size: 12px; min-height: 14px; }

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 900;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-sm); background: var(--surface-2); }
.btn:active{ transform: translateY(0); }
.btn-primary{
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: white;
}
.btn-primary:hover{ background: linear-gradient(180deg, var(--primary-2), var(--primary-2)); }
.btn-link{ background: transparent; border-color: transparent; color: var(--primary); }
.btn-link:hover{
  background: color-mix(in oklab, var(--primary) 12%, var(--surface));
  border-color: color-mix(in oklab, var(--primary) 20%, var(--border));
}

.auth{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.auth-card{
  width: min(440px, 100%);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.auth-head{
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-head b{ font-size: 16px; }
.auth-body{ padding: 16px; }

.notice{
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: color-mix(in oklab, var(--info) 70%, var(--border));
  background: color-mix(in oklab, var(--surface-2) 86%, var(--surface));
  margin-bottom: 12px;
}
.notice .dot{ margin-top: 5px; }

.notice.flash-success{ border-left-color: color-mix(in oklab, var(--success) 72%, var(--border)); }
.notice.flash-warning{ border-left-color: color-mix(in oklab, var(--warning) 72%, var(--border)); }
.notice.flash-error{ border-left-color: color-mix(in oklab, var(--danger) 72%, var(--border)); }

:focus-visible{
  outline: 3px solid color-mix(in oklab, var(--primary) 36%, transparent);
  outline-offset: 2px;
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--text);
  color: var(--bg);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: none;
  max-width: calc(100vw - 24px);
}
.toast.show{ display: block; }

.overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 35;
  display: none;
}
body.sidebar-open .overlay{ display: block; }

.top{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 46px; height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: none;
  place-items: center;
  z-index: 70;
}
.top.show{ display: grid; }

/* ---------- Responsive ---------- */
@media (max-width: 980px){
  .grid.cols-4{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search{ width: min(460px, 46vw); }
}
@media (max-width: 820px){
  .app{ grid-template-columns: 1fr; }
  body.sidebar-collapsed .app{ grid-template-columns: 1fr; }
  .sidebar{
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    transform: translateX(-105%);
    transition: transform .18s ease;
    z-index: 60;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar{ transform: translateX(0); }
  .search{ width: min(520px, 56vw); }
}
@media (max-width: 540px){
  .search{ display:none; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2{ grid-template-columns: 1fr; }
}
